Overview

Namespaces

  • Cron
  • None

Classes

  • _HtmlGrid_TableOut
  • _TransactionModel_RawSaveOperation
  • AccessControlComponent
  • AccessControlHelper
  • ActionListHelper
  • ActiveDirectoryUtils
  • AddCurrentPidToSchedulingShellCallLogs
  • AnonymousFunctionOperation
  • ArrayUtil
  • AssociationIntegrityBehavior
  • AtomicOperation
  • AuthenticationComponent
  • AuthenticationController
  • AuthenticationUser
  • AutocompleteDatasourceComponent
  • BaseModelComponent
  • Basics
  • CakeLayersHelper
  • CheckAndRunShell
  • ClassSearcher
  • CommandLineUtil
  • CommonValidationBehavior
  • ConfigurableShellCallsSchedulingTask
  • ConfigurationKey
  • ConfigurationKeys
  • ConfigurationKeysController
  • Context
  • ContextComponent
  • ContextHelper
  • Contexts
  • ControllerInspector
  • ControllerMenuHelper
  • CreateJournalingTables
  • CreateTableConfigurationKeys
  • CreateTableSchedulingConfigurableShellCalls
  • CreateTableSchedulingShellCallLogs
  • CreateTableSettedConfigurationKeys
  • CreateTableUserResetPasswordRequests
  • CreateTableUsers
  • CronSchedulingInstaller
  • CronValidationBehavior
  • CssBox
  • CssController
  • CssProperties
  • CssShell
  • CsvUtil
  • CustomDataModel
  • DatasourceDumperManager
  • DateTimeInput
  • DependencyShell
  • DetailHelper
  • DumperShell
  • ExtendedFieldsAccessControl
  • ExtendedFieldSet
  • ExtendedFieldSetHelper
  • ExtendedFieldsParser
  • ExtendedFormHelper
  • ExtendedHasManyAppModel
  • ExtendedOperationsBehavior
  • FieldDefinition
  • FieldRowDefinition
  • FieldSetDefinition
  • FieldSetLayoutHelper
  • FileOperations
  • FileOperations_Rename
  • FileOperations_SymLink
  • FileOperations_Touch
  • FileOperations_Unlink
  • FileSystem
  • FixConfigurationKeysPrimaryKey
  • FixSettedConfigurationKeysPrimaryKey
  • HasManyUtilsBehavior
  • HtmlDocument
  • HtmlGrid
  • HtmlGrid_Cell
  • HttpClient
  • HttpResponse
  • ImapClient
  • ImapMailBox
  • ImapParserShell
  • IncludePath
  • InputMasked
  • InputSearchable
  • InputsOnSubmit
  • InstallShell
  • JenkinsBuildShell
  • Journal
  • JournalDetail
  • JournalizedBehavior
  • JsonResponseComponent
  • LayoutsHelper
  • Ldap
  • LdapUtils
  • ListFieldSet
  • ListFieldSetHelper
  • ListsHelper
  • MailParser
  • Make
  • MenuHelper
  • MigrationAllPluginsShell
  • ModelOperations
  • ModelOperations_Delete
  • ModelOperations_Save
  • ModelTraverser
  • MysqlDumper
  • OpenLdapUtils
  • PaginatorUtilComponent
  • PaginatorUtilComponentFilter
  • PaginatorUtilHelper
  • Plugin
  • PluginManager
  • Reflections
  • RenameEnabledToActiveFromUsersTable
  • RunShellCallShell
  • ScaffoldUtilComponent
  • ScaffoldUtilHelper
  • Scheduling
  • SchedulingConfigurableShellCall
  • SchedulingConfigurableShellCallsController
  • SchedulingShellCallLog
  • SchedulingShellCallLogsController
  • SettedConfigurationKey
  • StuffreposPluginsRename
  • TimeZoneBehavior
  • TransactionModel
  • TransactionOperation
  • Translator
  • TranslatorShell
  • User
  • UserAuthenticationComponent
  • UserChangePassword
  • UserResetPassword
  • UserResetPasswordRequest
  • UserResetPasswordRequestSubmission
  • UsersController
  • ViewUtilHelper

Interfaces

  • AccessControlFilter
  • CommitableOperation
  • DatasourceDumper
  • MakeListener
  • SchedulingInstaller
  • TasksObject
  • UndoableOperation

Exceptions

  • LdapObjectNotWritableException
  • ModelTraverserException
  • Overview
  • Namespace
  • Class
  • Tree
  1: <?php
  2: 
  3: App::uses('AppHelper', 'View/Helper');
  4: 
  5: class FieldSetLayoutHelper extends AppHelper {
  6: 
  7:     public $helpers = array(
  8:         'Html',
  9:     );
 10: 
 11:     /**
 12:      * HTML do fieldset.
 13:      * @param array $lines
 14:      * @param array $options
 15:      * @return string
 16:      */
 17:     public function fieldSet($lines, $options = array()) {
 18:         return $this->Html->tag(
 19:                         'table', $this->_rows($lines),
 20:                         $this->Html->addClass($options, __CLASS__)
 21:         );
 22:     }
 23: 
 24:     /**
 25:      * HTML das linhas.
 26:      * @param array $lines
 27:      * @param array $options
 28:      * @return string
 29:      */
 30:     private function _rows($lines) {
 31:         $b = '';
 32:         $lineIndex = 0;
 33:         $lineCount = count($lines);
 34:         $maxColumnCount = $this->_maxColumnCount($lines);
 35:         foreach ($lines as $line) {
 36:             $b .= $this->_row(
 37:                     $line, compact('lineIndex', 'lineCount', 'maxColumnCount')
 38:             );
 39:             $lineIndex++;
 40:         }
 41:         return $b;
 42:     }
 43: 
 44:     /**
 45:      * HTML da linha.
 46:      * @param array $line
 47:      * @param array $options
 48:      * @return string
 49:      */
 50:     private function _row($line, $options) {
 51:         $b = '';
 52:         $columnIndex = 0;
 53:         $columnCount = count($line);
 54:         $columnExpandIndex = $this->_columnExpandIndex($line);
 55:         foreach ($line as $label => $content) {
 56:             $b .= $this->_column($label, $content,
 57:                     array_merge(compact(
 58:                                     'columnIndex', 'columnCount',
 59:                                     'columnExpandIndex'
 60:                             ), $options));
 61:         }
 62:         return $this->Html->tag('tr', $b);
 63:     }
 64: 
 65:     /**
 66:      * HTML da coluna (Label e valor)
 67:      * @param string $label
 68:      * @param string $content
 69:      * @param array $options
 70:      * @return string
 71:      */
 72:     private function _column($label, $content, $options) {
 73:         $b = $this->Html->tag('th', $label);
 74:         $b .= $this->Html->tag('td', $content,
 75:                 array(
 76:             'colspan' => $this->_fieldColumnSpan($options)
 77:         ));
 78:         return $b;
 79:     }
 80: 
 81:     /**
 82:      * Atributo "colspan" da célula de valor de campo.
 83:      * @param array $options
 84:      * @return int
 85:      */
 86:     private function _fieldColumnSpan($options) {
 87:         if ($options['columnIndex'] == $options['columnExpandIndex']) {
 88:             return ($options['maxColumnCount'] * 2) -
 89:                     ($options['columnCount'] - 1) * 2 -
 90:                     1;
 91:         } else {
 92:             return 1;
 93:         }
 94:     }
 95: 
 96:     /**
 97:      * Maior número de colunas entra as linhas.
 98:      * @param array $lines
 99:      * @return int
100:      */
101:     private function _maxColumnCount($lines) {
102:         return count($lines) > 0 ? max(array_map('count', $lines)) : 0;
103:     }
104: 
105:     /**
106:      * Índice da coluna da linha que se expandirá pelo
107:      * espaço restante
108:      * @param array $line
109:      */
110:     private function _columnExpandIndex($line) {
111:         foreach ($line as $index => $column) {
112:             if (!empty($column['expand']) && $column['expand']) {
113:                 return $index;
114:             }
115:         }
116:         return 0;
117:     }
118: 
119: }
120: 
API documentation generated by ApiGen 2.8.0