/**
  * 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();
 }
 /**
  * Fill template row
  * @param array $a_set
  */
 protected function fillRow($a_set)
 {
     global $objDefinition;
     include_once './Services/Link/classes/class.ilLink.php';
     $this->tpl->setCurrentBlock('item_row');
     $this->tpl->setVariable('ITEM_ID', $a_set['id']);
     $this->tpl->setVariable('COLL_TITLE', $a_set['title']);
     $this->tpl->setVariable('COLL_DESC', $a_set['description']);
     if ($this->getMode() == ilLPObjSettings::LP_MODE_SCORM) {
         $this->tpl->setVariable('TYPE_IMG', ilUtil::getImagePath('icon_sco_s.png'));
         $this->tpl->setVariable('ALT_IMG', $this->lng->txt('obj_sco'));
     } else {
         if ($objDefinition->isPluginTypeName($a_set["type"])) {
             $alt = ilPlugin::lookupTxt("rep_robj", $a_set['type'], "obj_" . $a_set['type']);
         } else {
             $alt = $this->lng->txt('obj_' . $a_set['type']);
         }
         $this->tpl->setVariable('ALT_IMG', $alt);
         $this->tpl->setVariable('TYPE_IMG', ilObject::_getIcon("", "tiny", $a_set['type']));
         if ($this->getMode() != ilLPObjSettings::LP_MODE_COLLECTION_MANUAL && $this->getMode() != ilLPObjSettings::LP_MODE_COLLECTION_TLT) {
             $this->tpl->setVariable('COLL_LINK', ilLink::_getLink($a_set['ref_id'], $a_set['type']));
             $this->tpl->setVariable('COLL_FRAME', ilFrameTargetInfo::_getFrame('MainContent', $a_set['type']));
             include_once './Services/Tree/classes/class.ilPathGUI.php';
             $path = new ilPathGUI();
             $this->tpl->setVariable('COLL_PATH', $this->lng->txt('path') . ': ' . $path->getPath($this->getNode(), $a_set['ref_id']));
             $mode = $a_set['mode_id'];
             if ($mode != ilLPObjSettings::LP_MODE_DEACTIVATED && $mode != ilLPObjSettings::LP_MODE_UNDEFINED) {
                 $this->tpl->setVariable("COLL_MODE", $a_set['mode']);
             } else {
                 $this->tpl->setVariable("COLL_MODE", "");
                 $this->tpl->setVariable("COLL_MODE_DEACTIVATED", $a_set['mode']);
             }
             if ($a_set["anonymized"]) {
                 $this->tpl->setVariable("ANONYMIZED", $this->lng->txt('trac_anonymized_info_short'));
             }
         } else {
             if ($this->getMode() == ilLPObjSettings::LP_MODE_COLLECTION_TLT) {
                 // handle tlt settings
                 $this->tpl->setCurrentBlock("tlt");
                 $this->tpl->setVariable("TXT_MONTH", $this->lng->txt('md_months'));
                 $this->tpl->setVariable("TXT_DAYS", $this->lng->txt('md_days'));
                 $this->tpl->setVariable("TXT_TIME", $this->lng->txt('md_time'));
                 $this->tpl->setVariable("TLT_HINT", '(hh:mm)');
                 // seconds to units
                 $mon = floor($a_set["tlt"] / (60 * 60 * 24 * 30));
                 $tlt = $a_set["tlt"] % (60 * 60 * 24 * 30);
                 $day = floor($tlt / (60 * 60 * 24));
                 $tlt = $tlt % (60 * 60 * 24);
                 $hr = floor($tlt / (60 * 60));
                 $tlt = $tlt % (60 * 60);
                 $min = floor($tlt / 60);
                 $options = array();
                 for ($i = 0; $i <= 24; $i++) {
                     $options[$i] = sprintf('%02d', $i);
                 }
                 $this->tpl->setVariable("SEL_MONTHS", ilUtil::formSelect($mon, 'tlt[' . $a_set['id'] . '][mo]', $options, false, true));
                 for ($i = 0; $i <= 31; $i++) {
                     $options[$i] = sprintf('%02d', $i);
                 }
                 $this->tpl->setVariable("SEL_DAYS", ilUtil::formSelect($day, 'tlt[' . $a_set['id'] . '][d]', $options, false, true));
                 $this->tpl->setVariable("SEL_TLT", ilUtil::makeTimeSelect('tlt[' . $a_set['id'] . ']', true, $hr, $min, null, false));
                 $this->tpl->parseCurrentBlock();
             }
         }
     }
     // Assigned ?
     $this->tpl->setVariable("ASSIGNED_IMG_OK", $a_set['status'] ? ilUtil::getImagePath('icon_ok.png') : ilUtil::getImagePath('icon_not_ok.png'));
     $this->tpl->setVariable("ASSIGNED_STATUS", $a_set['status'] ? $this->lng->txt('trac_assigned') : $this->lng->txt('trac_not_assigned'));
     $this->tpl->parseCurrentBlock();
     // Parse grouped items
     foreach ((array) $a_set['grouped'] as $item) {
         $this->fillRow($item);
     }
     // show num obligatory info
     if (count($a_set['grouped'])) {
         $this->tpl->setCurrentBlock('num_passed_items');
         $this->tpl->setVariable('MIN_PASSED_TXT', $this->lng->txt('trac_min_passed'));
         $this->tpl->setVariable('NUM_OBLIGATORY', $a_set['num_obligatory']);
         $this->tpl->setVariable('GRP_ID', $a_set['grouping_id']);
         $this->tpl->parseCurrentBlock();
     }
 }
 function listEducational()
 {
     $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.md_editor.html', 'Services/MetaData');
     $this->__setTabs('meta_educational');
     $this->tpl->addBlockFile('MD_CONTENT', 'md_content', 'tpl.md_educational.html', 'Services/MetaData');
     if (!is_object($this->md_section = $this->md_obj->getEducational())) {
         $this->tpl->setCurrentBlock("no_educational");
         $this->tpl->setVariable("TXT_NO_EDUCATIONAL", $this->lng->txt("meta_no_educational"));
         $this->tpl->setVariable("TXT_ADD_EDUCATIONAL", $this->lng->txt("meta_add"));
         $this->ctrl->setParameter($this, "section", "meta_educational");
         $this->tpl->setVariable("ACTION_ADD_EDUCATIONAL", $this->ctrl->getLinkTarget($this, "addSection"));
         $this->tpl->parseCurrentBlock();
     } else {
         $this->ctrl->setReturn($this, 'listEducational');
         $this->ctrl->setParameter($this, 'section', 'meta_educational');
         $this->tpl->setVariable("EDIT_ACTION", $this->ctrl->getFormAction($this));
         $this->ctrl->setParameter($this, "meta_index", $this->md_section->getMetaId());
         $this->tpl->setVariable("ACTION_DELETE", $this->ctrl->getLinkTarget($this, "deleteSection"));
         $this->tpl->setVariable("TXT_EDUCATIONAL", $this->lng->txt("meta_educational"));
         $this->tpl->setVariable("TXT_DELETE", $this->lng->txt("meta_delete"));
         $this->tpl->setVariable("TXT_NEW_ELEMENT", $this->lng->txt("meta_new_element"));
         $this->tpl->setVariable("TXT_TYPICALAGERANGE", $this->lng->txt("meta_typical_age_range"));
         $this->tpl->setVariable("TXT_DESCRIPTION", $this->lng->txt("meta_description"));
         $this->tpl->setVariable("TXT_LANGUAGE", $this->lng->txt("meta_language"));
         $this->tpl->setVariable("TXT_ADD", $this->lng->txt("meta_add"));
         $this->tpl->setVariable("TXT_PLEASE_SELECT", $this->lng->txt("meta_please_select"));
         $this->tpl->setVariable("TXT_INTERACTIVITYTYPE", $this->lng->txt("meta_interactivity_type"));
         $this->tpl->setVariable("TXT_LEARNINGRESOURCETYPE", $this->lng->txt("meta_learning_resource_type"));
         $this->tpl->setVariable("TXT_INTERACTIVITYLEVEL", $this->lng->txt("meta_interactivity_level"));
         $this->tpl->setVariable("TXT_SEMANTICDENSITY", $this->lng->txt("meta_semantic_density"));
         $this->tpl->setVariable("TXT_INTENDEDENDUSERROLE", $this->lng->txt("meta_intended_end_user_role"));
         $this->tpl->setVariable("TXT_CONTEXT", $this->lng->txt("meta_context"));
         $this->tpl->setVariable("TXT_DIFFICULTY", $this->lng->txt("meta_difficulty"));
         $this->tpl->setVariable("VAL_INTERACTIVITYTYPE_" . strtoupper($this->md_section->getInteractivityType()), " selected");
         $this->tpl->setVariable("VAL_LEARNINGRESOURCETYPE_" . strtoupper($this->md_section->getLearningResourceType()), " selected");
         $this->tpl->setVariable("VAL_INTERACTIVITYLEVEL_" . strtoupper($this->md_section->getInteractivityLevel()), " selected");
         $this->tpl->setVariable("VAL_SEMANTICDENSITY_" . strtoupper($this->md_section->getSemanticDensity()), " selected");
         $this->tpl->setVariable("VAL_INTENDEDENDUSERROLE_" . strtoupper($this->md_section->getIntendedEndUserRole()), " selected");
         $this->tpl->setVariable("VAL_CONTEXT_" . strtoupper($this->md_section->getContext()), " selected");
         $this->tpl->setVariable("VAL_DIFFICULTY_" . strtoupper($this->md_section->getDifficulty()), " selected");
         #$this->tpl->setVariable("VAL_TYPICALLEARNINGTIME", ilUtil::prepareFormOutput($this->md_section->getTypicalLearningTime()));
         $this->tpl->setVariable("TXT_ACTIVE", $this->lng->txt("meta_active"));
         $this->tpl->setVariable("TXT_EXPOSITIVE", $this->lng->txt("meta_expositive"));
         $this->tpl->setVariable("TXT_MIXED", $this->lng->txt("meta_mixed"));
         $this->tpl->setVariable("TXT_EXERCISE", $this->lng->txt("meta_exercise"));
         $this->tpl->setVariable("TXT_SIMULATION", $this->lng->txt("meta_simulation"));
         $this->tpl->setVariable("TXT_QUESTIONNAIRE", $this->lng->txt("meta_questionnaire"));
         $this->tpl->setVariable("TXT_DIAGRAMM", $this->lng->txt("meta_diagramm"));
         $this->tpl->setVariable("TXT_FIGURE", $this->lng->txt("meta_figure"));
         $this->tpl->setVariable("TXT_GRAPH", $this->lng->txt("meta_graph"));
         $this->tpl->setVariable("TXT_INDEX", $this->lng->txt("meta_index"));
         $this->tpl->setVariable("TXT_SLIDE", $this->lng->txt("meta_slide"));
         $this->tpl->setVariable("TXT_TABLE", $this->lng->txt("meta_table"));
         $this->tpl->setVariable("TXT_NARRATIVETEXT", $this->lng->txt("meta_narrative_text"));
         $this->tpl->setVariable("TXT_EXAM", $this->lng->txt("meta_exam"));
         $this->tpl->setVariable("TXT_EXPERIMENT", $this->lng->txt("meta_experiment"));
         $this->tpl->setVariable("TXT_PROBLEMSTATEMENT", $this->lng->txt("meta_problem_statement"));
         $this->tpl->setVariable("TXT_SELFASSESSMENT", $this->lng->txt("meta_self_assessment"));
         $this->tpl->setVariable("TXT_LECTURE", $this->lng->txt("meta_lecture"));
         $this->tpl->setVariable("TXT_VERYLOW", $this->lng->txt("meta_very_low"));
         $this->tpl->setVariable("TXT_LOW", $this->lng->txt("meta_low"));
         $this->tpl->setVariable("TXT_MEDIUM", $this->lng->txt("meta_medium"));
         $this->tpl->setVariable("TXT_HIGH", $this->lng->txt("meta_high"));
         $this->tpl->setVariable("TXT_VERYHIGH", $this->lng->txt("meta_very_high"));
         $this->tpl->setVariable("TXT_TEACHER", $this->lng->txt("meta_teacher"));
         $this->tpl->setVariable("TXT_AUTHOR", $this->lng->txt("meta_author"));
         $this->tpl->setVariable("TXT_LEARNER", $this->lng->txt("meta_learner"));
         $this->tpl->setVariable("TXT_MANAGER", $this->lng->txt("meta_manager"));
         $this->tpl->setVariable("TXT_SCHOOL", $this->lng->txt("meta_school"));
         $this->tpl->setVariable("TXT_HIGHEREDUCATION", $this->lng->txt("meta_higher_education"));
         $this->tpl->setVariable("TXT_TRAINING", $this->lng->txt("meta_training"));
         $this->tpl->setVariable("TXT_OTHER", $this->lng->txt("meta_other"));
         $this->tpl->setVariable("TXT_VERYEASY", $this->lng->txt("meta_very_easy"));
         $this->tpl->setVariable("TXT_EASY", $this->lng->txt("meta_easy"));
         $this->tpl->setVariable("TXT_DIFFICULT", $this->lng->txt("meta_difficult"));
         $this->tpl->setVariable("TXT_VERYDIFFICULT", $this->lng->txt("meta_very_difficult"));
         $this->tpl->setVariable("TXT_TYPICALLEARNINGTIME", $this->lng->txt("meta_typical_learning_time"));
         // Typical learning time
         $tlt = array(0, 0, 0, 0, 0);
         $valid = true;
         include_once 'Services/MetaData/classes/class.ilMDUtils.php';
         if (!($tlt = ilMDUtils::_LOMDurationToArray($this->md_section->getTypicalLearningTime()))) {
             if (strlen($this->md_section->getTypicalLearningTime())) {
                 $tlt = array(0, 0, 0, 0, 0);
                 $valid = false;
             }
         }
         $this->tpl->setVariable("TXT_MONTH", $this->lng->txt('md_months'));
         $this->tpl->setVariable("SEL_MONTHS", $this->__buildMonthsSelect($tlt[0]));
         $this->tpl->setVariable("SEL_DAYS", $this->__buildDaysSelect($tlt[1]));
         $this->tpl->setVariable("TXT_DAYS", $this->lng->txt('md_days'));
         $this->tpl->setVariable("TXT_TIME", $this->lng->txt('md_time'));
         $this->tpl->setVariable("TXT_TYPICAL_LEARN_TIME", $this->lng->txt('meta_typical_learning_time'));
         $this->tpl->setVariable("SEL_TLT", ilUtil::makeTimeSelect('tlt', $tlt[4] ? false : true, $tlt[2], $tlt[3], $tlt[4], false));
         $this->tpl->setVariable("TLT_HINT", $tlt[4] ? '(hh:mm:ss)' : '(hh:mm)');
         if (!$valid) {
             $this->tpl->setCurrentBlock("tlt_not_valid");
             $this->tpl->setVariable("TXT_CURRENT_VAL", $this->lng->txt('meta_current_value'));
             $this->tpl->setVariable("TLT", $this->md_section->getTypicalLearningTime());
             $this->tpl->setVariable("INFO_TLT_NOT_VALID", $this->lng->txt('meta_info_tlt_not_valid'));
             $this->tpl->parseCurrentBlock();
         }
         /* TypicalAgeRange */
         $first = true;
         foreach ($ids = $this->md_section->getTypicalAgeRangeIds() as $id) {
             $md_age = $this->md_section->getTypicalAgeRange($id);
             // extra test due to bug 5316 (may be due to eLaix import)
             if (is_object($md_age)) {
                 if ($first) {
                     $this->tpl->setCurrentBlock("agerange_head");
                     $this->tpl->setVariable("TYPICALAGERANGE_LOOP_TXT_TYPICALAGERANGE", $this->lng->txt("meta_typical_age_range"));
                     $this->tpl->setVariable("ROWSPAN_AGERANGE", count($ids));
                     $this->tpl->parseCurrentBlock();
                     $first = false;
                 }
                 $this->ctrl->setParameter($this, 'meta_index', $id);
                 $this->ctrl->setParameter($this, 'meta_path', 'educational_typical_age_range');
                 $this->tpl->setCurrentBlock("typicalagerange_delete");
                 $this->tpl->setVariable("TYPICALAGERANGE_LOOP_ACTION_DELETE", $this->ctrl->getLinkTarget($this, "deleteElement"));
                 $this->tpl->setVariable("TYPICALAGERANGE_LOOP_TXT_DELETE", $this->lng->txt("meta_delete"));
                 $this->tpl->parseCurrentBlock();
                 $this->tpl->setCurrentBlock("typicalagerange_loop");
                 $this->tpl->setVariable("TYPICALAGERANGE_LOOP_TXT_VALUE", $this->lng->txt("meta_value"));
                 $this->tpl->setVariable("TYPICALAGERANGE_LOOP_VAL", ilUtil::prepareFormOutput($md_age->getTypicalAgeRange()));
                 $this->tpl->setVariable("TYPICALAGERANGE_LOOP_NO", $id);
                 $this->tpl->setVariable("TYPICALAGERANGE_LOOP_TXT_LANGUAGE", $this->lng->txt("meta_language"));
                 $this->tpl->setVariable("TYPICALAGERANGE_LOOP_VAL_LANGUAGE", $this->__showLanguageSelect('educational[TypicalAgeRange][' . $id . '][Language]', $md_age->getTypicalAgeRangeLanguageCode()));
                 $this->ctrl->setParameter($this, "section_element", "educational_typical_age_range");
                 $this->tpl->setVariable("TYPICALAGERANGE_LOOP_ACTION_ADD", $this->ctrl->getLinkTarget($this, "addSectionElement"));
                 $this->tpl->setVariable("TYPICALAGERANGE_LOOP_TXT_ADD", $this->lng->txt("meta_add"));
                 $this->tpl->parseCurrentBlock();
             }
         }
         /* Description */
         $first = true;
         foreach ($ids = $this->md_section->getDescriptionIds() as $id) {
             if ($first) {
                 $this->tpl->setCurrentBlock("desc_head");
                 $this->tpl->setVariable("DESCRIPTION_LOOP_TXT_DESCRIPTION", $this->lng->txt("meta_description"));
                 $this->tpl->setVariable("ROWSPAN_DESC", count($ids));
                 $this->tpl->parseCurrentBlock();
                 $first = false;
             }
             $md_des = $this->md_section->getDescription($id);
             $this->ctrl->setParameter($this, 'meta_index', $id);
             $this->ctrl->setParameter($this, 'meta_path', 'educational_description');
             $this->tpl->setCurrentBlock("description_loop");
             $this->tpl->setVariable("DESCRIPTION_LOOP_NO", $id);
             $this->tpl->setVariable("DESCRIPTION_LOOP_TXT_VALUE", $this->lng->txt("meta_value"));
             $this->tpl->setVariable("DESCRIPTION_LOOP_VAL", ilUtil::prepareFormOutput($md_des->getDescription()));
             $this->tpl->setVariable("DESCRIPTION_LOOP_TXT_LANGUAGE", $this->lng->txt("meta_language"));
             $this->tpl->setVariable("DESCRIPTION_LOOP_VAL_LANGUAGE", $this->__showLanguageSelect('educational[Description][' . $id . '][Language]', $md_des->getDescriptionLanguageCode()));
             $this->tpl->setVariable("DESCRIPTION_LOOP_ACTION_DELETE", $this->ctrl->getLinkTarget($this, "deleteElement"));
             $this->tpl->setVariable("DESCRIPTION_LOOP_TXT_DELETE", $this->lng->txt("meta_delete"));
             $this->ctrl->setParameter($this, "section_element", "educational_description");
             $this->tpl->setVariable("DESCRIPTION_LOOP_ACTION_ADD", $this->ctrl->getLinkTarget($this, "addSectionElement"));
             $this->tpl->setVariable("DESCRIPTION_LOOP_TXT_ADD", $this->lng->txt("meta_add"));
             $this->tpl->parseCurrentBlock();
         }
         /* Language */
         $first = true;
         foreach ($ids = $this->md_section->getLanguageIds() as $id) {
             if ($first) {
                 $this->tpl->setCurrentBlock("language_head");
                 $this->tpl->setVariable("LANGUAGE_LOOP_TXT_LANGUAGE", $this->lng->txt("meta_language"));
                 $this->tpl->setVariable("ROWSPAN_LANG", count($ids));
                 $this->tpl->parseCurrentBlock();
                 $first = false;
             }
             $md_lang = $this->md_section->getLanguage($id);
             $this->ctrl->setParameter($this, 'meta_index', $id);
             $this->ctrl->setParameter($this, 'meta_path', 'educational_language');
             $this->tpl->setCurrentBlock("language_loop");
             $this->tpl->setVariable("LANGUAGE_LOOP_VAL_LANGUAGE", $this->__showLanguageSelect('educational[Language][' . $id . ']', $md_lang->getLanguageCode()));
             $this->tpl->setVariable("LANGUAGE_LOOP_ACTION_DELETE", $this->ctrl->getLinkTarget($this, "deleteElement"));
             $this->tpl->setVariable("LANGUAGE_LOOP_TXT_DELETE", $this->lng->txt("meta_delete"));
             $this->ctrl->setParameter($this, "section_element", "educational_language");
             $this->tpl->setVariable("LANGUAGE_LOOP_ACTION_ADD", $this->ctrl->getLinkTarget($this, "addSectionElement"));
             $this->tpl->setVariable("LANGUAGE_LOOP_TXT_ADD", $this->lng->txt("meta_add"));
             $this->tpl->parseCurrentBlock();
         }
         $this->tpl->setVariable("TXT_SAVE", $this->lng->txt("save"));
         $this->tpl->setCurrentBlock("educational");
         $this->tpl->parseCurrentBlock();
     }
 }
 /**
  * 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();
 }
 /**
  * Creates an output of the edit form for the question
  *
  * Creates an output of the edit form for the question
  *
  * @access public
  */
 function editQuestion()
 {
     $this->tpl->addJavascript("./Services/JavaScript/js/Basic.js");
     $this->tpl->addCss($this->cssDir . "/default.css");
     $this->tpl->addJavascript($this->ownDir . "/js/bracketCount.js");
     $this->tpl->addJavascript($this->ownDir . "/js/url_encode.js");
     $javascript = "<script type=\"text/javascript\">ilAddOnLoad(initialSelect);\n" . "function initialSelect() {\n%s\n}</script>";
     // single response
     $this->getQuestionTemplate();
     $this->tpl->addBlockFile("QUESTION_DATA", "question_data", "tpl.il_as_qpl_syntaxtree.html", $this->ownDir);
     // output of existing single response answers
     for ($i = 0; $i < $this->object->getAnswerCount(); $i++) {
         $this->tpl->setCurrentBlock("answers");
         $answer = $this->object->getAnswer($i);
         $this->tpl->setVariable("VALUE_ANSWER_COUNTER", $answer->getOrder() + 1);
         $this->tpl->setVariable("ANSWER_ORDER", $answer->getOrder());
         $this->tpl->setVariable("VALUE_ANSWER", ilUtil::prepareFormOutput($answer->getAnswertext()));
         $this->tpl->setVariable("VALUE_POINTS", ilUtil::prepareFormOutput($answer->getPoints()));
         $this->tpl->setVariable("TEXT_PHRASE_HEADER", $this->lng->txt("qpl_qst_syntaxtree_phrase_header"));
         $this->tpl->setVariable("TEXT_OPEN_BRACKETS", $this->lng->txt("qpl_qst_syntaxtree_open_brackets"));
         $this->tpl->setVariable("TEXT_CLOSED_BRACKETS", $this->lng->txt("qpl_qst_syntaxtree_closed_brackets"));
         /* SyntaxTreeAddon */
         $img = "<img src=\"" . sprintf($this->ownDir . "/phpsyntaxtree_obj/stgraph.png?syntaxTreeData=%s\" id=\"syntaxTreeGraph\" alt=\"\">", urlencode($answer->getAnswertext()));
         $this->tpl->setVariable("GRAPH", sprintf("%s", $img));
         $this->tpl->parseCurrentBlock();
     }
     if ($this->object->getAnswerCount() > 0) {
         $this->tpl->setCurrentBlock("answersheading");
         $this->tpl->setVariable("TEXT_ANSWER_TEXT", $this->lng->txt("answer_text"));
         $this->tpl->setVariable("TEXT_POINTS", $this->lng->txt("points"));
         $this->tpl->parseCurrentBlock();
     }
     $this->tpl->setCurrentBlock("HeadContent");
     if ($this->object->getAnswerCount() == 0) {
         $this->tpl->setVariable("CONTENT_BLOCK", sprintf($javascript, "document.frm_syntaxtree.title.focus();"));
     } else {
         switch ($this->ctrl->getCmd()) {
             case "add":
                 $this->tpl->setVariable("CONTENT_BLOCK", sprintf($javascript, "document.frm_syntaxtree.answer_" . ($this->object->getAnswerCount() - $_POST["nrOfAnswers"]) . ".focus(); document.getElementById('answer_" . ($this->object->getAnswerCount() - $_POST["nrOfAnswers"]) . "').scrollIntoView(\"true\");"));
                 break;
             case "":
                 if ($this->object->getAnswerCount() == 0) {
                     $this->tpl->setVariable("CONTENT_BLOCK", sprintf($javascript, "document.frm_syntaxtree.title.focus();"));
                 } else {
                     $this->tpl->setVariable("CONTENT_BLOCK", sprintf($javascript, "document.frm_syntaxtree.answer_" . ($this->object->getAnswerCount() - 1) . ".focus(); document.getElementById('answer_" . ($this->object->getAnswerCount() - 1) . "').scrollIntoView(\"true\");"));
                 }
                 break;
             default:
                 $this->tpl->setVariable("CONTENT_BLOCK", sprintf($javascript, "document.frm_syntaxtree.title.focus();"));
                 break;
         }
     }
     $this->tpl->parseCurrentBlock();
     // Add text rating options
     $text_options = array(array("ci", $this->lng->txt("cloze_textgap_case_insensitive")), array("cs", $this->lng->txt("cloze_textgap_case_sensitive")), array("l1", sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "1")), array("l2", sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "2")), array("l3", sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "3")), array("l4", sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "4")), array("l5", sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "5")));
     $text_rating = $this->object->getTextRating();
     foreach ($text_options as $text_option) {
         $this->tpl->setCurrentBlock("text_rating");
         $this->tpl->setVariable("RATING_VALUE", $text_option[0]);
         $this->tpl->setVariable("RATING_TEXT", $text_option[1]);
         if (strcmp($text_rating, $text_option[0]) == 0) {
             $this->tpl->setVariable("SELECTED_RATING_VALUE", " selected=\"selected\"");
         }
         $this->tpl->parseCurrentBlock();
     }
     if ($this->object->getAnswerCount() > 0) {
         $this->tpl->setCurrentBlock("selectall");
         $this->tpl->setVariable("SELECT_ALL", $this->lng->txt("select_all"));
         $this->tpl->parseCurrentBlock();
         $this->tpl->setCurrentBlock("existinganswers");
         $this->tpl->setVariable("DELETE", $this->lng->txt("delete"));
         $this->tpl->setVariable("MOVE", $this->lng->txt("move"));
         $this->tpl->setVariable("ARROW", "<img src=\"" . ilUtil::getImagePath("arrow_downright.gif") . "\" alt=\"" . $this->lng->txt("arrow_downright") . "\">");
         $this->tpl->parseCurrentBlock();
     }
     for ($i = 1; $i < 10; $i++) {
         $this->tpl->setCurrentBlock("numbers");
         $this->tpl->setVariable("VALUE_NUMBER", $i);
         if ($i == 1) {
             $this->tpl->setVariable("TEXT_NUMBER", $i . " " . $this->lng->txt("answer"));
         } else {
             $this->tpl->setVariable("TEXT_NUMBER", $i . " " . $this->lng->txt("answers"));
         }
         $this->tpl->parseCurrentBlock();
     }
     $this->tpl->setCurrentBlock("question_data");
     $this->tpl->setVariable("SYNTAXTREE_ID", $this->object->getId());
     $this->tpl->setVariable("VALUE_SYNTAXTREE_TITLE", ilUtil::prepareFormOutput($this->object->getTitle()));
     $this->tpl->setVariable("VALUE_SYNTAXTREE_COMMENT", ilUtil::prepareFormOutput($this->object->getComment()));
     $this->tpl->setVariable("VALUE_SYNTAXTREE_AUTHOR", ilUtil::prepareFormOutput($this->object->getAuthor()));
     $this->tpl->setVariable("VALUE_CORRECTANSWERS", $this->object->getCorrectAnswers());
     $this->tpl->setVariable("VALUE_POINTS", $this->object->getMaximumPoints());
     $questiontext = $this->object->getQuestion();
     $this->tpl->setVariable("VALUE_QUESTION", ilUtil::prepareFormOutput($this->object->prepareTextareaOutput($questiontext)));
     $this->tpl->setVariable("VALUE_ADD_ANSWER", $this->lng->txt("add"));
     $this->tpl->setVariable("TEXT_TITLE", $this->lng->txt("title"));
     $this->tpl->setVariable("TEXT_AUTHOR", $this->lng->txt("author"));
     $this->tpl->setVariable("TEXT_COMMENT", $this->lng->txt("description"));
     $this->tpl->setVariable("TEXT_QUESTION", $this->lng->txt("question"));
     $this->tpl->setVariable("TEXT_RATING", $this->lng->txt("text_rating"));
     $this->tpl->setVariable("TEXT_POINTS", $this->lng->txt("maximum_points"));
     $this->tpl->setVariable("TEXT_CORRECTANSWERS", $this->lng->txt("nr_of_correct_answers"));
     // estimated working time
     $est_working_time = $this->object->getEstimatedWorkingTime();
     $this->tpl->setVariable("TEXT_WORKING_TIME", $this->lng->txt("working_time"));
     $this->tpl->setVariable("TIME_FORMAT", $this->lng->txt("time_format"));
     $this->tpl->setVariable("VALUE_WORKING_TIME", ilUtil::makeTimeSelect("Estimated", false, $est_working_time[h], $est_working_time[m], $est_working_time[s]));
     $this->tpl->setVariable("SAVE", $this->lng->txt("save"));
     $this->tpl->setVariable("SAVE_EDIT", $this->lng->txt("save_edit"));
     $this->tpl->setVariable("CANCEL", $this->lng->txt("cancel"));
     $this->tpl->setVariable("TXT_REQUIRED_FLD", $this->lng->txt("required_field"));
     $this->ctrl->setParameter($this, "sel_question_types", "SyntaxTree");
     $this->tpl->setVariable("ACTION_SYNTAXTREE_TEST", $this->ctrl->getFormAction($this));
     $this->tpl->setVariable("TEXT_QUESTION_TYPE", $this->lng->txt("qpl_qst_syntaxtree_syntaxtree_question"));
     //$this->outOtherQuestionData();
     $this->tpl->parseCurrentBlock();
     include_once "./Services/RTE/classes/class.ilRTE.php";
     $rtestring = ilRTE::_getRTEClassname();
     include_once "./Services/RTE/classes/class.{$rtestring}.php";
     $rte = new $rtestring();
     $rte->addPlugin("latex");
     $rte->addButton("latex");
     $rte->addButton("pastelatex");
     include_once "./classes/class.ilObject.php";
     $obj_id = $_GET["q_id"];
     $obj_type = ilObject::_lookupType($_GET["ref_id"], TRUE);
     $rte->addRTESupport($obj_id, $obj_type, "assessment");
     $this->tpl->setCurrentBlock("adm_content");
     //$this->tpl->setVariable("BODY_ATTRIBUTES", " onload=\"initialSelect();\"");
     $this->tpl->parseCurrentBlock();
 }
 function render()
 {
     global $ilUser;
     $tpl = new ilTemplate("tpl.prop_datetime.html", true, true, "Services/Form");
     $tpl->setCurrentBlock("prop_time");
     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->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->parseCurrentBlock();
     return $tpl->get();
 }
 /**
  * Insert property html
  */
 function insert(&$a_tpl)
 {
     $ttpl = new ilTemplate("tpl.prop_typical_learning_time.html", true, true, "Services/MetaData");
     $val = $this->getValue();
     $ttpl->setVariable("TXT_MONTH", $this->lng->txt('md_months'));
     $ttpl->setVariable("SEL_MONTHS", $this->__buildMonthsSelect($val[0]));
     $ttpl->setVariable("SEL_DAYS", $this->__buildDaysSelect($val[1]));
     $ttpl->setVariable("TXT_DAYS", $this->lng->txt('md_days'));
     $ttpl->setVariable("TXT_TIME", $this->lng->txt('md_time'));
     $ttpl->setVariable("SEL_TLT", ilUtil::makeTimeSelect($this->getPostVar(), $val[4] ? false : true, $val[2], $val[3], $val[4], false));
     $ttpl->setVariable("TLT_HINT", $tlt[4] ? '(hh:mm:ss)' : '(hh:mm)');
     if (!$this->valid) {
         $ttpl->setCurrentBlock("tlt_not_valid");
         $ttpl->setVariable("TXT_CURRENT_VAL", $this->lng->txt('meta_current_value'));
         $ttpl->setVariable("TLT", $this->lom_duration);
         $ttpl->setVariable("INFO_TLT_NOT_VALID", $this->lng->txt('meta_info_tlt_not_valid'));
         $ttpl->parseCurrentBlock();
     }
     $a_tpl->setCurrentBlock("prop_generic");
     $a_tpl->setVariable("PROP_GENERIC", $ttpl->get());
     $a_tpl->parseCurrentBlock();
 }