/** * Insert property html * */ function render() { global $lng, $ilUser; $tpl = new ilTemplate("tpl.prop_datetime.html", true, true, "Services/Form"); $lng->loadLanguageModule("jscalendar"); require_once "./Services/Calendar/classes/class.ilCalendarUtil.php"; ilCalendarUtil::initJSCalendar(); if (strlen($this->getActivationPostVar())) { $tpl->setCurrentBlock('prop_date_activation'); $tpl->setVariable('CHECK_ENABLED_DATE', $this->getActivationPostVar()); $tpl->setVariable('TXT_DATE_ENABLED', $this->activation_title); $tpl->setVariable('CHECKED_ENABLED', $this->activation_checked ? 'checked="checked"' : ''); $tpl->setVariable('CHECKED_DISABLED', $this->getDisabled() ? 'disabled="disabled" ' : ''); $tpl->parseCurrentBlock(); } if ($this->getMode() == self::MODE_SELECT) { if (is_a($this->getDate(), 'ilDate')) { $date_info = $this->getDate()->get(IL_CAL_FKT_GETDATE, '', 'UTC'); } elseif (is_a($this->getDate(), 'ilDateTime')) { $date_info = $this->getDate()->get(IL_CAL_FKT_GETDATE, '', $ilUser->getTimeZone()); } else { $this->setDate(new ilDateTime(time(), IL_CAL_UNIX)); $date_info = $this->getDate()->get(IL_CAL_FKT_GETDATE, '', $ilUser->getTimeZone()); } // display invalid input again if (is_array($this->invalid_input)) { $date_info['year'] = $this->invalid_input['y']; $date_info['mon'] = $this->invalid_input['m']; $date_info['mday'] = $this->invalid_input['d']; } } if ($this->getMode() == self::MODE_SELECT) { $tpl->setCurrentBlock("prop_date_input_select_setup"); $tpl->setVariable("INPUT_FIELDS_DATE", $this->getPostVar() . "[date]"); $tpl->parseCurrentBlock(); $tpl->setCurrentBlock("prop_date"); $tpl->setVariable("DATE_SELECT", ilUtil::makeDateSelect($this->getPostVar() . "[date]", $date_info['year'], $date_info['mon'], $date_info['mday'], $this->startyear, true, array('disabled' => $this->getDisabled()), $this->getShowEmpty())); } else { $value = $this->getDate(); if ($value) { $value = substr($this->getDate()->get(IL_CAL_DATETIME), 0, 10); $day = substr($value, 8, 2); $month = substr($value, 5, 2); $year = substr($value, 0, 4); } switch ($ilUser->getDateFormat()) { case ilCalendarSettings::DATE_FORMAT_DMY: if ($value) { $value = date("d.m.Y", mktime(0, 0, 0, $month, $day, $year)); } $format = "%d.%m.%Y"; $input_hint = $lng->txt("dd_mm_yyyy"); break; case ilCalendarSettings::DATE_FORMAT_YMD: if ($value) { $value = date("Y-m-d", mktime(0, 0, 0, $month, $day, $year)); } $format = "%Y-%m-%d"; $input_hint = $lng->txt("yyyy_mm_dd"); break; case ilCalendarSettings::DATE_FORMAT_MDY: if ($value) { $value = date("m/d/Y", mktime(0, 0, 0, $month, $day, $year)); } $format = "%m/%d/%Y"; $input_hint = $lng->txt("mm_dd_yyyy"); break; } $tpl->setCurrentBlock("prop_date_input_field"); $tpl->setVariable("DATE_ID", $this->getPostVar()); $tpl->setVariable("DATE_VALUE", $value); $tpl->setVariable("DISABLED", $this->getDisabled() ? " disabled=\"disabled\"" : ""); $tpl->parseCurrentBlock(); $tpl->setCurrentBlock("prop_date_input_field_info"); $tpl->setVariable("TXT_INPUT_FORMAT", $input_hint); $tpl->parseCurrentBlock(); $tpl->setCurrentBlock("prop_date_input_field_setup"); $tpl->setVariable("DATE_ID", $this->getPostVar()); $tpl->setVariable("DATE_FIELD_FORMAT", $format); $tpl->parseCurrentBlock(); } $tpl->setCurrentBlock("prop_date"); include_once "./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php"; $tpl->setVariable("IMG_DATE_CALENDAR", ilGlyphGUI::get(ilGlyphGUI::CALENDAR, $lng->txt("open_calendar"))); $tpl->setVariable("DATE_ID", $this->getPostVar()); include_once './Services/Calendar/classes/class.ilCalendarUserSettings.php'; $tpl->setVariable('DATE_FIRST_DAY', ilCalendarUserSettings::_getInstance()->getWeekStart()); $tpl->parseCurrentBlock(); if ($this->getShowTime()) { if ($this->getMode() == self::MODE_INPUT) { $value = $this->getDate(); if ($value) { if (!$this->getShowSeconds()) { $value = substr($value->get(IL_CAL_DATETIME), 11, 5); if ($ilUser->getTimeFormat() == ilCalendarSettings::TIME_FORMAT_12) { $value = date("g:ia", mktime(substr($value, 0, 2), substr($value, 3, 2))); } } else { $value = substr($value->get(IL_CAL_DATETIME), 11, 8); if ($ilUser->getTimeFormat() == ilCalendarSettings::TIME_FORMAT_12) { $value = date("g:i:sa", mktime(substr($value, 0, 2), substr($value, 3, 2), substr($value, 6, 2))); } } } $tpl->setCurrentBlock("prop_time_input_field"); $tpl->setVariable("DATE_ID", $this->getPostVar()); $tpl->setVariable("TIME_VALUE", $value); $tpl->setVariable("DISABLED", $this->getDisabled() ? " disabled=\"disabled\"" : ""); $tpl->parseCurrentBlock(); } $tpl->setCurrentBlock("prop_time"); if ($this->getMode() == self::MODE_SELECT) { $tpl->setVariable("TIME_SELECT", ilUtil::makeTimeSelect($this->getPostVar() . "[time]", !$this->getShowSeconds(), $date_info['hours'], $date_info['minutes'], $date_info['seconds'], true, array('minute_steps' => $this->getMinuteStepSize(), 'disabled' => $this->getDisabled()))); } $tpl->setVariable("TXT_TIME", $this->getShowSeconds() ? "(" . $lng->txt("hh_mm_ss") . ")" : "(" . $lng->txt("hh_mm") . ")"); $tpl->parseCurrentBlock(); } return $tpl->get(); }
/** * Insert property html * */ function render() { global $lng, $ilUser; $tpl = new ilTemplate("tpl.prop_datetime.html", true, true, "Services/Form"); if (is_object($this->getDate())) { $date_info = $this->getDate()->get(IL_CAL_FKT_GETDATE, '', 'UTC'); } else { $date_info = array('year' => $_POST[$this->getPostVar()]['date']['y'], 'mon' => $_POST[$this->getPostVar()]['date']['m'], 'mday' => $_POST[$this->getPostVar()]['date']['d']); } $lng->loadLanguageModule("jscalendar"); require_once "./Services/Calendar/classes/class.ilCalendarUtil.php"; ilCalendarUtil::initJSCalendar(); if (strlen($this->getActivationPostVar())) { $tpl->setCurrentBlock('prop_date_activation'); $tpl->setVariable('CHECK_ENABLED_DATE', $this->getActivationPostVar()); $tpl->setVariable('TXT_DATE_ENABLED', $this->activation_title); $tpl->setVariable('CHECKED_ENABLED', $this->activation_checked ? 'checked="checked"' : ''); $tpl->setVariable('CHECKED_DISABLED', $this->getDisabled() ? 'disabled="disabled" ' : ''); $tpl->parseCurrentBlock(); } if ($this->getShowDate()) { $tpl->setCurrentBlock("prop_date"); $tpl->setVariable("IMG_DATE_CALENDAR", ilUtil::getImagePath("calendar.png")); $tpl->setVariable("TXT_DATE_CALENDAR", $lng->txt("open_calendar")); $tpl->setVariable("DATE_ID", $this->getPostVar()); $tpl->setVariable("INPUT_FIELDS_DATE", $this->getPostVar() . "[date]"); include_once './Services/Calendar/classes/class.ilCalendarUserSettings.php'; $tpl->setVariable('DATE_FIRST_DAY', ilCalendarUserSettings::_getInstance()->getWeekStart()); $tpl->setVariable("DATE_SELECT", ilUtil::makeDateSelect($this->getPostVar() . "[date]", $date_info['year'], $date_info['mon'], $date_info['mday'], $this->startyear, true, array('disabled' => $this->getDisabled()), $this->getShowEmpty())); $tpl->parseCurrentBlock(); } return $tpl->get(); }
/** * Insert property html * */ public function render() { global $lng, $ilUser; $tpl = new ilTemplate("tpl.prop_datetime_duration.html", true, true, "Services/Form"); // Init start if (is_a($this->getStart(), 'ilDate')) { $start_info = $this->getStart()->get(IL_CAL_FKT_GETDATE, '', 'UTC'); } elseif (is_a($this->getStart(), 'ilDateTime')) { $start_info = $this->getStart()->get(IL_CAL_FKT_GETDATE, '', $ilUser->getTimeZone()); } else { $this->setStart(new ilDateTime(time(), IL_CAL_UNIX)); $start_info = $this->getStart()->get(IL_CAL_FKT_GETDATE, '', $ilUser->getTimeZone()); } // display invalid input again if (is_array($this->invalid_input['start'])) { $start_info['year'] = $this->invalid_input['start']['y']; $start_info['mon'] = $this->invalid_input['start']['m']; $start_info['mday'] = $this->invalid_input['start']['d']; } // Init end if (is_a($this->getEnd(), 'ilDate')) { $end_info = $this->getEnd()->get(IL_CAL_FKT_GETDATE, '', 'UTC'); } elseif (is_a($this->getEnd(), 'ilDateTime')) { $end_info = $this->getEnd()->get(IL_CAL_FKT_GETDATE, '', $ilUser->getTimeZone()); } else { $this->setEnd(new ilDateTime(time(), IL_CAL_UNIX)); $end_info = $this->getEnd()->get(IL_CAL_FKT_GETDATE, '', $ilUser->getTimeZone()); } // display invalid input again if (is_array($this->invalid_input['end'])) { $end_info['year'] = $this->invalid_input['end']['y']; $end_info['mon'] = $this->invalid_input['end']['m']; $end_info['mday'] = $this->invalid_input['end']['d']; } $lng->loadLanguageModule("jscalendar"); require_once "./Services/Calendar/classes/class.ilCalendarUtil.php"; ilCalendarUtil::initJSCalendar(); if (strlen($this->getActivationPostVar())) { $tpl->setCurrentBlock('prop_date_activation'); $tpl->setVariable('CHECK_ENABLED_DATE', $this->getActivationPostVar()); $tpl->setVariable('TXT_DATE_ENABLED', $this->activation_title); $tpl->setVariable('CHECKED_ENABLED', $this->activation_checked ? 'checked="checked"' : ''); $tpl->setVariable('CHECKED_DISABLED', $this->getDisabled() ? 'disabled="disabled" ' : ''); $tpl->parseCurrentBlock(); } if (strlen($this->getStartText())) { $tpl->setVariable('TXT_START', $this->getStartText()); } if (strlen($this->getEndText())) { $tpl->setVariable('TXT_END', $this->getEndText()); } // Toggle fullday if ($this->enabledToggleFullTime()) { $tpl->setCurrentBlock('toggle_fullday'); $tpl->setVariable('FULLDAY_POSTVAR', $this->getPostVar()); $tpl->setVariable('FULLDAY_TOGGLE_NAME', $this->getPostVar() . '[fulltime]'); $tpl->setVariable('FULLDAY_TOGGLE_CHECKED', $this->toggle_fulltime_checked ? 'checked="checked"' : ''); $tpl->setVariable('FULLDAY_TOGGLE_DISABLED', $this->getDisabled() ? 'disabled="disabled"' : ''); $tpl->setVariable('TXT_TOGGLE_FULLDAY', $this->toggle_fulltime_txt); $tpl->parseCurrentBlock(); } $tpl->setVariable('POST_VAR', $this->getPostVar()); include_once "./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php"; $tpl->setVariable("IMG_START_CALENDAR", ilGlyphGUI::get(ilGlyphGUI::CALENDAR, $lng->txt("open_calendar"))); $tpl->setVariable("START_ID", $this->getPostVar()); $tpl->setVariable("DATE_ID_START", $this->getPostVar()); $tpl->setVariable("INPUT_FIELDS_START", $this->getPostVar() . "[start][date]"); include_once './Services/Calendar/classes/class.ilCalendarUserSettings.php'; $tpl->setVariable('DATE_FIRST_DAY', ilCalendarUserSettings::_getInstance()->getWeekStart()); $tpl->setVariable("START_SELECT", ilUtil::makeDateSelect($this->getPostVar() . "[start][date]", $start_info['year'], $start_info['mon'], $start_info['mday'], $this->getStartYear(), true, array('disabled' => $this->getDisabled(), 'select_attributes' => array('onchange' => 'ilUpdateEndDate();')), $this->getShowEmpty())); include_once "./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php"; $tpl->setVariable("IMG_END_CALENDAR", ilGlyphGUI::get(ilGlyphGUI::CALENDAR, $lng->txt("open_calendar"))); $tpl->setVariable("END_ID", $this->getPostVar()); $tpl->setVariable("DATE_ID_END", $this->getPostVar()); $tpl->setVariable("INPUT_FIELDS_END", $this->getPostVar() . "[end][date]"); $tpl->setVariable("END_SELECT", ilUtil::makeDateSelect($this->getPostVar() . "[end][date]", $end_info['year'], $end_info['mon'], $end_info['mday'], $this->getStartYear(), true, array('disabled' => $this->getDisabled()), $this->getShowEmpty())); if ($this->getShowTime()) { $tpl->setCurrentBlock("show_start_time"); $tpl->setVariable("START_TIME_SELECT", ilUtil::makeTimeSelect($this->getPostVar() . "[start][time]", !$this->getShowSeconds(), $start_info['hours'], $start_info['minutes'], $start_info['seconds'], true, array('minute_steps' => $this->getMinuteStepSize(), 'disabled' => $this->getDisabled(), 'select_attributes' => array('onchange' => 'ilUpdateEndDate();')))); $tpl->setVariable("TXT_START_TIME", $this->getShowSeconds() ? "(" . $lng->txt("hh_mm_ss") . ")" : "(" . $lng->txt("hh_mm") . ")"); $tpl->parseCurrentBlock(); $tpl->setCurrentBlock("show_end_time"); $tpl->setVariable("END_TIME_SELECT", ilUtil::makeTimeSelect($this->getPostVar() . "[end][time]", !$this->getShowSeconds(), $end_info['hours'], $end_info['minutes'], $end_info['seconds'], true, array('minute_steps' => $this->getMinuteStepSize(), 'disabled' => $this->getDisabled()))); $tpl->setVariable("TXT_END_TIME", $this->getShowSeconds() ? "(" . $lng->txt("hh_mm_ss") . ")" : "(" . $lng->txt("hh_mm") . ")"); $tpl->parseCurrentBlock(); } if ($this->getShowTime()) { $tpl->setVariable("DELIM", "<br />"); } return $tpl->get(); }