function showLearningModule() { global $ilUser; // Note license usage include_once "Services/License/classes/class.ilLicense.php"; ilLicense::_noteAccess($this->object->getId(), $this->object->getType(), $this->object->getRefId()); // #9483 if ($ilUser->getId() != ANONYMOUS_USER_ID) { include_once "Services/Tracking/classes/class.ilLearningProgress.php"; ilLearningProgress::_tracProgress($ilUser->getId(), $this->object->getId(), $this->object->getRefId(), "htlm"); } require_once "./Modules/HTMLLearningModule/classes/class.ilObjFileBasedLMAccess.php"; $startfile = ilObjFileBasedLMAccess::_determineStartUrl($this->object->getId()); if ($startfile != "") { ilUtil::redirect($startfile); } }
/** * Show overview of assignments */ function showOverviewObject() { global $tpl, $ilTabs, $ilUser, $ilToolbar; $this->checkPermission("read"); include_once "./Services/Tracking/classes/class.ilLearningProgress.php"; ilLearningProgress::_tracProgress($ilUser->getId(), $this->object->getId(), $this->object->getRefId(), 'exc'); $ilTabs->activateTab("content"); $this->addContentSubTabs("content"); // show certificate? if ($this->object->hasUserCertificate($ilUser->getId())) { include_once "./Modules/Exercise/classes/class.ilExerciseCertificateAdapter.php"; include_once "./Services/Certificate/classes/class.ilCertificate.php"; $adapter = new ilExerciseCertificateAdapter($this->object); if (ilCertificate::_isComplete($adapter)) { $ilToolbar->addButton($this->lng->txt("certificate"), $this->ctrl->getLinkTarget($this, "outCertificate")); } } include_once "./Modules/Exercise/classes/class.ilExAssignment.php"; include_once "./Services/Accordion/classes/class.ilAccordionGUI.php"; $acc = new ilAccordionGUI(); $acc->setId("exc_ow_" . $this->object->getId()); $ass_data = ilExAssignment::getAssignmentDataOfExercise($this->object->getId()); include_once "./Modules/Exercise/classes/class.ilExAssignmentGUI.php"; $ass_gui = new ilExAssignmentGUI($this->object); foreach ($ass_data as $ass) { // incoming assignment deeplink $force_open = false; if (isset($_GET["ass_id_goto"]) && (int) $_GET["ass_id_goto"] == $ass["id"]) { $force_open = true; } $acc->addItem($ass_gui->getOverviewHeader($ass), $ass_gui->getOverviewBody($ass), $force_open); } if (count($ass_data) < 2) { $acc->setBehaviour("FirstOpen"); } else { $acc->setUseSessionStorage(true); } $tpl->setContent($acc->getHTML()); }
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); } }
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 saveToDb() { global $ilDB, $ilLog; $submitted = $this->isSubmitted() ? 1 : 0; if ($this->active_id > 0) { $affectedRows = $ilDB->update('tst_active', array('lastindex' => array('integer', $this->getLastSequence()), 'tries' => array('integer', $this->getPass()), 'submitted' => array('integer', $submitted), 'submittimestamp' => array('timestamp', strlen($this->getSubmittedTimestamp()) ? $this->getSubmittedTimestamp() : NULL), 'tstamp' => array('integer', time() - 10), 'taxfilter' => array('text', serialize($this->getQuestionSetFilterSelection()->getTaxonomySelection())), 'answerstatusfilter' => array('text', $this->getQuestionSetFilterSelection()->getAnswerStatusSelection())), array('active_id' => array('integer', $this->getActiveId()))); // update learning progress include_once "./Modules/Test/classes/class.ilObjTestAccess.php"; include_once "./Services/Tracking/classes/class.ilLPStatusWrapper.php"; ilLPStatusWrapper::_updateStatus(ilObjTestAccess::_lookupObjIdForTestId($this->getTestId()), ilObjTestAccess::_getParticipantId($this->getActiveId())); } else { if (!$this->activeIDExists($this->getUserId(), $this->getTestId())) { $anonymous_id = $this->getAnonymousId() ? $this->getAnonymousId() : NULL; $next_id = $ilDB->nextId('tst_active'); $affectedRows = $ilDB->insert('tst_active', array('active_id' => array('integer', $next_id), 'user_fi' => array('integer', $this->getUserId()), 'anonymous_id' => array('text', $anonymous_id), 'test_fi' => array('integer', $this->getTestId()), 'lastindex' => array('integer', $this->getLastSequence()), 'tries' => array('integer', $this->getPass()), 'submitted' => array('integer', $submitted), 'submittimestamp' => array('timestamp', strlen($this->getSubmittedTimestamp()) ? $this->getSubmittedTimestamp() : NULL), 'tstamp' => array('integer', time() - 10), 'taxfilter' => array('text', serialize($this->getQuestionSetFilterSelection()->getTaxonomySelection())), 'answerstatusfilter' => array('text', $this->getQuestionSetFilterSelection()->getAnswerStatusSelection()))); $this->active_id = $next_id; // update learning progress include_once "./Modules/Test/classes/class.ilObjTestAccess.php"; include_once "./Services/Tracking/classes/class.ilLPStatusWrapper.php"; ilLPStatusWrapper::_updateStatus(ilObjTestAccess::_lookupObjIdForTestId($this->getTestId()), $this->getUserId()); } } include_once "./Services/Tracking/classes/class.ilLearningProgress.php"; ilLearningProgress::_tracProgress($this->getUserId(), ilObjTestAccess::_lookupObjIdForTestId($this->getTestId()), $this->getRefId(), 'tst'); }
/** * process <ilPage> content tag * * @param object page node * @param integer footer/header page id */ function ilPage(&$a_page_node, $a_page_id = 0) { global $ilUser; if (($ilUser->getId() == ANONYMOUS_USER_ID || $this->needs_to_be_purchased) && $this->lm_gui->object->getPublicAccessMode() == 'selected') { $public = ilLMObject::_isPagePublic($this->getCurrentPageId()); if (!$public) { return $this->showNoPublicAccess($this->getCurrentPageId()); } } if (!ilObjContentObject::_checkPreconditionsOfPage($this->lm->getRefId(), $this->lm->getId(), $this->getCurrentPageId())) { return $this->showPreconditionsOfPage($this->getCurrentPageId()); } require_once "./Modules/LearningModule/classes/class.ilLMPageGUI.php"; require_once "./Modules/LearningModule/classes/class.ilLMPageObject.php"; // page id is e.g. > 0 when footer or header page is processed if ($a_page_id == 0) { $page_id = $this->getCurrentPageId(); //echo ":".$page_id.":"; // highlighting? if ($_GET["srcstring"] != "" && !$this->offlineMode()) { include_once './Services/Search/classes/class.ilUserSearchCache.php'; $cache = ilUserSearchCache::_getInstance($ilUser->getId()); $cache->switchSearchType(ilUserSearchCache::LAST_QUERY); $search_string = $cache->getQuery(); include_once "./Services/UIComponent/TextHighlighter/classes/class.ilTextHighlighterGUI.php"; include_once "./Services/Search/classes/class.ilQueryParser.php"; $p = new ilQueryParser($search_string); $p->parse(); $words = $p->getQuotedWords(); if (is_array($words)) { foreach ($words as $w) { ilTextHighlighterGUI::highlight("ilLMPageContent", $w, $this->tpl); } } $this->fill_on_load_code = true; } } else { $page_id = $a_page_id; } // content style $this->tpl->setCurrentBlock("ContentStyle"); if (!$this->offlineMode()) { $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", ilObjStyleSheet::getContentStylePath($this->lm->getStyleSheetId())); } else { $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", "content_style/content.css"); } $this->tpl->parseCurrentBlock(); // no active page found in chapter if ($this->chapter_has_no_active_page && ilLMObject::_lookupType($_GET["obj_id"]) == "st") { $mtpl = new ilTemplate("tpl.no_content_message.html", true, true, "Modules/LearningModule"); $mtpl->setVariable("MESSAGE", $this->lng->txt("cont_no_page_in_chapter")); //$mtpl->setVariable("SRC_ICON", ilUtil::getImagePath("icon_st.png", // false, "output", $this->offlineMode())); $mtpl->setVariable("ITEM_TITLE", ilLMObject::_lookupTitle($_GET["obj_id"])); $this->tpl->setVariable("PAGE_CONTENT", $mtpl->get()); return $mtpl->get(); } // current page is deactivated if ($this->deactivated_page) { $mtpl = new ilTemplate("tpl.no_content_message.html", true, true, "Modules/LearningModule"); $m = $this->lng->txt("cont_page_currently_deactivated"); $act_data = ilLMPage::_lookupActivationData((int) $_GET["obj_id"], $this->lm->getType()); if ($act_data["show_activation_info"] && ilUtil::now() < $act_data["activation_start"]) { $m .= "<p>" . sprintf($this->lng->txt("cont_page_activation_on"), ilDatePresentation::formatDate(new ilDateTime($act_data["activation_start"], IL_CAL_DATETIME))) . "</p>"; } $mtpl->setVariable("MESSAGE", $m); //$mtpl->setVariable("SRC_ICON", ilUtil::getImagePath("icon_pg.png", // false, "output", $this->offlineMode())); $mtpl->setVariable("ITEM_TITLE", ilLMObject::_lookupTitle($_GET["obj_id"])); $this->tpl->setVariable("PAGE_CONTENT", $mtpl->get()); return $mtpl->get(); } // no page found if ($page_id == 0) { $cont = $this->lng->txt("cont_no_page"); $this->tpl->setVariable("PAGE_CONTENT", $cont); return $cont; } $page_object_gui = $this->getLMPageGUI($page_id); $this->basicPageGuiInit($page_object_gui); $page_object = $page_object_gui->getPageObject(); $page_object->buildDom(); $page_object->registerOfflineHandler($this); $int_links = $page_object->getInternalLinks(); $page_object_gui->setTemplateOutput(false); // Update personal desktop items $ilUser->setDesktopItemParameters($this->lm->getRefId(), $this->lm->getType(), $page_id); // Update course items include_once './Modules/Course/classes/class.ilCourseLMHistory.php'; ilCourseLMHistory::_updateLastAccess($ilUser->getId(), $this->lm->getRefId(), $page_id); // read link targets $link_xml = $this->getLinkXML($int_links, $this->getLayoutLinkTargets()); $link_xml .= $this->getLinkTargetsXML(); //echo htmlentities($link_xml); // get lm page object $lm_pg_obj = new ilLMPageObject($this->lm, $page_id); $lm_pg_obj->setLMId($this->lm->getId()); //$pg_obj->setParentId($this->lm->getId()); $page_object_gui->setLinkXML($link_xml); // determine target frames for internal links //$pg_frame = $_GET["frame"]; $page_object_gui->setLinkFrame($_GET["frame"]); // page title and tracking (not for header or footer page) if ($page_id == 0 || $page_id != $this->lm->getHeaderPage() && $page_id != $this->lm->getFooterPage()) { $page_object_gui->setPresentationTitle(ilLMPageObject::_getPresentationTitle($lm_pg_obj->getId(), $this->lm->getPageHeader(), $this->lm->isActiveNumbering(), $this->lm_set->get("time_scheduled_page_activation"))); // update learning progress if ($ilUser->getId() != ANONYMOUS_USER_ID) { // #9483 include_once "./Services/Tracking/classes/class.ilLearningProgress.php"; ilLearningProgress::_tracProgress($ilUser->getId(), $this->lm->getId(), $this->lm->getRefId(), $this->lm->getType()); // obsolete? include_once "./Services/Tracking/classes/class.ilLPStatusWrapper.php"; ilLPStatusWrapper::_updateStatus($this->lm->getId(), $ilUser->getId()); } } else { $page_object_gui->setEnabledPageFocus(false); $page_object_gui->getPageConfig()->setEnableSelfAssessment(false); } // ADDED FOR CITATION $page_object_gui->setLinkParams("ref_id=" . $this->lm->getRefId()); $page_object_gui->setTemplateTargetVar("PAGE_CONTENT"); $page_object_gui->setSourcecodeDownloadScript($this->getSourcecodeDownloadLink()); // syntax style $this->tpl->setCurrentBlock("SyntaxStyle"); if (!$this->offlineMode()) { $this->tpl->setVariable("LOCATION_SYNTAX_STYLESHEET", ilObjStyleSheet::getSyntaxStylePath()); } else { $this->tpl->setVariable("LOCATION_SYNTAX_STYLESHEET", "syntaxhighlight.css"); } $this->tpl->parseCurrentBlock(); $ret = $page_object_gui->presentation($page_object_gui->getOutputMode()); // process header if ($this->lm->getHeaderPage() > 0 && $page_id != $this->lm->getHeaderPage() && ($page_id == 0 || $page_id != $this->lm->getFooterPage())) { if (ilLMObject::_exists($this->lm->getHeaderPage())) { $head = $this->ilPage($a_page_node, $this->lm->getHeaderPage()); } } // process footer if ($this->lm->getFooterPage() > 0 && $page_id != $this->lm->getFooterPage() && ($page_id == 0 || $page_id != $this->lm->getHeaderPage())) { if (ilLMObject::_exists($this->lm->getFooterPage())) { $foot = $this->ilPage($a_page_node, $this->lm->getFooterPage()); } } $this->tpl->setVariable("PAGE_CONTENT", $head . $ret . $foot); //echo htmlentities("-".$ret."-"); return $head . $ret . $foot; }
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); } }
/** * Track access to lm page * * @param int $a_page_id page id */ function trackAccess($a_page_id) { if ($this->lm_ref_id == 0) { die("ilLMTracker: No Ref Id given."); } // track page and chapter access $this->trackPageAndChapterAccess($a_page_id); // track last page access (must be done after calling trackPageAndChapterAccess()) $this->trackLastPageAccess($this->user_id, $this->lm_ref_id, $a_page_id); // #9483 // general learning module lp tracking include_once "./Services/Tracking/classes/class.ilLearningProgress.php"; ilLearningProgress::_tracProgress($this->user_id, $this->lm_obj_id, $this->lm_ref_id, "lm"); // obsolete? include_once "./Services/Tracking/classes/class.ilLPStatusWrapper.php"; ilLPStatusWrapper::_updateStatus($this->lm_obj_id, $this->user_id); // mark currently loaded data as dirty to force reload if necessary $this->dirty = true; }
function fetchPrintMemberData($a_members) { global $ilAccess, $lng; $lng->loadLanguageModule('trac'); #$is_admin = (bool) $ilAccess->checkAccess("write",'',$this->object->getRefId()); $is_admin = true; include_once './Services/PrivacySecurity/classes/class.ilPrivacySettings.php'; $privacy = ilPrivacySettings::_getInstance(); if ($privacy->enabledCourseAccessTimes()) { include_once './Services/Tracking/classes/class.ilLearningProgress.php'; $progress = ilLearningProgress::_lookupProgressByObjId($this->object->getId()); } if ($this->show_tracking) { include_once 'Services/Tracking/classes/class.ilLPStatusWrapper.php'; $completed = ilLPStatusWrapper::_lookupCompletedForObject($this->object->getId()); $in_progress = ilLPStatusWrapper::_lookupInProgressForObject($this->object->getId()); $failed = ilLPStatusWrapper::_lookupFailedForObject($this->object->getId()); } foreach ($a_members as $member_id) { // GET USER OBJ if ($tmp_obj = ilObjectFactory::getInstanceByObjId($member_id, false)) { $print_member[$member_id]['login'] = $tmp_obj->getLogin(); $print_member[$member_id]['name'] = $tmp_obj->getLastname() . ', ' . $tmp_obj->getFirstname(); if ($this->object->getMembersObject()->isAdmin($member_id)) { $print_member[$member_id]['role'] = $this->lng->txt("il_crs_admin"); } elseif ($this->object->getMembersObject()->isTutor($member_id)) { $print_member[$member_id]['role'] = $this->lng->txt("il_crs_tutor"); } elseif ($this->object->getMembersObject()->isMember($member_id)) { $print_member[$member_id]['role'] = $this->lng->txt("il_crs_member"); } if ($this->object->getMembersObject()->isAdmin($member_id) or $this->object->getMembersObject()->isTutor($member_id)) { if ($this->object->getMembersObject()->isNotificationEnabled($member_id)) { $print_member[$member_id]['status'] = $this->lng->txt("crs_notify"); } else { $print_member[$member_id]['status'] = $this->lng->txt("crs_no_notify"); } } else { if ($this->object->getMembersObject()->isBlocked($member_id)) { $print_member[$member_id]['status'] = $this->lng->txt("crs_blocked"); } else { $print_member[$member_id]['status'] = $this->lng->txt("crs_unblocked"); } } if ($is_admin) { $print_member[$member_id]['passed'] = $this->object->getMembersObject()->hasPassed($member_id) ? $this->lng->txt('crs_member_passed') : $this->lng->txt('crs_member_not_passed'); } if ($privacy->enabledCourseAccessTimes()) { if (isset($progress[$member_id]['ts']) and $progress[$member_id]['ts']) { ilDatePresentation::setUseRelativeDates(false); $print_member[$member_id]['access'] = ilDatePresentation::formatDate(new ilDateTime($progress[$member_id]['ts'], IL_CAL_UNIX)); ilDatePresentation::setUseRelativeDates(true); } else { $print_member[$member_id]['access'] = $this->lng->txt('no_date'); } } if ($this->show_tracking) { if (in_array($member_id, $completed)) { $print_member[$member_id]['progress'] = $this->lng->txt(ilLPStatus::LP_STATUS_COMPLETED); } elseif (in_array($member_id, $in_progress)) { $print_member[$member_id]['progress'] = $this->lng->txt(ilLPStatus::LP_STATUS_IN_PROGRESS); } elseif (in_array($member_id, $failed)) { $print_member[$member_id]['progress'] = $this->lng->txt(ilLPStatus::LP_STATUS_FAILED); } else { $print_member[$member_id]['progress'] = $this->lng->txt(ilLPStatus::LP_STATUS_NOT_ATTEMPTED); } } } } switch ($_SESSION['crs_print_sort']) { case 'progress': return ilUtil::sortArray($print_member, 'progress', $_SESSION['crs_print_order'], false, true); case 'access_time': return ilUtil::sortArray($print_member, 'access', $_SESSION['crs_print_order'], false, true); case 'lastname': return ilUtil::sortArray($print_member, 'name', $_SESSION['crs_print_order'], false, true); case 'login': return ilUtil::sortArray($print_member, 'login', $_SESSION['crs_print_order'], false, true); case 'passed': return ilUtil::sortArray($print_member, 'passed', $_SESSION['crs_print_order'], false, true); case 'blocked': case 'notification': return ilUtil::sortArray($print_member, 'status', $_SESSION['crs_print_order'], false, true); default: return ilUtil::sortArray($print_member, 'name', $_SESSION['crs_print_order'], false, true); } }
protected function readMemberData($ids, $role = 'admin') { include_once './Services/PrivacySecurity/classes/class.ilPrivacySettings.php'; $privacy = ilPrivacySettings::_getInstance(); if ($this->show_tracking) { include_once 'Services/Tracking/classes/class.ilLPStatusWrapper.php'; $completed = ilLPStatusWrapper::_lookupCompletedForObject($this->object->getId()); $in_progress = ilLPStatusWrapper::_lookupInProgressForObject($this->object->getId()); $failed = ilLPStatusWrapper::_lookupFailedForObject($this->object->getId()); } if ($privacy->enabledGroupAccessTimes()) { include_once './Services/Tracking/classes/class.ilLearningProgress.php'; $progress = ilLearningProgress::_lookupProgressByObjId($this->object->getId()); } foreach ($ids as $usr_id) { $name = ilObjUser::_lookupName($usr_id); $tmp_data['firstname'] = $name['firstname']; $tmp_data['lastname'] = $name['lastname']; $tmp_data['login'] = ilObjUser::_lookupLogin($usr_id); $tmp_data['notification'] = $this->object->members_obj->isNotificationEnabled($usr_id) ? 1 : 0; $tmp_data['usr_id'] = $usr_id; $tmp_data['login'] = ilObjUser::_lookupLogin($usr_id); if ($this->show_tracking) { if (in_array($usr_id, $completed)) { $tmp_data['progress'] = LP_STATUS_COMPLETED; } elseif (in_array($usr_id, $in_progress)) { $tmp_data['progress'] = LP_STATUS_IN_PROGRESS; } elseif (in_array($usr_id, $failed)) { $tmp_data['progress'] = LP_STATUS_FAILED; } else { $tmp_data['progress'] = LP_STATUS_NOT_ATTEMPTED; } } if ($privacy->enabledGroupAccessTimes()) { if (isset($progress[$usr_id]['ts']) and $progress[$usr_id]['ts']) { $tmp_data['access_time'] = ilDatePresentation::formatDate($tmp_date = new ilDateTime($progress[$usr_id]['ts'], IL_CAL_UNIX)); $tmp_data['access_time_unix'] = $tmp_date->get(IL_CAL_UNIX); } else { $tmp_data['access_time'] = $this->lng->txt('no_date'); $tmp_data['access_time_unix'] = 0; } } $members[$usr_id] = $tmp_data; } return $members ? $members : array(); }
function saveToDb() { global $ilDB, $ilLog; $submitted = $this->isSubmitted() ? 1 : 0; if ($this->active_id > 0) { $affectedRows = $ilDB->manipulateF("UPDATE tst_active SET lastindex = %s, tries = %s, submitted = %s, submittimestamp = %s, tstamp = %s WHERE active_id = %s", array('integer', 'integer', 'integer', 'timestamp', 'integer', 'integer'), array($this->getLastSequence(), $this->getPass(), $submitted, strlen($this->getSubmittedTimestamp()) ? $this->getSubmittedTimestamp() : NULL, time() - 10, $this->getActiveId())); // update learning progress include_once "./Modules/Test/classes/class.ilObjTestAccess.php"; include_once "./Services/Tracking/classes/class.ilLPStatusWrapper.php"; ilLPStatusWrapper::_updateStatus(ilObjTestAccess::_lookupObjIdForTestId($this->getTestId()), ilObjTestAccess::_getParticipantId($this->getActiveId())); } else { if (!$this->activeIDExists($this->getUserId(), $this->getTestId())) { $anonymous_id = $this->getAnonymousId() ? $this->getAnonymousId() : NULL; $next_id = $ilDB->nextId('tst_active'); $affectedRows = $ilDB->manipulateF("INSERT INTO tst_active (active_id, user_fi, anonymous_id, test_fi, lastindex, tries, submitted, submittimestamp, tstamp) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s)", array('integer', 'integer', 'text', 'integer', 'integer', 'integer', 'integer', 'timestamp', 'integer'), array($next_id, $this->getUserId(), $anonymous_id, $this->getTestId(), $this->getLastSequence(), $this->getPass(), $submitted, strlen($this->getSubmittedTimestamp()) ? $this->getSubmittedTimestamp() : NULL, time() - 10)); $this->active_id = $next_id; // update learning progress include_once "./Modules/Test/classes/class.ilObjTestAccess.php"; include_once "./Services/Tracking/classes/class.ilLPStatusWrapper.php"; ilLPStatusWrapper::_updateStatus(ilObjTestAccess::_lookupObjIdForTestId($this->getTestId()), $this->getUserId()); } } include_once "./Services/Tracking/classes/class.ilLearningProgress.php"; ilLearningProgress::_tracProgress($this->getUserId(), ilObjTestAccess::_lookupObjIdForTestId($this->getTestId()), $this->getRefId(), 'tst'); }