/**
  * Show delete confirmation
  */
 public function delete()
 {
     global $tpl, $ilSetting, $ilErr;
     $this->ctrl->setReturnByClass(get_class($this->getContainer()), '');
     $to_delete = array();
     if ((int) $_GET['item_ref_id']) {
         $to_delete = array((int) $_GET['item_ref_id']);
     }
     if (isset($_POST['id']) and is_array($_POST['id'])) {
         $to_delete = $_POST['id'];
     }
     if (!$to_delete) {
         $ilErr->raiseError($this->lng->txt('no_checkbox'), $ilErr->MESSAGE);
     }
     include_once './Services/Utilities/classes/class.ilConfirmationGUI.php';
     $confirm = new ilConfirmationGUI();
     $confirm->setFormAction($this->ctrl->getFormActionByClass(get_class($this->getContainer()), 'cancel'));
     $confirm->setHeaderText('');
     $confirm->setCancel($this->lng->txt('cancel'), 'cancelDelete');
     $confirm->setConfirm($this->lng->txt('delete'), 'performDelete');
     foreach ($to_delete as $delete) {
         $obj_id = ilObject::_lookupObjId($delete);
         $type = ilObject::_lookupType($obj_id);
         $confirm->addItem('id[]', $delete, call_user_func(array(ilObjectFactory::getClassByType($type), '_lookupTitle'), $obj_id), ilUtil::getTypeIconPath($type, $obj_id));
     }
     $msg = $this->lng->txt("info_delete_sure");
     if (!$ilSetting->get('enable_trash')) {
         $msg .= "<br/>" . $this->lng->txt("info_delete_warning_no_trash");
     }
     ilUtil::sendQuestion($msg);
     $tpl->setContent($confirm->getHTML());
 }
 public function fillRow($set)
 {
     include_once './Services/Link/classes/class.ilLink.php';
     $this->tpl->setVariable('OBJ_LINK', ilLink::_getLink($set['ref_id'], $set['type']));
     $this->tpl->setVariable('OBJ_LINKED_TITLE', $set['title']);
     $this->tpl->setVariable('TYPE_IMG', ilUtil::getTypeIconPath($set['type'], $set['obj_id']));
     $this->tpl->setVariable('TYPE_STR', $this->lng->txt('obj_' . $set['type']));
 }
 public function fillRow($a_set)
 {
     if ($a_set["last_admin"]) {
         $this->tpl->setCurrentBlock("warning_bl");
         $this->tpl->setVariable("TXT_WARNING", $this->lng->txt('pd_min_one_admin'));
         $this->tpl->parseCurrentBlock();
         $this->tpl->setVariable("CHK_DISABLED", ' disabled="disabled"');
     }
     $this->tpl->setVariable("VAL_REF_ID", $a_set["ref_id"]);
     $this->tpl->setVariable("TXT_TITLE", $a_set["title"]);
     $this->tpl->setVariable("TXT_DESCRIPTION", $a_set["desc"]);
     $this->tpl->setVariable("URL_ICON", ilUtil::getTypeIconPath($a_set["type"], $a_set["obj_id"]));
     $this->tpl->setVariable("TXT_TYPE", $this->lng->txt("icon") . " " . $a_set["type_caption"]);
     $this->tpl->setVariable("TXT_CONTAINER", $a_set["container"]);
 }
 /**
  * Import data from DB
  */
 protected function importData()
 {
     include_once "./Services/User/classes/class.ilUserUtil.php";
     $data = array();
     foreach ($this->handler->getPermissions($this->node_id) as $obj_id) {
         switch ($obj_id) {
             case ilWorkspaceAccessGUI::PERMISSION_REGISTERED:
                 $title = $icon_alt = $this->lng->txt("wsp_set_permission_registered");
                 $type = "registered";
                 $icon = "";
                 break;
             case ilWorkspaceAccessGUI::PERMISSION_ALL_PASSWORD:
                 $title = $icon_alt = $this->lng->txt("wsp_set_permission_all_password");
                 $type = "all_password";
                 $icon = "";
                 break;
             case ilWorkspaceAccessGUI::PERMISSION_ALL:
                 $title = $icon_alt = $this->lng->txt("wsp_set_permission_all");
                 $type = "all_password";
                 $icon = "";
                 break;
             default:
                 $type = ilObject::_lookupType($obj_id);
                 $icon = ilUtil::getTypeIconPath($type, null, "tiny");
                 $icon_alt = $this->lng->txt("obj_" . $type);
                 if ($type != "usr") {
                     $title = ilObject::_lookupTitle($obj_id);
                 } else {
                     $title = ilUserUtil::getNamePresentation($obj_id, true, true);
                 }
                 break;
         }
         $data[] = array("id" => $obj_id, "title" => $title, "type" => $type, "icon" => $icon, "icon_alt" => $icon_alt);
     }
     $this->setData($data);
 }
 protected function initSettingsForm($a_mode = 'create')
 {
     include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
     $this->form_gui = new ilPropertyFormGUI();
     $this->form_gui->setTableWidth('600');
     if ($a_mode == 'create') {
         $this->form_gui->setTitle($this->lng->txt('icla_add'));
     } else {
         $this->form_gui->setTitle($this->lng->txt('icla_edit'));
     }
     $this->form_gui->setTitleIcon(ilUtil::getTypeIconPath('icla', 0));
     // Title
     $text_input = new ilTextInputGUI($this->lng->txt('title'), 'title');
     $text_input->setRequired(true);
     $this->form_gui->addItem($text_input);
     // Description
     $text_area = new ilTextAreaInputGUI($this->lng->txt('desc'), 'desc');
     $this->form_gui->addItem($text_area);
     // Docentselection
     $sel = new ilSelectInputGUI($this->lng->txt(ILINC_MEMBER_DOCENT), 'instructoruserid');
     $docentlist = $this->object->getDocentList();
     $docent_options = array();
     $docent_options[0] = $this->lng->txt('please_choose');
     foreach ((array) $docentlist as $id => $data) {
         $docent_options[$id] = $data['fullname'];
     }
     $sel->setOptions($docent_options);
     $this->form_gui->addItem($sel);
     // Open
     $rg = new ilRadioGroupInputGUI($this->lng->txt('access'), 'alwaysopen');
     $rg->setValue(0);
     $ro = new ilRadioOption($this->lng->txt('ilinc_classroom_open'), 1);
     $rg->addOption($ro);
     $ro = new ilRadioOption($this->lng->txt('ilinc_classroom_closed'), 0);
     $rg->addOption($ro);
     $this->form_gui->addItem($rg);
     // Display akclassvalues
     if ($this->ilias->getSetting('ilinc_akclassvalues_active')) {
         $text_input = new ilTextInputGUI($this->lng->txt('akclassvalue1'), 'akclassvalue1');
         $text_input->setDisabled(true);
         $this->form_gui->addItem($text_input);
         $text_input = new ilTextInputGUI($this->lng->txt('akclassvalue2'), 'akclassvalue2');
         $text_input->setDisabled(true);
         $this->form_gui->addItem($text_input);
     }
     // save and cancel commands
     if ($a_mode == 'create') {
         $this->ctrl->setParameter($this, 'mode', 'create');
         $this->ctrl->setParameter($this, 'new_type', 'icla');
         $this->form_gui->addCommandButton('save', $this->lng->txt('icla_add'));
         $this->form_gui->addCommandButton('cancel', $this->lng->txt('cancel'));
         $this->form_gui->setFormAction($this->ctrl->getFormAction($this, 'save'));
     } else {
         $this->ctrl->setParameter($this, 'class_id', $this->object->id);
         $this->form_gui->addCommandButton('updateClassroom', $this->lng->txt('save'));
         $this->form_gui->addCommandButton('cancel', $this->lng->txt('cancel'));
         $this->form_gui->setFormAction($this->ctrl->getFormAction($this, 'updateClassroom'));
     }
 }
 /**
  * Fill row
  *
  * @access public
  * @param array row data
  * 
  */
 public function fillRow($a_set)
 {
     global $tree;
     include_once './Services/Link/classes/class.ilLink.php';
     $this->tpl->setVariable('VAL_TITLE', $a_set['title']);
     #$this->tpl->setVariable('VAL_LINK',ilLink::_getLink($a_set['ref_id'],'rcrs'));
     $this->tpl->setVariable('VAL_DESC', $a_set['desc']);
     $this->tpl->setVariable('VAL_REMOTE', $a_set['from']);
     $this->tpl->setVariable('VAL_REMOTE_INFO', $a_set['from_info']);
     $this->tpl->setVariable('TXT_EMAIL', $this->lng->txt('ecs_email'));
     $this->tpl->setVariable('TXT_DNS', $this->lng->txt('ecs_dns'));
     $this->tpl->setVariable('TXT_ABR', $this->lng->txt('ecs_abr'));
     $this->tpl->setVariable('VAL_LAST_UPDATE', ilDatePresentation::formatDate(new ilDateTime($a_set['last_update'], IL_CAL_DATETIME)));
     // Links
     foreach (ilObject::_getAllReferences($a_set['obj_id']) as $ref_id) {
         $parent = $tree->getParentId($ref_id);
         $p_obj_id = ilObject::_lookupObjId($parent);
         $p_title = ilObject::_lookupTitle($p_obj_id);
         $p_type = ilObject::_lookupType($p_obj_id);
         $this->tpl->setCurrentBlock('link');
         $this->tpl->setVariable('LINK_IMG', ilUtil::getTypeIconPath($p_type, $p_obj_id, 'tiny'));
         $this->tpl->setVariable('LINK_CONTAINER', $p_title);
         $this->tpl->setVariable('LINK_LINK', ilLink::_getLink($parent, $p_type));
         $this->tpl->parseCurrentBlock();
     }
     $this->tpl->setVariable('TXT_TERM', $this->lng->txt('ecs_field_term'));
     $this->tpl->setVariable('TXT_CRS_TYPE', $this->lng->txt('ecs_field_courseType'));
     $this->tpl->setVariable('TXT_CRS_ID', $this->lng->txt('ecs_field_courseID'));
     $this->tpl->setVariable('TXT_CREDITS', $this->lng->txt('ecs_field_credits'));
     $this->tpl->setVariable('TXT_ROOM', $this->lng->txt('ecs_field_room'));
     $this->tpl->setVariable('TXT_CYCLE', $this->lng->txt('ecs_field_cycle'));
     $this->tpl->setVariable('TXT_SWS', $this->lng->txt('ecs_field_semester_hours'));
     $this->tpl->setVariable('TXT_START', $this->lng->txt('ecs_field_begin'));
     $this->tpl->setVariable('TXT_END', $this->lng->txt('ecs_field_end'));
     $this->tpl->setVariable('TXT_LECTURER', $this->lng->txt('ecs_field_lecturer'));
     include_once './Services/WebServices/ECS/classes/class.ilECSDataMappingSettings.php';
     $settings = ilECSDataMappingSettings::getInstanceByServerId($a_set['sid']);
     include_once './Services/AdvancedMetaData/classes/class.ilAdvancedMDValues.php';
     $values = ilAdvancedMDValues::_getValuesByObjId($a_set['obj_id']);
     if ($field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS, 'lecturer')) {
         $this->tpl->setVariable('VAL_LECTURER', isset($values[$field]) ? $values[$field] : '--');
     }
     if ($field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS, 'term')) {
         $this->tpl->setVariable('VAL_TERM', isset($values[$field]) ? $values[$field] : '--');
     }
     if ($field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS, 'courseID')) {
         $this->tpl->setVariable('VAL_CRS_ID', isset($values[$field]) ? $values[$field] : '--');
     }
     if ($field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS, 'courseType')) {
         $this->tpl->setVariable('VAL_CRS_TYPE', isset($values[$field]) ? $values[$field] : '--');
     }
     if ($field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS, 'credits')) {
         $this->tpl->setVariable('VAL_CREDITS', isset($values[$field]) ? $values[$field] : '--');
     }
     if ($field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS, 'semester_hours')) {
         $this->tpl->setVariable('VAL_SWS', isset($values[$field]) ? $values[$field] : '--');
     }
     if ($field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS, 'room')) {
         $this->tpl->setVariable('VAL_ROOM', isset($values[$field]) ? $values[$field] : '--');
     }
     if ($field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS, 'cycle')) {
         $this->tpl->setVariable('VAL_CYCLE', isset($values[$field]) ? $values[$field] : '--');
     }
     if ($field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS, 'begin')) {
         $this->tpl->setVariable('VAL_START', isset($values[$field]) ? ilDatePresentation::formatDate(new ilDateTime($values[$field], IL_CAL_UNIX)) : '--');
     }
     if ($field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS, 'end')) {
         $this->tpl->setVariable('VAL_END', isset($values[$field]) ? ilDatePresentation::formatDate(new ilDateTime($values[$field], IL_CAL_UNIX)) : '--');
     }
 }
 /**
  * Fill table row
  *
  * @param array $a_set data array
  */
 protected function fillRow($node)
 {
     global $ilCtrl, $lng;
     $this->tpl->setVariable("LASTNAME", $node["lastname"]);
     $this->tpl->setVariable("FIRSTNAME", $node["firstname"]);
     $this->tpl->setVariable("LOGIN", $node["login"]);
     $this->tpl->setVariable("TITLE", $node["title"]);
     if (!$this->portfolio_mode) {
         $this->tpl->setVariable("TYPE", $node["obj_type"]);
         $this->tpl->setVariable("ICON_ALT", $node["obj_type"]);
         $this->tpl->setVariable("ICON", ilObject::_getIcon("", "tiny", $node["type"]));
         $url = $this->handler->getGotoLink($node["wsp_id"], $node["obj_id"]);
     } else {
         $url = ilLink::_getStaticLink($node["obj_id"], "prtf", true);
     }
     $this->tpl->setVariable("URL_TITLE", $url);
     $this->tpl->setVariable("ACL_DATE", ilDatePresentation::formatDate(new ilDateTime($node["acl_date"], IL_CAL_UNIX)));
     asort($node["acl_type"]);
     foreach ($node["acl_type"] as $obj_id) {
         // see ilWorkspaceAccessTableGUI
         switch ($obj_id) {
             case ilWorkspaceAccessGUI::PERMISSION_REGISTERED:
                 $title = $icon_alt = $this->lng->txt("wsp_set_permission_registered");
                 $type = "registered";
                 $icon = "";
                 break;
             case ilWorkspaceAccessGUI::PERMISSION_ALL_PASSWORD:
                 $title = $icon_alt = $this->lng->txt("wsp_set_permission_all_password");
                 $type = "all_password";
                 $icon = "";
                 break;
             case ilWorkspaceAccessGUI::PERMISSION_ALL:
                 $title = $icon_alt = $this->lng->txt("wsp_set_permission_all");
                 $type = "all_password";
                 $icon = "";
                 break;
             default:
                 $type = ilObject::_lookupType($obj_id);
                 $icon = ilUtil::getTypeIconPath($type, null, "tiny");
                 $icon_alt = $this->lng->txt("obj_" . $type);
                 if ($type != "usr") {
                     $title = ilObject::_lookupTitle($obj_id);
                 } else {
                     $title = ilUserUtil::getNamePresentation($obj_id, true, true);
                 }
                 break;
         }
         if ($icon) {
             $this->tpl->setCurrentBlock("acl_type_icon_bl");
             $this->tpl->setVariable("ACL_ICON", $icon);
             $this->tpl->setVariable("ACL_ICON_ALT", $icon_alt);
             $this->tpl->parseCurrentBlock();
         }
         $this->tpl->setCurrentBlock("acl_type_bl");
         $this->tpl->setVariable("ACL_TYPE", $title);
         $this->tpl->parseCurrentBlock();
     }
     if (!$this->portfolio_mode) {
         // files may be copied to own workspace
         if ($node["type"] == "file") {
             $ilCtrl->setParameter($this->parent_obj, "wsp_id", $this->parent_node_id);
             $ilCtrl->setParameter($this->parent_obj, "item_ref_id", $node["wsp_id"]);
             $url = $ilCtrl->getLinkTarget($this->parent_obj, "copyshared");
             $this->tpl->setCurrentBlock("action_bl");
             $this->tpl->setVariable("URL_ACTION", $url);
             $this->tpl->setVariable("ACTION", $lng->txt("copy"));
             $this->tpl->parseCurrentBlock();
         }
     }
 }
 /**
  * confirmation screen for export file deletion
  */
 function confirmDeleteExportFileObject()
 {
     if (!isset($_POST["file"])) {
         $this->ilias->raiseError($this->lng->txt("no_checkbox"), $this->ilias->error_obj->MESSAGE);
     }
     // display confirmation message
     include_once "./Services/Utilities/classes/class.ilConfirmationGUI.php";
     $cgui = new ilConfirmationGUI();
     $cgui->setFormAction($this->ctrl->getFormAction($this));
     $cgui->setHeaderText($this->lng->txt("info_delete_sure"));
     $cgui->setCancel($this->lng->txt("cancel"), "cancelDeleteExportFile");
     $cgui->setConfirm($this->lng->txt("confirm"), "deleteExportFile");
     // BEGIN TABLE DATA
     foreach ($_POST["file"] as $file) {
         $cgui->addItem("file[]", $file, $file, ilUtil::getTypeIconPath("usrf"), $this->lng->txt("obj_usrf"));
     }
     $this->tpl->setContent($cgui->getHTML());
 }
 function __showOtherResources()
 {
     global $ilias, $rbacsystem, $ilObjDataCache, $objDefinition;
     if (!count($ors = $this->__getOtherResources())) {
         return false;
     }
     $this->tpl->addBlockfile('RESOURCES_BLOCK', 'resources_block', 'tpl.crs_objectives_view_or_table.html', 'Modules/Course');
     $this->tpl->setVariable("TBL_TITLE_OR", $this->lng->txt('crs_other_resources'));
     $this->__showHideLinks('or');
     if (isset($_SESSION['crs_hide_or'])) {
         return true;
     }
     $this->tpl->setCurrentBlock("tbl_header_columns_or");
     $this->tpl->setVariable("TBL_HEADER_WIDTH_OR", "5%");
     $this->tpl->setVariable("TBL_HEADER_NAME_OR", $this->lng->txt('type'));
     $this->tpl->parseCurrentBlock();
     $this->tpl->setCurrentBlock("tbl_header_columns_or");
     $this->tpl->setVariable("TBL_HEADER_WIDTH_OR", "75%");
     $this->tpl->setVariable("TBL_HEADER_NAME_OR", $this->lng->txt('description'));
     $this->tpl->parseCurrentBlock();
     $this->tpl->setCurrentBlock("tbl_header_columns_or");
     $this->tpl->setVariable("TBL_HEADER_WIDTH_OR", "20%");
     $this->tpl->setVariable("TBL_HEADER_NAME_OR", '');
     $this->tpl->parseCurrentBlock();
     $counter = 1;
     foreach ($ors as $or_id) {
         $obj_id = $ilObjDataCache->lookupObjId($or_id);
         $obj_type = $ilObjDataCache->lookupType($obj_id);
         // do not show side block items
         if ($objDefinition->isSideBlock($obj_type)) {
             continue;
         }
         $conditions_ok = ilConditionHandler::_checkAllConditionsOfTarget($or_id, $obj_id);
         $obj_link = ilRepositoryExplorer::buildLinkTarget($or_id, $obj_type);
         $obj_frame = ilRepositoryExplorer::buildFrameTarget($obj_type, $or_id, $obj_id);
         $obj_frame = $obj_frame ? $obj_frame : '';
         if (ilRepositoryExplorer::isClickable($obj_type, $or_id, $obj_id)) {
             $this->tpl->setCurrentBlock("or_read");
             $this->tpl->setVariable("READ_TITLE_OR", $ilObjDataCache->lookupTitle($obj_id));
             $this->tpl->setVariable("READ_TARGET_OR", $obj_frame);
             $this->tpl->setVariable("READ_LINK_OR", $obj_link);
             $this->tpl->parseCurrentBlock();
         } else {
             $this->tpl->setCurrentBlock("or_visible");
             $this->tpl->setVariable("VISIBLE_LINK_OR", $ilObjDataCache->lookupTitle($obj_id));
             $this->tpl->parseCurrentBlock();
         }
         // add to desktop link
         if (!$ilias->account->isDesktopItem($or_id, $obj_type) and $this->course_obj->getAboStatus() == $this->course_obj->ABO_ENABLED) {
             if ($rbacsystem->checkAccess('read', $or_id)) {
                 $this->tpl->setCurrentBlock("or_desklink");
                 $this->ctrl->setParameterByClass(get_class($this->container_gui), 'item_ref_id', $or_id);
                 $this->ctrl->setParameterByClass(get_class($this->container_gui), 'item_id', $or_id);
                 $this->ctrl->setParameterByClass(get_class($this->container_gui), 'type', $obj_type);
                 $this->tpl->setVariable("DESK_LINK_OR", $this->ctrl->getLinkTarget($this->container_gui, 'addToDesk'));
                 $this->tpl->setVariable("TXT_DESK_OR", $this->lng->txt("to_desktop"));
                 $this->tpl->parseCurrentBlock();
             }
         }
         $this->tpl->setCurrentBlock("or_row");
         $this->tpl->setVariable("OBJ_TITLE_OR", $ilObjDataCache->lookupTitle($obj_id));
         $this->tpl->setVariable('IMG_TYPE_OR', ilUtil::getTypeIconPath($obj_type, $obj_id, 'small'));
         $this->tpl->setVariable("TXT_IMG_OR", $this->lng->txt('obj_' . $obj_type));
         $this->tpl->setVariable("OBJ_CLASS_CENTER_OR", 'option_value_center');
         $this->tpl->setVariable("OBJ_CLASS_OR", 'option_value');
         $this->tpl->parseCurrentBlock();
         ++$counter;
     }
 }
 protected function renderMyCourses($a_user_id, $a_default_sorting)
 {
     global $ilAccess, $ilUser, $ilCtrl;
     if ($this->getOutputMode() == "preview") {
         return $this->renderMyCoursesTeaser($a_user_id, $a_default_sorting);
     }
     if (!$this->isMyCoursesActive()) {
         return;
     }
     $img_path = null;
     if ($this->getOutputMode() == "offline") {
         $this->export_material["images"][] = "./templates/default/images/icon_crs.svg";
         $this->export_material["images"][] = "./templates/default/images/icon_lobj.svg";
         $this->export_material["images"][] = "./templates/default/images/scorm/complete.svg";
         $this->export_material["images"][] = "./templates/default/images/scorm/not_attempted.svg";
         $this->export_material["images"][] = "./templates/default/images/scorm/failed.svg";
         $this->export_material["images"][] = "./templates/default/images/scorm/incomplete.svg";
         $img_path = "images/";
     }
     $user_id = $this->getPageContentUserId($a_user_id);
     // sorting pref
     if ($_POST["srt"] && in_array($_POST["srt"], array("alpha", "loc"))) {
         $ilUser->writePref("prtf_mcrs_sort", $_POST["srt"]);
     }
     $sorting = $ilUser->getPref("prtf_mcrs_sort");
     if (!$sorting) {
         $sorting = $a_default_sorting;
     }
     $data = $this->getCoursesOfUser($user_id, $sorting == "loc");
     if (sizeof($data)) {
         if ($sorting != "loc") {
             $data = ilUtil::sortArray($data, "title", "ASC");
         } else {
             $data = ilUtil::sortArray($data, "path_sort", "ASC");
         }
         $tpl = new ilTemplate("tpl.pc_my_courses.html", true, true, "Modules/Portfolio");
         $tpl->setVariable("TITLE", $this->lng->txt("prtf_page_element_my_courses_title"));
         $tpl->setVariable("INFO", $this->lng->txt("prtf_page_element_my_courses_info"));
         // #14464
         include_once "./Services/Tracking/classes/class.ilLearningProgressBaseGUI.php";
         $this->lng->loadLanguageModule("trac");
         $this->lng->loadLanguageModule("crs");
         include_once "./Services/Container/classes/class.ilContainerObjectiveGUI.php";
         include_once "./Services/Link/classes/class.ilLink.php";
         // sorting
         $options = array("alpha" => $this->lng->txt("cont_mycourses_sortorder_alphabetical"), "loc" => $this->lng->txt("cont_mycourses_sortorder_location"));
         $tpl->setVariable("SORT_SELECT", ilUtil::formSelect($sorting, "srt", $options, false, true, 0, "", array("onchange" => "form.submit()")));
         $tpl->setVariable("SORT_FORM", $ilCtrl->getFormActionByClass("ilobjportfoliogui", "preview"));
         $old_path = null;
         foreach ($data as $course) {
             if ($sorting == "loc") {
                 if ($course["path"] != $old_path) {
                     $tpl->setCurrentBlock("path_bl");
                     $tpl->setVariable("PATH", $course["path"]);
                     $tpl->parseCurrentBlock();
                     $old_path = $course["path"];
                 }
             }
             if (isset($course["lp_status"])) {
                 $lp_icon = ilLearningProgressBaseGUI::_getImagePathForStatus($course["lp_status"]);
                 $lp_alt = ilLearningProgressBaseGUI::_getStatusText($course["lp_status"]);
                 if ($img_path) {
                     $lp_icon = $img_path . basename($lp_icon);
                 }
                 $tpl->setCurrentBlock("lp_bl");
                 $tpl->setVariable("LP_ICON_URL", $lp_icon);
                 $tpl->setVariable("LP_ICON_ALT", $lp_alt);
                 $tpl->parseCurrentBlock();
             }
             $do_links = false;
             if ($ilUser->getId() != ANONYMOUS_USER_ID) {
                 $do_links = $ilAccess->checkAccessOfUser($ilUser->getId(), "read", "", $course["ref_id"], "crs") || $ilAccess->checkAccessOfUser($ilUser->getId(), "visible", "", $course["ref_id"], "crs") && $ilAccess->checkAccessOfUser($ilUser->getId(), "join", "", $course["ref_id"], "crs");
             }
             if (isset($course["objectives"])) {
                 include_once './Modules/Course/classes/Objectives/class.ilLOSettings.php';
                 $loc_settings = ilLOSettings::getInstanceByObjId($course["obj_id"]);
                 $has_initial_test = (bool) $loc_settings->getInitialTest();
                 foreach ($course["objectives"] as $objtv) {
                     if ($do_links) {
                         $params = array("oobj" => $objtv["id"]);
                         $url = ilLink::_getLink($course["ref_id"], "crs", $params);
                         // #15510
                         $url .= "#objtv_acc_" . $objtv["id"];
                         $tpl->setCurrentBlock("objective_link_bl");
                         if (trim($objtv["desc"])) {
                             $desc = nl2br($objtv["desc"]);
                             $tt_id = "objtvtt_" . $objtv["id"] . "_" . (int) self::$initialized;
                             include_once "Services/UIComponent/Tooltip/classes/class.ilTooltipGUI.php";
                             ilToolTipGUI::addTooltip($tt_id, $desc, "", "bottom center", "top center", false);
                             $tpl->setVariable("OBJECTIVE_LINK_ID", $tt_id);
                         }
                         $tpl->setVariable("OBJECTIVE_LINK_URL", $url);
                         $tpl->setVariable("OBJECTIVE_LINK_TITLE", $objtv["title"]);
                         $tpl->parseCurrentBlock();
                     } else {
                         $tpl->setCurrentBlock("objective_nolink_bl");
                         $tpl->setVariable("OBJECTIVE_NOLINK_TITLE", $objtv["title"]);
                         $tpl->parseCurrentBlock();
                     }
                     $objtv_icon = ilUtil::getTypeIconPath("lobj", $objtv["id"]);
                     if ($img_path) {
                         $objtv_icon = $img_path . basename($objtv_icon);
                     }
                     $tpl->setCurrentBlock("objective_bl");
                     $tpl->setVariable("OBJTV_ICON_URL", $objtv_icon);
                     $tpl->setVariable("OBJTV_ICON_ALT", $this->lng->txt("crs_objectives"));
                     if ($objtv["type"]) {
                         $tpl->setVariable("LP_OBJTV_PROGRESS", ilContainerObjectiveGUI::buildObjectiveProgressBar($has_initial_test, $objtv["id"], $objtv, true, (int) self::$initialized));
                     }
                     $tpl->parseCurrentBlock();
                 }
                 $tpl->setCurrentBlock("objectives_bl");
                 $tpl->setVariable("OBJTV_LIST_CRS_ID", $course["obj_id"]);
                 $tpl->parseCurrentBlock();
             }
             // always check against current user
             if ($do_links) {
                 $tpl->setCurrentBlock("course_link_bl");
                 $tpl->setVariable("COURSE_LINK_TITLE", $course["title"]);
                 $tpl->setVariable("COURSE_LINK_URL", ilLink::_getLink($course["ref_id"]));
                 $tpl->parseCurrentBlock();
             } else {
                 $tpl->setCurrentBlock("course_nolink_bl");
                 $tpl->setVariable("COURSE_NOLINK_TITLE", $course["title"]);
                 $tpl->parseCurrentBlock();
             }
             $crs_icon = ilUtil::getTypeIconPath("crs", $course["obj_id"]);
             if ($img_path) {
                 $crs_icon = $img_path . basename($crs_icon);
             }
             $tpl->setCurrentBlock("course_bl");
             if (isset($course["objectives"])) {
                 $tpl->setVariable("TOGGLE_CLASS", "ilPCMyCoursesToggle");
             } else {
                 $tpl->setVariable("NO_TOGGLE", ' style="visibility:hidden;"');
             }
             $tpl->setVariable("CRS_ICON_URL", $crs_icon);
             $tpl->setVariable("CRS_ICON_ALT", $this->lng->txt("obj_crs"));
             $tpl->parseCurrentBlock();
         }
         // #15508
         if (!self::$initialized) {
             $GLOBALS["tpl"]->addJavaScript("Modules/Portfolio/js/ilPortfolio.js");
             $GLOBALS["tpl"]->addOnLoadCode("ilPortfolio.init()");
         }
         self::$initialized++;
         return $tpl->get();
     }
 }
 /**
  * Show membership limitations
  *
  * @access protected
  * @return
  */
 protected function fillMembershipLimitation()
 {
     global $ilAccess, $ilCtrl;
     include_once 'Modules/Course/classes/class.ilObjCourseGrouping.php';
     if (!($items = ilObjCourseGrouping::_getGroupingItems($this->container))) {
         return true;
     }
     $mem = new ilCustomInputGUI($this->lng->txt('groupings'));
     $tpl = new ilTemplate('tpl.membership_limitation_form.html', true, true, 'Services/Membership');
     $tpl->setVariable('LIMIT_INTRO', $this->lng->txt($this->type . '_grp_info_reg'));
     foreach ($items as $ref_id) {
         $obj_id = ilObject::_lookupObjId($ref_id);
         $type = ilObject::_lookupType($obj_id);
         $title = ilObject::_lookupTitle($obj_id);
         if ($ilAccess->checkAccess('visible', '', $ref_id, $type)) {
             include_once './Services/Link/classes/class.ilLink.php';
             $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $ref_id);
             $tpl->setVariable('LINK_ITEM', $ilCtrl->getLinkTargetByClass("ilrepositorygui", ""));
             $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $_GET["ref_id"]);
             $tpl->setVariable('ITEM_LINKED_TITLE', $title);
         } else {
             $tpl->setVariable('ITEM_TITLE');
         }
         $tpl->setCurrentBlock('items');
         $tpl->setVariable('TYPE_ICON', ilUtil::getTypeIconPath($type, $obj_id, 'tiny'));
         $tpl->setVariable('ALT_ICON', $this->lng->txt('obj_' . $type));
         $tpl->parseCurrentBlock();
     }
     $mem->setHtml($tpl->get());
     if (!ilObjCourseGrouping::_checkGroupingDependencies($this->container)) {
         $mem->setAlert($this->container->getMessage());
         $this->enableRegistration(false);
     }
     $this->form->addItem($mem);
 }
 function __renderItem($item, $level)
 {
     global $ilUser, $ilAccess;
     include_once 'Modules/Course/classes/Timings/class.ilTimingPlaned.php';
     include_once './Services/Link/classes/class.ilLink.php';
     include_once './Services/MetaData/classes/class.ilMDEducational.php';
     if (!$ilAccess->checkAccess('visible', '', $item['ref_id'])) {
         return false;
     }
     $this->lng->loadLanguageModule('meta');
     $usr_planed = new ilTimingPlaned($item['ref_id'], $ilUser->getId());
     for ($i = 0; $i < $level; $i++) {
         $this->tpl->touchBlock('start_indent');
         $this->tpl->touchBlock('end_indent');
     }
     if (strlen($item['description'])) {
         $this->tpl->setCurrentBlock("item_description");
         $this->tpl->setVariable("DESC", $item['description']);
         $this->tpl->parseCurrentBlock();
     }
     if ($tlt = ilMDEducational::_getTypicalLearningTimeSeconds($item['obj_id'])) {
         $this->tpl->setCurrentBlock("tlt");
         $this->tpl->setVariable("TXT_TLT", $this->lng->txt('meta_typical_learning_time'));
         $this->tpl->setVariable("TLT_VAL", ilFormat::_secondsToString($tlt));
         $this->tpl->parseCurrentBlock();
     }
     if ($ilAccess->checkAccess('read', '', $item['ref_id'])) {
         $this->tpl->setCurrentBlock("title_as_link");
         $this->tpl->setVariable("TITLE_LINK", ilLink::_getLink($item['ref_id'], $item['type']));
         $this->tpl->setVariable("TITLE_NAME", $item['title']);
         $this->tpl->parseCurrentBlock();
     } else {
         $this->tpl->setCurrentBlock("title_plain");
         $this->tpl->setVariable("TITLE", $item['title']);
         $this->tpl->parseCurrentBlock();
     }
     $this->tpl->setCurrentBlock("container_standard_row");
     if (isset($this->invalid["{$item['ref_id']}"])) {
         $this->tpl->setVariable("ROWCLASS", 'tblrowmarked');
     } else {
         $this->tpl->setVariable("ROWCLASS", ilUtil::switchColor($this->counter++, 'tblrow1', 'tblrow2'));
     }
     #$this->tpl->setVariable("TYPE_IMG",ilUtil::getImagePath('icon_'.$item['type'].'.png'));
     $this->tpl->setVariable('TYPE_IMG', ilUtil::getTypeIconPath($item['type'], $item['obj_id'], 'small'));
     $this->tpl->setVariable("TYPE_ALT_IMG", $this->lng->txt('obj_' . $item['type']));
     if ($item['timing_type'] == ilObjectActivation::TIMINGS_PRESETTING) {
         $this->tpl->setVariable('SUG_START', ilDatePresentation::formatDate(new ilDate($item['suggestion_start'], IL_CAL_UNIX)));
         $this->tpl->setVariable('SUG_END', ilDatePresentation::formatDate(new ilDate($item['suggestion_end'], IL_CAL_UNIX)));
     }
     if ($item['changeable']) {
         $item_prefix = "item[" . $item['ref_id'] . ']';
         if (is_array($_POST['item']["{$item['ref_id']}"]['own_start'])) {
             #echo "Start post<br>";
             $start = $this->__toUnix($_POST['item']["{$item['ref_id']}"]['own_start']);
         } elseif ($usr_planed->getPlanedStartingTime()) {
             #echo "Own start<br>";
             $start = $usr_planed->getPlanedStartingTime();
         } else {
             #echo "Empfehlung start<br>";
             $start = $item['suggestion_start'];
         }
         $date = $this->__prepareDateSelect($start);
         $this->tpl->setVariable("OWN_START", ilUtil::makeDateSelect($item_prefix . "[own_start]", $date['y'], $date['m'], $date['d'], date('Y', time()), false));
         if ($usr_planed->getPlanedEndingTime()) {
             #echo "Own End<br>";
             $end = $usr_planed->getPlanedEndingTime();
         } else {
             #echo "Empfehlung end<br>";
             $end = $item['suggestion_end'];
         }
         $this->tpl->setVariable('OWN_END', ilDatePresentation::formatDate(new ilDate($end, IL_CAL_UNIX)));
         $this->tpl->setVariable("NAME_DURATION", $item_prefix . "[duration]");
         // Duration
         if (isset($_POST['item']["{$item['ref_id']}"]['duration'])) {
             $this->tpl->setVariable("VAL_DURATION", $_POST['item']["{$item['ref_id']}"]['duration']);
         } else {
             $this->tpl->setVariable("VAL_DURATION", intval(($end - $start) / (60 * 60 * 24)));
         }
         $this->tpl->setVariable('LIM_START', ilDatePresentation::formatDate(new ilDate($item['earliest_start'], IL_CAL_UNIX)));
         $this->tpl->setVariable('LIM_END', ilDatePresentation::formatDate(new ilDate($item['latest_end'], IL_CAL_UNIX)));
     }
     $this->tpl->parseCurrentBlock();
     if (!$_SESSION['crs_timings_user_hidden']) {
         return true;
     }
     foreach (ilObjectActivation::getTimingsItems($item['ref_id']) as $item_data) {
         $this->__renderItem($item_data, $level + 1);
     }
 }
 /**
  * fill row
  *
  * @access protected
  * @param array row data
  * @return
  */
 protected function fillRow($a_set)
 {
     foreach ($a_set['sub'] as $sub_data) {
         // Indentation
         for ($i = $sub_data['depth']; $i > 1; $i--) {
             $this->tpl->touchBlock('begin_depth');
             $this->tpl->touchBlock('end_depth');
         }
         $this->tpl->setCurrentBlock('chapter');
         include_once 'Modules/LearningModule/classes/class.ilLMObject.php';
         if ($this->objective_lm->isChapterAssigned($a_set['id'], $sub_data['id'])) {
             $this->tpl->setVariable('CHAP_CHECKED', 'checked="checked"');
         }
         $this->tpl->setVariable('CHAPTER_TITLE', ilLMObject::_lookupTitle($sub_data['id']));
         $this->tpl->setVariable('CHAP_ID', $a_set['id'] . '_' . $sub_data['id']);
         $this->tpl->setVariable('CHAP_TYPE_IMG', ilUtil::getTypeIconPath($sub_data['type'], $sub_data['id'], 'tiny'));
         $this->tpl->setVariable('CHAP_TYPE_ALT', $this->lng->txt('obj_' . $sub_data['type']));
         $this->tpl->parseCurrentBlock();
     }
     if (count($a_set['sub'])) {
         $this->tpl->setVariable('TXT_CHAPTER', $this->lng->txt('objs_st'));
     }
     $this->tpl->setVariable('VAL_ID', $a_set['id']);
     if ($this->objective_lm->isAssigned($a_set['id'])) {
         $this->tpl->setVariable('VAL_CHECKED', 'checked="checked"');
     }
     $this->tpl->setVariable('ROW_TYPE_IMG', ilUtil::getTypeIconPath($a_set['type'], $a_set['obj_id'], 'tiny'));
     $this->tpl->setVariable('ROW_TYPE_ALT', $this->lng->txt('obj_' . $a_set['type']));
     $this->tpl->setVariable('VAL_TITLE', $a_set['title']);
     if (strlen($a_set['description'])) {
         $this->tpl->setVariable('VAL_DESC', $a_set['description']);
     }
 }
 protected function renderMyCourses($a_user_id)
 {
     global $ilAccess, $ilUser;
     if ($this->getOutputMode() == "preview") {
         return $this->renderMyCoursesTeaser($a_user_id);
     }
     if (!$this->isMyCoursesActive()) {
         return;
     }
     $img_path = null;
     if ($this->getOutputMode() == "offline") {
         $this->export_material["images"][] = "./templates/default/images/icon_crs.svg";
         $this->export_material["images"][] = "./templates/default/images/icon_lobj.svg";
         $this->export_material["images"][] = "./templates/default/images/scorm/complete.svg";
         $this->export_material["images"][] = "./templates/default/images/scorm/not_attempted.svg";
         $this->export_material["images"][] = "./templates/default/images/scorm/failed.svg";
         $this->export_material["images"][] = "./templates/default/images/scorm/incomplete.svg";
         $img_path = "images/";
     }
     $user_id = $this->getPageContentUserId($a_user_id);
     $data = $this->getCoursesOfUser($user_id);
     if (sizeof($data)) {
         $tpl = new ilTemplate("tpl.pc_my_courses.html", true, true, "Modules/Portfolio");
         $tpl->setVariable("TITLE", $this->lng->txt("prtf_page_element_my_courses_title"));
         $tpl->setVariable("INFO", $this->lng->txt("prtf_page_element_my_courses_info"));
         // #14464
         include_once "./Services/Tracking/classes/class.ilLearningProgressBaseGUI.php";
         $this->lng->loadLanguageModule("trac");
         $this->lng->loadLanguageModule("crs");
         include_once "./Services/Container/classes/class.ilContainerObjectiveGUI.php";
         include_once "./Services/Link/classes/class.ilLink.php";
         foreach ($data as $course) {
             if (isset($course["lp_status"])) {
                 $lp_icon = ilLearningProgressBaseGUI::_getImagePathForStatus($course["lp_status"]);
                 $lp_alt = ilLearningProgressBaseGUI::_getStatusText($course["lp_status"]);
                 if ($img_path) {
                     $lp_icon = $img_path . basename($lp_icon);
                 }
                 $tpl->setCurrentBlock("lp_bl");
                 $tpl->setVariable("LP_ICON_URL", $lp_icon);
                 $tpl->setVariable("LP_ICON_ALT", $lp_alt);
                 $tpl->parseCurrentBlock();
             }
             if (isset($course["objectives"])) {
                 include_once './Modules/Course/classes/Objectives/class.ilLOSettings.php';
                 $loc_settings = ilLOSettings::getInstanceByObjId($course["obj_id"]);
                 $has_initial_test = (bool) $loc_settings->getInitialTest();
                 foreach ($course["objectives"] as $objtv) {
                     $objtv_icon = ilUtil::getTypeIconPath("lobj", $objtv["id"]);
                     if ($img_path) {
                         $objtv_icon = $img_path . basename($objtv_icon);
                     }
                     $tpl->setCurrentBlock("objective_bl");
                     $tpl->setVariable("OBJECTIVE_TITLE", $objtv["title"]);
                     $tpl->setVariable("OBJTV_ICON_URL", $objtv_icon);
                     $tpl->setVariable("OBJTV_ICON_ALT", $this->lng->txt("crs_objectives"));
                     if ($objtv["type"]) {
                         $tpl->setVariable("LP_OBJTV_PROGRESS", ilContainerObjectiveGUI::buildObjectiveProgressBar($has_initial_test, $objtv["id"], $objtv, true));
                     }
                     $tpl->parseCurrentBlock();
                 }
             }
             // always check against current user
             if ($ilAccess->checkAccessOfUser($ilUser->getId(), "read", "", $course["ref_id"], "crs") || $ilAccess->checkAccessOfUser($ilUser->getId(), "visible", "", $course["ref_id"], "crs") && $ilAccess->checkAccessOfUser($ilUser->getId(), "join", "", $course["ref_id"], "crs")) {
                 $tpl->setCurrentBlock("course_link_bl");
                 $tpl->setVariable("COURSE_LINK_TITLE", $course["title"]);
                 $tpl->setVariable("COURSE_LINK_URL", ilLink::_getLink($course["ref_id"]));
                 $tpl->parseCurrentBlock();
             } else {
                 $tpl->setCurrentBlock("course_nolink_bl");
                 $tpl->setVariable("COURSE_NOLINK_TITLE", $course["title"]);
                 $tpl->parseCurrentBlock();
             }
             $crs_icon = ilUtil::getTypeIconPath("crs", $course["obj_id"]);
             if ($img_path) {
                 $crs_icon = $img_path . basename($crs_icon);
             }
             $tpl->setCurrentBlock("course_bl");
             $tpl->setVariable("CRS_ICON_URL", $crs_icon);
             $tpl->setVariable("CRS_ICON_ALT", $this->lng->txt("obj_crs"));
             $tpl->parseCurrentBlock();
         }
         return $tpl->get();
     }
 }
 /**
  * fill row
  *
  * @access protected
  * @param array row data
  * @return
  */
 protected function fillRow($a_set)
 {
     foreach ($a_set['sub'] as $sub_data) {
         if ($a_set['random']) {
             break;
         }
         if ($sub_data['description']) {
             $this->tpl->setVariable('QST_DESCRIPTION', $sub_data['description']);
         }
         $this->tpl->setCurrentBlock('qst');
         $this->tpl->setVariable('QST_TITLE', $sub_data['title']);
         $this->tpl->setVariable('QST_ID', $a_set['id'] . '_' . $sub_data['id']);
         switch ($this->mode) {
             case ilCourseObjectiveQuestion::TYPE_SELF_ASSESSMENT:
                 if ($this->objective_qst_obj->isSelfAssessmentQuestion($sub_data['id'])) {
                     $this->tpl->setVariable('QST_CHECKED', 'checked="checked"');
                 }
                 break;
             case ilCourseObjectiveQuestion::TYPE_FINAL_TEST:
                 if ($this->objective_qst_obj->isFinalTestQuestion($sub_data['id'])) {
                     $this->tpl->setVariable('QST_CHECKED', 'checked="checked"');
                 }
                 break;
         }
         $this->tpl->parseCurrentBlock();
     }
     if (count($a_set['sub']) and !$a_set['random']) {
         $this->tpl->setVariable('TXT_QUESTIONS', $this->lng->txt('objs_qst'));
     }
     if ($a_set['random']) {
         $this->tpl->setVariable('VAL_WARN', $this->lng->txt('crs_objective_random_warn'));
     }
     $this->tpl->setVariable('VAL_ID', $a_set['id']);
     $this->tpl->setVariable('ROW_TYPE_IMG', ilUtil::getTypeIconPath($a_set['type'], $a_set['obj_id'], 'tiny'));
     $this->tpl->setVariable('ROW_TYPE_ALT', $this->lng->txt('obj_' . $a_set['type']));
     $this->tpl->setVariable('VAL_TITLE', $a_set['title']);
     if (strlen($a_set['description'])) {
         $this->tpl->setVariable('VAL_DESC', $a_set['description']);
     }
 }
 function getSelectableColumns()
 {
     global $ilObjDataCache, $rbacsystem;
     $user_cols = $this->getSelectableUserColumns($this->in_course, $this->in_group);
     if ($this->obj_ids === NULL) {
         // we cannot use the selected columns because they are not ready yet
         // so we use all available columns, should be ok anyways
         $this->obj_ids = $this->getItems(array_keys($user_cols[0]), $user_cols[1]);
     }
     if ($this->obj_ids) {
         $tmp_cols = array();
         foreach ($this->obj_ids as $obj_id) {
             if ($obj_id == $this->obj_id) {
                 $parent = array("txt" => $this->lng->txt("status"), "default" => true);
             } else {
                 $no_perm = false;
                 $ref_id = $this->ref_ids[$obj_id];
                 if ($ref_id && !$rbacsystem->checkAccess('read_learning_progress', $ref_id)) {
                     $no_perm = true;
                     $this->privacy_cols[] = $obj_id;
                 }
                 $title = $ilObjDataCache->lookupTitle($obj_id);
                 $type = $ilObjDataCache->lookupType($obj_id);
                 $icon = ilObject::_getIcon("", "tiny", $type);
                 if ($type == "sess") {
                     include_once "Modules/Session/classes/class.ilObjSession.php";
                     $sess = new ilObjSession($obj_id, false);
                     $title = $sess->getPresentationTitle();
                 }
                 $tmp_cols[strtolower($title) . "#~#obj_" . $obj_id] = array("txt" => $title, "icon" => $icon, "type" => $type, "default" => true, "no_permission" => $no_perm);
             }
         }
         if (sizeof($this->objective_ids)) {
             foreach ($this->objective_ids as $obj_id => $title) {
                 $tmp_cols[strtolower($title) . "#~#objtv_" . $obj_id] = array("txt" => $title, "default" => true);
             }
         }
         if (sizeof($this->sco_ids)) {
             foreach ($this->sco_ids as $obj_id => $title) {
                 $icon = ilUtil::getTypeIconPath("sco", $obj_id, "tiny");
                 $tmp_cols[strtolower($title) . "#~#objsco_" . $obj_id] = array("txt" => $title, "icon" => $icon, "default" => true);
             }
         }
         if (sizeof($this->subitem_ids)) {
             foreach ($this->subitem_ids as $obj_id => $title) {
                 $icon = ilUtil::getTypeIconPath("st", $obj_id, "tiny");
                 $tmp_cols[strtolower($title) . "#~#objsub_" . $obj_id] = array("txt" => $title, "icon" => $icon, "default" => true);
             }
         }
         // alex, 5 Nov 2011: Do not sort SCORM items or "chapters"
         if (!sizeof($this->sco_ids) && !sizeof($this->subitem_ids)) {
             ksort($tmp_cols);
         }
         foreach ($tmp_cols as $id => $def) {
             $id = explode('#~#', $id);
             $columns[$id[1]] = $def;
         }
         unset($tmp_cols);
         if ($parent) {
             $columns["obj_" . $this->obj_id] = $parent;
         }
     }
     unset($user_cols[0]["status"]);
     unset($user_cols[0]["login"]);
     foreach ($user_cols[0] as $col_id => $col_def) {
         if (!isset($columns[$col_id])) {
             // these are all additional fields, no default
             $col_def["default"] = false;
             $columns[$col_id] = $col_def;
         }
     }
     return $columns;
 }
Example #17
0
 /**
  * get html 
  * @return
  */
 protected function getHTML()
 {
     if ($this->textOnly()) {
         $tpl = new ilTemplate('tpl.locator_text_only.html', true, true, "Services/Locator");
         $first = true;
         // Display cut
         if ($this->displayCut() && $this->startnode != ROOT_FOLDER_ID) {
             $tpl->setCurrentBlock('locator_item');
             $tpl->setVariable('ITEM', "...");
             $tpl->parseCurrentBlock();
             $first = false;
         }
         foreach ($this->getPathIds() as $ref_id) {
             $obj_id = ilObject::_lookupObjId($ref_id);
             $title = ilObject::_lookupTitle($obj_id);
             if ($first) {
                 if ($ref_id == ROOT_FOLDER_ID) {
                     $title = $this->lng->txt('repository');
                 }
             } else {
                 $tpl->touchBlock('locator_separator_prefix');
             }
             $tpl->setCurrentBlock('locator_item');
             $tpl->setVariable('ITEM', $title);
             $tpl->parseCurrentBlock();
             $first = false;
         }
         return $tpl->get();
     } else {
         // With images and links
         include_once './Services/Link/classes/class.ilLink.php';
         $tpl = new ilTemplate('tpl.locator.html', true, true, 'Services/Locator');
         $first = true;
         // Display cut
         if ($this->displayCut() && $this->startnode != ROOT_FOLDER_ID) {
             $tpl->setCurrentBlock('locator_item');
             $tpl->setVariable('ITEM', "...");
             $tpl->parseCurrentBlock();
             $first = false;
         }
         foreach ($this->getPathIds() as $ref_id) {
             $obj_id = ilObject::_lookupObjId($ref_id);
             $title = ilObject::_lookupTitle($obj_id);
             $type = ilObject::_lookupType($obj_id);
             if ($first) {
                 if ($ref_id == ROOT_FOLDER_ID) {
                     $title = $this->lng->txt('repository');
                 }
             } else {
                 $tpl->touchBlock('locator_separator_prefix');
             }
             if ($this->getUseImages()) {
                 $tpl->setCurrentBlock('locator_img');
                 $tpl->setVariable('IMG_SRC', ilUtil::getTypeIconPath($type, $obj_id));
                 $tpl->setVariable('IMG_ALT', $this->lng->txt('obj_' . $type));
                 $tpl->parseCurrentBlock();
             }
             $tpl->setCurrentBlock('locator_item');
             $tpl->setVariable('LINK_ITEM', ilLink::_getLink($ref_id, $type));
             $tpl->setVariable('ITEM', $title);
             $tpl->parseCurrentBlock();
             $first = false;
         }
         return $tpl->get();
     }
 }
 function getItems()
 {
     global $objDefinition;
     include_once "Services/Tracking/classes/class.ilTrQuery.php";
     $res = ilTrQuery::getObjectTypeStatisticsPerMonth($this->filter["aggregation"], $this->filter["year"]);
     $data = array();
     foreach ($res as $type => $months) {
         // inactive plugins, etc.
         if (!$objDefinition->getLocation($type)) {
             continue;
         }
         $data[$type]["type"] = $type;
         // to enable sorting by title
         if ($objDefinition->isPluginTypeName($type)) {
             include_once "./Services/Component/classes/class.ilPlugin.php";
             $data[$type]["title"] = ilPlugin::lookupTxt("rep_robj", $type, "obj_" . $type);
             $data[$type]["icon"] = ilObject::_getIcon("", "tiny", $type);
         } else {
             $data[$type]["title"] = $this->lng->txt("objs_" . $type);
             $data[$type]["icon"] = ilUtil::getTypeIconPath($type, null, "tiny");
         }
         foreach ($months as $month => $row) {
             $value = $row[$this->filter["measure"]];
             $data[$type]["month_" . $month] = $value;
         }
     }
     // add live data
     if ($this->filter["year"] == date("Y")) {
         $live = ilTrQuery::getObjectTypeStatistics();
         foreach ($live as $type => $item) {
             // inactive plugins, etc.
             if (!$objDefinition->getLocation($type)) {
                 continue;
             }
             $data[$type]["type"] = $type;
             // to enable sorting by title
             if ($objDefinition->isPluginTypeName($type)) {
                 include_once "./Services/Component/classes/class.ilPlugin.php";
                 $data[$type]["title"] = ilPlugin::lookupTxt("rep_robj", $type, "obj_" . $type);
                 $data[$type]["icon"] = ilObject::_getIcon("", "tiny", $type);
             } else {
                 $data[$type]["title"] = $this->lng->txt("objs_" . $type);
                 $data[$type]["icon"] = ilUtil::getTypeIconPath($type, null, "tiny");
             }
             $value = $item[$this->filter["measure"]];
             $data[$type]["month_live"] = $value;
         }
     }
     $this->setData($data);
 }
 function getSelectableColumns()
 {
     global $ilObjDataCache;
     $columns = array();
     if ($this->obj_ids === NULL) {
         $this->obj_ids = $this->getItems();
     }
     if ($this->obj_ids) {
         $tmp_cols = array();
         foreach ($this->obj_ids as $obj_id) {
             if ($obj_id == $this->obj_id) {
                 $parent = array("txt" => $this->lng->txt("status"), "default" => true);
             } else {
                 $title = $ilObjDataCache->lookupTitle($obj_id);
                 $type = $ilObjDataCache->lookupType($obj_id);
                 $icon = ilObject::_getIcon("", "tiny", $type);
                 if ($type == "sess") {
                     include_once "Modules/Session/classes/class.ilObjSession.php";
                     $sess = new ilObjSession($obj_id, false);
                     $title = $sess->getPresentationTitle();
                 }
                 $tmp_cols[strtolower($title) . "#~#obj_" . $obj_id] = array("txt" => $title, "icon" => $icon, "type" => $type, "default" => true);
             }
         }
         if (sizeof($this->objective_ids)) {
             foreach ($this->objective_ids as $obj_id => $title) {
                 $tmp_cols[strtolower($title) . "#~#objtv_" . $obj_id] = array("txt" => $title, "default" => true);
             }
         }
         if (sizeof($this->sco_ids)) {
             foreach ($this->sco_ids as $obj_id => $title) {
                 $icon = ilUtil::getTypeIconPath("sco", $obj_id, "tiny");
                 $tmp_cols[strtolower($title) . "#~#objsco_" . $obj_id] = array("txt" => $title, "icon" => $icon, "default" => true);
             }
         }
         // alex, 5 Nov 2011: Do not sort SCORM items
         if (!sizeof($this->sco_ids)) {
             ksort($tmp_cols);
         }
         foreach ($tmp_cols as $id => $def) {
             $id = explode('#~#', $id);
             $columns[$id[1]] = $def;
         }
         unset($tmp_cols);
         if ($parent) {
             $columns["obj_" . $this->obj_id] = $parent;
         }
     }
     $columns["status_changed"] = array("txt" => $this->lng->txt("trac_status_changed"), "id" => "status_changed", "default" => false);
     include_once 'Services/Tracking/classes/class.ilObjUserTracking.php';
     $tracking = new ilObjUserTracking();
     if ($tracking->hasExtendedData(ilObjUserTracking::EXTENDED_DATA_LAST_ACCESS)) {
         $columns["last_access"] = array("txt" => $this->lng->txt("last_access"), "id" => "last_access", "default" => false);
     }
     if ($tracking->hasExtendedData(ilObjUserTracking::EXTENDED_DATA_SPENT_SECONDS)) {
         $columns["spent_seconds"] = array("txt" => $this->lng->txt("trac_spent_seconds"), "id" => "spent_seconds", "default" => false);
     }
     return $columns;
 }
 /**
  * init limit form
  *
  * @access protected
  * @param string mode selfAssessment or final
  * @return
  */
 protected function initFormLimits($a_mode)
 {
     if (!is_object($this->form)) {
         include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
         $this->form = new ilPropertyFormGUI();
     }
     $this->form->setFormAction($this->ctrl->getFormAction($this));
     $this->form->setTableWidth('100%');
     $this->form->setTitleIcon(ilUtil::getImagePath('icon_lobj.png'), $this->lng->txt('crs_objective'));
     switch ($a_mode) {
         case 'selfAssessment':
             $this->form->setTitle($this->lng->txt('crs_objective_wiz_self_limit'));
             $this->form->addCommandButton('updateSelfAssessmentLimits', $this->lng->txt('crs_wiz_next'));
             $this->form->addCommandButton('selfAssessmentAssignment', $this->lng->txt('crs_wiz_back'));
             $tests = $this->objectives_qst_obj->getSelfAssessmentTests();
             $max_points = $this->objectives_qst_obj->getSelfAssessmentPoints();
             break;
         case 'final':
             $this->form->setTitle($this->lng->txt('crs_objective_wiz_final_limit'));
             $this->form->addCommandButton('updateFinalTestLimits', $this->lng->txt('crs_wiz_next'));
             $this->form->addCommandButton('finalTestAssignment', $this->lng->txt('crs_wiz_back'));
             $tests = $this->objectives_qst_obj->getFinalTests();
             $max_points = $this->objectives_qst_obj->getFinalTestPoints();
             break;
     }
     $over = new ilCustomInputGUI($this->lng->txt('crs_objective_qst_summary'), '');
     $tpl = new ilTemplate('tpl.crs_objective_qst_summary.html', true, true, 'Modules/Course');
     $limit = 0;
     foreach ($tests as $test) {
         $limit = $test['limit'];
         foreach ($this->objectives_qst_obj->getQuestionsOfTest($test['obj_id']) as $question) {
             $tpl->setCurrentBlock('qst');
             $tpl->setVariable('QST_TITLE', $question['title']);
             if (strlen($question['description'])) {
                 $tpl->setVariable('QST_DESCRIPTION', $question['description']);
             }
             $tpl->setVariable('QST_POINTS', $question['points'] . ' ' . $this->lng->txt('crs_objective_points'));
             $tpl->parseCurrentBlock();
         }
         $tpl->setCurrentBlock('tst');
         $tpl->setVariable('TST_TITLE', ilObject::_lookupTitle($test['obj_id']));
         if ($desc = ilObject::_lookupDescription($test['obj_id'])) {
             $tpl->setVariable('TST_DESC', $desc);
         }
         $tpl->setVariable('TST_TYPE_IMG', ilUtil::getTypeIconPath('tst', $test['obj_id'], 'tiny'));
         $tpl->setVariable('TST_ALT_IMG', $this->lng->txt('obj_tst'));
         $tpl->parseCurrentBlock();
     }
     $tpl->setVariable('TXT_ALL_POINTS', $this->lng->txt('crs_objective_all_points'));
     $tpl->setVariable('TXT_POINTS', $this->lng->txt('crs_objective_points'));
     $tpl->setVariable('POINTS', $max_points);
     $over->setHtml($tpl->get());
     $this->form->addItem($over);
     $req = new ilTextInputGUI($this->lng->txt('crs_obj_required_points'), 'limit');
     $req->setValue($limit);
     $req->setMaxLength(5);
     $req->setSize(3);
     $req->setRequired(true);
     switch ($a_mode) {
         case 'selfAssessment':
             $req->setInfo($this->lng->txt('crs_obj_initial_req_info'));
             break;
         case 'final':
             $req->setInfo($this->lng->txt('crs_obj_final_req_info'));
             break;
     }
     $this->form->addItem($req);
 }
 protected function initSettingsForm($a_mode = 'create')
 {
     include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
     $this->form_gui = new ilPropertyFormGUI();
     $this->form_gui->setTableWidth('600');
     if ($a_mode == 'create') {
         $this->form_gui->setTitle($this->lng->txt('icrs_new'));
     } else {
         $this->form_gui->setTitle($this->lng->txt('icrs_edit'));
     }
     $this->form_gui->setTitleIcon(ilUtil::getTypeIconPath('icrs', 0));
     // Title
     $text_input = new ilTextInputGUI($this->lng->txt('title'), 'title');
     $text_input->setRequired(true);
     $this->form_gui->addItem($text_input);
     // Description
     $text_area = new ilTextAreaInputGUI($this->lng->txt('desc'), 'desc');
     $this->form_gui->addItem($text_area);
     // Access
     $text_area = new ilCheckboxInputGUI($this->lng->txt('online'), 'activated');
     $this->form_gui->addItem($text_area);
     // AKClassValues
     if ($this->ilias->getSetting('ilinc_akclassvalues_active')) {
         $section_header = new ilFormSectionHeaderGUI();
         $section_header->setTitle($this->lng->txt('akclassvalues'));
         $this->form_gui->addItem($section_header);
         $text_input = new ilTextInputGUI($this->lng->txt('akclassvalue1'), 'akclassvalue1');
         if ($this->ilias->getSetting('ilinc_akclassvalues_required')) {
             $text_input->setRequired(true);
         }
         $this->form_gui->addItem($text_input);
         $text_input = new ilTextInputGUI($this->lng->txt('akclassvalue2'), 'akclassvalue2');
         $this->form_gui->addItem($text_input);
     }
     if ($this->call_by_reference) {
         $this->ctrl->setParameter($this, 'obj_id', $this->obj_id);
     }
     // save and cancel commands
     if ($a_mode == 'create') {
         $this->ctrl->setParameter($this, 'mode', 'create');
         $this->ctrl->setParameter($this, 'new_type', 'icrs');
         $this->form_gui->addCommandButton('save', $this->lng->txt('icrs_add'));
         $this->form_gui->addCommandButton('cancel', $this->lng->txt('cancel'));
         $this->form_gui->setFormAction($this->ctrl->getFormAction($this, 'save'));
     } else {
         $this->form_gui->addCommandButton('update', $this->lng->txt('save'));
         $this->form_gui->addCommandButton('cancel', $this->lng->txt('cancel'));
         $this->form_gui->setFormAction($this->ctrl->getFormAction($this, 'update'));
     }
 }
 function getItems()
 {
     include_once "Services/Tracking/classes/class.ilTrQuery.php";
     $res = ilTrQuery::getObjectTypeStatisticsPerMonth($this->filter["aggregation"], $this->filter["year"]);
     // get plugin titles
     include_once "./Services/Repository/classes/class.ilRepositoryObjectPluginSlot.php";
     $plugins = array();
     $plugins = ilRepositoryObjectPluginSlot::addCreatableSubObjects($plugins);
     $data = array();
     foreach ($res as $type => $months) {
         $data[$type]["type"] = $type;
         // to enable sorting by title
         if (array_key_exists($type, $plugins)) {
             include_once "./Services/Component/classes/class.ilPlugin.php";
             $data[$type]["title"] = ilPlugin::lookupTxt("rep_robj", $type, "obj_" . $type);
             $data[$type]["icon"] = ilObject::_getIcon("", "tiny", $type);
         } else {
             $data[$type]["title"] = $this->lng->txt("objs_" . $type);
             $data[$type]["icon"] = ilUtil::getTypeIconPath($type, null, "tiny");
         }
         foreach ($months as $month => $row) {
             $value = $row[$this->filter["measure"]];
             $data[$type]["month_" . $month] = $value;
         }
     }
     // add live data
     if ($this->filter["year"] == date("Y")) {
         $live = ilTrQuery::getObjectTypeStatistics();
         foreach ($live as $type => $item) {
             $data[$type]["type"] = $type;
             // to enable sorting by title
             if (array_key_exists($type, $plugins)) {
                 include_once "./Services/Component/classes/class.ilPlugin.php";
                 $data[$type]["title"] = ilPlugin::lookupTxt("rep_robj", $type, "obj_" . $type);
                 $data[$type]["icon"] = ilObject::_getIcon("", "tiny", $type);
             } else {
                 $data[$type]["title"] = $this->lng->txt("objs_" . $type);
                 $data[$type]["icon"] = ilUtil::getTypeIconPath($type, null, "tiny");
             }
             $value = $item[$this->filter["measure"]];
             $data[$type]["month_live"] = $value;
         }
     }
     $this->setData($data);
 }
 /**
  * Show links to references
  * @param int $a_obj_id $obj_id
  * @return
  */
 protected function addReferenceLinks($a_obj_id)
 {
     global $tree;
     $tpl = new ilTemplate('tpl.cal_reference_links.html', true, true, 'Services/Calendar');
     foreach (ilObject::_getAllReferences($a_obj_id) as $ref_id => $ref_id) {
         include_once './Services/Link/classes/class.ilLink.php';
         $parent_ref_id = $tree->getParentId($ref_id);
         $parent_obj_id = ilObject::_lookupObjId($parent_ref_id);
         $parent_type = ilObject::_lookupType($parent_obj_id);
         $parent_title = ilObject::_lookupTitle($parent_obj_id);
         $type = ilObject::_lookupType($a_obj_id);
         $title = ilObject::_lookupTitle($a_obj_id);
         $tpl->setCurrentBlock('reference');
         $tpl->setVariable('PIMG_SRC', ilUtil::getTypeIconPath($parent_type, $parent_obj_id, 'tiny'));
         $tpl->setVariable('PIMG_ALT', $this->lng->txt('obj_' . $parent_type));
         $tpl->setVariable('PARENT_TITLE', $parent_title);
         $tpl->setVariable('PARENT_HREF', ilLink::_getLink($parent_ref_id));
         $tpl->setVariable('SRC', ilUtil::getTypeIconPath($type, $a_obj_id, 'tiny'));
         $tpl->setVariable('ALT', $this->lng->txt('obj_' . $type));
         $tpl->setVariable('TITLE', $title);
         $tpl->setVariable('HREF', ilLink::_getLink($ref_id));
         $tpl->parseCurrentBlock();
     }
     return $tpl->get();
 }
 /**
  * Set Course title and icon in header
  *
  */
 protected function initHeader()
 {
     $lgui = ilObjectListGUIFactory::_getListGUIByType($this->crs->getType());
     $this->tpl->setTitle($this->crs->getTitle());
     $this->tpl->setDescription($this->crs->getDescription());
     if ($this->crs->getOfflineStatus()) {
         $this->tpl->setAlertProperties($lgui->getAlertProperties());
     }
     $this->tpl->setTitleIcon(ilUtil::getTypeIconPath('crs', $this->crs->getId(), 'big'));
     $this->ctrl->setParameterByClass('ilrepositorygui', 'ref_id', $this->ref_id);
     $this->tabs->setBackTarget($this->pl->txt('back_to_course'), $this->ctrl->getLinkTargetByClass('ilrepositorygui'));
 }