예제 #1
0
 /**
  * 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());
 }
 /**
  * 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 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);
     }
 }
 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');
 }
예제 #5
0
 /**
  * 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;
 }
예제 #6
0
 function viewObject()
 {
     global $rbacsystem, $ilUser, $ilCtrl;
     // CHECK ACCESS
     $this->checkPermission('read', 'view');
     /*
     if(!$rbacsystem->checkAccess("read",$this->object->getRefId()))
     {
     	$this->ilias->raiseError($this->lng->txt("msg_no_perm_read"),$this->ilias->error_obj->MESSAGE);
     }
     */
     if (strtolower($_GET["baseClass"]) == "iladministrationgui") {
         parent::viewObject();
         return true;
     }
     // Fill meta header tags
     include_once 'Services/MetaData/classes/class.ilMDUtils.php';
     ilMDUtils::_fillHTMLMetaTags($this->object->getId(), $this->object->getId(), 'crs');
     // Trac access
     if ($ilCtrl->getNextClass() != "ilcolumngui") {
         include_once 'Services/Tracking/classes/class.ilLearningProgress.php';
         ilLearningProgress::_tracProgress($ilUser->getId(), $this->object->getId(), $this->object->getRefId(), 'crs');
     }
     if (!$this->checkAgreement()) {
         include_once 'Services/Membership/classes/class.ilMemberAgreementGUI.php';
         $this->tabs_gui->clearTargets();
         $this->ctrl->setReturn($this, 'view_content');
         $agreement = new ilMemberAgreementGUI($this->object->getRefId());
         $this->ctrl->setCmdClass(get_class($agreement));
         $this->ctrl->forwardCommand($agreement);
         return true;
     }
     if (!$this->__checkStartObjects()) {
         include_once "Services/Container/classes/class.ilContainerStartObjectsContentGUI.php";
         $stgui = new ilContainerStartObjectsContentGUI($this->object);
         $stgui->enableDesktop($this->object->getAboStatus(), $this);
         return $stgui->getHTML();
     }
     // views handled by general container logic
     if ($this->object->getViewMode() == ilContainer::VIEW_SIMPLE || $this->object->getViewMode() == ilContainer::VIEW_BY_TYPE || $this->object->getViewMode() == ilContainer::VIEW_SESSIONS || $this->object->getViewMode() == ilContainer::VIEW_TIMING || $this->object->getViewMode() == ilContainer::VIEW_OBJECTIVE) {
         $ret = parent::renderObject();
         return $ret;
     } else {
         include_once './Modules/Course/classes/class.ilCourseContentGUI.php';
         $course_content_obj = new ilCourseContentGUI($this);
         $this->ctrl->setCmdClass(get_class($course_content_obj));
         $this->ctrl->forwardCommand($course_content_obj);
     }
     return true;
 }
 function viewObject()
 {
     global $tree, $rbacsystem, $ilUser;
     include_once 'Services/Tracking/classes/class.ilLearningProgress.php';
     ilLearningProgress::_tracProgress($ilUser->getId(), $this->object->getId(), $this->object->getRefId(), 'grp');
     if (strtolower($_GET["baseClass"]) == "iladministrationgui") {
         parent::viewObject();
         return true;
     }
     if (!$this->checkAgreement()) {
         include_once 'Services/Membership/classes/class.ilMemberAgreementGUI.php';
         $this->tabs_gui->setTabActive('view_content');
         $this->ctrl->setReturn($this, 'view');
         $agreement = new ilMemberAgreementGUI($this->object->getRefId());
         $this->ctrl->setCmdClass(get_class($agreement));
         $this->ctrl->forwardCommand($agreement);
         return true;
     }
     $this->tabs_gui->setTabActive('view_content');
     $this->renderObject();
 }
 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');
 }