/**
  * Set by LOM duration
  *
  * @param	string	$a_value	Value
  */
 function setValueByLOMDuration($a_value)
 {
     $this->lom_duration = $a_value;
     $this->valid = true;
     include_once 'Services/MetaData/classes/class.ilMDUtils.php';
     $tlt = ilMDUtils::_LOMDurationToArray($a_value);
     if (!$tlt) {
         $this->setValue(array(0, 0, 0, 0, 0));
         if ($a_value != "") {
             $this->valid = false;
         }
     } else {
         $this->setValue($tlt);
     }
 }
 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();
     }
 }
 function _getTypicalLearningTimeSeconds($a_rbac_id, $a_obj_id = 0)
 {
     global $ilDB;
     $a_obj_id = $a_obj_id ? $a_obj_id : $a_rbac_id;
     $query = "SELECT typical_learning_time FROM il_meta_educational " . "WHERE rbac_id = " . $ilDB->quote($a_rbac_id, 'integer') . " " . "AND obj_id = " . $ilDB->quote($a_obj_id, 'integer');
     $res = $ilDB->query($query);
     while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) {
         include_once './Services/MetaData/classes/class.ilMDUtils.php';
         $time_arr = ilMDUtils::_LOMDurationToArray($row->typical_learning_time);
         return 60 * 60 * 24 * 30 * $time_arr[0] + 60 * 60 * 24 * $time_arr[1] + 60 * 60 * $time_arr[2] + 60 * $time_arr[3] + $time_arr[4];
     }
     return 0;
 }