public function processDOMEditable($node, $template, $form_node) { $default = $this->getValue(); $ele_name = $this->getHTMLName(); if (!$default instanceof I2CE_Date) { $default = I2CE_Date::now(); } if ($this->use_date_picker) { $date = $default->dbFormat(); $attrs = array("class" => "datepicker_ymd", "name" => $ele_name, "type" => "text", "value" => $date); foreach (array('onclick', 'onchange') as $attr) { if ($node->hasAttribute($attr)) { $attrs[$attr] = $node->getAttribute($attr); $node->removeAttribute($attr); } } $element = $template->createElement("input", $attrs); $this->setElement($element); $node->appendChild($element); $args = array('format' => 'F j, Y', 'inputOutputFormat' => 'Y-m-d', 'allowEmpty' => true, 'startView' => 'decades'); $add_args = I2CE::getConfig()->getAsArray("/modules/DatePicker/options"); if (is_array($add_args)) { $args = array_merge($args, $add_args); } $template->addDatePicker('datepicker_ymd', $args); } else { I2CE_Date::addMonthDayElement($template, $ele_name, $default, $this->hasInvalid(), $node); I2CE_Date::addYearElement($template, $ele_name, $default, $this->hasInvalid(), $node, $this->getYearRange(), false, true); } }
public function processDOMEditable($node, $template, $form_node) { $ele_name = $this->getHTMLName(); $default = $this->getValue(); if (!$default instanceof I2CE_Date) { $default = I2CE_Date::now(); } I2CE_Date::addMonthDayElement($template, $ele_name, $default, $this->hasInvalid(), $node); }
protected function addDateTimeElements($fieldObj, $template, $date, $name, $node) { switch ($date->getType()) { case I2CE_Date::YEAR_ONLY: I2CE_Date::addYearElement($template, $name, $date, false, $node, $fieldObj->getYearRange(), false, true); break; case I2CE_Date::DATE: $date_db = $date->dbFormat(); $element = $template->createElement("input", array("class" => "datepicker_ymd", "name" => $name . ":value", "type" => "text", "value" => $date_db)); $node->appendChild($element); $args = array("format" => "F j, Y", "inputOutputFormat" => "Y-m-d", "allowEmpty" => true, "startView" => "decades"); $add_args = I2CE::getConfig()->getAsArray("/modules/DatePicker/options"); if (is_array($add_args)) { $args = array_merge($args, $add_args); } $template->addDatePicker("datepicker_ymd", $args); /* I2CE_Date::addMonthDayElement( $template, $name, $date, false, $node ); I2CE_Date::addYearElement( $template, $name, $date, false, $node, array(1900,2100), false, true ); */ break; case I2CE_Date::MONTH_DAY: I2CE_Date::addMonthDayElement($template, $name, $date, false, $node); break; case I2CE_Date::DATE_TIME: $date_db = $date->dbFormat(); $element = $template->createElement("input", array("class" => "datepicker_ymd_hms", "name" => $name . ":value", "type" => "text", "value" => $date_db)); $node->appendChild($element); $args = array("format" => "F j, Y @ H:i:s", "inputOutputFormat" => "Y-m-d H:i:s", "allowEmpty" => true, "startView" => "decades", 'timePicker' => true); $add_args = I2CE::getConfig()->getAsArray("/modules/DatePicker/options"); if (is_array($add_args)) { $args = array_merge($args, $add_args); } $add_args = I2CE::getConfig()->getAsArray("/modules/DatePicker/options_datetime"); if (is_array($add_args)) { $args = array_merge($args, $add_args); } $template->addDatePicker("datepicker_ymd_hms", $args); /* I2CE_Date::addMonthDayElement( $template, $name, $date, false, $node ); I2CE_Date::addYearElement( $template, $name, $date, false, $node, array(1900,2100), false, true ); $node->appendChild($template->createElement( "br" )); I2CE_Date::addTimeElement( $template, $name , $date, false, $node ); */ break; case I2CE_Date::TIME_ONLY: I2CE_Date::addTimeElement($template, $name, $date, false, $node); break; } }