/** * Constructor * @param type $a_parent_obj * @param type $a_parent_cmd * @param type $a_template_context */ public function __construct($a_parent_obj_gui, $a_parent_obj, $a_parent_cmd) { $this->parent_container = $a_parent_obj; $this->setId('lomemtstres_' . $a_parent_obj->getId()); parent::__construct($a_parent_obj_gui, $a_parent_cmd); $this->settings = ilLOSettings::getInstanceByObjId($a_parent_obj->getId()); }
protected function resetCustomLPDataForUserIds(array $a_user_ids, $a_recursive = true) { /* @var ilObjTest $testOBJ */ require_once 'Services/Object/classes/class.ilObjectFactory.php'; $testOBJ = ilObjectFactory::getInstanceByObjId($this->obj_id); $testOBJ->removeTestResults($a_user_ids); // :TODO: there has to be a better way $test_ref_id = (int) $_REQUEST["ref_id"]; if ($test_ref_id) { require_once "Modules/Course/classes/Objectives/class.ilLOSettings.php"; $course_obj_id = ilLOSettings::isObjectiveTest($test_ref_id); if ($course_obj_id) { // is test initial and/or qualified? $lo_settings = ilLOSettings::getInstanceByObjId($course_obj_id); $is_i = $lo_settings->getInitialTest() == $test_ref_id; $is_q = $lo_settings->getQualifiedTest() == $test_ref_id; // remove objective results data require_once "Modules/Course/classes/Objectives/class.ilLOUserResults.php"; ilLOUserResults::deleteResultsFromLP($course_obj_id, $a_user_ids, $is_i, $is_q); // refresh LP - see ilLPStatusWrapper::_updateStatus() require_once "Services/Tracking/classes/class.ilLPStatusFactory.php"; $lp_status = ilLPStatusFactory::_getInstance($course_obj_id); if (strtolower(get_class($lp_status)) != "illpstatus") { foreach ($a_user_ids as $user_id) { $lp_status->_updateStatus($course_obj_id, $user_id); } } } } }
/** * Constructor * @param type $a_container_id */ public function __construct($a_container_id) { $this->container_id = $a_container_id; include_once './Modules/Course/classes/Objectives/class.ilLOSettings.php'; $this->settings = ilLOSettings::getInstanceByObjId($a_container_id); $this->readTestAssignments(); }
/** * Constructor * @param ilObject $a_parent_obj * @param type $a_parent_cmd * @param type $a_test_type */ public function __construct($a_parent_obj, $a_parent_cmd, $a_container_id, $a_test_type) { $this->test_type = $a_test_type; $this->setId('obj_loc_' . $a_container_id); parent::__construct($a_parent_obj, $a_parent_cmd); $this->settings = ilLOSettings::getInstanceByObjId($a_container_id); }
/** * * @param type $a_user_id * @param type $a_course_id */ public function __construct($a_user_id, $a_course_id) { $this->user_id = $a_user_id; $this->container_id = $a_course_id; $this->settings = ilLOSettings::getInstanceByObjId($this->container_id); $this->assignments = ilLOTestAssignments::getInstance($this->container_id); }
/** * Constructor */ public function __construct($gui, ilObject $a_container_obj, $a_type) { $this->lng = $GLOBALS['lng']; $this->ctrl = $GLOBALS['ilCtrl']; $this->gui = $gui; $this->container = $a_container_obj; $this->settings = ilLOSettings::getInstanceByObjId($this->getContainer()->getId()); $this->type = $a_type; }
/** * * @param type $a_container_id * @param type $a_objective_id * @param type $a_passes * @return boolean */ public static function lookupMaxAttempts($a_container_id, $a_objective_id) { include_once './Modules/Course/classes/Objectives/class.ilLOSettings.php'; $settings = ilLOSettings::getInstanceByObjId($a_container_id); if ($settings->isGeneralQualifiedTestVisible()) { return 0; } include_once './Modules/Course/classes/class.ilCourseObjective.php'; $max_passes = ilCourseObjective::lookupMaxPasses($a_objective_id); return (int) $max_passes; }
/** * Constructor * @param ilObject $a_parent_obj * @param type $a_parent_cmd * @param type $a_test_type */ public function __construct($a_parent_obj, $a_parent_cmd, $a_container_id, $a_test_type, $a_assignment_type = self::TYPE_SINGLE_ASSIGNMENTS) { $this->test_type = $a_test_type; $this->assignment_type = $a_assignment_type; $this->container_id = $a_container_id; $this->setId('obj_loc_' . $a_container_id); parent::__construct($a_parent_obj, $a_parent_cmd); $this->settings = ilLOSettings::getInstanceByObjId($a_container_id); $this->initTitle(); $this->setTopCommands(FALSE); }
/** * Constructor * * @access public * @param object parent gui object * @return */ public function __construct($a_parent_obj, $a_course_obj) { global $lng, $ilCtrl; $this->course_obj = $a_course_obj; // begin-patch lok $this->settings = ilLOSettings::getInstanceByObjId($this->course_obj->getId()); // end-patch lok $this->lng = $lng; $this->lng->loadLanguageModule('crs'); $this->ctrl = $ilCtrl; parent::__construct($a_parent_obj, 'listObjectives'); $this->setFormName('objectives'); $this->addColumn('', 'f', "1px"); $this->addColumn($this->lng->txt('position'), 'position', '10em'); $this->addColumn($this->lng->txt('title'), 'title', '20%'); $this->addColumn($this->lng->txt('crs_objective_assigned_materials'), 'materials'); // begin-patch lok if ($this->getSettings()->worksWithInitialTest()) { $this->addColumn($this->lng->txt('crs_objective_self_assessment'), 'self'); } // end-patch lok if ($this->getSettings()->getQualifyingTestType() == ilLOSettings::TYPE_QUALIFYING_SELECTED) { $this->addColumn($this->lng->txt('crs_objective_tbl_col_final_tsts'), 'final'); } else { $this->addColumn($this->lng->txt('crs_objective_final_test'), 'final'); } $this->addColumn($this->lng->txt(''), '5em'); $this->setFormAction($this->ctrl->getFormAction($a_parent_obj)); $this->setRowTemplate("tpl.crs_objectives_table_row.html", "Modules/Course"); $this->disable('sort'); $this->enable('header'); $this->disable('numinfo'); $this->enable('select_all'); // begin-patch lok $this->setSelectAllCheckbox('objective'); // end-patch lok $this->setLimit(200); // begin-patch lo $this->addMultiCommand('activateObjectives', $this->lng->txt('set_online')); $this->addMultiCommand('deactivateObjectives', $this->lng->txt('set_offline')); $this->addMultiCommand('askDeleteObjectives', $this->lng->txt('delete')); // end-patch lok $this->addCommandButton('saveSorting', $this->lng->txt('sorting_save')); // $this->addCommandButton('create',$this->lng->txt('crs_add_objective')); }
function ilCourseObjectivesGUI($a_course_id) { include_once './Modules/Course/classes/class.ilCourseObjective.php'; global $ilCtrl, $lng, $ilErr, $ilias, $tpl, $tree, $ilTabs; $this->ctrl =& $ilCtrl; $this->ctrl->saveParameter($this, array("ref_id")); $this->ilErr =& $ilErr; $this->lng =& $lng; $this->lng->loadLanguageModule('crs'); $this->tpl =& $tpl; $this->tree =& $tree; $this->tabs_gui =& $ilTabs; $this->course_id = $a_course_id; $this->__initCourseObject(); // begin-patch lok $this->settings = ilLOSettings::getInstanceByObjId($this->course_obj->getId()); // end-patch lok }
/** * Constructor * * @access public * @param * @return */ public function __construct($a_parent_obj, $a_course_obj, $a_objective_id, $a_mode) { global $lng, $ilCtrl; $this->objective_id = $a_objective_id; $this->course_obj = $a_course_obj; // begin-patch lok $this->settings = ilLOSettings::getInstanceByObjId($this->course_obj->getId()); // end-patch lok $this->lng = $lng; $this->lng->loadLanguageModule('crs'); $this->ctrl = $ilCtrl; parent::__construct($a_parent_obj, 'materialAssignment'); $this->setFormName('assignments'); $this->addColumn($this->lng->txt('type'), 'type', "20px"); $this->addColumn($this->lng->txt('title'), 'title', ''); $this->setFormAction($this->ctrl->getFormAction($a_parent_obj)); $this->setRowTemplate("tpl.crs_objective_list_questions_row.html", "Modules/Course"); $this->disable('sort'); $this->disable('header'); $this->disable('numinfo'); $this->disable('select_all'); #$this->setDefaultOrderField('title'); $this->setLimit(200); $this->mode = $a_mode; switch ($a_mode) { case ilCourseObjectiveQuestion::TYPE_SELF_ASSESSMENT: $this->addCommandButton('updateSelfAssessmentAssignment', $this->lng->txt('crs_wiz_next')); $this->addCommandButton('materialAssignment', $this->lng->txt('crs_wiz_back')); break; case ilCourseObjectiveQuestion::TYPE_FINAL_TEST: $this->addCommandButton('updateFinalTestAssignment', $this->lng->txt('crs_wiz_next')); $this->addCommandButton('selfAssessmentAssignment', $this->lng->txt('crs_wiz_back')); break; } $this->initQuestionAssignments(); }
/** * show objectives * * @access public * @param object $tpl template object * @return */ public function showObjectives($a_tpl, $a_is_order = false) { global $lng, $ilSetting; $this->clearAdminCommandsDetermination(); // get embedded blocks $has_container_page = false; if (!$a_is_order) { $output_html = $this->getContainerGUI()->getContainerPageHTML(); if ($output_html != "") { $has_container_page = true; $this->output_html .= $this->insertPageEmbeddedBlocks($output_html); } unset($output_html); } // All objectives include_once './Modules/Course/classes/class.ilCourseObjective.php'; if (!count($objective_ids = ilCourseObjective::_getObjectiveIds($this->getContainerObject()->getId(), true))) { return false; } include_once './Modules/Course/classes/class.ilCourseObjectiveListGUI.php'; $this->objective_list_gui = new ilCourseObjectiveListGUI(); $this->objective_list_gui->setContainerObject($this->getContainerGUI()); if ($ilSetting->get("icon_position_in_lists") == "item_rows") { $this->objective_list_gui->enableIcon(true); } $acc = null; if (!$a_is_order) { include_once "Services/Accordion/classes/class.ilAccordionGUI.php"; $acc = new ilAccordionGUI(); $acc->setUseSessionStorage(true); $acc->setAllowMultiOpened(true); $acc->setBehaviour(ilAccordionGUI::FIRST_OPEN); $acc->setId("crsobjtv_" . $this->container_obj->getId()); } else { $this->renderer->addCustomBlock('lobj', $lng->txt('crs_objectives')); } $lur_data = $this->parseLOUserResults(); $has_initial = ilLOSettings::getInstanceByObjId($this->container_obj->getId())->worksWithInitialTest(); $has_lo_page = false; $obj_cnt = 0; foreach ($objective_ids as $objective_id) { include_once './Modules/Course/classes/Objectives/class.ilLOUtils.php'; if ($has_initial && (!isset($lur_data[$objective_id]) or ilLOUtils::hasActiveRun($this->container_obj->getId(), ilLOSettings::getInstanceByObjId($this->container_obj->getId())->getInitialTest(), $objective_id))) { $lur_data[$objective_id] = array("type" => ilLOSettings::TYPE_TEST_INITIAL); } if ($html = $this->renderObjective($objective_id, $has_lo_page, $acc, $lur_data[$objective_id])) { $this->renderer->addItemToBlock('lobj', 'lobj', $objective_id, $html); } $obj_cnt++; } // buttons for showing/hiding all objectives if (!$a_is_order && $obj_cnt > 1) { $this->showButton("", $lng->txt("crs_show_all_obj"), "", "crs_show_all_obj_btn"); $this->showButton("", $lng->txt("crs_hide_all_obj"), "", "crs_hide_all_obj_btn"); $acc->setShowAllElement("crs_show_all_obj_btn"); $acc->setHideAllElement("crs_hide_all_obj_btn"); } if (!$has_container_page && $has_lo_page) { // add core co page css include_once "./Services/Style/classes/class.ilObjStyleSheet.php"; $GLOBALS["tpl"]->setVariable("LOCATION_CONTENT_STYLESHEET", ilObjStyleSheet::getContentStylePath(0)); $GLOBALS["tpl"]->setCurrentBlock("SyntaxStyle"); $GLOBALS["tpl"]->setVariable("LOCATION_SYNTAX_STYLESHEET", ilObjStyleSheet::getSyntaxStylePath()); $GLOBALS["tpl"]->parseCurrentBlock(); } // order/block if ($a_is_order) { $this->addFooterRow(); $this->output_html .= $output_html . $this->renderer->getHTML(); $this->renderer->resetDetails(); } else { $this->output_html .= "<div class='ilCrsObjAcc'>" . $acc->getHTML() . "</div>"; } }
function reset($a_course_id) { global $ilDB; include_once './Modules/Course/classes/class.ilCourseObjective.php'; include_once './Modules/Course/classes/class.ilCourseObjectiveQuestion.php'; include_once './Services/Object/classes/class.ilObjectFactory.php'; $factory = new ilObjectFactory(); include_once './Modules/Course/classes/Objectives/class.ilLOSettings.php'; $initial = ilLOSettings::getInstanceByObjId($a_course_id)->getInitialTest(); $initial_tst = $factory->getInstanceByRefId($initial, FALSE); if ($initial_tst instanceof ilObjTest) { $this->resetTestForUser($initial_tst, $this->getUserId()); } $qualified = ilLOSettings::getInstanceByObjId($a_course_id)->getQualifiedTest(); $qualified_tst = $factory->getInstanceByRefId($qualified, FALSE); if ($qualified_tst instanceof ilObjTest) { $this->resetTestForUser($qualified_tst, $this->getUserId()); } $objectives = ilCourseObjective::_getObjectiveIds($a_course_id, FALSE); if (count($objectives)) { $query = "DELETE FROM crs_objective_status " . "WHERE " . $ilDB->in('objective_id', $objectives, false, 'integer') . ' ' . "AND user_id = " . $ilDB->quote($this->getUserId(), 'integer') . " "; $res = $ilDB->manipulate($query); $query = "DELETE FROM crs_objective_status_p " . "WHERE " . $ilDB->in('objective_id', $objectives, false, 'integer') . ' ' . "AND user_id = " . $ilDB->quote($this->getUserId()) . ""; $res = $ilDB->manipulate($query); $query = "DELETE FROM ilLOUserResults " . "WHERE " . $ilDB->in('objective_id', $objectives, false, 'integer') . ' ' . "AND user_id = " . $ilDB->quote($this->getUserId()) . ""; } // update/reset LP for course include_once './Services/Tracking/classes/class.ilLPStatusWrapper.php'; ilLPStatusWrapper::_updateStatus($a_course_id, $this->getUserId()); return true; }
/** * Get an array of course material ids that can be assigned to learning objectives * No tst, fold and grp. * * @access public * @static * * @param int obj id of course * @return array data of course materials */ public static function _getAssignableMaterials($a_container_id) { global $tree, $ilDB; $all_materials = $tree->getSubTree($tree->getNodeData($a_container_id), true); $all_materials = ilUtil::sortArray($all_materials, 'title', 'asc'); // Filter foreach ($all_materials as $material) { switch ($material['type']) { case 'tst': if (ilLOSettings::getInstanceByObjId($a_container_id)->isObjectiveTest($material['child'])) { continue; } else { $assignable[] = $material; } break; case 'crs': case 'rolf': case 'itgr': continue; default: $assignable[] = $material; break; } } return $assignable ? $assignable : array(); }
public static function buildObjectiveProgressBar($a_has_initial_test, $a_objective_id, array $a_lo_result, $a_list_mode = false, $a_sub = false, $a_tt_suffix = null) { global $lng, $ilCtrl, $ilUser; $tpl = new ilTemplate("tpl.objective_progressbar.html", true, true, "Services/Container"); $tooltip_id = "crsobjtvusr_" . $a_objective_id . "_" . $a_lo_result["type"] . "_" . (int) $a_sub; if ($a_tt_suffix !== null) { $tooltip_id .= "_" . $a_tt_suffix; } $tt_txt = sprintf($lng->txt("crs_loc_tt_info"), $a_lo_result["result_perc"], $a_lo_result["limit_perc"]); // #12970 $perc_resize = (int) $a_lo_result["result_perc"]; /* if($a_lo_result["limit_perc"] && $a_lo_result["result_perc"]) { $perc_resize = min(round($a_lo_result["result_perc"]*(100/$a_lo_result["limit_perc"])), 100); } */ include_once './Modules/Course/classes/Objectives/class.ilLOUtils.php'; include_once './Modules/Course/classes/Objectives/class.ilLOSettings.php'; $next_step = $progress_txt = $bar_color = $test_url = $initial_sub = null; // qualifying test if ($a_lo_result["type"] == ilLOUserResults::TYPE_QUALIFIED or $a_lo_result['type'] == ilLOUserResults::TYPE_INITIAL and ilLOSettings::getInstanceByObjId($a_lo_result['course_id'])->isInitialTestQualifying()) { $progress_txt = $lng->txt("crs_loc_progress_result_qtest"); $tt_txt = $lng->txt("crs_loc_tab_qtest") . ": " . $tt_txt; // link to test statistics if ($a_lo_result["type"] == ilLOUserResults::TYPE_QUALIFIED && $a_lo_result["qtest"]) { $test_url = ilLOUtils::getTestResultLinkForUser($a_lo_result["qtest"], $a_lo_result["user_id"]); } else { if ($a_lo_result["itest"]) { $test_url = ilLOUtils::getTestResultLinkForUser($a_lo_result["itest"], $a_lo_result["user_id"]); } } if ($a_lo_result["status"] == ilLOUserResults::STATUS_COMPLETED) { $next_step = $lng->txt("crs_loc_progress_objective_complete"); $bar_color = "ilCourseObjectiveProgressBarCompleted"; if ($a_lo_result["type"] == ilLOUserResults::TYPE_QUALIFIED && $a_has_initial_test && is_array($a_lo_result["initial"])) { $a_lo_result["initial"]["itest"] = $a_lo_result["itest"]; $initial_sub = self::buildObjectiveProgressBar(true, $a_objective_id, $a_lo_result["initial"], true, true, $a_tt_suffix); } } else { $next_step = $lng->txt("crs_loc_progress_do_qualifying_again"); $bar_color = "ilCourseObjectiveProgressBarFailed"; } } else { if ($a_lo_result["status"]) { $progress_txt = $lng->txt("crs_loc_progress_result_itest"); $tt_txt = $lng->txt("crs_loc_tab_itest") . ": " . $tt_txt; // link to test statistics if ($a_lo_result["itest"]) { $test_url = ilLOUtils::getTestResultLinkForUser($a_lo_result["itest"], $a_lo_result["user_id"]); } $bar_color = "ilCourseObjectiveProgressBarNeutral"; if ($a_lo_result["status"] == ilLOUserResults::STATUS_COMPLETED) { $next_step = $lng->txt("crs_loc_progress_do_qualifying"); } else { $next_step = $lng->txt("crs_loc_suggested"); } } else { if ((bool) $a_has_initial_test) { $next_step = $lng->txt("crs_loc_progress_no_result_do_initial"); } else { $next_step = $lng->txt("crs_loc_progress_no_result_no_initial"); } } } if ($progress_txt) { if ($test_url) { $tpl->setCurrentBlock("statustxt_bl"); $tpl->setVariable("TXT_PROGRESS_STATUS", $progress_txt); $tpl->setVariable("URL_TEST", $test_url); } else { $tpl->setCurrentBlock("statustxt_no_link_bl"); $tpl->setVariable("TXT_PROGRESS_STATUS_NO_LINK", $progress_txt); } $tpl->parseCurrentBlock(); } if ($bar_color) { $limit_pos = (99 - (int) $a_lo_result["limit_perc"]) * -1; $tpl->setCurrentBlock("statusbar_bl"); $tpl->setVariable("PERC_STATUS", $a_lo_result["result_perc"]); $tpl->setVariable("LIMIT_POS", $limit_pos); $tpl->setVariable("PERC_WIDTH", $perc_resize); $tpl->setVariable("PERC_COLOR", $bar_color); $tpl->setVariable("TT_ID", $tooltip_id); $tpl->parseCurrentBlock(); } if ($next_step && !$a_list_mode) { $tpl->setCurrentBlock("nstep_bl"); $tpl->setVariable("TXT_NEXT_STEP", $next_step); $tpl->parseCurrentBlock(); } if ($tt_txt) { include_once "./Services/UIComponent/Tooltip/classes/class.ilTooltipGUI.php"; ilTooltipGUI::addTooltip($tooltip_id, $tt_txt); } if ($initial_sub) { if ($a_list_mode) { $tpl->setVariable("SUB_STYLE", ' style="padding-left: 30px;"'); } else { $tpl->setVariable("SUB_STYLE", ' style="padding-left: 10px;"'); } $tpl->setVariable("SUB_INIT", $initial_sub); } return $tpl->get(); }
/** * Set tabs * @param type $a_section */ protected function setTabs($a_section = '') { // objective settings $GLOBALS['ilTabs']->addSubTab('settings', $this->lng->txt('settings'), $this->ctrl->getLinkTarget($this, 'settings')); // learning objectives $GLOBALS['ilTabs']->addSubTab('objectives', $this->lng->txt('crs_loc_tab_objectives'), $this->ctrl->getLinkTarget($this, 'listObjectives')); // materials /* $GLOBALS['ilTabs']->addTab( 'materials', $this->lng->txt('crs_loc_tab_materials'), $this->ctrl->getLinkTarget($this,'materials') ); */ // tests $settings = ilLOSettings::getInstanceByObjId($this->getParentObject()->getId()); if ($settings->worksWithInitialTest()) { if ($settings->getInitialTestType() == ilLOSettings::TYPE_INITIAL_PLACEMENT_ALL || $settings->getInitialTestType() == ilLOSettings::TYPE_INITIAL_QUALIFYING_ALL) { $this->ctrl->setParameter($this, 'tt', ilLOSettings::TYPE_TEST_INITIAL); $GLOBALS['ilTabs']->addSubTab('itest', $this->lng->txt('crs_loc_tab_itest'), $this->ctrl->getLinkTarget($this, 'testOverview')); } else { $this->ctrl->setParameter($this, 'tt', ilLOSettings::TYPE_TEST_INITIAL); $GLOBALS['ilTabs']->addSubTab('itests', $this->lng->txt('crs_loc_tab_itests'), $this->ctrl->getLinkTarget($this, 'testsOverview')); } } if ($settings->getQualifyingTestType() == ilLOSettings::TYPE_QUALIFYING_ALL) { $this->ctrl->setParameter($this, 'tt', ilLOSettings::TYPE_TEST_QUALIFIED); $GLOBALS['ilTabs']->addSubTab('qtest', $this->lng->txt('crs_loc_tab_qtest'), $this->ctrl->getLinkTarget($this, 'testOverview')); } else { $this->ctrl->setParameter($this, 'tt', ilLOSettings::TYPE_TEST_QUALIFIED); $GLOBALS['ilTabs']->addSubTab('qtests', $this->lng->txt('crs_loc_tab_qtests'), $this->ctrl->getLinkTarget($this, 'testsOverview')); } if ($settings->worksWithStartObjects()) { $GLOBALS['ilTabs']->addSubTab('start', $this->lng->txt('crs_loc_tab_start'), $this->ctrl->getLinkTargetByClass('ilcontainerstartobjectsgui', '')); } // Member view #include_once './Services/Container/classes/class.ilMemberViewGUI.php'; #ilMemberViewGUI::showMemberViewSwitch($this->getParentObject()->getRefId()); }
/** * Get html */ public function getHTML() { include_once "./Services/UIComponent/Checklist/classes/class.ilChecklistGUI.php"; $list = new ilChecklistGUI(); $list->setHeading($this->lng->txt('crs_objective_status_configure')); // Step 1 // course settings $done = $this->getSettingsStatus(); $list->addEntry($this->lng->txt('crs_objective_status_settings'), $this->ctrl->getLinkTarget($this->getCmdClass(), 'settings'), $done ? ilChecklistGUI::STATUS_OK : ilChecklistGUI::STATUS_NOT_OK, $this->section == self::SECTION_SETTINGS, $this->getErrorMessages(self::SECTION_SETTINGS)); // Step 1.1 $done = $this->getObjectivesAvailableStatus(); $list->addEntry($this->lng->txt('crs_objective_status_objective_creation'), $done ? $this->ctrl->getLinkTarget($this->getCmdClass(), 'listObjectives') : $this->ctrl->getLinkTarget($this->getCmdClass(), 'showObjectiveCreation'), $done ? ilChecklistGUI::STATUS_OK : ilChecklistGUI::STATUS_NOT_OK, $this->section == self::SECTION_OBJECTIVES_NEW, $this->getErrorMessages(self::SECTION_OBJECTIVES_NEW)); // Step 2 // course material $done = $this->getMaterialsStatus(true); $this->ctrl->setParameterByClass('ilobjcoursegui', 'cmd', 'enableAdministrationPanel'); $list->addEntry($this->lng->txt('crs_objective_status_materials'), $this->ctrl->getLinkTargetByClass('ilobjcoursegui', ''), $done ? ilChecklistGUI::STATUS_OK : ilChecklistGUI::STATUS_NOT_OK, $this->section == self::SECTION_MATERIALS, $this->getErrorMessages(self::SECTION_MATERIALS)); // Step 3 // course itest if (ilLOSettings::getInstanceByObjId($this->getParentObject()->getId())->worksWithInitialTest()) { $done = $this->getInitialTestStatus(); $command = $this->getSettings()->hasSeparateInitialTests() ? 'testsOverview' : 'testOverview'; $this->ctrl->setParameter($this->getCmdClass(), 'tt', ilLOSettings::TYPE_TEST_INITIAL); $list->addEntry($this->lng->txt('crs_objective_status_itest'), $this->ctrl->getLinkTarget($this->getCmdClass(), $command), $done ? ilChecklistGUI::STATUS_OK : ilChecklistGUI::STATUS_NOT_OK, $this->section == self::SECTION_ITES, $this->getErrorMessages(self::SECTION_ITES)); } // Step 4 // course qtest $done = $this->getQualifiedTestStatus(); $command = $this->getSettings()->hasSeparateQualifiedTests() ? 'testsOverview' : 'testOverview'; $this->ctrl->setParameter($this->getCmdClass(), 'tt', ilLOSettings::TYPE_TEST_QUALIFIED); $list->addEntry($this->lng->txt('crs_objective_status_qtest'), $this->ctrl->getLinkTarget($this->getCmdClass(), $command), $done ? ilChecklistGUI::STATUS_OK : ilChecklistGUI::STATUS_NOT_OK, $this->section == self::SECTION_QTEST, $this->getErrorMessages(self::SECTION_QTEST)); // Step 5 // course qtest $done = $this->getObjectivesStatus(); $list->addEntry($this->lng->txt('crs_objective_status_objectives'), $this->ctrl->getLinkTarget($this->getCmdClass(), 'listObjectives'), $done ? ilChecklistGUI::STATUS_OK : ilChecklistGUI::STATUS_NOT_OK, $this->section == self::SECTION_OBJECTIVES, $this->getErrorMessages(self::SECTION_OBJECTIVES)); return $list->getHTML(); }
protected function determineObjectiveOrientedContainer() { require_once 'Modules/Course/classes/Objectives/class.ilLOSettings.php'; $containerObjId = (int) ilLOSettings::isObjectiveTest($this->ref_id); $containerRefId = current(ilObject::_getAllReferences($containerObjId)); $this->objectiveOrientedContainer->setObjId($containerObjId); $this->objectiveOrientedContainer->setRefId($containerRefId); }
protected function modifyTitleLink($a_default_link) { include_once './Modules/Course/classes/Objectives/class.ilLOSettings.php'; $id = ilLOSettings::isObjectiveTest($this->ref_id); $cmd_link = $a_default_link; if ($id) { $ref_ids = ilObject::_getAllReferences($id); $ref_id = end($ref_ids); $this->ctrl->setParameterByClass("ilrepositorygui", 'ref_id', $ref_id); $this->ctrl->setParameterByClass("ilrepositorygui", 'tid', $this->ref_id); $cmd_link = $this->ctrl->getLinkTargetByClass("ilrepositorygui", 'redirectLocToTest'); $this->ctrl->setParameterByClass("ilrepositorygui", "ref_id", $this->ref_id); $this->ctrl->clearParametersByClass('ilrepositorygui'); } return parent::modifyTitleLink($cmd_link); }
protected function getObjectiveOrientedContainerId() { require_once 'Modules/Course/classes/Objectives/class.ilLOSettings.php'; return (int) ilLOSettings::isObjectiveTest($this->testSession->getRefId()); }
public static function getSummarizedObjectiveStatusForLP($a_obj_id, array $a_objective_ids, $a_user_id = null) { global $ilDB; // change event is NOT parsed here! // are initital test(s) qualifying? include_once "Modules/Course/classes/Objectives/class.ilLOSettings.php"; $lo_set = ilLOSettings::getInstanceByObjId($a_obj_id); $initial_qualifying = $lo_set->isInitialTestQualifying(); // this method returns LP status codes! include_once "Services/Tracking/classes/class.ilLPStatus.php"; $res = $tmp_completed = array(); $sql = "SELECT lor.objective_id, lor.user_id, lor.status, lor.type" . " FROM loc_user_results lor" . " JOIN crs_objectives cobj ON (cobj.objective_id = lor.objective_id)" . " WHERE " . $ilDB->in("lor.objective_id", $a_objective_ids, "", "integer") . " AND cobj.active = " . $ilDB->quote(1, "integer"); if (!(bool) $initial_qualifying) { $sql .= " AND lor.type = " . $ilDB->quote(self::TYPE_QUALIFIED, "integer"); } if ($a_user_id) { $sql .= " AND lor.user_id = " . $ilDB->quote($a_user_id, "integer"); } $sql .= " ORDER BY lor.type DESC"; // qualified must come first! $set = $ilDB->query($sql); while ($row = $ilDB->fetchAssoc($set)) { $user_id = (int) $row["user_id"]; $status = (int) $row["status"]; // initial tests only count if no qualified test if ($row["type"] == self::TYPE_INITIAL && isset($res[$user_id])) { continue; } // user did do something $res[$user_id] = ilLPStatus::LP_STATUS_IN_PROGRESS_NUM; switch ($status) { case self::STATUS_COMPLETED: $tmp_completed[$user_id]++; break; case self::STATUS_FAILED: if ((bool) $row["is_final"]) { // object is failed when at least 1 objective is failed without any tries left $res[$user_id] = ilLPStatus::LP_STATUS_FAILED_NUM; } break; } } $all_nr = sizeof($a_objective_ids); foreach ($tmp_completed as $user_id => $counter) { // if used as precondition object should be completed ASAP, status can be lost on subsequent tries if ($counter == $all_nr) { $res[$user_id] = ilLPStatus::LP_STATUS_COMPLETED_NUM; } } if ($a_user_id) { // might return null! return $res[$a_user_id]; } else { return $res; } }
/** * Show confirmation whether user wants to start a new run or resume a previous run * @param type $a_objective_id * @param type $a_test_id */ protected function redirectLocToTestConfirmation($a_objective_id, $a_test_id) { include_once './Services/Utilities/classes/class.ilConfirmationGUI.php'; $confirm = new ilConfirmationGUI(); $confirm->setFormAction($GLOBALS['ilCtrl']->getFormAction($this)); include_once './Modules/Course/classes/Objectives/class.ilLOSettings.php'; if (ilLOSettings::getInstanceByObjId($this->object->getId())->getQualifiedTest() == $a_test_id) { $question = $this->lng->txt('crs_loc_qst_resume_tst_qtest'); } else { $question = $this->lng->txt('crs_loc_qst_resume_tst_itest'); } ilUtil::sendQuestion($question); $confirm->addHiddenItem('objective_id', $a_objective_id); $confirm->addHiddenItem('tid', $a_test_id); $confirm->setConfirm($this->lng->txt('crs_loc_tst_resume'), 'redirectLocToTestContinue'); $confirm->setCancel($this->lng->txt('crs_loc_tst_new_run'), 'redirectLocToTestNewRun'); $GLOBALS['tpl']->setContent($confirm->getHTML()); return true; }
/** * Clone object dependencies (start objects, preconditions) * * @access public * @param int target ref id of new course * @param int copy id * */ public function cloneDependencies($a_target_id, $a_copy_id) { parent::cloneDependencies($a_target_id, $a_copy_id); // Clone course start objects include_once 'Services/Container/classes/class.ilContainerStartObjects.php'; $start = new ilContainerStartObjects($this->getRefId(), $this->getId()); $start->cloneDependencies($a_target_id, $a_copy_id); // Clone course item settings include_once 'Services/Object/classes/class.ilObjectActivation.php'; ilObjectActivation::cloneDependencies($this->getRefId(), $a_target_id, $a_copy_id); include_once './Modules/Course/classes/Objectives/class.ilLOSettings.php'; ilLOSettings::cloneSettings($a_copy_id, $this->getId(), ilObject::_lookupObjId($a_target_id)); // Clone course learning objectives include_once 'Modules/Course/classes/class.ilCourseObjective.php'; $crs_objective = new ilCourseObjective($this); $crs_objective->ilClone($a_target_id, $a_copy_id); return true; }
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(); } }
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(); } }
private function initTestType() { require_once 'Modules/Course/classes/Objectives/class.ilLOSettings.php'; $loSettings = ilLOSettings::getInstanceByObjId($this->getObjectiveOrientedContainerId()); if ($loSettings->getInitialTest() == $this->getTestRefId()) { $this->testType = self::LO_TEST_TYPE_INITIAL; } elseif ($loSettings->getQualifiedTest() == $this->getTestRefId()) { $this->testType = self::LO_TEST_TYPE_QUALIFYING; } }
/** * Set tabs * @param type $a_section */ protected function setTabs($a_section = '') { // objective settings $GLOBALS['ilTabs']->addSubTab('settings', $this->lng->txt('settings'), $this->ctrl->getLinkTarget($this, 'settings')); // learning objectives $GLOBALS['ilTabs']->addSubTab('objectives', $this->lng->txt('crs_loc_tab_objectives'), $this->ctrl->getLinkTarget($this, 'listObjectives')); // materials /* $GLOBALS['ilTabs']->addTab( 'materials', $this->lng->txt('crs_loc_tab_materials'), $this->ctrl->getLinkTarget($this,'materials') ); */ // tests $settings = ilLOSettings::getInstanceByObjId($this->getParentObject()->getId()); if ($settings->worksWithInitialTest()) { $this->ctrl->setParameter($this, 'tt', self::TEST_TYPE_IT); $GLOBALS['ilTabs']->addSubTab('itest', $this->lng->txt('crs_loc_tab_itest'), $this->ctrl->getLinkTarget($this, 'testOverview')); } $this->ctrl->setParameter($this, 'tt', self::TEST_TYPE_QT); $GLOBALS['ilTabs']->addSubTab('qtest', $this->lng->txt('crs_loc_tab_qtest'), $this->ctrl->getLinkTarget($this, 'testOverview')); // start objects $GLOBALS['ilTabs']->addSubTab('start', $this->lng->txt('crs_loc_tab_start'), $this->ctrl->getLinkTargetByClass('ilcontainerstartobjectsgui', '')); // Member view #include_once './Services/Container/classes/class.ilMemberViewGUI.php'; #ilMemberViewGUI::showMemberViewSwitch($this->getParentObject()->getRefId()); }