function gatherCourseLPData() { global $tree, $ilDB; // process all courses $all_courses = array_keys(ilObject::_getObjectsByType("crs")); if ($all_courses) { // gather objects in trash $trashed_objects = $tree->getSavedNodeObjIds($all_courses); include_once 'Services/Tracking/classes/class.ilLPObjSettings.php'; include_once "Modules/Course/classes/class.ilCourseParticipants.php"; include_once "Services/Tracking/classes/class.ilLPStatusWrapper.php"; foreach ($all_courses as $crs_id) { // trashed objects will not change if (!in_array($crs_id, $trashed_objects)) { // only if LP is active $mode = ilLPObjSettings::_lookupMode($crs_id); if ($mode == LP_MODE_DEACTIVATED || $mode == LP_MODE_UNDEFINED) { continue; } // only save once per day $ilDB->manipulate("DELETE FROM obj_lp_stat WHERE" . " obj_id = " . $ilDB->quote($crs_id, "integer") . " AND fulldate = " . $ilDB->quote(date("Ymd", $this->date), "integer")); $members = new ilCourseParticipants($crs_id); $members = $members->getMembers(); $in_progress = count(ilLPStatusWrapper::_lookupInProgressForObject($crs_id, $members)); $completed = count(ilLPStatusWrapper::_lookupCompletedForObject($crs_id, $members)); $failed = count(ilLPStatusWrapper::_lookupFailedForObject($crs_id, $members)); // calculate with other values - there is not direct method $not_attempted = count($members) - $in_progress - $completed - $failed; $set = array("type" => array("text", "crs"), "obj_id" => array("integer", $crs_id), "yyyy" => array("integer", date("Y", $this->date)), "mm" => array("integer", date("m", $this->date)), "dd" => array("integer", date("d", $this->date)), "fulldate" => array("integer", date("Ymd", $this->date)), "mem_cnt" => array("integer", count($members)), "in_progress" => array("integer", $in_progress), "completed" => array("integer", $completed), "failed" => array("integer", $failed), "not_attempted" => array("integer", $not_attempted)); $ilDB->insert("obj_lp_stat", $set); } } } }
/** * check access to learning progress * * @param int $a_ref_id reference ifd of object * @param bool $a_allow_only_read read access is sufficient (see courses/groups) * @return * @static */ public static function checkAccess($a_ref_id, $a_allow_only_read = true) { global $ilUser, $ilAccess; if ($ilUser->getId() == ANONYMOUS_USER_ID) { return false; } include_once "Services/Tracking/classes/class.ilObjUserTracking.php"; if (!ilObjUserTracking::_enabledLearningProgress()) { return false; } if ($ilAccess->checkAccess('edit_learning_progress', '', $a_ref_id)) { return true; } if (!ilObjUserTracking::_hasLearningProgressLearner()) { return false; } include_once './Services/Tracking/classes/class.ilLPObjSettings.php'; if (ilLPObjSettings::_lookupMode(ilObject::_lookupObjId($a_ref_id)) == LP_MODE_DEACTIVATED) { return false; } if (!$ilAccess->checkAccess('read', '', $a_ref_id)) { return false; } if ($a_allow_only_read) { return true; } return false; }
function _showWarning($a_ref_id, $a_usr_id) { global $objDefinition; include_once './Services/Tracking/classes/class.ilLPCollectionCache.php'; include_once './Services/Tracking/classes/class.ilLPStatus.php'; include_once './Services/Tracking/classes/class.ilLPObjSettings.php'; global $ilObjDataCache; $obj_id = $ilObjDataCache->lookupObjId($a_ref_id); // if completed no warning if (ilLPStatus::_lookupStatus($obj_id, $a_usr_id) == LP_STATUS_COMPLETED_NUM) { return false; } // if editing time reached => show warning $timings =& ilTimingCache::_getTimings($a_ref_id); if ($timings['item']['timing_type'] == ilObjectActivation::TIMINGS_PRESETTING) { if ($timings['item']['changeable'] and $timings['user'][$a_usr_id]['end']) { $end = $timings['user'][$a_usr_id]['end']; } else { $end = $timings['item']['suggestion_end']; } if ($end < time()) { return true; } } // objective_ids would get confused with ref_ids ! if (ilLPObjSettings::_lookupMode($obj_id) != LP_MODE_OBJECTIVES && $objDefinition->isContainer(ilObject::_lookupType($obj_id))) { // No check subitems foreach (ilLPCollectionCache::_getItems($obj_id) as $item) { if (ilTimingCache::_showWarning($item, $a_usr_id)) { return true; } } } // Really ??? return false; }
/** * Init filter */ function initFilter() { global $lng, $rbacreview, $ilUser; // for scorm and objectives this filter does not make sense / is not implemented include_once "Services/Tracking/classes/class.ilLPObjSettings.php"; $mode = ilLPObjSettings::_lookupMode($this->obj_id); if ($mode == LP_MODE_SCORM || $mode == LP_MODE_OBJECTIVES) { return; } include_once "./Services/Form/classes/class.ilSubEnabledFormPropertyGUI.php"; include_once "./Services/Table/interfaces/interface.ilTableFilterItem.php"; // show collection only/all include_once "./Services/Form/classes/class.ilRadioGroupInputGUI.php"; include_once "./Services/Form/classes/class.ilRadioOption.php"; $ti = new ilRadioGroupInputGUI($lng->txt("trac_view_mode"), "view_mode"); $ti->addOption(new ilRadioOption($lng->txt("trac_view_mode_all"), "")); $ti->addOption(new ilRadioOption($lng->txt("trac_view_mode_collection"), "coll")); $this->addFilterItem($ti); $ti->readFromSession(); $this->filter["view_mode"] = $ti->getValue(); }
/** * Get complete branch of tree (recursively) * * @param int $a_parent_ref_id * @param array $a_object_ids * @param array $a_ref_ids */ protected static function getSubTree($a_parent_ref_id, array &$a_object_ids, array &$a_ref_ids) { global $tree; $children = $tree->getChilds($a_parent_ref_id); if ($children) { foreach ($children as $child) { if ($child["type"] == "adm" || $child["type"] == "rolf") { continue; } // as there can be deactivated items in the collection // we should allow them here too $cmode = ilLPObjSettings::_lookupMode($child["obj_id"]); if ($cmode != LP_MODE_UNDEFINED) { $a_object_ids[] = $child["obj_id"]; $a_ref_ids[$child["obj_id"]] = $child["ref_id"]; } self::getSubTree($child["ref_id"], $a_object_ids, $a_ref_ids); } } }
function __initDetails($a_details_id) { global $ilObjDataCache; if (!$a_details_id) { $a_details_id = $this->getRefId(); } if ($a_details_id) { $_GET['details_id'] = $a_details_id; $this->details_id = $a_details_id; $this->details_obj_id = $ilObjDataCache->lookupObjId($this->details_id); $this->details_type = $ilObjDataCache->lookupType($this->details_obj_id); $this->details_mode = ilLPObjSettings::_lookupMode($this->details_obj_id); } }
function &_getInstance($a_obj_id, $a_mode = NULL) { include_once 'Services/Tracking/classes/class.ilLPObjSettings.php'; if ($a_mode === NULL) { $a_mode = ilLPObjSettings::_lookupMode($a_obj_id); } switch ($a_mode) { case LP_MODE_VISITS: include_once 'Services/Tracking/classes/class.ilLPStatusVisits.php'; return new ilLPStatusVisits($a_obj_id); case LP_MODE_COLLECTION: include_once 'Services/Tracking/classes/class.ilLPStatusCollection.php'; return new ilLPStatusCollection($a_obj_id); case LP_MODE_TLT: include_once 'Services/Tracking/classes/class.ilLPStatusTypicalLearningTime.php'; return new ilLPStatusTypicalLearningTime($a_obj_id); case LP_MODE_SCORM: include_once 'Services/Tracking/classes/class.ilLPStatusSCORM.php'; return new ilLPStatusSCORM($a_obj_id); case LP_MODE_TEST_FINISHED: include_once 'Services/Tracking/classes/class.ilLPStatusTestFinished.php'; return new ilLPStatusTestFinished($a_obj_id); case LP_MODE_TEST_PASSED: include_once 'Services/Tracking/classes/class.ilLPStatusTestPassed.php'; return new ilLPStatusTestPassed($a_obj_id); case LP_MODE_MANUAL: include_once 'Services/Tracking/classes/class.ilLPStatusManual.php'; return new ilLPStatusManual($a_obj_id); case LP_MODE_MANUAL_BY_TUTOR: include_once 'Services/Tracking/classes/class.ilLPStatusManualByTutor.php'; return new ilLPStatusManualByTutor($a_obj_id); case LP_MODE_EXERCISE_RETURNED: include_once 'Services/Tracking/classes/class.ilLPStatusExerciseReturned.php'; return new ilLPStatusExerciseReturned($a_obj_id); case LP_MODE_OBJECTIVES: include_once 'Services/Tracking/classes/class.ilLPStatusObjectives.php'; return new ilLPStatusObjectives($a_obj_id); case LP_MODE_EVENT: include_once 'Services/Tracking/classes/class.ilLPStatusEvent.php'; return new ilLPStatusEvent($a_obj_id); case LP_MODE_PLUGIN: include_once 'Services/Tracking/classes/class.ilLPStatusPlugin.php'; return new ilLPStatusEvent($a_obj_id); case LP_MODE_UNDEFINED: $type = ilObject::_lookupType($a_obj_id); $mode = ilLPObjSettings::__getDefaultMode($a_obj_id, $type); if ($mode != LP_MODE_UNDEFINED) { return self::_getInstance($a_obj_id, $mode); } // fallthrough // fallthrough default: echo "ilLPStatusFactory: unknown type " . ilLPObjSettings::_lookupMode($a_obj_id); exit; } }
function __showEditUser($a_user_id, $a_ref_id, $a_cancel, $a_sub_id = false) { global $ilObjDataCache, $lng, $ilCtrl; include_once 'Services/Tracking/classes/class.ilLPMarks.php'; if (!$a_sub_id) { $obj_id = $ilObjDataCache->lookupObjId($a_ref_id); } else { $ilCtrl->setParameter($this, 'userdetails_id', $a_sub_id); $obj_id = $ilObjDataCache->lookupObjId($a_sub_id); } $marks = new ilLPMarks($obj_id, $a_user_id); $tpl = new ilTemplate('tpl.lp_edit_user.html', true, true, 'Services/Tracking'); $tpl->setVariable("OBJ_TITLE", $lng->txt("edit") . ": " . $ilObjDataCache->lookupTitle($obj_id)); $tpl->setVariable("OBJ_SUBTITLE", $this->lng->txt('trac_mode') . ": " . ilLPObjSettings::_mode2Text(ilLPObjSettings::_lookupMode($obj_id))); $ilCtrl->setParameter($this, 'user_id', $a_user_id); $ilCtrl->setParameter($this, 'details_id', $a_ref_id); $tpl->setVariable("FORMACTION", $ilCtrl->getFormAction($this)); $tpl->setVariable("TYPE_IMG", ilObjUser::_getPersonalPicturePath($a_user_id, 'xxsmall')); $tpl->setVariable("ALT_IMG", $ilObjDataCache->lookupTitle($a_user_id)); $tpl->setVariable("TXT_LP", $lng->txt('trac_learning_progress_tbl_header')); $tpl->setVariable("COMMENT", ilUtil::prepareFormOutput($marks->getComment(), false)); $type = $ilObjDataCache->lookupType($obj_id); if ($type != 'lm') { $tpl->setVariable("TXT_MARK", $lng->txt('trac_mark')); $tpl->setVariable("MARK", ilUtil::prepareFormOutput($marks->getMark(), false)); } $tpl->setVariable("TXT_COMMENT", $lng->txt('trac_comment')); $mode = ilLPObjSettings::_lookupMode($obj_id); if ($mode == LP_MODE_MANUAL or $mode == LP_MODE_MANUAL_BY_TUTOR) { include_once "./Services/Tracking/classes/class.ilLPStatus.php"; $completed = ilLPStatus::_lookupStatus($obj_id, $a_user_id); $tpl->setVariable("mode_manual"); $tpl->setVariable("TXT_COMPLETED", $lng->txt('trac_completed')); $tpl->setVariable("CHECK_COMPLETED", ilUtil::formCheckbox($completed == LP_STATUS_COMPLETED_NUM, 'completed', '1')); } $tpl->setVariable("TXT_CANCEL", $lng->txt('cancel')); $tpl->setVariable("TXT_SAVE", $lng->txt('save')); $tpl->setVariable("CMD_CANCEL", $a_cancel); return $tpl->get(); }
function &_getItems($a_obj_id, $a_use_subtree_by_id = false) { global $ilObjDataCache; global $ilDB, $tree; include_once 'Services/Tracking/classes/class.ilLPObjSettings.php'; $mode = ilLPObjSettings::_lookupMode($a_obj_id); if ($mode == LP_MODE_OBJECTIVES) { include_once 'Modules/Course/classes/class.ilCourseObjective.php'; return ilCourseObjective::_getObjectiveIds($a_obj_id); } if ($mode != LP_MODE_SCORM and $mode != LP_MODE_COLLECTION and $mode != LP_MODE_MANUAL_BY_TUTOR) { return array(); } if ($ilObjDataCache->lookupType($a_obj_id) != 'sahs') { $course_ref_ids = ilObject::_getAllReferences($a_obj_id); $course_ref_id = end($course_ref_ids); if (!$a_use_subtree_by_id) { $possible_items = ilLPCollections::_getPossibleItems($course_ref_id); } else { $possible_items = $tree->getSubTreeIds($course_ref_id); } $query = "SELECT * FROM ut_lp_collections utc " . "JOIN object_reference obr ON item_id = ref_id " . "JOIN object_data obd ON obr.obj_id = obd.obj_id " . "WHERE utc.obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " " . "AND active = " . $ilDB->quote(1, 'integer') . " " . "ORDER BY title"; } else { // SAHS $query = "SELECT * FROM ut_lp_collections WHERE obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " " . "AND active = " . $ilDB->quote(1, 'integer'); } $res = $ilDB->query($query); while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) { if ($ilObjDataCache->lookupType($a_obj_id) != 'sahs') { if (!in_array($row->item_id, $possible_items)) { ilLPCollections::__deleteEntry($a_obj_id, $row->item_id); continue; } } // Check anonymized if ($ilObjDataCache->lookupType($item_obj_id = $ilObjDataCache->lookupObjId($row->item_id)) == 'tst') { include_once './Modules/Test/classes/class.ilObjTest.php'; if (ilObjTest::_lookupAnonymity($item_obj_id)) { ilLPCollections::__deleteEntry($a_obj_id, $row->item_id); continue; } } $items[] = $row->item_id; } return $items ? $items : array(); }
/** * Get selectable columns * * @param * @return */ function getSelectableColumns() { global $lng, $ilSetting; if ($this->selectable_columns) { return $this->selectable_columns; } $anonymized_object = false; include_once './Modules/Test/classes/class.ilObjTest.php'; if (ilObjTest::_lookupAnonymity($this->obj_id)) { $anonymized_object = true; } include_once "./Services/User/classes/class.ilUserProfile.php"; $up = new ilUserProfile(); $up->skipGroup("preferences"); $up->skipGroup("settings"); $ufs = $up->getStandardFields(); // default fields $cols = array(); $cols["login"] = array("txt" => $lng->txt("login"), "default" => true); if (!$anonymized_object) { $cols["firstname"] = array("txt" => $lng->txt("firstname"), "default" => true); $cols["lastname"] = array("txt" => $lng->txt("lastname"), "default" => true); } // show only if extended data was activated in lp settings include_once 'Services/Tracking/classes/class.ilObjUserTracking.php'; $tracking = new ilObjUserTracking(); if ($tracking->hasExtendedData(ilObjUserTracking::EXTENDED_DATA_LAST_ACCESS)) { $cols["first_access"] = array("txt" => $lng->txt("trac_first_access"), "default" => true); $cols["last_access"] = array("txt" => $lng->txt("trac_last_access"), "default" => true); } if ($tracking->hasExtendedData(ilObjUserTracking::EXTENDED_DATA_READ_COUNT)) { $cols["read_count"] = array("txt" => $lng->txt("trac_read_count"), "default" => true); } if ($tracking->hasExtendedData(ilObjUserTracking::EXTENDED_DATA_SPENT_SECONDS)) { $cols["spent_seconds"] = array("txt" => $lng->txt("trac_spent_seconds"), "default" => true); } if ($this->isPercentageAvailable($this->obj_id)) { $cols["percentage"] = array("txt" => $lng->txt("trac_percentage"), "default" => true); } // do not show status if learning progress is deactivated $mode = ilLPObjSettings::_lookupMode($this->obj_id); if ($mode != LP_MODE_DEACTIVATED && $mode != LP_MODE_LP_MODE_UNDEFINED) { $cols["status"] = array("txt" => $lng->txt("trac_status"), "default" => true); $cols['status_changed'] = array('txt' => $lng->txt('trac_status_changed'), 'default' => false); } if ($this->type != "lm") { $cols["mark"] = array("txt" => $lng->txt("trac_mark"), "default" => true); } $cols["u_comment"] = array("txt" => $lng->txt("trac_comment"), "default" => false); $cols["create_date"] = array("txt" => $lng->txt("create_date"), "default" => false); $cols["language"] = array("txt" => $lng->txt("language"), "default" => false); // add user data only if object is [part of] course if (!$anonymized_object && ($this->in_course || $this->in_group)) { // only show if export permission is granted include_once 'Services/PrivacySecurity/classes/class.ilPrivacySettings.php'; if (ilPrivacySettings::_getInstance()->checkExportAccess($this->ref_id)) { $this->user_fields = array(); // other user profile fields foreach ($ufs as $f => $fd) { if (!isset($cols[$f]) && $f != "username" && !$fd["lists_hide"]) { if ($this->in_course && !($fd["course_export_fix_value"] || $ilSetting->get("usr_settings_course_export_" . $f))) { continue; } if ($this->in_group && !($fd["group_export_fix_value"] || $ilSetting->get("usr_settings_group_export_" . $f))) { continue; } $cols[$f] = array("txt" => $lng->txt($f), "default" => false); $this->user_fields[] = $f; } } // additional defined user data fields include_once './Services/User/classes/class.ilUserDefinedFields.php'; $user_defined_fields = ilUserDefinedFields::_getInstance(); if ($this->in_course) { $user_defined_fields = $user_defined_fields->getCourseExportableFields(); } else { $user_defined_fields = $user_defined_fields->getGroupExportableFields(); } foreach ($user_defined_fields as $definition) { if ($definition["field_type"] != UDF_TYPE_WYSIWYG) { $f = "udf_" . $definition["field_id"]; $cols[$f] = array("txt" => $definition["field_name"], "default" => false); $this->user_fields[] = $f; } } } } $this->selectable_columns = $cols; return $cols; }
/** * Init filter */ function initFilter() { global $lng, $ilSetting; if ($this->ref_id == ROOT_FOLDER_ID) { return parent::initFilter(true, false); } // show only if extended data was activated in lp settings include_once 'Services/Tracking/classes/class.ilObjUserTracking.php'; $tracking = new ilObjUserTracking(); $item = $this->addFilterItemByMetaType("user_total", ilTable2GUI::FILTER_NUMBER_RANGE, true, "∑ " . $lng->txt("users")); $this->filter["user_total"] = $item->getValue(); if ($tracking->hasExtendedData(ilObjUserTracking::EXTENDED_DATA_READ_COUNT)) { $item = $this->addFilterItemByMetaType("read_count", ilTable2GUI::FILTER_NUMBER_RANGE, true, "∑ " . $lng->txt("trac_read_count")); $this->filter["read_count"] = $item->getValue(); } if ($tracking->hasExtendedData(ilObjUserTracking::EXTENDED_DATA_SPENT_SECONDS)) { $item = $this->addFilterItemByMetaType("spent_seconds", ilTable2GUI::FILTER_DURATION_RANGE, true, "Ø " . $lng->txt("trac_spent_seconds") . " / " . $lng->txt("user")); $this->filter["spent_seconds"]["from"] = $item->getCombinationItem("from")->getValueInSeconds(); $this->filter["spent_seconds"]["to"] = $item->getCombinationItem("to")->getValueInSeconds(); } $item = $this->addFilterItemByMetaType("percentage", ilTable2GUI::FILTER_NUMBER_RANGE, true, "Ø " . $lng->txt("trac_percentage") . " / " . $lng->txt("user")); $this->filter["percentage"] = $item->getValue(); // do not show status if learning progress is deactivated $mode = ilLPObjSettings::_lookupMode($this->obj_id); if ($mode != LP_MODE_DEACTIVATED && $mode != LP_MODE_LP_MODE_UNDEFINED) { include_once "Services/Tracking/classes/class.ilLPStatus.php"; $item = $this->addFilterItemByMetaType("status", ilTable2GUI::FILTER_SELECT, true); $item->setOptions(array("" => $lng->txt("trac_all"), LP_STATUS_NOT_ATTEMPTED_NUM + 1 => $lng->txt(LP_STATUS_NOT_ATTEMPTED), LP_STATUS_IN_PROGRESS_NUM + 1 => $lng->txt(LP_STATUS_IN_PROGRESS), LP_STATUS_COMPLETED_NUM + 1 => $lng->txt(LP_STATUS_COMPLETED), LP_STATUS_FAILED_NUM + 1 => $lng->txt(LP_STATUS_FAILED))); $this->filter["status"] = $item->getValue(); if ($this->filter["status"]) { $this->filter["status"]--; } $item = $this->addFilterItemByMetaType("trac_status_changed", ilTable2GUI::FILTER_DATE_RANGE, true); $this->filter["status_changed"] = $item->getDate(); } if (ilObject::_lookupType($this->obj_id) != "lm") { $item = $this->addFilterItemByMetaType("mark", ilTable2GUI::FILTER_TEXT, true, $lng->txt("trac_mark")); $this->filter["mark"] = $item->getValue(); } if ($ilSetting->get("usr_settings_course_export_gender")) { $item = $this->addFilterItemByMetaType("gender", ilTable2GUI::FILTER_SELECT, true); $item->setOptions(array("" => $lng->txt("trac_all"), "m" => $lng->txt("gender_m"), "f" => $lng->txt("gender_f"))); $this->filter["gender"] = $item->getValue(); } if ($ilSetting->get("usr_settings_course_export_city")) { $item = $this->addFilterItemByMetaType("city", ilTable2GUI::FILTER_TEXT, true); $this->filter["city"] = $item->getValue(); } if ($ilSetting->get("usr_settings_course_export_country")) { $item = $this->addFilterItemByMetaType("country", ilTable2GUI::FILTER_TEXT, true); $this->filter["country"] = $item->getValue(); } if ($ilSetting->get("usr_settings_course_export_sel_country")) { $item = $this->addFilterItemByMetaType("sel_country", ilTable2GUI::FILTER_SELECT, true); $item->setOptions(array("" => $lng->txt("trac_all")) + $this->getSelCountryCodes()); $this->filter["sel_country"] = $item->getValue(); } $item = $this->addFilterItemByMetaType("language", ilTable2GUI::FILTER_LANGUAGE, true); $this->filter["language"] = $item->getValue(); if ($tracking->hasExtendedData(ilObjUserTracking::EXTENDED_DATA_LAST_ACCESS)) { $item = $this->addFilterItemByMetaType("trac_first_access", ilTable2GUI::FILTER_DATETIME_RANGE, true); $this->filter["first_access"] = $item->getDate(); $item = $this->addFilterItemByMetaType("trac_last_access", ilTable2GUI::FILTER_DATETIME_RANGE, true); $this->filter["last_access"] = $item->getDate(); } $item = $this->addFilterItemByMetaType("registration_filter", ilTable2GUI::FILTER_DATE_RANGE, true); $this->filter["registration"] = $item->getDate(); }
/** * Parse one item * @param array $item */ protected function parseCollectionItem($item) { $tmp['ref_id'] = $item; $tmp['id'] = $item; $tmp['obj_id'] = ilObject::_lookupObjId($item); $tmp['type'] = ilObject::_lookupType($tmp['obj_id']); $tmp['title'] = ilObject::_lookupTitle($tmp['obj_id']); $tmp['description'] = ilObject::_lookupDescription($tmp['obj_id']); // mode to text (sorting) $tmp["mode_id"] = ilLPObjSettings::_lookupMode($tmp['obj_id']); $tmp["mode"] = ilLPObjSettings::_mode2Text($tmp["mode_id"]); // status (sorting) $tmp["status"] = $this->getCollection()->isAssigned($item); return $tmp; }
/** * Init attendance list object * * @return ilAttendanceList */ protected function initAttendanceList() { include_once './Modules/Group/classes/class.ilGroupParticipants.php'; $members_obj = ilGroupParticipants::_getInstanceByObjId($this->object->getId()); include_once 'Services/Membership/classes/class.ilAttendanceList.php'; $list = new ilAttendanceList($this, $members_obj); $list->setId('grpmemlst'); $list->setTitle($this->lng->txt('grp_members_print_title'), $this->lng->txt('obj_grp') . ': ' . $this->object->getTitle()); include_once './Services/Tracking/classes/class.ilObjUserTracking.php'; include_once './Services/Tracking/classes/class.ilLPObjSettings.php'; $this->show_tracking = (ilObjUserTracking::_enabledLearningProgress() and ilObjUserTracking::_enabledUserRelatedData() and ilLPObjSettings::_lookupMode($this->object->getId()) != LP_MODE_DEACTIVATED); if ($this->show_tracking) { $this->lng->loadLanguageModule('trac'); $list->addPreset('progress', $this->lng->txt('learning_progress'), true); } include_once './Services/PrivacySecurity/classes/class.ilPrivacySettings.php'; $privacy = ilPrivacySettings::_getInstance(); if ($privacy->enabledGroupAccessTimes()) { $list->addPreset('access', $this->lng->txt('last_access'), true); } return $list; }
function __initDetails($a_details_id) { global $ilObjDataCache; if (!$a_details_id) { $a_details_id = $this->getRefId(); } if ($a_details_id) { $ref_ids = ilObject::_getAllReferences($a_details_id); $this->details_id = $a_details_id; $this->details_obj_id = $ilObjDataCache->lookupObjId($this->details_id); $this->details_type = $ilObjDataCache->lookupType($this->details_obj_id); $this->details_mode = ilLPObjSettings::_lookupMode($this->details_obj_id); } }
protected function parseTitle($a_obj_id, $action, $a_user_id = false) { global $lng, $ilObjDataCache, $ilUser; $user = ""; if ($a_user_id) { if ($a_user_id != $ilUser->getId()) { $a_user = ilObjectFactory::getInstanceByObjId($a_user_id); } else { $a_user = $ilUser; } $user .= ", " . $a_user->getFullName(); // " [".$a_user->getLogin()."]"; } if ($a_obj_id != ROOT_FOLDER_ID) { $this->setTitle($lng->txt($action) . ": " . $ilObjDataCache->lookupTitle($a_obj_id) . $user); $this->setDescription($this->lng->txt('trac_mode') . ": " . ilLPObjSettings::_mode2Text(ilLPObjSettings::_lookupMode($a_obj_id))); } else { $this->setTitle($lng->txt($action)); } }
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/Tracking/classes/class.ilLPObjSettings.php'; include_once 'Services/Tracking/classes/class.ilLPMarks.php'; if (ilLPObjSettings::_lookupMode($this->gui_object->object->getId()) != LP_MODE_MANUAL) { return false; } $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"); } } }