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.º 2
0
 function showLearningProgress($a_tpl)
 {
     global $ilUser, $rbacsystem;
     if (!$rbacsystem->checkAccess('read', $this->gui_object->object->getRefId())) {
         return false;
     }
     if ($ilUser->getId() == ANONYMOUS_USER_ID) {
         return false;
     }
     include_once "Services/Tracking/classes/class.ilObjUserTracking.php";
     if (!ilObjUserTracking::_enabledLearningProgress() and $ilUser->getId() != ANONYMOUS_USER_ID) {
         return false;
     }
     include_once './Services/Object/classes/class.ilObjectLP.php';
     $olp = ilObjectLP::getInstance($this->gui_object->object->getId());
     if ($olp->getCurrentMode() != ilLPObjSettings::LP_MODE_MANUAL) {
         return false;
     }
     include_once 'Services/Tracking/classes/class.ilLPMarks.php';
     $this->lng->loadLanguageModule('trac');
     // section header
     //		$a_tpl->setCurrentBlock("header_row");
     $a_tpl->setVariable("TXT_SECTION", $this->lng->txt('learning_progress'));
     $a_tpl->parseCurrentBlock();
     // $a_tpl->touchBlock("row");
     // status
     $i_tpl = new ilTemplate("tpl.lp_edit_manual_info_page.html", true, true, "Services/Tracking");
     $i_tpl->setVariable("INFO_EDITED", $this->lng->txt("trac_info_edited"));
     $i_tpl->setVariable("SELECT_STATUS", ilUtil::formSelect((int) ilLPMarks::_hasCompleted($ilUser->getId(), $this->gui_object->object->getId()), 'lp_edit', array(0 => $this->lng->txt('trac_not_completed'), 1 => $this->lng->txt('trac_completed')), false, true));
     $i_tpl->setVariable("TXT_SAVE", $this->lng->txt("save"));
     $a_tpl->setCurrentBlock("pv");
     $a_tpl->setVariable("TXT_PROPERTY_VALUE", $i_tpl->get());
     $a_tpl->parseCurrentBlock();
     $a_tpl->setCurrentBlock("property_row");
     $a_tpl->setVariable("TXT_PROPERTY", $this->lng->txt('trac_status'));
     $a_tpl->parseCurrentBlock();
     // $a_tpl->touchBlock("row");
     // More infos for lm's
     if ($this->gui_object->object->getType() == 'lm' || $this->gui_object->object->getType() == 'htlm') {
         $a_tpl->setCurrentBlock("pv");
         include_once 'Services/Tracking/classes/class.ilLearningProgress.php';
         $progress = ilLearningProgress::_getProgress($ilUser->getId(), $this->gui_object->object->getId());
         if ($progress['access_time']) {
             $a_tpl->setVariable("TXT_PROPERTY_VALUE", ilDatePresentation::formatDate(new ilDateTime($progress['access_time'], IL_CAL_DATETIME)));
         } else {
             $a_tpl->setVariable("TXT_PROPERTY_VALUE", $this->lng->txt('trac_not_accessed'));
         }
         $a_tpl->parseCurrentBlock();
         $a_tpl->setCurrentBlock("property_row");
         $a_tpl->setVariable("TXT_PROPERTY", $this->lng->txt('trac_last_access'));
         $a_tpl->parseCurrentBlock();
         // $a_tpl->touchBlock("row");
         // tags of all users
         $a_tpl->setCurrentBlock("pv");
         $a_tpl->setVariable("TXT_PROPERTY_VALUE", (int) $progress['visits']);
         $a_tpl->parseCurrentBlock();
         $a_tpl->setCurrentBlock("property_row");
         $a_tpl->setVariable("TXT_PROPERTY", $this->lng->txt('trac_visits'));
         $a_tpl->parseCurrentBlock();
         // $a_tpl->touchBlock("row");
         if ($this->gui_object->object->getType() == 'lm') {
             // tags of all users
             $a_tpl->setCurrentBlock("pv");
             $a_tpl->setVariable("TXT_PROPERTY_VALUE", ilFormat::_secondsToString($progress['spent_seconds']));
             $a_tpl->parseCurrentBlock();
             $a_tpl->setCurrentBlock("property_row");
             $a_tpl->setVariable("TXT_PROPERTY", $this->lng->txt('trac_spent_time'));
             $a_tpl->parseCurrentBlock();
             // $a_tpl->touchBlock("row");
         }
     }
     // #10493
     $a_tpl->touchBlock("row");
 }
 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);
     }
 }