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: class DateTimeInput {
 4: 
 5:     public static function dateTime(ExtendedFormHelper $helper, $fieldName, $dateFormat = 'DMY', $timeFormat = '12', $selected = null, $attributes = array()) {
 6:         $id = $helper->createNewDomId();
 7:         $hiddenInput = self::_hiddenInput($helper, $fieldName, $selected);
 8:         $visibleInput = self::_visibleInput($helper, $fieldName, $attributes);
 9:         $initData = json_encode(array(
10:             '_patterns' => self::_getPatterns(self::_type($dateFormat, $timeFormat))
11:         ));
12:         return <<<EOT
13: <span id="$id" initCallback="ExtendedFormHelper.DateTimeInput.initInput" initData='$initData' >
14:     $hiddenInput
15:     $visibleInput
16: </span>
17: EOT;
18:     }
19:     
20:     private static function _type($dateFormat, $timeFormat) {
21:         if ($dateFormat && $timeFormat) {
22:             return 'datetime';
23:         } else if ($timeFormat) {
24:             return 'time';
25:         } else {
26:             return 'date';
27:         }
28:     }
29: 
30:     private static function _hiddenInput(ExtendedFormHelper $helper, $fieldName, $selected = null) {
31:         $hiddenAttributes = array('subId' => 'hiddenInput',);
32:         if (isset($selected['value'])) {
33:             $hiddenAttributes['value'] = $selected['value'];
34:         }
35:         return $helper->hidden($fieldName, $hiddenAttributes);
36:     }
37: 
38:     private static function _visibleInput(ExtendedFormHelper $helper, $fieldName, $attributes = array()) {
39:         $visibleInputName = $fieldName . '_masked';
40:         $helper->setEntity($visibleInputName);
41:         $visibleId = $helper->createNewDomId();
42:         return $helper->nonExtendedText(
43:                 $visibleInputName, array_merge(
44:                         $attributes, array(
45:                                 'id' => $visibleId,
46:                                 'subId' => 'visibleInput',
47:                         )
48:                 )
49:         );
50:     }
51: 
52:     private static function _getPatterns($fieldType) {
53:         switch ($fieldType) {
54:             case 'date':
55:                 return array(
56:                     'mask' => 'd/m/y',
57:                     'emptyMask' => '__/__/____',
58:                     'serverFormat' => 'YYYY-MM-DD',
59:                     'guiFormat' => 'DD/MM/YYYY',
60:                 );
61: 
62:             case 'time':
63:                 return array(
64:                     'mask' => '99:99',
65:                     'emptyMask' => '__:__',
66:                     'serverFormat' => 'HH:mm',
67:                     'guiFormat' => 'HH:mm',
68:                 );
69:                 break;
70: 
71:             case 'datetime':
72:                 return array(
73:                     'mask' => 'd/m/y 99:99',
74:                     'emptyMask' => '__/__/____ __:__',
75:                     'serverFormat' => 'YYYY-MM-DD HH:mm',
76:                     'guiFormat' => 'DD/MM/YYYY HH:mm',
77:                 );
78:                 break;
79: 
80:             default:
81:                 throw new Exception("Field type unknown: \"$fieldType\"");
82:         }
83:     }
84: 
85: }
86: 
API documentation generated by ApiGen 2.8.0