コード例 #1
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");
 }