/**
  * Fill table row
  */
 protected function fillRow($data)
 {
     global $ilCtrl, $lng;
     if (!$this->isPercentageAvailable($data["obj_id"])) {
         $data["percentage"] = NULL;
     }
     foreach ($this->getSelectedColumns() as $c) {
         $val = trim($data[$c]) == "" ? " " : $data[$c];
         if ($data[$c] != "" || $c == "status") {
             switch ($c) {
                 case "first_access":
                     $val = ilDatePresentation::formatDate(new ilDateTime($data[$c], IL_CAL_DATETIME));
                     break;
                 case "last_access":
                     $val = ilDatePresentation::formatDate(new ilDateTime($data[$c], IL_CAL_UNIX));
                     break;
                 case "status":
                     include_once "./Services/Tracking/classes/class.ilLearningProgressBaseGUI.php";
                     $path = ilLearningProgressBaseGUI::_getImagePathForStatus($data[$c]);
                     $text = ilLearningProgressBaseGUI::_getStatusText($data[$c]);
                     $val = ilUtil::img($path, $text);
                     if ($data["type"] != "lobj" && $data["type"] != "sco") {
                         $timing = $this->showTimingsWarning($data["ref_id"], $this->user_id);
                         if ($timing) {
                             if ($timing !== true) {
                                 $timing = ": " . ilDatePresentation::formatDate(new ilDate($timing, IL_CAL_UNIX));
                             } else {
                                 $timing = "";
                             }
                             $this->tpl->setCurrentBlock('warning_img');
                             $this->tpl->setVariable('WARNING_IMG', ilUtil::getImagePath('time_warn.png'));
                             $this->tpl->setVariable('WARNING_ALT', $this->lng->txt('trac_time_passed') . $timing);
                             $this->tpl->parseCurrentBlock();
                         }
                     }
                     break;
                 case "spent_seconds":
                     include_once "./Services/Utilities/classes/class.ilFormat.php";
                     $val = ilFormat::_secondsToString($data[$c]);
                     break;
                 case "percentage":
                     $val = $data[$c] . "%";
                     break;
             }
         }
         if ($c == "mark" && in_array($this->type, array("lm", "dbk"))) {
             $val = "-";
         }
         if ($c == "spent_seconds" && in_array($this->type, array("exc"))) {
             $val = "-";
         }
         if ($c == "percentage" && (in_array(strtolower($this->status_class), array("illpstatusmanual", "illpstatusscormpackage", "illpstatustestfinished")) || $this->type == "exc")) {
             $val = "-";
         }
         $this->tpl->setCurrentBlock("user_field");
         $this->tpl->setVariable("VAL_UF", $val);
         $this->tpl->parseCurrentBlock();
     }
     if ($data["title"] == "") {
         $data["title"] = "--" . $lng->txt("none") . "--";
     }
     $this->tpl->setVariable("ICON", ilObject::_getIcon("", "tiny", $data["type"]));
     $this->tpl->setVariable("ICON_ALT", $lng->txt($data["type"]));
     if (in_array($data['type'], array('fold', 'grp')) && $data['obj_id'] != $this->obj_id) {
         if ($data['type'] == 'fold') {
             $object_gui = 'ilobjfoldergui';
         } else {
             $object_gui = 'ilobjgroupgui';
         }
         $this->tpl->setCurrentBlock('title_linked');
         // link structure gets too complicated
         if ($_GET["baseClass"] != "ilPersonalDesktopGUI" && $_GET["baseClass"] != "ilAdministrationGUI") {
             $old = $ilCtrl->getParameterArrayByClass('illplistofobjectsgui');
             $ilCtrl->setParameterByClass('illplistofobjectsgui', 'ref_id', $data["ref_id"]);
             $ilCtrl->setParameterByClass('illplistofobjectsgui', 'details_id', $data["ref_id"]);
             $ilCtrl->setParameterByClass('illplistofobjectsgui', 'user_id', $this->user_id);
             $url = $ilCtrl->getLinkTargetByClass(array('ilrepositorygui', $object_gui, 'illearningprogressgui', 'illplistofobjectsgui'), 'userdetails');
             $ilCtrl->setParameterByClass('illplistofobjectsgui', 'ref_id', $old["ref_id"]);
             $ilCtrl->setParameterByClass('illplistofobjectsgui', 'details_id', $old["details_id"]);
             $ilCtrl->setParameterByClass('illplistofobjectsgui', 'user_id', $old["user_id"]);
         } else {
             $url = "#";
         }
         $this->tpl->setVariable("URL_TITLE", $url);
         $this->tpl->setVariable("VAL_TITLE", $data["title"]);
         $this->tpl->parseCurrentBlock();
     } else {
         $this->tpl->setCurrentBlock('title_plain');
         $this->tpl->setVariable("VAL_TITLE", $data["title"]);
         $this->tpl->parseCurrentBlock();
     }
     if (!in_array($data["type"], array("sco", "lobj")) && !$this->getPrintMode()) {
         $this->tpl->setCurrentBlock("item_command");
         $ilCtrl->setParameterByClass("illplistofobjectsgui", "userdetails_id", $data["ref_id"]);
         $this->tpl->setVariable("HREF_COMMAND", $ilCtrl->getLinkTargetByClass("illplistofobjectsgui", 'edituser'));
         $this->tpl->setVariable("TXT_COMMAND", $lng->txt('edit'));
         $ilCtrl->setParameterByClass("illplistofobjectsgui", "userdetails_id", "");
         $this->tpl->parseCurrentBlock();
     }
 }
 protected function getDetailItems($a_obj_id)
 {
     $data = array();
     $all_status = array_merge(array("mem_cnt"), $this->status);
     include_once "Services/Tracking/classes/class.ilTrQuery.php";
     foreach (ilTrQuery::getObjectLPStatistics(array($a_obj_id), $this->filter["yearmonth"]) as $item) {
         $month = "month_" . $item["yyyy"] . "-" . str_pad($item["mm"], 2, "0", STR_PAD_LEFT);
         foreach ($all_status as $status) {
             // status-id to field name
             if ($status != "mem_cnt") {
                 $field = $this->status_map[$status];
             } else {
                 $field = $status;
             }
             // aggregated fields
             foreach ($this->types as $type) {
                 $value = $item[$field . "_" . $type];
                 $idx = $item["yyyy"] . "-" . str_pad($item["mm"], 2, "0", STR_PAD_LEFT);
                 $data[$status . "_" . $type]["month_" . $idx] = $value;
             }
         }
     }
     // add captions
     foreach (array_keys($data) as $figure) {
         $status = substr($figure, 0, -4);
         $type = substr($figure, -3);
         if ($status != "mem_cnt") {
             $path = ilLearningProgressBaseGUI::_getImagePathForStatus((int) $status);
             $text = ilLearningProgressBaseGUI::_getStatusText((int) $status);
             $icon = ilUtil::img($path, $text);
             $text = $icon . " " . $text;
         } else {
             $text = $this->lng->txt("members");
         }
         if ($type != "avg") {
             $caption = $text . " " . $this->lng->txt("trac_object_stat_lp_" . $type);
         } else {
             $caption = $text . " Ø";
         }
         $data[$figure]["figure"] = $caption;
     }
     $this->setData($data);
 }
 protected function parseValue($id, $value, $type)
 {
     global $lng;
     $lng->loadLanguageModule("trac");
     switch ($id) {
         case "status":
             include_once "./Services/Tracking/classes/class.ilLearningProgressBaseGUI.php";
             $path = ilLearningProgressBaseGUI::_getImagePathForStatus($value);
             $text = ilLearningProgressBaseGUI::_getStatusText($value);
             $value = ilUtil::img($path, $text);
             break;
     }
     //BLUM round
     if ($id == "launch_data" || $id == "suspend_data") {
         return $value;
     }
     if (is_numeric($value)) {
         return round($value, 2);
     }
     return $value;
 }
Exemplo n.º 4
0
 protected function checkLPIcon($a_id)
 {
     global $ilUser;
     // do it once for all chapters
     if ($this->lp_cache[$this->lm_obj->getId()] === null) {
         $this->lp_cache[$this->lm_obj->getId()] = false;
         include_once './Services/Tracking/classes/class.ilLearningProgressAccess.php';
         if (ilLearningProgressAccess::checkAccess($this->lm_obj->getRefId())) {
             $info = null;
             include_once './Services/Object/classes/class.ilObjectLP.php';
             $olp = ilObjectLP::getInstance($this->lm_obj->getId());
             if ($olp->getCurrentMode() == ilLPObjSettings::LP_MODE_COLLECTION_MANUAL || $olp->getCurrentMode() == ilLPObjSettings::LP_MODE_COLLECTION_TLT) {
                 include_once "Services/Tracking/classes/class.ilLPStatusFactory.php";
                 $class = ilLPStatusFactory::_getClassById($this->lm_obj->getId(), $olp->getCurrentMode());
                 $info = $class::_getStatusInfo($this->lm_obj->getId());
             }
             // parse collection items
             if (is_array($info["items"])) {
                 foreach ($info["items"] as $item_id) {
                     $status = ilLPStatus::LP_STATUS_NOT_ATTEMPTED_NUM;
                     if (is_array($info["in_progress"][$item_id]) && in_array($ilUser->getId(), $info["in_progress"][$item_id])) {
                         $status = ilLPStatus::LP_STATUS_IN_PROGRESS_NUM;
                     } else {
                         if (is_array($info["completed"][$item_id]) && in_array($ilUser->getId(), $info["completed"][$item_id])) {
                             $status = ilLPStatus::LP_STATUS_COMPLETED_NUM;
                         }
                     }
                     $this->lp_cache[$this->lm_obj->getId()][$item_id] = $status;
                 }
             }
         }
         include_once './Services/Tracking/classes/class.ilLearningProgressBaseGUI.php';
     }
     if (is_array($this->lp_cache[$this->lm_obj->getId()]) && isset($this->lp_cache[$this->lm_obj->getId()][$a_id])) {
         return ilLearningProgressBaseGUI::_getImagePathForStatus($this->lp_cache[$this->lm_obj->getId()][$a_id]);
     }
 }
 /**
  * Fill table row
  */
 protected function fillRow($a_set)
 {
     global $ilCtrl;
     if (!$this->details) {
         $this->tpl->setCurrentBlock("column_checkbox");
         $this->tpl->setVariable("OBJ_ID", $a_set["obj_id"]);
         $this->tpl->parseCurrentBlock();
     }
     $this->tpl->setVariable("ICON_SRC", ilObject::_getIcon("", "tiny", $a_set["type"]));
     $this->tpl->setVariable("ICON_ALT", $this->lng->txt($a_set["type"]));
     $this->tpl->setVariable("TITLE_TEXT", $a_set["title"]);
     if ($a_set["offline"]) {
         $this->tpl->setCurrentBlock("offline");
         $this->tpl->setVariable("TEXT_STATUS", $this->lng->txt("status"));
         $this->tpl->setVariable("TEXT_OFFLINE", $this->lng->txt("offline"));
         $this->tpl->parseCurrentBlock();
     }
     $this->tpl->setVariable("STATUS_ALT", ilLearningProgressBaseGUI::_getStatusText($a_set["status"]));
     $this->tpl->setVariable("STATUS_IMG", ilLearningProgressBaseGUI::_getImagePathForStatus($a_set["status"]));
     if ($this->mode == LP_MODE_SCORM) {
         $this->tpl->setVariable('SCORE_VAL', $a_set["score"]);
     } else {
         if ($this->mode != LP_MODE_OBJECTIVES) {
             $this->tpl->setCurrentBlock("status_details");
             $this->tpl->setVariable('STATUS_CHANGED_VAL', ilDatePresentation::formatDate(new ilDateTime($a_set['status_changed'], IL_CAL_DATETIME)));
             $this->tpl->setVariable("MODE_TEXT", ilLPObjSettings::_mode2Text($a_set["u_mode"]));
             $this->tpl->setVariable("MARK_VALUE", $a_set["mark"]);
             $this->tpl->setVariable("COMMENT_TEXT", $a_set["comment"]);
             if (!$this->isPercentageAvailable($a_set["obj_id"]) || (int) $a_set["percentage"] === 0) {
                 $this->tpl->setVariable("PERCENTAGE_VALUE", "");
             } else {
                 $this->tpl->setVariable("PERCENTAGE_VALUE", sprintf("%d%%", $a_set["percentage"]));
             }
             // path
             $path = $this->buildPath($a_set["ref_ids"]);
             if ($path) {
                 $this->tpl->setCurrentBlock("item_path");
                 foreach ($path as $path_item) {
                     $this->tpl->setVariable("PATH_ITEM", $path_item);
                     $this->tpl->parseCurrentBlock();
                 }
             }
             $this->tpl->parseCurrentBlock();
         }
     }
     // not for objectives/scos
     if (!$this->mode) {
         // tlt warning
         if ($a_set["status"] != LP_STATUS_COMPLETED_NUM && $a_set["ref_ids"]) {
             $ref_id = $a_set["ref_ids"];
             $ref_id = array_shift($ref_id);
             $timing = $this->showTimingsWarning($ref_id, $this->tracked_user->getId());
             if ($timing) {
                 if ($timing !== true) {
                     $timing = ": " . ilDatePresentation::formatDate(new ilDate($timing, IL_CAL_UNIX));
                 } else {
                     $timing = "";
                 }
                 $this->tpl->setCurrentBlock('warning_img');
                 $this->tpl->setVariable('WARNING_IMG', ilUtil::getImagePath('time_warn.png'));
                 $this->tpl->setVariable('WARNING_ALT', $this->lng->txt('trac_time_passed') . $timing);
                 $this->tpl->parseCurrentBlock();
             }
         }
         // hide / unhide?!
         if (!$this->details) {
             $this->tpl->setCurrentBlock("item_command");
             $ilCtrl->setParameterByClass(get_class($this), 'hide', $a_set["obj_id"]);
             $this->tpl->setVariable("HREF_COMMAND", $ilCtrl->getLinkTargetByClass(get_class($this), 'hide'));
             $this->tpl->setVariable("TXT_COMMAND", $this->lng->txt('trac_hide'));
             $this->tpl->parseCurrentBlock();
             if (ilLPObjSettings::_isContainer($a_set["u_mode"]) && $a_set["ref_ids"]) {
                 $ref_id = $a_set["ref_ids"];
                 $ref_id = array_shift($ref_id);
                 $ilCtrl->setParameterByClass($ilCtrl->getCmdClass(), 'details_id', $ref_id);
                 $this->tpl->setVariable("HREF_COMMAND", $ilCtrl->getLinkTargetByClass($ilCtrl->getCmdClass(), 'details'));
                 $ilCtrl->setParameterByClass($ilCtrl->getCmdClass(), 'details_id', '');
                 $this->tpl->setVariable("TXT_COMMAND", $this->lng->txt('trac_subitems'));
                 $this->tpl->parseCurrentBlock();
             }
             $this->tpl->setCurrentBlock("column_action");
             $this->tpl->parseCurrentBlock();
         }
     }
 }
 /**
  * @description This adds the collumn for status.
  *
  * @param ilDataCollectionRecord $record
  * @param ilDataCollectionField  $field
  *
  * @return string
  */
 protected function getStatus(ilDataCollectionRecord $record, ilDataCollectionField $field)
 {
     $record_field = ilDataCollectionCache::getRecordFieldCache($record, $field);
     $return = "";
     if ($status = $record_field->getStatus()) {
         $return = "<img src='" . ilLearningProgressBaseGUI::_getImagePathForStatus($status->status) . "'>";
     }
     return $return;
 }
Exemplo n.º 7
0
 protected function parseValue($id, $value, $type)
 {
     global $lng;
     // get rid of aggregation
     $pos = strrpos($id, "_");
     if ($pos !== false) {
         $function = strtoupper(substr($id, $pos + 1));
         if (in_array($function, array("MIN", "MAX", "SUM", "AVG", "COUNT"))) {
             $id = substr($id, 0, $pos);
         }
     }
     if (trim($value) == "" && $id != "status") {
         if ($id == "title" && get_class($this) != "ilTrObjectUsersPropsTableGUI" && get_class($this) != "ilTrMatrixTableGUI") {
             return "--" . $lng->txt("none") . "--";
         }
         return " ";
     }
     switch ($id) {
         case "first_access":
         case "create_date":
         case 'status_changed':
             $value = ilDatePresentation::formatDate(new ilDateTime($value, IL_CAL_DATETIME));
             break;
         case "last_access":
             $value = ilDatePresentation::formatDate(new ilDateTime($value, IL_CAL_UNIX));
             break;
         case "birthday":
             $value = ilDatePresentation::formatDate(new ilDate($value, IL_CAL_DATE));
             break;
         case "spent_seconds":
             if (in_array($type, array("exc"))) {
                 $value = "-";
             } else {
                 include_once "./Services/Utilities/classes/class.ilFormat.php";
                 $value = ilFormat::_secondsToString($value, $value < 3600 ? true : false);
                 // #14858
             }
             break;
         case "percentage":
             /* :TODO:
             			if(in_array(strtolower($this->status_class),
             					  array("illpstatusmanual", "illpstatusscormpackage", "illpstatustestfinished")) ||
             			$type == "exc"))
             			*/
             if (false) {
                 $value = "-";
             } else {
                 $value = $value . "%";
             }
             break;
         case "mark":
             if (in_array($type, array("lm", "dbk"))) {
                 $value = "-";
             }
             break;
         case "gender":
             $value = $lng->txt("gender_" . $value);
             break;
         case "status":
             include_once "./Services/Tracking/classes/class.ilLearningProgressBaseGUI.php";
             $path = ilLearningProgressBaseGUI::_getImagePathForStatus($value);
             $text = ilLearningProgressBaseGUI::_getStatusText($value);
             $value = ilUtil::img($path, $text);
             break;
         case "language":
             $lng->loadLanguageModule("meta");
             $value = $lng->txt("meta_l_" . $value);
             break;
         case "sel_country":
             $value = $lng->txt("meta_c_" . $value);
             break;
     }
     return $value;
 }
 function __appendLPDetails(&$info, $item_id, $user_id)
 {
     global $ilObjDataCache;
     $type = $ilObjDataCache->lookupType($item_id);
     // Section learning_progress
     // $info->addSection($this->lng->txt('trac_learning_progress'));
     // see ilLPTableBaseGUI::parseTitle();
     $info->addSection($this->lng->txt("trac_progress") . ": " . ilObject::_lookupTitle($item_id));
     $olp = ilObjectLP::getInstance($item_id);
     $info->addProperty($this->lng->txt('trac_mode'), $olp->getModeText($olp->getCurrentMode()));
     switch ($type) {
         case 'lm':
         case 'htlm':
             include_once 'Services/Tracking/classes/class.ilLearningProgress.php';
             $progress = ilLearningProgress::_getProgress($user_id, $item_id);
             if ($progress['access_time']) {
                 $info->addProperty($this->lng->txt('last_access'), ilDatePresentation::formatDate(new ilDateTime($progress['access_time'], IL_CAL_DATETIME)));
             } else {
                 $info->addProperty($this->lng->txt('last_access'), $this->lng->txt('trac_not_accessed'));
             }
             $info->addProperty($this->lng->txt('trac_visits'), (int) $progress['visits']);
             if ($type == 'lm') {
                 $info->addProperty($this->lng->txt('trac_spent_time'), ilFormat::_secondsToString($progress['spent_seconds']));
             }
             // fallthrough
         // fallthrough
         case 'exc':
         case 'tst':
         case 'crs':
         case 'sahs':
         case 'grp':
             // display status as image
             include_once "./Services/Tracking/classes/class.ilLearningProgressBaseGUI.php";
             $status = $this->__readStatus($item_id, $user_id);
             $status_path = ilLearningProgressBaseGUI::_getImagePathForStatus($status);
             $status_text = ilLearningProgressBaseGUI::_getStatusText($status);
             $info->addProperty($this->lng->txt('trac_status'), ilUtil::img($status_path, $status_text) . " " . $status_text);
             // #15334 - see ilLPTableBaseGUI::isPercentageAvailable()
             $mode = $olp->getCurrentMode();
             if (in_array($mode, array(ilLPObjSettings::LP_MODE_TLT, ilLPObjSettings::LP_MODE_VISITS, ilLPObjSettings::LP_MODE_SCORM, ilLPObjSettings::LP_MODE_TEST_PASSED))) {
                 include_once 'Services/Tracking/classes/class.ilLPStatus.php';
                 $perc = ilLPStatus::_lookupPercentage($item_id, $user_id);
                 $info->addProperty($this->lng->txt('trac_percentage'), (int) $perc . "%");
             }
             break;
     }
     include_once 'Services/Tracking/classes/class.ilLPMarks.php';
     if (strlen($mark = ilLPMarks::_lookupMark($user_id, $item_id))) {
         $info->addProperty($this->lng->txt('trac_mark'), $mark);
     }
     if (strlen($comment = ilLPMarks::_lookupComment($user_id, $item_id))) {
         $info->addProperty($this->lng->txt('trac_comment'), $comment);
     }
 }
Exemplo n.º 9
0
 public static function preloadListGUIData($a_obj_ids)
 {
     global $ilDB, $ilUser, $lng;
     $res = array();
     include_once "Services/Tracking/classes/class.ilObjUserTracking.php";
     if ($ilUser->getId() != ANONYMOUS_USER_ID && ilObjUserTracking::_enabledLearningProgress() && ilObjUserTracking::_hasLearningProgressLearner() && ilObjUserTracking::_hasLearningProgressListGUI()) {
         include_once "Services/Object/classes/class.ilObjectLP.php";
         // validate objects
         $valid = array();
         $existing = ilLPObjSettings::_lookupDBModeForObjects($a_obj_ids);
         foreach ($existing as $obj_id => $obj_mode) {
             if ($obj_mode != ilLPObjSettings::LP_MODE_DEACTIVATED) {
                 $valid[$obj_id] = $obj_id;
             }
         }
         if (sizeof($existing) != sizeof($a_obj_ids)) {
             // missing objects (default mode)
             foreach (array_diff($a_obj_ids, $existing) as $obj_id) {
                 $olp = ilObjectLP::getInstance($obj_id);
                 $mode = $olp->getCurrentMode();
                 if ($mode == ilLPObjSettings::LP_MODE_DEACTIVATED) {
                     // #11141
                     unset($valid[$obj_id]);
                 } else {
                     if ($mode != ilLPObjSettings::LP_MODE_UNDEFINED) {
                         $valid[$obj_id] = $obj_id;
                     }
                 }
             }
             unset($existing);
         }
         $valid = array_values($valid);
         // get user lp data
         $sql = "SELECT status, status_dirty, obj_id FROM ut_lp_marks" . " WHERE " . $ilDB->in("obj_id", $valid, "", "integer") . " AND usr_id = " . $ilDB->quote($ilUser->getId(), "integer");
         $set = $ilDB->query($sql);
         while ($row = $ilDB->fetchAssoc($set)) {
             if (!$row["status_dirty"]) {
                 $res[$row["obj_id"]] = $row["status"];
             } else {
                 $res[$row["obj_id"]] = self::_lookupStatus($row["obj_id"], $ilUser->getId());
             }
         }
         // process missing user entries (same as dirty entries, see above)
         foreach ($valid as $obj_id) {
             if (!isset($res[$obj_id])) {
                 $res[$obj_id] = self::_lookupStatus($obj_id, $ilUser->getId());
                 if ($res[$obj_id] === null) {
                     $res[$obj_id] = self::LP_STATUS_NOT_ATTEMPTED_NUM;
                 }
             }
         }
         // value to icon
         $lng->loadLanguageModule("trac");
         include_once "./Services/Tracking/classes/class.ilLearningProgressBaseGUI.php";
         foreach ($res as $obj_id => $status) {
             $path = ilLearningProgressBaseGUI::_getImagePathForStatus($status);
             $text = ilLearningProgressBaseGUI::_getStatusText($status);
             $res[$obj_id] = ilUtil::img($path, $text);
         }
     }
     self::$list_gui_cache = $res;
 }
 function details()
 {
     global $ilToolbar, $ilCtrl, $rbacsystem;
     // Show back button to crs if called from crs. Otherwise if called from personal desktop or administration
     // show back to list
     if ((int) $_GET['crs_id']) {
         $this->ctrl->setParameter($this, 'details_id', (int) $_GET['crs_id']);
         $ilToolbar->addButton($this->lng->txt('trac_view_crs'), $this->ctrl->getLinkTarget($this, 'details'));
     } elseif ($this->getMode() == self::LP_CONTEXT_PERSONAL_DESKTOP or $this->getMode() == self::LP_CONTEXT_ADMINISTRATION or $this->getMode() == self::LP_CONTEXT_USER_FOLDER) {
         $ilToolbar->addButton($this->lng->txt('trac_view_list'), $this->ctrl->getLinkTarget($this, 'show'));
     }
     $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.lp_progress_container.html', 'Services/Tracking');
     $olp = ilObjectLP::getInstance($this->details_obj_id);
     $collection = $olp->getCollectionInstance();
     include_once "./Services/InfoScreen/classes/class.ilInfoScreenGUI.php";
     $info = new ilInfoScreenGUI($this);
     $info->setFormAction($ilCtrl->getFormAction($this));
     $this->__appendUserInfo($info, $this->tracked_user);
     $this->__showObjectDetails($info, $this->details_obj_id, false);
     // START PATCH RUBRIC CPKN 2016
     include_once './Services/Tracking/classes/rubric/class.ilLPRubricGrade.php';
     include_once './Services/Tracking/classes/rubric/class.ilLPRubricGradeGUI.php';
     //if the user is viewing history show the old status/mark/etc.
     if ($olp->getCurrentMode() == 92 && $_REQUEST['grader_history'] !== 'current' && !is_null($_REQUEST['grader_history'])) {
         $marks = ilLPRubricGrade::_lookupRubricHistoryLP($_REQUEST['grader_history']);
         include_once "./Services/Tracking/classes/class.ilLearningProgressBaseGUI.php";
         $status_path = ilLearningProgressBaseGUI::_getImagePathForStatus($marks['status']);
         $status_text = ilLearningProgressBaseGUI::_getStatusText($marks['status']);
         $info->addSection($this->lng->txt("trac_progress") . ": " . ilObject::_lookupTitle($this->details_obj_id));
         $info->addProperty($this->lng->txt('trac_mode'), $olp->getModeText($olp->getCurrentMode()));
         $info->addProperty($this->lng->txt('trac_status'), ilUtil::img($status_path, $status_text) . " " . $status_text);
         $info->addProperty($this->lng->txt('trac_mark'), $marks['mark']);
         $info->addProperty($this->lng->txt('trac_comment'), $marks['comments']);
     } else {
         $this->__appendLPDetails($info, $this->details_obj_id, $this->tracked_user->getId());
     }
     // END PATCH RUBRIC CPKN 2016
     // Finally set template variable
     $this->tpl->setVariable("LM_INFO", $info->getHTML());
     include_once './Services/Object/classes/class.ilObjectLP.php';
     if ($collection) {
         $obj_ids = array();
         foreach ($collection->getItems() as $item_id) {
             if ($collection instanceof ilLPCollectionOfRepositoryObjects) {
                 $obj_ids[ilObject::_lookupObjectId($item_id)] = array($item_id);
             } else {
                 $obj_ids[] = $item_id;
             }
         }
     }
     // #15247
     if (sizeof($obj_ids)) {
         // seems obsolete
         $personal_only = !$rbacsystem->checkAccess('read_learning_progress', $this->getRefId());
         include_once "./Services/Tracking/classes/repository_statistics/class.ilLPProgressTableGUI.php";
         $lp_table = new ilLPProgressTableGUI($this, "details", $this->tracked_user, $obj_ids, true, $this->details_mode, $personal_only, $this->details_obj_id, $this->details_id);
         $this->tpl->setVariable("LP_OBJECTS", $lp_table->getHTML());
     }
     $this->tpl->setVariable("LEGEND", $this->__getLegendHTML());
     // START PATCH RUBRIC CPKN 2015
     if ($olp->getCurrentMode() == ilLPObjSettings::LP_MODE_RUBRIC) {
         $rubricObj = new ilLPRubricGrade($this->getObjId());
         $rubricGui = new ilLPRubricGradeGUI();
         $a_user = ilObjectFactory::getInstanceByObjId($_SESSION['AccountId']);
         if ($rubricObj->objHasRubric() && $rubricObj->isRubricComplete()) {
             $rubricGui->setUserHistoryId($_REQUEST['grader_history']);
             $rubricGui->setUserHistory($rubricObj->getUserHistory($_SESSION['AccountId']));
             $rubricGui->setRubricData($rubricObj->load());
             $rubricGui->setUserData($rubricObj->getRubricUserGradeData($_SESSION['AccountId'], $_REQUEST['grader_history']));
             $rubricGui->setRubricComment($rubricObj->getRubricComment($_SESSION['AccountId'], $_REQUEST['grader_history']));
             $this->tpl->setVariable("LP_OBJECTS", $rubricGui->getStudentViewHTML($this->ctrl->getFormAction($this), $a_user->getFullname(), $_SESSION['AccountId']));
         }
     }
     // END PATCH RUBRIC CPKN 2015
 }
 /**
  * Build summary item rows for given object and filter(s
  *
  * @param	int		$a_object_id
  * @param	int		$a_ref_id
  */
 function getItems($a_object_id, $a_ref_id)
 {
     global $lng;
     include_once "./Services/Tracking/classes/class.ilTrQuery.php";
     $preselected_obj_ids = $filter = NULL;
     if ($this->is_root) {
         // using search to get all relevant objects
         // #8498/#8499: restrict to objects with at least "edit_learning_progress" access
         $preselected_obj_ids = $this->searchObjects($this->getCurrentFilter(true), "edit_learning_progress");
     } else {
         // using summary filters
         $filter = $this->getCurrentFilter();
     }
     $data = ilTrQuery::getObjectsSummaryForObject($a_object_id, $a_ref_id, ilUtil::stripSlashes($this->getOrderField()), ilUtil::stripSlashes($this->getOrderDirection()), ilUtil::stripSlashes($this->getOffset()), ilUtil::stripSlashes($this->getLimit()), $filter, $this->getSelectedColumns(), $preselected_obj_ids);
     // build status to image map
     include_once "./Services/Tracking/classes/class.ilLearningProgressBaseGUI.php";
     include_once "./Services/Tracking/classes/class.ilLPStatus.php";
     $valid_status = array(ilLPStatus::LP_STATUS_NOT_ATTEMPTED_NUM, ilLPStatus::LP_STATUS_IN_PROGRESS_NUM, ilLPStatus::LP_STATUS_COMPLETED_NUM, ilLPStatus::LP_STATUS_FAILED_NUM);
     $status_map = array();
     foreach ($valid_status as $status) {
         $path = ilLearningProgressBaseGUI::_getImagePathForStatus($status);
         $text = ilLearningProgressBaseGUI::_getStatusText($status);
         $status_map[$status] = ilUtil::img($path, $text);
     }
     // language map
     $lng->loadLanguageModule("meta");
     $languages = array();
     foreach ($lng->getInstalledLanguages() as $lang_key) {
         $languages[$lang_key] = $lng->txt("meta_l_" . $lang_key);
     }
     $rows = array();
     foreach ($data["set"] as $idx => $result) {
         // sessions have no title
         if ($result["title"] == "" && $result["type"] == "sess") {
             include_once "Modules/Session/classes/class.ilObjSession.php";
             $sess = new ilObjSession($result["obj_id"], false);
             $data["set"][$idx]["title"] = $sess->getFirstAppointment()->appointmentToString();
         }
         $data["set"][$idx]["offline"] = ilLearningProgressBaseGUI::isObjectOffline($result["obj_id"], $result["type"]);
         // percentages
         $users_no = $result["user_total"];
         $data["set"][$idx]["country"] = $this->getItemsPercentages($result["country"], $users_no);
         $data["set"][$idx]["gender"] = $this->getItemsPercentages($result["gender"], $users_no, array("m" => $lng->txt("gender_m"), "f" => $lng->txt("gender_f")));
         $data["set"][$idx]["city"] = $this->getItemsPercentages($result["city"], $users_no);
         $data["set"][$idx]["sel_country"] = $this->getItemsPercentages($result["sel_country"], $users_no, $this->getSelCountryCodes());
         $data["set"][$idx]["mark"] = $this->getItemsPercentages($result["mark"], $users_no);
         $data["set"][$idx]["language"] = $this->getItemsPercentages($result["language"], $users_no, $languages);
         // if we encounter any invalid status codes, e.g. null, map them to not attempted instead
         foreach ($result["status"] as $status_code => $status_counter) {
             // null is cast to ""
             if ($status_code === "" || !in_array($status_code, $valid_status)) {
                 $result["status"][ilLPStatus::LP_STATUS_NOT_ATTEMPTED_NUM] += $status_counter;
                 unset($result["status"][$status_code]);
             }
         }
         $data["set"][$idx]["status"] = $this->getItemsPercentagesStatus($result["status"], $users_no, $status_map);
         if (!$this->isPercentageAvailable($result["obj_id"])) {
             $data["set"][$idx]["percentage_avg"] = NULL;
         }
     }
     $this->setMaxCount($data["cnt"]);
     $this->setData($data["set"]);
 }
 function __appendLPDetails(&$info, $item_id, $user_id)
 {
     global $ilObjDataCache;
     $type = $ilObjDataCache->lookupType($item_id);
     // Section learning_progress
     $info->addSection($this->lng->txt('trac_learning_progress'));
     switch ($type) {
         case 'lm':
         case 'htlm':
             include_once 'Services/Tracking/classes/class.ilLearningProgress.php';
             $progress = ilLearningProgress::_getProgress($user_id, $item_id);
             if ($progress['access_time']) {
                 $info->addProperty($this->lng->txt('last_access'), ilDatePresentation::formatDate(new ilDateTime($progress['access_time'], IL_CAL_DATETIME)));
             } else {
                 $info->addProperty($this->lng->txt('last_access'), $this->lng->txt('trac_not_accessed'));
             }
             $info->addProperty($this->lng->txt('trac_visits'), (int) $progress['visits']);
             if ($type == 'lm') {
                 $info->addProperty($this->lng->txt('trac_spent_time'), ilFormat::_secondsToString($progress['spent_seconds']));
             }
             // display status as image
             include_once "./Services/Tracking/classes/class.ilLearningProgressBaseGUI.php";
             $status = $this->__readStatus($item_id, $user_id);
             $status_path = ilLearningProgressBaseGUI::_getImagePathForStatus($status);
             $status_text = ilLearningProgressBaseGUI::_getStatusText($status);
             $info->addProperty($this->lng->txt('trac_status'), ilUtil::img($status_path, $status_text) . " " . $status_text);
             break;
         case 'exc':
         case 'tst':
         case 'crs':
         case 'sahs':
         case 'grp':
             // display status as image
             include_once "./Services/Tracking/classes/class.ilLearningProgressBaseGUI.php";
             $status = $this->__readStatus($item_id, $user_id);
             $status_path = ilLearningProgressBaseGUI::_getImagePathForStatus($status);
             $status_text = ilLearningProgressBaseGUI::_getStatusText($status);
             $info->addProperty($this->lng->txt('trac_status'), ilUtil::img($status_path, $status_text) . " " . $status_text);
             break;
     }
     include_once 'Services/Tracking/classes/class.ilLPMarks.php';
     if (strlen($mark = ilLPMarks::_lookupMark($user_id, $item_id))) {
         $info->addProperty($this->lng->txt('trac_mark'), $mark);
     }
     if (strlen($comment = ilLPMarks::_lookupComment($user_id, $item_id))) {
         $info->addProperty($this->lng->txt('trac_comment'), $comment);
     }
 }
 protected function showtlt()
 {
     global $lng, $ilCtrl, $tpl, $ilUser;
     include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setFormAction($ilCtrl->getFormAction($this, "showtlt"));
     $form->setTitle($lng->txt("learning_progress"));
     $form->setDescription($lng->txt("trac_collection_tlt_learner_info"));
     $coll_items = array();
     include_once './Services/Object/classes/class.ilObjectLP.php';
     $olp = ilObjectLP::getInstance($this->getObjId());
     $collection = $olp->getCollectionInstance();
     if ($collection) {
         $coll_items = $collection->getItems();
         $possible_items = $collection->getPossibleItems($this->getRefId());
         // for titles
     }
     include_once "Services/Tracking/classes/class.ilLPStatusFactory.php";
     $class = ilLPStatusFactory::_getClassById($this->getObjId(), ilLPObjSettings::LP_MODE_COLLECTION_TLT);
     $info = $class::_getStatusInfo($this->getObjId(), true);
     foreach ($coll_items as $item_id) {
         $field = new ilCustomInputGUI($possible_items[$item_id]["title"]);
         // lp status
         $status = ilLPStatus::LP_STATUS_NOT_ATTEMPTED_NUM;
         if (isset($info["completed"][$item_id]) && in_array($ilUser->getId(), $info["completed"][$item_id])) {
             $status = ilLPStatus::LP_STATUS_COMPLETED_NUM;
         } else {
             if (isset($info["in_progress"][$item_id]) && in_array($ilUser->getId(), $info["in_progress"][$item_id])) {
                 $status = ilLPStatus::LP_STATUS_IN_PROGRESS_NUM;
             }
         }
         $path = ilLearningProgressBaseGUI::_getImagePathForStatus($status);
         $text = ilLearningProgressBaseGUI::_getStatusText($status);
         $field->setHtml(ilUtil::img($path, $text));
         // stats
         $spent = 0;
         if (isset($info["tlt_users"][$item_id][$ilUser->getId()])) {
             $spent = $info["tlt_users"][$item_id][$ilUser->getId()];
         }
         $needed = $info["tlt"][$item_id];
         if ($needed) {
             $field->setInfo(sprintf($lng->txt("trac_collection_tlt_learner_subitem"), ilFormat::_secondsToString($spent), ilFormat::_secondsToString($needed), min(100, round(abs($spent) / $needed * 100))));
         }
         $form->addItem($field);
     }
     $tpl->setContent($form->getHTML());
 }
Exemplo n.º 14
0
 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();
     }
 }
Exemplo n.º 15
0
 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();
     }
 }