function _showWarning($a_ref_id, $a_usr_id) { global $ilObjDataCache; $obj_id = $ilObjDataCache->lookupObjId($a_ref_id); // if completed no warning include_once './Services/Tracking/classes/class.ilLPStatus.php'; if (ilLPStatus::_hasUserCompleted($obj_id, $a_usr_id)) { 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; } } include_once './Services/Object/classes/class.ilObjectLP.php'; $olp = ilObjectLP::getInstance($obj_id); $collection = $olp->getCollectionInstance(); if ($collection instanceof ilLPCollectionOfRepositoryObjects) { foreach ($collection->getItems() as $item) { if (ilTimingCache::_showWarning($item, $a_usr_id)) { return true; } } } // Really ??? return false; }
function _tracProgress($a_user_id, $a_obj_id, $a_ref_id, $a_obj_type = '') { global $ilDB; require_once 'Services/Tracking/classes/class.ilChangeEvent.php'; ilChangeEvent::_recordReadEvent($a_obj_type, $a_ref_id, $a_obj_id, $a_user_id); require_once 'Services/Tracking/classes/class.ilLPStatus.php'; ilLPStatus::setInProgressIfNotAttempted($a_obj_id, $a_user_id); return true; }
/** * Get all completed tests */ protected function getItems() { global $ilUser, $tree; $data = array(); include_once "Services/Certificate/classes/class.ilCertificate.php"; if (ilCertificate::isActive()) { $obj_ids = array(); $root = $tree->getNodeData($tree->getRootId()); foreach ($tree->getSubTree($root, true, "sahs") as $node) { $obj_ids[] = $node["obj_id"]; } if ($obj_ids) { include_once "./Services/Tracking/classes/class.ilObjUserTracking.php"; include_once "./Services/Tracking/classes/class.ilLPStatus.php"; include_once "./Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php"; include_once "./Modules/ScormAicc/classes/class.ilObjSCORMLearningModule.php"; include_once "./Modules/Scorm2004/classes/class.ilObjSCORM2004LearningModule.php"; include_once "./Modules/ScormAicc/classes/class.ilSCORMCertificateAdapter.php"; $lp_active = ilObjUserTracking::_enabledLearningProgress(); foreach (ilCertificate::areObjectsActive($obj_ids) as $obj_id => $active) { if ($active) { $type = ilObjSAHSLearningModule::_lookupSubType($obj_id); if ($type == "scorm") { $lm = new ilObjSCORMLearningModule($obj_id, false); } else { $lm = new ilObjSCORM2004LearningModule($obj_id, false); } $adapter = new ilSCORMCertificateAdapter($lm); if (ilCertificate::_isComplete($adapter)) { $lpdata = $completed = false; if ($lp_active) { $completed = ilLPStatus::_hasUserCompleted($obj_id, $ilUser->getId()); $lpdata = true; } if (!$lpdata) { switch ($type) { case "scorm": $completed = ilObjSCORMLearningModule::_getCourseCompletionForUser($obj_id, $ilUser->getId()); break; case "scorm2004": $completed = ilObjSCORM2004LearningModule::_getCourseCompletionForUser($obj_id, $ilUser->getId()); break; } } $data[] = array("id" => $obj_id, "title" => ilObject::_lookupTitle($obj_id), "passed" => (bool) $completed); } } } } } $this->setData($data); }
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; }
/** * Checks whether a certificate exists for the active user or not * @param int obj_id Object ID of the SCORM Learning Module * @param int usr_id Object ID of the user. If not given, the active user will be taken * @return true/false */ public static function _lookupUserCertificate($obj_id, $usr_id = 0) { global $ilUser; $uid = $usr_id ? $usr_id : $ilUser->getId(); $completed = false; // check for certificates include_once "./Services/Certificate/classes/class.ilCertificate.php"; if (ilCertificate::isActive() && ilCertificate::isObjectActive($obj_id)) { $lpdata = false; include_once "./Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php"; $type = ilObjSAHSLearningModule::_lookupSubType($obj_id); include_once "Services/Tracking/classes/class.ilObjUserTracking.php"; if (ilObjUserTracking::_enabledLearningProgress()) { include_once "./Services/Tracking/classes/class.ilLPStatus.php"; $completed = ilLPStatus::_hasUserCompleted($obj_id, $uid); $lpdata = true; } switch ($type) { case "scorm": if (!$lpdata) { include_once "./Modules/ScormAicc/classes/class.ilObjSCORMLearningModule.php"; $completed = ilObjSCORMLearningModule::_getCourseCompletionForUser($obj_id, $uid); } break; case "scorm2004": if (!$lpdata) { include_once "./Modules/Scorm2004/classes/class.ilObjSCORM2004LearningModule.php"; $completed = ilObjSCORM2004LearningModule::_getCourseCompletionForUser($obj_id, $uid); } break; default: break; } } return $completed; }
function ilLPStatusTypicalLearningTime($a_obj_id) { global $ilDB; parent::ilLPStatus($a_obj_id); $this->db =& $ilDB; }
function ilLPStatusObjectives($a_obj_id) { global $ilDB; parent::ilLPStatus($a_obj_id); $this->db =& $ilDB; }
function ilLPStatusVisits($a_obj_id) { global $ilDB; parent::ilLPStatus($a_obj_id); $this->db =& $ilDB; }
public final function resetLPDataForUserIds(array $a_user_ids, $a_recursive = true) { if ((bool) $a_recursive) { $subitems = $this->getPossibleCollectionItems(); if (is_array($subitems)) { foreach ($subitems as $sub_ref_id) { $olp = self::getInstance(ilObject::_lookupObjId($sub_ref_id)); $olp->resetLPDataForUserIds($a_user_ids, false); } } } $this->resetCustomLPDataForUserIds($a_user_ids, (bool) $a_recursive); include_once "Services/Tracking/classes/class.ilLPMarks.php"; ilLPMarks::_deleteForUsers($this->obj_id, $a_user_ids); include_once "Services/Tracking/classes/class.ilChangeEvent.php"; ilChangeEvent::_deleteReadEventsForUsers($this->obj_id, $a_user_ids); // update LP status to get collections up-to-date include_once "Services/Tracking/classes/class.ilLPStatus.php"; foreach ($a_user_ids as $user_id) { ilLPStatus::_updateStatus($this->obj_id, $user_id); } }
function refreshStatus($a_obj_id) { parent::refreshStatus($a_obj_id); // this is restricted to SCOs in the current collection include_once "./Services/Tracking/classes/class.ilLPStatusWrapper.php"; $in_progress = ilLPStatusWrapper::_getInProgress($a_obj_id); $completed = ilLPStatusWrapper::_getCompleted($a_obj_id); $failed = ilLPStatusWrapper::_getFailed($a_obj_id); $all_active_users = array_unique(array_merge($in_progress, $completed, $failed)); // get all tracked users regardless of SCOs include_once './Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php'; $subtype = ilObjSAHSLearningModule::_lookupSubType($a_obj_id); if ($subtype != "scorm2004") { include_once "./Modules/ScormAicc/classes/SCORM/class.ilObjSCORMTracking.php"; $all_tracked_users = ilObjSCORMTracking::_getTrackedUsers($a_obj_id); } else { include_once "./Modules/Scorm2004/classes/class.ilSCORM2004Tracking.php"; $all_tracked_users = ilSCORM2004Tracking::_getTrackedUsers($a_obj_id); } $not_attempted_users = array_diff($all_tracked_users, $all_active_users); unset($all_tracked_users); unset($all_active_users); // reset all users which have no data for the current SCOs if ($not_attempted_users) { foreach ($not_attempted_users as $usr_id) { // this will update any (parent) collections if necessary ilLPStatus::writeStatus($a_obj_id, $usr_id, self::LP_STATUS_NOT_ATTEMPTED_NUM, 0); } } }
/** * check whether status (for all relevant users) exists * * @param array $a_obj_ids * @param array $a_users */ protected static function refreshObjectsStatus(array $a_obj_ids, $a_users = null) { include_once "./Services/Tracking/classes/class.ilLPStatus.php"; foreach ($a_obj_ids as $obj_id) { ilLPStatus::checkStatusForObject($obj_id, $a_users); } }
public static function preloadListGUIData($a_obj_ids) { global $ilDB, $ilUser, $lng; $res = array(); include_once "Services/Tracking/classes/class.ilObjUserTracking.php"; if ($ilUser->getId() != ANONYMOUS_USER_ID && ilObjUserTracking::_enabledLearningProgress() && ilObjUserTracking::_hasLearningProgressLearner() && ilObjUserTracking::_hasLearningProgressListGUI()) { include_once "Services/Object/classes/class.ilObjectLP.php"; // validate objects $valid = array(); $existing = ilLPObjSettings::_lookupDBModeForObjects($a_obj_ids); foreach ($existing as $obj_id => $obj_mode) { if ($obj_mode != ilLPObjSettings::LP_MODE_DEACTIVATED) { $valid[$obj_id] = $obj_id; } } if (sizeof($existing) != sizeof($a_obj_ids)) { // missing objects (default mode) foreach (array_diff($a_obj_ids, $existing) as $obj_id) { $olp = ilObjectLP::getInstance($obj_id); $mode = $olp->getCurrentMode(); if ($mode == ilLPObjSettings::LP_MODE_DEACTIVATED) { // #11141 unset($valid[$obj_id]); } else { if ($mode != ilLPObjSettings::LP_MODE_UNDEFINED) { $valid[$obj_id] = $obj_id; } } } unset($existing); } $valid = array_values($valid); // get user lp data $sql = "SELECT status, status_dirty, obj_id FROM ut_lp_marks" . " WHERE " . $ilDB->in("obj_id", $valid, "", "integer") . " AND usr_id = " . $ilDB->quote($ilUser->getId(), "integer"); $set = $ilDB->query($sql); while ($row = $ilDB->fetchAssoc($set)) { if (!$row["status_dirty"]) { $res[$row["obj_id"]] = $row["status"]; } else { $res[$row["obj_id"]] = self::_lookupStatus($row["obj_id"], $ilUser->getId()); } } // process missing user entries (same as dirty entries, see above) foreach ($valid as $obj_id) { if (!isset($res[$obj_id])) { $res[$obj_id] = self::_lookupStatus($obj_id, $ilUser->getId()); if ($res[$obj_id] === null) { $res[$obj_id] = self::LP_STATUS_NOT_ATTEMPTED_NUM; } } } // value to icon $lng->loadLanguageModule("trac"); include_once "./Services/Tracking/classes/class.ilLearningProgressBaseGUI.php"; foreach ($res as $obj_id => $status) { $path = ilLearningProgressBaseGUI::_getImagePathForStatus($status); $text = ilLearningProgressBaseGUI::_getStatusText($status); $res[$obj_id] = ilUtil::img($path, $text); } } self::$list_gui_cache = $res; }
/** * Fill a table row. * * This method is called internally by ilias to * fill a table row according to the row template. * * @param array $row * @internal param \ilObjTestOverview $overview */ protected function fillRow($row) { $overview = $this->getParentObject()->object; $results = array(); foreach ($overview->getUniqueTests() as $obj_id => $refs) { $test = $overview->getTest($obj_id); $activeId = $test->getActiveIdOfUser($row['member_id']); $result = $progress = null; if ($this->accessIndex[$obj_id]) { $result = $test->getTestResult($activeId); $lpStatus = new ilLPStatus($test->getId()); $progress = $lpStatus->_lookupStatus($test->getId(), $row['member_id']); if ((bool) $progress) { $result = sprintf("%.2f %%", (double) $result['pass']['percent'] * 100); $results[] = $result; } else { $result = $this->lng->txt("rep_robj_xtov_overview_test_not_passed"); $results[] = 0; } if ($activeId > 0) { $resultLink = $this->buildMemberResultLinkTarget($this->accessIndex[$obj_id], $activeId); $this->populateLinkedCell($resultLink, $result, $this->getCSSByProgress($progress)); } else { $this->populateNoLinkCell($result, $this->getCSSByProgress($progress)); } } else { $this->populateNoLinkCell($this->lng->txt("rep_robj_xtov_overview_test_no_permission"), $this->getCSSByProgress($progress)); } } if (count($results)) { $average = sprintf("%.2f", array_sum($results) / count($results)); } else { $average = ""; } $this->tpl->setVariable("AVERAGE_CLASS", ""); $this->tpl->setVariable("AVERAGE_VALUE", $average . (is_numeric($average) ? "%" : "")); $this->tpl->setVariable('TEST_PARTICIPANT', $row['member_fullname']); }
function _getTypicalLearningTime($a_obj_id) { global $ilObjDataCache; if ($ilObjDataCache->lookupType($a_obj_id) == 'sahs') { return parent::_getTypicalLearningTime($a_obj_id); } $tlt = 0; $status_info = ilLPStatusWrapper::_getStatusInfo($a_obj_id); foreach ($status_info['collections'] as $item) { $tlt += ilLPStatusWrapper::_getTypicalLearningTime($ilObjDataCache->lookupObjId($item)); } return $tlt; }
/** * sync course status from lp * * as lp data is not deleted on course exit new members may already have lp completed * * @param int $a_member_id */ public function checkLPStatusSync($a_member_id) { // #11113 include_once "Services/Tracking/classes/class.ilObjUserTracking.php"; if (ilObjUserTracking::_enabledLearningProgress() && $this->getStatusDetermination() == ilObjCourse::STATUS_DETERMINATION_LP) { include_once "Services/Tracking/classes/class.ilLPStatus.php"; $lp_status = ilLPStatus::_lookupStatus($this->getId(), $a_member_id); if ($lp_status == LP_STATUS_COMPLETED_NUM) { $this->getMembersObject()->updatePassed($a_member_id, true, -1); } } }
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(); }
public function syncGlobalStatus($userId, $packageId, $data, $new_global_status) { global $ilDB, $ilLog; $saved_global_status = $data->saved_global_status; $ilLog->write("saved_global_status=" . $saved_global_status); // sync access number and time in read event table //include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Tracking.php"); //ilSCORM2004Tracking::_syncReadEvent($packageId, $userId, "sahs", $a_ref_id); // get attempts if (!$data->packageAttempts) { $val_set = $ilDB->queryF('SELECT package_attempts FROM sahs_user WHERE obj_id = %s AND user_id = %s', array('integer', 'integer'), array($packageId, $userId)); $val_rec = $ilDB->fetchAssoc($val_set); $attempts = $val_rec["package_attempts"]; } else { $attempts = $data->packageAttempts; } if ($attempts == null) { $attempts = ""; } //update percentage_completed, sco_total_time_sec,status in sahs_user $totalTime = (int) $data->totalTimeCentisec; $totalTime = round($totalTime / 100); $ilDB->queryF('UPDATE sahs_user SET sco_total_time_sec=%s, status=%s, percentage_completed=%s, package_attempts=%s WHERE obj_id = %s AND user_id = %s', array('integer', 'integer', 'integer', 'integer', 'integer', 'integer'), array($totalTime, $new_global_status, $data->percentageCompleted, $attempts, $packageId, $userId)); self::ensureObjectDataCacheExistence(); global $ilObjDataCache; include_once "./Services/Tracking/classes/class.ilChangeEvent.php"; ilChangeEvent::_recordReadEvent("sahs", (int) $_GET['ref_id'], $packageId, $userId, false, $attempts, $totalTime); //end sync access number and time in read event table // if($saved_global_status != $new_global_status) // { // update learning progress // include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php"); // ilLPStatusWrapper::_updateStatus($packageId, $userId); include_once "./Services/Tracking/classes/class.ilObjUserTracking.php"; include_once "./Services/Tracking/classes/class.ilLPStatus.php"; ilLPStatus::writeStatus($packageId, $userId, $new_global_status, $data->percentageCompleted); // here put code for soap to MaxCMS e.g. when if($saved_global_status != $new_global_status) // } return true; }
function getStatus($a_packageId, $a_user_id) { include_once './Services/Tracking/classes/class.ilLPStatus.php'; $oldStatus = ilLPStatus::_lookupStatus($a_packageId, $a_user_id); $status['saved_global_status'] = (int) $oldStatus; include_once './Services/Object/classes/class.ilObjectLP.php'; $olp = ilObjectLP::getInstance($a_packageId); $status['lp_mode'] = $olp->getCurrentMode(); $collection = $olp->getCollectionInstance(); if ($collection) { $status['scos'] = $collection->getItems(); } else { $status['scos'] = array(); } $status['hash'] = ilObjSCORMInitData::setHash($a_packageId, $a_user_id); $status['p'] = $a_user_id; return $status; }
/** * Prepare For a Regrade of a Rubric * @param $obj_id * @param $usr_id * @return bool */ public static function _prepareForRegrade($obj_id, $usr_id) { global $ilDB, $ilUser; $delete_date = date("Y-m-d H:i:s"); //try and set deleted on any criteria in rubric_data table where deleted is not null. $affected_rows = $ilDB->manipulate("UPDATE rubric_data d INNER JOIN rubric r on d.rubric_id = r.rubric_id SET d.deleted =\r\n " . $ilDB->quote($delete_date, "timestamp") . " WHERE d.deleted IS NULL AND d.usr_id = " . $ilDB->quote($usr_id, "integer") . " AND r.obj_id = " . $ilDB->quote($obj_id, "integer")); if ($affected_rows > 0) { //there was a mark prior, we should proceed with preparing things for a regrade. include_once 'Services/Tracking/classes/class.ilLPMarks.php'; include_once "./Modules/Exercise/classes/class.ilExAssignment.php"; include_once "./Services/Tracking/classes/class.ilLPStatus.php"; //grab everything from ut_lp_marks for the users obj_id and usr_id, that way we can save it for our own use. $marks = new ilLPMarks($obj_id, $usr_id); $status = ilLPStatus::_lookupStatus($obj_id, $usr_id); $completed = $marks->getCompleted(); $mark = $marks->getMark(); $comments = $marks->getComment(); //Save the UT LP marks for this object. We're using Delete Date for the Create Date so we can inner join to the delete up above so we have a //record of all marks. $id = $ilDB->nextID('rubric_grade_hist'); $ilDB->manipulateF("INSERT INTO rubric_grade_hist(rubric_history_id,rubric_id,obj_id,usr_id,status,mark,completed,comments,owner,create_date,last_update) VALUES " . " (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)", array("integer", "integer", "integer", "integer", "integer", "float", "integer", "text", "integer", "date", "date"), array($id, self::_lookupRubricId($obj_id), $obj_id, $usr_id, $status, $mark, $completed, $comments, $ilUser->getId(), $delete_date, $delete_date)); //now that a record is saved delete it from marks, status and exercise. $marks->_deleteForUsers($obj_id, array($usr_id)); ilLPStatus::writeStatus($obj_id, $usr_id, ilLPStatus::LP_STATUS_IN_PROGRESS_NUM); //Remove from Ex Assignment $ass_id = array_shift(ilExAssignment::getAssignmentDataOfExercise($obj_id)); $assignment = new ilExAssignment($ass_id['id']); $assignment->updateMarkOfUser($ass_id['id'], $usr_id, ''); $assignment->updateStatusOfUser($ass_id['id'], $usr_id, 'notgraded'); return true; } else { //there were no marks to begin with OR this was already marked for regrade, so go no further. return false; } }
function ilLPStatusTestFinished($a_obj_id) { global $ilDB; parent::ilLPStatus($a_obj_id); $this->db =& $ilDB; }
/** * Get completion for user * * @param int $a_user_id * @param int $a_object_id * @return string datetime */ protected function getUserCompletionDate($a_user_id, $a_object_id = null) { if (!$a_object_id) { $a_object_id = $this->object->getId(); } include_once "Services/Tracking/classes/class.ilLPStatus.php"; return ilLPStatus::_lookupStatusChanged($a_object_id, $a_user_id); }
/** * get selected items per type */ function getSelectedItemsPerLocation(&$tpl) { global $ilUser, $rbacsystem, $objDefinition, $ilBench, $ilSetting, $ilObjDataCache, $tree; $output = false; $items = $ilUser->getDesktopItems(); $item_html = array(); $cur_obj_type = ""; if (count($items) > 0) { // preload object data cache $ref_ids = $obj_ids = array(); foreach ($items as $item) { $ref_ids[] = $item["ref_id"]; $obj_ids[] = $item["obj_id"]; } reset($items); $tree->preloadDeleted($ref_ids); $tree->preloadDepthParent($ref_ids); $ilObjDataCache->preloadReferenceCache($ref_ids); include_once "Services/Tracking/classes/class.ilLPStatus.php"; ilLPStatus::preloadListGUIData($obj_ids); include_once "Services/Object/classes/class.ilObjectActivation.php"; ilObjectActivation::preloadData($ref_ids); foreach ($items as $item) { //echo "1"; // get list gui class for each object type if ($cur_obj_type != $item["type"]) { $item_list_gui =& $this->getItemListGUI($item["type"]); if (!$item_list_gui) { continue; } ilObjectActivation::addListGUIActivationProperty($item_list_gui, $item); // notes, comment currently do not work properly $item_list_gui->enableNotes(false); $item_list_gui->enableComments(false); $item_list_gui->enableTags(false); $item_list_gui->enableIcon(true); $item_list_gui->enableDelete(false); $item_list_gui->enableCut(false); $item_list_gui->enableCopy(false); $item_list_gui->enablePayment(false); $item_list_gui->enableLink(false); $item_list_gui->enableInfoScreen(true); if ($this->getCurrentDetailLevel() < 3 || $this->manage) { //echo "3"; $item_list_gui->enableDescription(false); $item_list_gui->enableProperties(false); $item_list_gui->enablePreconditions(false); } if ($this->getCurrentDetailLevel() < 2 || $this->manage) { $item_list_gui->enableCommands(true, true); } } // render item row $ilBench->start("ilPersonalDesktopGUI", "getListHTML"); $item_list_gui->setContainerObject($this); $html = $item_list_gui->getListItemHTML($item["ref_id"], $item["obj_id"], $item["title"], $item["description"]); $ilBench->stop("ilPersonalDesktopGUI", "getListHTML"); if ($html != "") { // BEGIN WebDAV: Use $item_list_gui to determine icon image type $item_html[] = array("html" => $html, "item_ref_id" => $item["ref_id"], "item_obj_id" => $item["obj_id"], "parent_ref" => $item["parent_ref"], "type" => $item["type"], 'item_icon_image_type' => $item_list_gui->getIconImageType()); // END WebDAV: Use $item_list_gui to determine icon image type } } // output block for resource type if (count($item_html) > 0) { $cur_parent_ref = 0; // content row foreach ($item_html as $item) { // add a parent header row for each new parent if ($cur_parent_ref != $item["parent_ref"]) { if ($ilSetting->get("icon_position_in_lists") == "item_rows") { $this->addParentRow($tpl, $item["parent_ref"], false); } else { $this->addParentRow($tpl, $item["parent_ref"]); } $this->resetRowType(); $cur_parent_ref = $item["parent_ref"]; } // BEGIN WebDAV: Use $item_list_gui to determine icon image type. $this->addStandardRow($tpl, $item["html"], $item["item_ref_id"], $item["item_obj_id"], $item['item_icon_image_type'], "th_" . $cur_parent_ref); // END WebDAV: Use $item_list_gui to determine icon image type. $output = true; } } } return $output; }
function getStatus($a_packageId, $a_user_id, $auto_last_visited, $scormType = "1.2") { global $ilDB; include_once './Services/Tracking/classes/class.ilLPStatus.php'; $oldStatus = ilLPStatus::_lookupStatus($a_packageId, $a_user_id); $status['saved_global_status'] = (int) $oldStatus; include_once './Services/Object/classes/class.ilObjectLP.php'; $olp = ilObjectLP::getInstance($a_packageId); $status['lp_mode'] = $olp->getCurrentMode(); $collection = $olp->getCollectionInstance(); if ($collection) { $status['scos'] = $collection->getItems(); } else { $status['scos'] = array(); } $status['hash'] = ilObjSCORMInitData::setHash($a_packageId, $a_user_id); $status['p'] = $a_user_id; $status['last_visited'] = null; $status['total_time_sec'] = 0; $val_set = $ilDB->queryF('SELECT last_visited, sco_total_time_sec, total_time_sec FROM sahs_user WHERE obj_id = %s AND user_id = %s', array('integer', 'integer'), array($a_packageId, $a_user_id)); $val_rec = $ilDB->fetchAssoc($val_set); if ($auto_last_visited) { $status['last_visited'] = $val_rec["last_visited"]; } if ($val_rec["total_time_sec"] == null) { if ($val_rec["sco_total_time_sec"] == null) { //fall back for old ILIAS-Versions if ($scormType == "2004") { include_once './Modules/Scorm2004/classes/class.ilSCORM2004Tracking.php'; $status['total_time_sec'] = (int) ilSCORM2004Tracking::getSumTotalTimeSecondsFromScos($a_packageId, $a_user_id, true); } } else { $status['total_time_sec'] = (int) $val_rec["sco_total_time_sec"]; } } else { $status['total_time_sec'] = (int) $val_rec["total_time_sec"]; } return $status; }
public function syncGlobalStatus($userId, $packageId, $data, $new_global_status, $time_from_lms) { global $ilDB, $ilLog; $saved_global_status = $data->saved_global_status; $ilLog->write("saved_global_status=" . $saved_global_status); //update percentage_completed, sco_total_time_sec,status in sahs_user $totalTime = (int) $data->totalTimeCentisec; $totalTime = round($totalTime / 100); $ilDB->queryF('UPDATE sahs_user SET sco_total_time_sec=%s, status=%s, percentage_completed=%s WHERE obj_id = %s AND user_id = %s', array('integer', 'integer', 'integer', 'integer', 'integer'), array($totalTime, $new_global_status, $data->percentageCompleted, $packageId, $userId)); self::ensureObjectDataCacheExistence(); global $ilObjDataCache; // update learning progress if ($new_global_status != null) { //could only happen when synchronising from SCORM Offline Player include_once "./Services/Tracking/classes/class.ilObjUserTracking.php"; include_once "./Services/Tracking/classes/class.ilLPStatus.php"; ilLPStatus::writeStatus($packageId, $userId, $new_global_status, $data->percentageCompleted); // here put code for soap to MaxCMS e.g. when if($saved_global_status != $new_global_status) } // sync access number and time in read event table if ($time_from_lms == false) { include_once "./Modules/Scorm2004/classes/class.ilSCORM2004Tracking.php"; ilSCORM2004Tracking::_syncReadEvent($packageId, $userId, "sahs", (int) $_GET['ref_id'], $time_from_lms); } //end sync access number and time in read event table return true; }
function isFullfilled($user_id, $item_id) { global $ilObjDataCache; include_once './Modules/Course/classes/class.ilCourseLMHistory.php'; $lm_continue =& new ilCourseLMHistory($this->getRefId(), $user_id); $continue_data = $lm_continue->getLMHistory(); $obj_id = $ilObjDataCache->lookupObjId($item_id); $type = $ilObjDataCache->lookupType($obj_id); switch ($type) { case 'tst': include_once './Modules/Test/classes/class.ilObjTestAccess.php'; include_once './Services/AccessControl/classes/class.ilConditionHandler.php'; if (!ilObjTestAccess::checkCondition($obj_id, ilConditionHandler::OPERATOR_FINISHED, '', $user_id)) { return false; } break; case 'svy': include_once './Modules/Survey/classes/class.ilObjSurveyAccess.php'; if (!ilObjSurveyAccess::_lookupFinished($obj_id, $user_id)) { return false; } break; case 'sahs': include_once 'Services/Tracking/classes/class.ilLPStatus.php'; if (!ilLPStatus::_hasUserCompleted($obj_id, $user_id)) { return false; } break; default: if (!isset($continue_data[$item_id])) { return false; } } return true; }
public function preload() { global $objDefinition, $tree, $ilObjDataCache, $ilUser, $rbacsystem; if (!$this->obj_ids) { return; } $this->obj_ids = array_unique($this->obj_ids); $this->types = array_unique($this->types); if ($this->ref_ids) { $this->ref_ids = array_unique($this->ref_ids); } // type specific preloads include_once "./Services/AccessControl/classes/class.ilConditionHandler.php"; foreach ($this->types as $type) { $this->obj_ids_by_type[$type] = array_unique($this->obj_ids_by_type[$type]); if (is_array($this->ref_ids_by_type[$type])) { $this->ref_ids_by_type[$type] = array_unique($this->ref_ids_by_type[$type]); } if ($this->context == ilObjectListGUI::CONTEXT_REPOSITORY || $this->context == ilObjectListGUI::CONTEXT_PERSONAL_DESKTOP || $this->context == ilObjectListGUI::CONTEXT_SEARCH) { ilConditionHandler::preloadConditionsForTargetRecords($type, $this->obj_ids_by_type[$type]); } $class = $objDefinition->getClassName($type); $location = $objDefinition->getLocation($type); if ($class && $location) { $full_class = "ilObj" . $class . "Access"; include_once $location . "/class." . $full_class . ".php"; if (class_exists($full_class)) { call_user_func(array($full_class, "_preloadData"), $this->obj_ids_by_type[$type], $this->ref_ids_by_type[$type]); } } } if ($this->ref_ids) { $tree->preloadDeleted($this->ref_ids); $tree->preloadDepthParent($this->ref_ids); $ilObjDataCache->preloadReferenceCache($this->ref_ids, false); $rbacsystem->preloadRbacPaCache($this->ref_ids, $ilUser->getId()); if ($ilUser->getId != ANONYMOUS_USER_ID && $this->context != ilObjectListGUI::CONTEXT_PERSONAL_DESKTOP) { ilObjUser::preloadIsDesktopItem($ilUser->getId(), $this->ref_ids); } include_once "./Services/Object/classes/class.ilObjectActivation.php"; ilObjectActivation::preloadData($this->ref_ids); } include_once "./Services/Object/classes/class.ilObjectListGUI.php"; ilObjectListGUI::preloadCommonProperties($this->obj_ids, $this->context); if ($this->context == ilObjectListGUI::CONTEXT_REPOSITORY) { include_once "./Services/Rating/classes/class.ilRating.php"; include_once "./Services/Rating/classes/class.ilRatingGUI.php"; ilRating::preloadListGUIData($this->obj_ids); include_once "./Services/AdvancedMetaData/classes/class.ilAdvancedMDValues.php"; ilAdvancedMDValues::preloadByObjIds($this->obj_ids); } if ($this->context == ilObjectListGUI::CONTEXT_REPOSITORY || $this->context == ilObjectListGUI::CONTEXT_PERSONAL_DESKTOP || $this->context == ilObjectListGUI::CONTEXT_SEARCH) { include_once "./Services/Tracking/classes/class.ilLPStatus.php"; ilLPStatus::preloadListGUIData($this->obj_ids); } }
protected function initEditUserForm($a_user_id, $a_obj_id, $a_cancel = null) { global $lng, $ilCtrl; include_once 'Services/Object/classes/class.ilObjectLP.php'; $olp = ilObjectLP::getInstance($a_obj_id); $lp_mode = $olp->getCurrentMode(); include_once './Services/Form/classes/class.ilPropertyFormGUI.php'; $form = new ilPropertyFormGUI(); $form->setFormAction($ilCtrl->getFormAction($this, "updateUser")); $form->setTitle($lng->txt("edit") . ": " . ilObject::_lookupTitle($a_obj_id)); $form->setDescription($lng->txt('trac_mode') . ": " . $olp->getModeText($lp_mode)); include_once "Services/User/classes/class.ilUserUtil.php"; $user = new ilNonEditableValueGUI($lng->txt("user"), null, true); $user->setValue(ilUserUtil::getNamePresentation($a_user_id, true)); $form->addItem($user); include_once 'Services/Tracking/classes/class.ilLPMarks.php'; $marks = new ilLPMarks($a_obj_id, $a_user_id); $type = ilObject::_lookupType($a_obj_id); if ($type != 'lm') { $mark = new ilTextInputGUI($lng->txt("trac_mark"), "mark"); $mark->setValue($marks->getMark()); $mark->setMaxLength(32); $form->addItem($mark); } $comm = new ilTextInputGUI($lng->txt("trac_comment"), "comment"); $comm->setValue($marks->getComment()); $form->addItem($comm); if ($lp_mode == ilLPObjSettings::LP_MODE_MANUAL || $lp_mode == ilLPObjSettings::LP_MODE_MANUAL_BY_TUTOR) { include_once "./Services/Tracking/classes/class.ilLPStatus.php"; $completed = ilLPStatus::_lookupStatus($a_obj_id, $a_user_id); $status = new ilCheckboxInputGUI($lng->txt('trac_completed'), "completed"); $status->setChecked($completed == ilLPStatus::LP_STATUS_COMPLETED_NUM); $form->addItem($status); } $form->addCommandButton("updateUser", $lng->txt('save')); if ($a_cancel) { $form->addCommandButton($a_cancel, $lng->txt('cancel')); } return $form; }
/** * insert properties * * @access private */ function insertProperties($a_item = '') { global $ilAccess, $lng, $ilUser; $props = $this->getProperties($a_item); $props = $this->getCustomProperties($props); if ($this->context != self::CONTEXT_WORKSPACE && $this->context != self::CONTEXT_WORKSPACE_SHARING) { // add learning progress custom property include_once "Services/Tracking/classes/class.ilLPStatus.php"; $lp = ilLPStatus::getListGUIStatus($this->obj_id); if ($lp) { $props[] = array("alert" => false, "property" => $lng->txt("learning_progress"), "value" => $lp, "newline" => true); } // add no item access note in public section // for items that are visible but not readable if ($this->ilias->account->getId() == ANONYMOUS_USER_ID) { if (!$ilAccess->checkAccess("read", "", $this->ref_id, $this->type, $this->obj_id)) { $props[] = array("alert" => true, "value" => $lng->txt("no_access_item_public"), "newline" => true); } } } // reference objects have translated ids, revert to originals $note_ref_id = $this->ref_id; $note_obj_id = $this->obj_id; if ($this->reference_ref_id) { $note_ref_id = $this->reference_ref_id; $note_obj_id = $this->reference_obj_id; } $redraw_js = "il.Object.redrawListItem(" . $note_ref_id . ");"; // add common properties (comments, notes, tags) if ((self::$cnt_notes[$note_obj_id][IL_NOTE_PRIVATE] > 0 || self::$cnt_notes[$note_obj_id][IL_NOTE_PUBLIC] > 0 || self::$cnt_tags[$note_obj_id] > 0 || is_array(self::$tags[$note_obj_id])) && $ilUser->getId() != ANONYMOUS_USER_ID) { include_once "./Services/Notes/classes/class.ilNoteGUI.php"; include_once "./Services/Tagging/classes/class.ilTaggingGUI.php"; $nl = true; if ($this->isCommentsActivated($this->type, $this->ref_id, $this->obj_id, false, false) && self::$cnt_notes[$note_obj_id][IL_NOTE_PUBLIC] > 0) { $props[] = array("alert" => false, "property" => $lng->txt("notes_comments"), "value" => "<a href='#' onclick=\"return " . ilNoteGUI::getListCommentsJSCall($this->ajax_hash, $redraw_js) . "\">" . self::$cnt_notes[$note_obj_id][IL_NOTE_PUBLIC] . "</a>", "newline" => $nl); $nl = false; } if ($this->notes_enabled && self::$cnt_notes[$note_obj_id][IL_NOTE_PRIVATE] > 0) { $props[] = array("alert" => false, "property" => $lng->txt("notes"), "value" => "<a href='#' onclick=\"return " . ilNoteGUI::getListNotesJSCall($this->ajax_hash, $redraw_js) . "\">" . self::$cnt_notes[$note_obj_id][IL_NOTE_PRIVATE] . "</a>", "newline" => $nl); $nl = false; } if ($this->tags_enabled && (self::$cnt_tags[$note_obj_id] > 0 || is_array(self::$tags[$note_obj_id]))) { $tags_set = new ilSetting("tags"); if ($tags_set->get("enable")) { $tags_url = ilTaggingGUI::getListTagsJSCall($this->ajax_hash, $redraw_js); // list object tags if (is_array(self::$tags[$note_obj_id])) { $tags_tmp = array(); foreach (self::$tags[$note_obj_id] as $tag => $is_tag_owner) { if ($is_tag_owner) { $tags_tmp[] = "<a class=\"ilTag ilTagRelHigh\" href='#' onclick=\"return " . $tags_url . "\">" . $tag . "</a>"; } else { $tags_tmp[] = "<span class=\"ilTag ilTagRelMiddle\">" . $tag . "</span>"; } } $tags_value = implode(" ", $tags_tmp); $nl = true; $prop_text = ""; } else { $tags_value = "<a href='#' onclick=\"return " . $tags_url . "\">" . self::$cnt_tags[$note_obj_id] . "</a>"; $prop_text = $lng->txt("tagging_tags"); } $props[] = array("alert" => false, "property" => $prop_text, "value" => $tags_value, "newline" => $nl); $nl = false; } } } $cnt = 1; if (is_array($props) && count($props) > 0) { foreach ($props as $prop) { // BEGIN WebDAV: Display a separator between properties. if ($cnt > 1) { $this->tpl->touchBlock("separator_prop"); } // END WebDAV: Display a separator between properties. if ($prop["alert"] == true) { $this->tpl->touchBlock("alert_prop"); } else { $this->tpl->touchBlock("std_prop"); } if ($prop["newline"] == true && $cnt > 1) { $this->tpl->touchBlock("newline_prop"); } //BEGIN WebDAV: Support hidden property names. if (isset($prop["property"]) && $prop['propertyNameVisible'] !== false && $prop["property"] != "") { $this->tpl->setCurrentBlock("prop_name"); $this->tpl->setVariable("TXT_PROP", $prop["property"]); $this->tpl->parseCurrentBlock(); } $this->tpl->setCurrentBlock("item_property"); //BEGIN WebDAV: Support links in property values. if ($prop['link']) { $this->tpl->setVariable("LINK_PROP", $prop['link']); $this->tpl->setVariable("LINK_VAL_PROP", $prop["value"]); } else { $this->tpl->setVariable("VAL_PROP", $prop["value"]); } //END WebDAV: Support links in property values. $this->tpl->parseCurrentBlock(); $cnt++; } $this->tpl->setCurrentBlock("item_properties"); $this->tpl->parseCurrentBlock(); } }
/** * sync course status from lp * * as lp data is not deleted on course exit new members may already have lp completed * * @param int $a_member_id */ public function checkLPStatusSync($a_member_id) { // #11113 include_once "Services/Tracking/classes/class.ilObjUserTracking.php"; if (ilObjUserTracking::_enabledLearningProgress() && $this->getStatusDetermination() == ilObjCourse::STATUS_DETERMINATION_LP) { include_once "Services/Tracking/classes/class.ilLPStatus.php"; // #13811 - we need to suppress creation if status entry $has_completed = ilLPStatus::_lookupStatus($this->getId(), $a_member_id, false) == ilLPStatus::LP_STATUS_COMPLETED_NUM; $this->getMembersObject()->updatePassed($a_member_id, $has_completed, false, true); } }
public function getSCORMCompletionStatus($sid, $a_usr_id, $a_ref_id) { $this->initAuth($sid); $this->initIlias(); if (!$this->__checkSession($sid)) { return $this->__raiseError($this->__getMessage(), $this->__getMessageCode()); } if (!strlen($a_ref_id)) { return $this->__raiseError('No ref_id given. Aborting!', 'Client'); } include_once 'include/inc.header.php'; // get obj_id if (!($obj_id = ilObject::_lookupObjectId($a_ref_id))) { return $this->__raiseError('No scorm module found for id: ' . $a_ref_id, 'Client'); } include_once 'Services/Tracking/classes/class.ilLPStatus.php'; include_once 'Services/Tracking/classes/class.ilObjUserTracking.php'; if (!ilObjUserTracking::_enabledLearningProgress()) { return $this->__raiseError('Learning progress not enabled in this installation. Aborting!', 'Server'); } $status = ilLPStatus::_lookupStatus($obj_id, $a_usr_id); if ($status == ilLPStatus::LP_STATUS_COMPLETED_NUM) { return 'completed'; } else { if ($status == ilLPStatus::LP_STATUS_FAILED_NUM) { return 'failed'; } else { if ($status == ilLPStatus::LP_STATUS_IN_PROGRESS_NUM) { return 'in_progress'; } else { return 'not_attempted'; } } } }