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; }
/** * Get children for given object * @param int $a_parent_id * @param array $result */ function getObjectHierarchy($a_parent_id, array &$result) { include_once 'Services/Tracking/classes/class.ilLPCollectionCache.php'; foreach (ilLPCollectionCache::_getItems($a_parent_id) as $child_ref_id) { $child_id = ilObject::_lookupObjId($child_ref_id); $result[] = $child_id; $this->getObjectHierarchy($child_id, $result); } }
/** * Get (sub)objects for given object, also handles learning objectives (course only) * * @param int $a_parent_obj_id * @param int $a_parent_ref_id * @param int $use_collection * @param bool $a_refresh_status * @param array $a_user_ids * @return array object_ids, objectives_parent_id */ public static function getObjectIds($a_parent_obj_id, $a_parent_ref_id = false, $use_collection = true, $a_refresh_status = true, $a_user_ids = null) { include_once "Services/Tracking/classes/class.ilLPObjSettings.php"; $object_ids = array($a_parent_obj_id); $ref_ids = array($a_parent_obj_id => $a_parent_ref_id); $objectives_parent_id = $scorm = false; $mode = ilLPObjSettings::_lookupMode($a_parent_obj_id); switch ($mode) { // what about LP_MODE_SCORM_PACKAGE ? case LP_MODE_SCORM: include_once "Services/Tracking/classes/class.ilLPStatusSCORM.php"; $status_scorm = new ilLPStatusSCORM($a_parent_obj_id); $scorm = $status_scorm->_getStatusInfo($a_parent_obj_id); break; case LP_MODE_OBJECTIVES: if (ilObject::_lookupType($a_parent_obj_id) == "crs") { $objectives_parent_id = $a_parent_obj_id; } break; default: // lp collection if ($use_collection) { include_once 'Services/Tracking/classes/class.ilLPCollectionCache.php'; foreach (ilLPCollectionCache::_getItems($a_parent_obj_id) as $child_ref_id) { $child_id = ilObject::_lookupObjId($child_ref_id); $object_ids[] = $child_id; $ref_ids[$child_id] = $child_ref_id; } } else { self::getSubTree($a_parent_ref_id, $object_ids, $ref_ids); $object_ids = array_unique($object_ids); } foreach ($object_ids as $idx => $object_id) { if (!$object_id) { unset($object_ids[$idx]); } } break; } if ($a_refresh_status) { self::refreshObjectsStatus($object_ids, $a_user_ids); } return array("object_ids" => $object_ids, "ref_ids" => $ref_ids, "objectives_parent_id" => $objectives_parent_id, "scorm" => $scorm); }
/** * Determine percentage * * @param integer object id * @param integer user id * @param object object (optional depends on object type) * @return integer percentage */ function determinePercentage($a_obj_id, $a_user_id, $a_obj = null) { // Which sco's determine the status include_once './Services/Tracking/classes/class.ilLPCollectionCache.php'; $scos = ilLPCollectionCache::_getItems($a_obj_id); $reqscos = count($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"; $compl = ilObjSCORMTracking::_countCompleted($scos, $a_obj_id, $a_user_id); } else { include_once "./Modules/Scorm2004/classes/class.ilSCORM2004Tracking.php"; $compl = ilSCORM2004Tracking::_countCompleted($scos, $a_obj_id, $a_user_id, true); } if ($reqscos > 0) { $per = min(100, 100 / $reqscos * $compl); } else { $per = 100; } return $per; }
function __readItemStatusInfo($a_items) { global $ilObjDataCache; foreach ($a_items as $item_id) { $this->obj_data[$item_id]['mode'] = ilLPObjSettings::_lookupMode($item_id); $this->obj_data[$item_id]['type'] = $ilObjDataCache->lookupType($item_id); if ($this->obj_data[$item_id]['mode'] == LP_MODE_TLT) { include_once './Services/MetaData/classes/class.ilMDEducational.php'; $this->obj_data[$item_id]['tlt'] = ilMDEducational::_getTypicalLearningTimeSeconds($item_id); } if ($this->obj_data[$item_id]['mode'] == LP_MODE_VISITS) { include_once './Services/Tracking/classes/class.ilLPObjSettings.php'; $this->obj_data[$item_id]['visits'] = ilLPObjSettings::_lookupVisits($item_id); } if ($this->obj_data[$item_id]['mode'] == LP_MODE_SCORM) { include_once './Services/Tracking/classes/class.ilLPCollectionCache.php'; $this->obj_data[$item_id]['scos'] = count(ilLPCollectionCache::_getItems($item_id)); } } }
function details() { global $ilObjDataCache, $ilCtrl, $rbacsystem; // Show back button to crs if called from crs. Otherwise if called from personal desktop or administration // show back to list if ((int) $_GET['crs_id']) { $this->ctrl->setParameter($this, 'details_id', (int) $_GET['crs_id']); $this->__showButton($this->ctrl->getLinkTarget($this, 'details'), $this->lng->txt('trac_view_crs')); } elseif ($this->getMode() == LP_MODE_PERSONAL_DESKTOP or $this->getMode() == LP_MODE_ADMINISTRATION or $this->getMode() == LP_MODE_USER_FOLDER) { $this->__showButton($this->ctrl->getLinkTarget($this, 'show'), $this->lng->txt('trac_view_list')); } $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.lp_progress_container.html', 'Services/Tracking'); include_once "./Services/InfoScreen/classes/class.ilInfoScreenGUI.php"; $info = new ilInfoScreenGUI($this); $info->setFormAction($ilCtrl->getFormAction($this)); $this->__appendUserInfo($info, $this->tracked_user); $this->__showObjectDetails($info, $this->details_obj_id); $this->__appendLPDetails($info, $this->details_obj_id, $this->tracked_user->getId()); // Finally set template variable $this->tpl->setVariable("LM_INFO", $info->getHTML()); include_once './Services/Tracking/classes/class.ilLPCollectionCache.php'; $obj_ids = array(); foreach (ilLPCollectionCache::_getItems($this->details_obj_id) as $ref_id) { switch ($this->details_mode) { case LP_MODE_SCORM: case LP_MODE_OBJECTIVES: $obj_ids[] = $ref_id; break; default: $obj_ids[ilObject::_lookupObjectId($ref_id)] = array($ref_id); break; } } $personal_only = !$rbacsystem->checkAccess('edit_learning_progress', $this->getRefId()); include_once "./Services/Tracking/classes/class.ilLPProgressTableGUI.php"; $lp_table = new ilLPProgressTableGUI($this, "details", $this->tracked_user, $obj_ids, true, $this->details_mode, $personal_only, $this->details_obj_id); $this->tpl->setVariable("LP_OBJECTS", $lp_table->getHTML()); $this->tpl->setVariable("LEGEND", $this->__getLegendHTML()); }
function _getStatusInfo($a_obj_id) { include_once './Services/Tracking/classes/class.ilLPCollectionCache.php'; $status_info = array(); $status_info['collections'] = ilLPCollectionCache::_getItems($a_obj_id); $status_info['num_collections'] = count($status_info['collections']); return $status_info; }