function Field() { Requirements::javascript("jsparty/calendar/calendar.js"); Requirements::javascript("jsparty/calendar/lang/calendar-en.js"); Requirements::javascript("jsparty/calendar/calendar-setup.js"); Requirements::css("sapphire/css/CalendarDateField.css"); Requirements::css("jsparty/calendar/calendar-win2k-1.css"); Requirements::javascript("sapphire/javascript/CalendarDateField.js"); $field = DateField::Field(); $id = $this->id(); $val = $this->attrValue(); if (preg_match('/^\\d{2}\\/\\d{2}\\/\\d{4}$/', $val)) { $dateArray = explode('/', $val); $val = $dateArray[2] . '-' . $dateArray[1] . '-' . $dateArray[0]; } $dateArray = explode('-', $val); $day = $dateArray[2]; $month = $dateArray[1]; $year = $dateArray[0]; preg_match('/(.*)[(.+)]$/', $this->name, $fieldNameParts); $fieldNamePrefix = $fieldNameParts[1]; $fieldName = $fieldNameParts[2]; return <<<HTML \t\t\t<div class="dmycalendardate"> \t\t\t\t<input type="hidden" id="{$id}" name="{$this->name}" value="{$val}" /> \t\t\t\t<input type="text" id="{$id}-day" class="day numeric" name="{$fieldNamePrefix}[{$fieldName}-Day]" value="{$day}" maxlength="2" />/ \t\t\t\t<input type="text" id="{$id}-month" class="month numeric" name="{$fieldNamePrefix}[{$fieldName}-Month]" value="{$month}" maxlength="2" />/ \t\t\t\t<input type="text" id="{$id}-year" class="year numeric" name="{$fieldNamePrefix}[{$fieldName}-Year]" value="{$year}" maxlength="4" /> \t\t\t\t<div class="calendarpopup" id="{$id}-calendar"></div> \t\t\t</div> HTML; }
public function Field($properties = array()) { Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js'); Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery-ui.js'); Requirements::javascript(BOOTSTRAPFIELDS__DIR . '/js/BootstrapDateField.js'); return parent::Field($properties); }
function Field() { Requirements::javascript($this->BaseHref() . "dataobject_manager/javascript/jquery-ui-1.6.js"); Requirements::javascript($this->BaseHref() . "dataobject_manager/code/date_picker_field/datepicker_init.js"); Requirements::css("dataobject_manager/css/ui/ui.all.css"); $id = $this->id(); $val = $this->attrValue(); $field = parent::Field(); $innerHTML = self::HTMLField($id, $this->name, $val); return "\n\t\t\t\t\t<div class='datepicker field'>\n\t\t\t\t\t\t{$innerHTML}\n\t\t\t\t\t</div>\n\t\t"; }
function Field() { Requirements::javascript(THIRDPARTY_DIR . "/jquery-livequery/jquery.livequery.js"); Requirements::javascript(THIRDPARTY_DIR . "/jquery-metadata/jquery.metadata.js"); Requirements::javascript("dataobject_manager/javascript/dom_jquery_ui.js"); Requirements::javascript("dataobject_manager/code/date_picker_field/datepicker_init.js"); Requirements::css("dataobject_manager/css/ui/dom_jquery_ui.css"); $id = $this->id(); $val = $this->attrValue(); $field = parent::Field(); $innerHTML = self::HTMLField($id, $this->name, $val); return "\n\t\t\t\t\t<div class=\"datepicker field {dateFormat : '" . self::$dateFormat . "'}\">\n\t\t\t\t\t\t{$innerHTML}\n\t\t\t\t\t</div>\n\t\t"; }
function Field($options = array()) { //GENERAL Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js'); Requirements::javascript("datefield_simplified/javascript/SimpleDateField.js"); $this->addExtraClass("simpledatefield"); $this->setAttribute("placeholder", $this->Config()->get("placeholder_value")); $html = parent::Field($options); $fieldID = $this->id(); $url = Convert::raw2js(Director::absoluteBaseURL() . Config::inst()->get("SimpleDateField_Controller", "url") . "/ajaxvalidation/"); $objectID = $fieldID . "_OBJECT"; Requirements::customScript("\r\n\t\t\tvar {$objectID} = new SimpleDateFieldAjaxValidationAPI('" . $fieldID . "');\r\n\t\t\t{$objectID}.init();\r\n\t\t\t{$objectID}.setVar('url', '{$url}');\r\n\t\t\t", 'func_SimpleDateField' . $fieldID); return $html; }
function Field() { Requirements::javascript("jsparty/calendar/calendar.js"); Requirements::javascript("jsparty/calendar/lang/calendar-en.js"); Requirements::javascript("jsparty/calendar/calendar-setup.js"); Requirements::css("sapphire/css/CalendarDateField.css"); Requirements::css("jsparty/calendar/calendar-win2k-1.css"); $field = parent::Field(); $id = $this->id(); $val = $this->attrValue(); $futureClass = $this->futureOnly ? ' futureonly' : ''; $innerHTML = self::HTMLField($id, $this->name, $val); return <<<HTML \t\t\t<div class="calendardate{$futureClass}"> \t\t\t\t{$innerHTML} \t\t\t</div> HTML; }
function Field() { Requirements::javascript(THIRDPARTY_DIR . "/calendar/calendar.js"); Requirements::javascript(THIRDPARTY_DIR . "/calendar/lang/calendar-en.js"); Requirements::javascript(THIRDPARTY_DIR . "/calendar/calendar-setup.js"); Requirements::css(SAPPHIRE_DIR . "/css/CalendarDateField.css"); Requirements::css(THIRDPARTY_DIR . "/calendar/calendar-win2k-1.css"); Requirements::javascript(SAPPHIRE_DIR . "/javascript/CalendarDateField.js"); $field = DateField::Field(); $id = $this->id(); $val = $this->attrValue(); if( preg_match( '/^\d{2}\/\d{2}\/\d{4}$/', $val ) ) { $dateArray = explode( '/', $val ); $val = $dateArray[2] . '-' . $dateArray[1] . '-' . $dateArray[0]; } $day = $month = $year = null; if($val) { $dateArray = explode( '-', $val ); $day = $dateArray[2]; $month = $dateArray[1]; $year = $dateArray[0]; } $fieldName = $this->name; $tabIndex0 = $this->getTabIndexHTML(0); $tabIndex1 = $this->getTabIndexHTML(1); $tabIndex2 = $this->getTabIndexHTML(2); return <<<HTML <div class="dmycalendardate"> <input type="hidden" id="$id" name="{$this->name}" value="$val" /> <input type="text" id="$id-day" class="day numeric" name="{$fieldName}[Day]" value="$day" maxlength="2"$tabIndex0 />/ <input type="text" id="$id-month" class="month numeric" name="{$fieldName}[Month]" value="$month" maxlength="2"$tabIndex1 />/ <input type="text" id="$id-year" class="year numeric" name="{$fieldName}[Year]" value="$year" maxlength="4"$tabIndex2 /> <div class="calendarpopup" id="{$id}-calendar"></div> </div> HTML; }
public function Field($properties = array()) { $config = array('showcalendar' => $this->getConfig('showcalendar'), 'isoDateformat' => $this->getConfig('dateformat'), 'jquerydateformat' => DateDropdownField_View_JQuery::convert_iso_to_jquery_format($this->getConfig('dateformat')), 'min' => $this->getConfig('min'), 'max' => $this->getConfig('max'), 'yearRange' => $this->getConfig('yearRange')); // Add other jQuery UI specific, namespaced options (only serializable, no callbacks etc.) // TODO Move to DateField_View_jQuery once we have a properly extensible HTML5 attribute system for FormField $jqueryUIConfig = array(); foreach ($this->getConfig() as $k => $v) { if (preg_match('/^jQueryUI\\.(.*)/', $k, $matches)) { $jqueryUIConfig[$matches[1]] = $v; } } if ($jqueryUIConfig) { $config['jqueryuiconfig'] = Convert::array2json(array_filter($jqueryUIConfig)); } $config = array_filter($config); foreach ($config as $k => $v) { $this->setAttribute('data-' . $k, $v); } // Three separate fields for day, month and year if ($this->getConfig('dmyfields')) { // values $valArr = $this->valueObj ? $this->valueObj->toArray() : null; // fields $fieldNames = Zend_Locale::getTranslationList('Field', $this->locale); $fieldDay = NumericField::create($this->name . '[day]', false, $valArr ? $valArr['day'] : null)->addExtraClass('day')->setAttribute('placeholder', $this->getConfig('dmyplaceholders') ? $fieldNames['day'] : null)->setMaxLength(2); $fieldMonth = NumericField::create($this->name . '[month]', false, $valArr ? $valArr['month'] : null)->addExtraClass('month')->setAttribute('placeholder', $this->getConfig('dmyplaceholders') ? $fieldNames['month'] : null)->setMaxLength(2); $fieldYear = NumericField::create($this->name . '[year]', false, $valArr ? $valArr['year'] : null)->addExtraClass('year')->setAttribute('placeholder', $this->getConfig('dmyplaceholders') ? $fieldNames['year'] : null)->setMaxLength(4); // order fields depending on format $sep = $this->getConfig('dmyseparator'); $format = $this->getConfig('dateformat'); $fields = array(); $fields[stripos($format, 'd')] = $fieldDay->Field(); $fields[stripos($format, 'm')] = $fieldMonth->Field(); $fields[stripos($format, 'y')] = $fieldYear->Field(); ksort($fields); $html = implode($sep, $fields); // dmyfields doesn't work with showcalendar $this->setConfig('showcalendar', false); } else { $html = parent::Field(); } return $html; }
public function SiteTreeFilterDateField() { $dateField = new DateField('SiteTreeFilterDate'); // TODO Enabling this means we load jQuery UI by default in the CMS, // which is a pretty big performance hit in 2.4 (where the library isn't used for other parts // of the interface). // $dateField->setConfig('showcalendar', true); return $dateField->Field(); }
public function Field($properties = array()) { $config = array('separator' => $this->getConfig('separator') ? $this->getConfig('separator') : ', ', 'showcalendar' => $this->getConfig('showcalendar'), 'isoDateformat' => $this->getConfig('dateformat'), 'jquerydateformat' => DateField_View_JQuery::convert_iso_to_jquery_format($this->getConfig('dateformat')), 'min' => $this->getConfig('min'), 'max' => $this->getConfig('max')); // Add other jQuery UI specific, namespaced options (only serializable, no callbacks etc.) // TODO Move to DateField_View_jQuery once we have a properly extensible HTML5 attribute system for FormField $jqueryUIConfig = array(); foreach ($this->getConfig() as $k => $v) { if (preg_match('/^jQueryUI\\.(.*)/', $k, $matches)) { $jqueryUIConfig[$matches[1]] = $v; } } if ($jqueryUIConfig) { $config['jqueryuiconfig'] = Convert::array2json(array_filter($jqueryUIConfig)); } $config = array_filter($config); foreach ($config as $k => $v) { $this->setAttribute('data-' . $k, $v); } // Three separate fields for day, month and year (not available for multidates) if ($this->getConfig('dmyfields')) { user_error("MultiDateField doen't work with separate fields for day/month/year"); } // Default text input field $html = parent::Field(); return $html; }