/**
  * 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);
     }
 }
Пример #2
0
 /**
  * add standard meta data sections
  */
 function addMetaDataSections($a_rep_obj_id, $a_obj_id, $a_type)
 {
     global $lng;
     $lng->loadLanguageModule("meta");
     include_once "./Services/MetaData/classes/class.ilMD.php";
     $md = new ilMD($a_rep_obj_id, $a_obj_id, $a_type);
     if ($md_gen = $md->getGeneral()) {
         // get first descrption
         // The description is shown on the top of the page.
         // Thus it is not necessary to show it again.
         foreach ($md_gen->getDescriptionIds() as $id) {
             $md_des = $md_gen->getDescription($id);
             $description = $md_des->getDescription();
             break;
         }
         // get language(s)
         $langs = array();
         foreach ($ids = $md_gen->getLanguageIds() as $id) {
             $md_lan = $md_gen->getLanguage($id);
             if ($md_lan->getLanguageCode() != "") {
                 $langs[] = $lng->txt("meta_l_" . $md_lan->getLanguageCode());
             }
         }
         $langs = implode($langs, ", ");
         // keywords
         $keywords = array();
         foreach ($ids = $md_gen->getKeywordIds() as $id) {
             $md_key = $md_gen->getKeyword($id);
             $keywords[] = $md_key->getKeyword();
         }
         $keywords = implode($keywords, ", ");
     }
     // authors
     if (is_object($lifecycle = $md->getLifecycle())) {
         $sep = $author = "";
         foreach ($ids = $lifecycle->getContributeIds() as $con_id) {
             $md_con = $lifecycle->getContribute($con_id);
             if ($md_con->getRole() == "Author") {
                 foreach ($ent_ids = $md_con->getEntityIds() as $ent_id) {
                     $md_ent = $md_con->getEntity($ent_id);
                     $author = $author . $sep . $md_ent->getEntity();
                     $sep = ", ";
                 }
             }
         }
     }
     // copyright
     $copyright = "";
     if (is_object($rights = $md->getRights())) {
         include_once 'Services/MetaData/classes/class.ilMDUtils.php';
         $copyright = ilMDUtils::_parseCopyright($rights->getDescription());
     }
     // learning time
     #if(is_object($educational = $md->getEducational()))
     #{
     #	$learning_time = $educational->getTypicalLearningTime();
     #}
     $learning_time = "";
     if (is_object($educational = $md->getEducational())) {
         if ($seconds = $educational->getTypicalLearningTimeSeconds()) {
             $learning_time = ilFormat::_secondsToString($seconds);
         }
     }
     // output
     // description
     if ($description != "") {
         $this->addSection($lng->txt("description"));
         $this->addProperty("", nl2br($description));
     }
     // general section
     $this->addSection($lng->txt("meta_general"));
     if ($langs != "") {
         $this->addProperty($lng->txt("language"), $langs);
     }
     if ($keywords != "") {
         $this->addProperty($lng->txt("keywords"), $keywords);
     }
     if ($author != "") {
         $this->addProperty($lng->txt("author"), $author);
     }
     if ($copyright != "") {
         $this->addProperty($lng->txt("meta_copyright"), $copyright);
     }
     if ($learning_time != "") {
         $this->addProperty($lng->txt("meta_typical_learning_time"), $learning_time);
     }
 }
Пример #3
0
 /**
  * show download list
  */
 function showDownloadList()
 {
     //$this->tpl = new ilTemplate("tpl.lm_toc.html", true, true, true);
     $this->tpl->setCurrentBlock("ContentStyle");
     if (!$this->offlineMode()) {
         $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", ilObjStyleSheet::getContentStylePath($this->lm->getStyleSheetId()));
     } else {
         $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", "content_style/content.css");
     }
     $this->tpl->parseCurrentBlock();
     $this->renderPageTitle();
     $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
     $this->tpl->getStandardTemplate();
     $this->tpl->setVariable("TABS", $this->lm_gui->setilLMMenu($this->offlineMode(), $this->getExportFormat(), "download", true));
     $this->ilLocator();
     //$this->tpl->stopTitleFloating();
     $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.lm_download_list.html", "Modules/LearningModule");
     // set title header
     $this->tpl->setTitle($this->lm->getTitle());
     $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_lm.svg"));
     /*
     		$this->tpl->setVariable("TXT_BACK", $this->lng->txt("back"));
     		$this->ctrl->setParameter($this, "obj_id", $_GET["obj_id"]);
     		$this->tpl->setVariable("LINK_BACK",
     			$this->ctrl->getLinkTarget($this, "")); */
     // output copyright information
     include_once 'Services/MetaData/classes/class.ilMD.php';
     $md = new ilMD($this->lm->getId(), 0, $this->lm->getType());
     if (is_object($md_rights = $md->getRights())) {
         $copyright = $md_rights->getDescription();
         include_once 'Services/MetaData/classes/class.ilMDUtils.php';
         $copyright = ilMDUtils::_parseCopyright($copyright);
         if ($copyright != "") {
             $this->lng->loadLanguageModule("meta");
             $this->tpl->setCurrentBlock("copyright");
             $this->tpl->setVariable("TXT_COPYRIGHT", $this->lng->txt("meta_copyright"));
             $this->tpl->setVariable("LM_COPYRIGHT", $copyright);
             $this->tpl->parseCurrentBlock();
         }
     }
     // create table
     require_once "./Services/Table/classes/class.ilTableGUI.php";
     $tbl = new ilTableGUI();
     // load files templates
     $this->tpl->addBlockfile("DOWNLOAD_TABLE", "download_table", "tpl.table.html");
     // load template for table content data
     $this->tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.download_file_row.html", "Modules/LearningModule");
     $export_files = array();
     $types = array("xml", "html", "scorm");
     foreach ($types as $type) {
         if ($this->lm->getPublicExportFile($type) != "") {
             if (is_file($this->lm->getExportDirectory($type) . "/" . $this->lm->getPublicExportFile($type))) {
                 $dir = $this->lm->getExportDirectory($type);
                 $size = filesize($this->lm->getExportDirectory($type) . "/" . $this->lm->getPublicExportFile($type));
                 $export_files[] = array("type" => $type, "file" => $this->lm->getPublicExportFile($type), "size" => $size);
             }
         }
     }
     $num = 0;
     $tbl->setTitle($this->lng->txt("download"));
     $tbl->setHeaderNames(array($this->lng->txt("cont_format"), $this->lng->txt("cont_file"), $this->lng->txt("size"), $this->lng->txt("date"), ""));
     $cols = array("format", "file", "size", "date", "download");
     $header_params = array("ref_id" => $_GET["ref_id"], "obj_id" => $_GET["obj_id"], "cmd" => "showDownloadList", "cmdClass" => strtolower(get_class($this)));
     $tbl->setHeaderVars($cols, $header_params);
     $tbl->setColumnWidth(array("10%", "30%", "20%", "20%", "20%"));
     $tbl->disable("sort");
     // control
     $tbl->setOrderColumn($_GET["sort_by"]);
     $tbl->setOrderDirection($_GET["sort_order"]);
     $tbl->setLimit($_GET["limit"]);
     $tbl->setOffset($_GET["offset"]);
     $tbl->setMaxCount($this->maxcount);
     // ???
     //$this->tpl->setVariable("COLUMN_COUNTS", 5);
     // footer
     //$tbl->setFooter("tblfooter",$this->lng->txt("previous"),$this->lng->txt("next"));
     $tbl->disable("footer");
     $tbl->setMaxCount(count($export_files));
     $export_files = array_slice($export_files, $_GET["offset"], $_GET["limit"]);
     $tbl->render();
     if (count($export_files) > 0) {
         $i = 0;
         foreach ($export_files as $exp_file) {
             if (!$exp_file["size"] > 0) {
                 continue;
             }
             $this->tpl->setCurrentBlock("tbl_content");
             $this->tpl->setVariable("TXT_FILENAME", $exp_file["file"]);
             $css_row = ilUtil::switchColor($i++, "tblrow1", "tblrow2");
             $this->tpl->setVariable("CSS_ROW", $css_row);
             $this->tpl->setVariable("TXT_SIZE", $exp_file["size"]);
             $this->tpl->setVariable("TXT_FORMAT", strtoupper($exp_file["type"]));
             $this->tpl->setVariable("CHECKBOX_ID", $exp_file["type"] . ":" . $exp_file["file"]);
             $file_arr = explode("__", $exp_file["file"]);
             $this->tpl->setVariable("TXT_DATE", date("Y-m-d H:i:s", $file_arr[0]));
             $this->tpl->setVariable("TXT_DOWNLOAD", $this->lng->txt("download"));
             $this->ctrl->setParameter($this, "type", $exp_file["type"]);
             $this->tpl->setVariable("LINK_DOWNLOAD", $this->ctrl->getLinkTarget($this, "downloadExportFile"));
             $this->tpl->parseCurrentBlock();
         }
     } else {
         $this->tpl->setCurrentBlock("notfound");
         $this->tpl->setVariable("TXT_OBJECT_NOT_FOUND", $this->lng->txt("obj_not_found"));
         $this->tpl->setVariable("NUM_COLS", 5);
         $this->tpl->parseCurrentBlock();
     }
     $this->tpl->show();
 }
 public function executeCommand()
 {
     global $ilCtrl, $ilTabs, $ilErr, $ilAccess;
     //if($this->ctrl->getTargetScript() == 'link_resources.php')
     if ($_GET["baseClass"] == 'ilLinkResourceHandlerGUI') {
         $_GET['view_mode'] = isset($_GET['switch_mode']) ? $_GET['switch_mode'] : $_GET['view_mode'];
         $ilCtrl->saveParameter($this, 'view_mode');
         $this->__prepareOutput();
     }
     $this->lng->loadLanguageModule("webr");
     $next_class = $this->ctrl->getNextClass($this);
     $cmd = $this->ctrl->getCmd();
     switch ($next_class) {
         case "ilinfoscreengui":
             $this->infoScreenForward();
             // forwards command
             break;
         case 'ilmdeditorgui':
             if (!$ilAccess->checkAccess('write', '', $this->object->getRefId())) {
                 $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING);
             }
             $this->prepareOutput();
             $ilTabs->activateTab('id_meta_data');
             include_once 'Services/MetaData/classes/class.ilMDEditorGUI.php';
             $md_gui =& new ilMDEditorGUI($this->object->getId(), 0, $this->object->getType());
             $md_gui->addObserver($this->object, 'MDUpdateListener', 'General');
             $this->ctrl->forwardCommand($md_gui);
             break;
         case 'ilpermissiongui':
             $this->prepareOutput();
             $ilTabs->activateTab('id_permissions');
             include_once "Services/AccessControl/classes/class.ilPermissionGUI.php";
             $perm_gui =& new ilPermissionGUI($this);
             $ret =& $this->ctrl->forwardCommand($perm_gui);
             break;
         case 'ilobjectcopygui':
             $this->prepareOutput();
             include_once './Services/Object/classes/class.ilObjectCopyGUI.php';
             $cp = new ilObjectCopyGUI($this);
             $cp->setType('webr');
             $this->ctrl->forwardCommand($cp);
             break;
         case 'ilexportgui':
             $this->prepareOutput();
             $this->tabs_gui->setTabActive('export');
             include_once './Services/Export/classes/class.ilExportGUI.php';
             $exp = new ilExportGUI($this);
             $exp->addFormat('xml');
             $this->ctrl->forwardCommand($exp);
             break;
         case "ilcommonactiondispatchergui":
             include_once "Services/Object/classes/class.ilCommonActionDispatcherGUI.php";
             $gui = ilCommonActionDispatcherGUI::getInstanceFromAjaxCall();
             $this->ctrl->forwardCommand($gui);
             break;
         case "ilpropertyformgui":
             include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
             $this->initFormLink(self::LINK_MOD_EDIT);
             $this->ctrl->forwardCommand($this->form);
             break;
         case "ilinternallinkgui":
             $this->lng->loadLanguageModule("content");
             require_once "./Modules/LearningModule/classes/class.ilInternalLinkGUI.php";
             $link_gui = new ilInternalLinkGUI("RepositoryItem", 0);
             $link_gui->filterLinkType("PageObject");
             $link_gui->filterLinkType("GlossaryItem");
             $link_gui->filterLinkType("RepositoryItem");
             $link_gui->setFilterWhiteList(true);
             $link_gui->setMode("asynch");
             $ilCtrl->forwardCommand($link_gui);
             break;
         default:
             if (!$cmd) {
                 $this->ctrl->setCmd("view");
             }
             parent::executeCommand();
     }
     if (!$this->getCreationMode()) {
         // Fill meta header tags
         include_once 'Services/MetaData/classes/class.ilMDUtils.php';
         ilMDUtils::_fillHTMLMetaTags($this->object->getId(), $this->object->getId(), 'webr');
         $this->addHeaderAction();
     }
     return true;
 }
Пример #5
0
 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();
     }
 }
Пример #6
0
 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;
 }
Пример #7
0
 /**
  * show information screen
  */
 function infoScreen()
 {
     global $ilErr, $ilAccess, $ilUser, $ilSetting;
     $this->checkPermission('visible');
     // Fill meta header tags
     include_once 'Services/MetaData/classes/class.ilMDUtils.php';
     ilMDUtils::_fillHTMLMetaTags($this->object->getId(), $this->object->getId(), 'crs');
     $this->tabs_gui->setTabActive('info_short');
     include_once "./Services/InfoScreen/classes/class.ilInfoScreenGUI.php";
     include_once 'Modules/Course/classes/class.ilCourseFile.php';
     $files =& ilCourseFile::_readFilesByCourse($this->object->getId());
     $info = new ilInfoScreenGUI($this);
     $info->enablePrivateNotes();
     $info->enableFeedback();
     $info->enableNews();
     if ($ilAccess->checkAccess("write", "", $_GET["ref_id"])) {
         $info->enableNewsEditing();
     }
     if (strlen($this->object->getImportantInformation()) or strlen($this->object->getSyllabus()) or count($files)) {
         $info->addSection($this->lng->txt('crs_general_informations'));
     }
     if (strlen($this->object->getImportantInformation())) {
         $info->addProperty($this->lng->txt('crs_important_info'), "<strong>" . nl2br(ilUtil::makeClickable($this->object->getImportantInformation(), true) . "</strong>"));
     }
     if (strlen($this->object->getSyllabus())) {
         $info->addProperty($this->lng->txt('crs_syllabus'), nl2br(ilUtil::makeClickable($this->object->getSyllabus(), true)));
     }
     // files
     if (count($files)) {
         $tpl = new ilTemplate('tpl.event_info_file.html', true, true, 'Modules/Course');
         foreach ($files as $file) {
             $tpl->setCurrentBlock("files");
             $this->ctrl->setParameter($this, 'file_id', $file->getFileId());
             $tpl->setVariable("DOWN_LINK", $this->ctrl->getLinkTarget($this, 'sendfile'));
             $tpl->setVariable("DOWN_NAME", $file->getFileName());
             $tpl->setVariable("DOWN_INFO_TXT", $this->lng->txt('crs_file_size_info'));
             $tpl->setVariable("DOWN_SIZE", $file->getFileSize());
             $tpl->setVariable("TXT_BYTES", $this->lng->txt('bytes'));
             $tpl->parseCurrentBlock();
         }
         $info->addProperty($this->lng->txt('crs_file_download'), $tpl->get());
     }
     include_once 'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordGUI.php';
     $record_gui = new ilAdvancedMDRecordGUI(ilAdvancedMDRecordGUI::MODE_INFO, 'crs', $this->object->getId());
     $record_gui->setInfoObject($info);
     $record_gui->parse();
     // meta data
     $info->addMetaDataSections($this->object->getId(), 0, $this->object->getType());
     // contact
     if ($this->object->hasContactData()) {
         $info->addSection($this->lng->txt("crs_contact"));
     }
     if (strlen($this->object->getContactName())) {
         $info->addProperty($this->lng->txt("crs_contact_name"), $this->object->getContactName());
     }
     if (strlen($this->object->getContactResponsibility())) {
         $info->addProperty($this->lng->txt("crs_contact_responsibility"), $this->object->getContactResponsibility());
     }
     if (strlen($this->object->getContactPhone())) {
         $info->addProperty($this->lng->txt("crs_contact_phone"), $this->object->getContactPhone());
     }
     if ($this->object->getContactEmail()) {
         require_once 'Services/Mail/classes/class.ilMailFormCall.php';
         $emails = split(",", $this->object->getContactEmail());
         foreach ($emails as $email) {
             $email = trim($email);
             $etpl = new ilTemplate("tpl.crs_contact_email.html", true, true, 'Modules/Course');
             $etpl->setVariable("EMAIL_LINK", ilMailFormCall::getLinkTarget($info, 'showSummary', array(), array('type' => 'new', 'rcp_to' => $email, 'sig' => $this->createMailSignature())));
             $etpl->setVariable("CONTACT_EMAIL", $email);
             $mailString .= $etpl->get() . "<br />";
         }
         $info->addProperty($this->lng->txt("crs_contact_email"), $mailString);
     }
     if (strlen($this->object->getContactConsultation())) {
         $info->addProperty($this->lng->txt("crs_contact_consultation"), nl2br($this->object->getContactConsultation()));
     }
     //
     // access
     //
     // #10360
     $this->lng->loadLanguageModule("rep");
     $info->addSection($this->lng->txt("rep_activation_availability"));
     $info->showLDAPRoleGroupMappingInfo();
     // activation
     if ($this->object->getActivationUnlimitedStatus()) {
         $info->addProperty($this->lng->txt("rep_activation_access"), $this->lng->txt('crs_visibility_limitless'));
     } else {
         $info->addProperty($this->lng->txt('rep_activation_access'), ilDatePresentation::formatPeriod(new ilDateTime($this->object->getActivationStart(), IL_CAL_UNIX), new ilDateTime($this->object->getActivationEnd(), IL_CAL_UNIX)));
     }
     switch ($this->object->getSubscriptionLimitationType()) {
         case IL_CRS_SUBSCRIPTION_DEACTIVATED:
             $txt = $this->lng->txt("crs_info_reg_deactivated");
             break;
         default:
             switch ($this->object->getSubscriptionType()) {
                 case IL_CRS_SUBSCRIPTION_CONFIRMATION:
                     $txt = $this->lng->txt("crs_info_reg_confirmation");
                     break;
                 case IL_CRS_SUBSCRIPTION_DIRECT:
                     $txt = $this->lng->txt("crs_info_reg_direct");
                     break;
                 case IL_CRS_SUBSCRIPTION_PASSWORD:
                     $txt = $this->lng->txt("crs_info_reg_password");
                     break;
             }
     }
     // subscription
     $info->addProperty($this->lng->txt("crs_info_reg"), $txt);
     if ($this->object->getSubscriptionLimitationType() != IL_CRS_SUBSCRIPTION_DEACTIVATED) {
         if ($this->object->getSubscriptionUnlimitedStatus()) {
             $info->addProperty($this->lng->txt("crs_reg_until"), $this->lng->txt('crs_unlimited'));
         } elseif ($this->object->getSubscriptionStart() < time()) {
             $info->addProperty($this->lng->txt("crs_reg_until"), $this->lng->txt('crs_to') . ' ' . ilDatePresentation::formatDate(new ilDateTime($this->object->getSubscriptionEnd(), IL_CAL_UNIX)));
         } elseif ($this->object->getSubscriptionStart() > time()) {
             $info->addProperty($this->lng->txt("crs_reg_until"), $this->lng->txt('crs_from') . ' ' . ilDatePresentation::formatDate(new ilDateTime($this->object->getSubscriptionStart(), IL_CAL_UNIX)));
         }
         if ($this->object->isSubscriptionMembershipLimited()) {
             include_once './Services/Membership/classes/class.ilParticipants.php';
             $info->addProperty($this->lng->txt("mem_free_places"), max(0, $this->object->getSubscriptionMaxMembers() - ilParticipants::lookupNumberOfMembers($this->object->getRefId())));
         }
     }
     // archive
     if ($this->object->getViewMode() == IL_CRS_VIEW_ARCHIVE) {
         if ($this->object->getArchiveType() != IL_CRS_ARCHIVE_NONE) {
             $info->addProperty($this->lng->txt("crs_archive"), ilDatePresentation::formatPeriod(new ilDateTime($this->object->getArchiveStart(), IL_CAL_UNIX), new ilDateTime($this->object->getArchiveStart(), IL_CAL_UNIX)));
         }
     }
     // Confirmation
     include_once 'Services/PrivacySecurity/classes/class.ilPrivacySettings.php';
     $privacy = ilPrivacySettings::_getInstance();
     include_once 'Modules/Course/classes/Export/class.ilCourseDefinedFieldDefinition.php';
     if ($privacy->courseConfirmationRequired() or ilCourseDefinedFieldDefinition::_getFields($this->object->getId()) or $privacy->enabledCourseExport()) {
         include_once 'Services/PrivacySecurity/classes/class.ilExportFieldsInfo.php';
         $field_info = ilExportFieldsInfo::_getInstanceByType($this->object->getType());
         $this->lng->loadLanguageModule('ps');
         $info->addSection($this->lng->txt('crs_user_agreement_info'));
         $info->addProperty($this->lng->txt('ps_export_data'), $field_info->exportableFieldsToInfoString());
         if ($fields = ilCourseDefinedFieldDefinition::_fieldsToInfoString($this->object->getId())) {
             $info->addProperty($this->lng->txt('ps_crs_user_fields'), $fields);
         }
     }
     $info->enableLearningProgress(true);
     // forward the command
     $this->ctrl->forwardCommand($info);
 }