/**
  * Determine status
  *
  * @param	integer		object id
  * @param	integer		user id
  * @param	object		object (optional depends on object type)
  * @return	integer		status
  */
 function determineStatus($a_obj_id, $a_user_id, $a_obj = null)
 {
     $status = self::LP_STATUS_NOT_ATTEMPTED_NUM;
     include_once "Services/Tracking/classes/class.ilChangeEvent.php";
     if (ilChangeEvent::hasAccessed($a_obj_id, $a_user_id)) {
         $status = self::LP_STATUS_IN_PROGRESS_NUM;
         include_once "Modules/LearningModule/classes/class.ilLMTracker.php";
         $tracker = ilLMTracker::getInstanceByObjId($a_obj_id, $a_user_id);
         if ($tracker->getAllQuestionsCorrect()) {
             $status = self::LP_STATUS_COMPLETED_NUM;
         }
     }
     return $status;
 }
 /**
  * Determine status
  *
  * @param	integer		object id
  * @param	integer		user id
  * @param	object		object (optional depends on object type)
  * @return	integer		status
  */
 function determineStatus($a_obj_id, $a_user_id, $a_obj = null)
 {
     global $ilObjDataCache, $ilDB;
     $status = LP_STATUS_NOT_ATTEMPTED_NUM;
     switch ($ilObjDataCache->lookupType($a_obj_id)) {
         case 'lm':
             if (ilChangeEvent::hasAccessed($a_obj_id, $a_user_id)) {
                 $status = LP_STATUS_IN_PROGRESS_NUM;
                 // completed?
                 $status_info = ilLPStatusWrapper::_getStatusInfo($a_obj_id);
                 $tlt = $status_info['tlt'];
                 include_once './Services/Tracking/classes/class.ilChangeEvent.php';
                 $re = ilChangeEvent::_lookupReadEvents($a_obj_id, $a_user_id);
                 if ($re[0]['spent_seconds'] >= $tlt) {
                     $status = LP_STATUS_COMPLETED_NUM;
                 }
             }
             break;
     }
     return $status;
 }
 /**
  * Determine status
  *
  * @param	integer		object id
  * @param	integer		user id
  * @param	object		object (optional depends on object type)
  * @return	integer		status
  */
 function determineStatus($a_obj_id, $a_user_id, $a_obj = null)
 {
     global $ilObjDataCache, $ilDB;
     $status = self::LP_STATUS_NOT_ATTEMPTED_NUM;
     switch ($ilObjDataCache->lookupType($a_obj_id)) {
         case 'dbk':
         case 'lm':
         case 'htlm':
             include_once "./Services/Tracking/classes/class.ilChangeEvent.php";
             if (ilChangeEvent::hasAccessed($a_obj_id, $a_user_id)) {
                 $status = self::LP_STATUS_IN_PROGRESS_NUM;
                 // completed?
                 $set = $ilDB->query($q = "SELECT usr_id FROM ut_lp_marks " . "WHERE obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " " . "AND usr_id = " . $ilDB->quote($a_user_id, 'integer') . " " . "AND completed = '1' ");
                 if ($rec = $ilDB->fetchAssoc($set)) {
                     $status = self::LP_STATUS_COMPLETED_NUM;
                 }
             }
             break;
     }
     return $status;
 }
 /**
  * Determine status
  *
  * @param	integer		object id
  * @param	integer		user id
  * @param	object		object (optional depends on object type)
  * @return	integer		status
  */
 function determineStatus($a_obj_id, $a_user_id, $a_obj = null)
 {
     global $ilObjDataCache;
     $status = LP_STATUS_NOT_ATTEMPTED_NUM;
     switch ($ilObjDataCache->lookupType($a_obj_id)) {
         case 'exc':
             include_once './Services/Tracking/classes/class.ilChangeEvent.php';
             include_once './Modules/Exercise/classes/class.ilExerciseMembers.php';
             if (ilChangeEvent::hasAccessed($a_obj_id, $a_user_id) || ilExerciseMembers::_hasReturned($a_obj_id, $a_user_id)) {
                 $status = LP_STATUS_IN_PROGRESS_NUM;
             }
             $ex_stat = ilExerciseMembers::_lookupStatus($a_obj_id, $a_user_id);
             if ($ex_stat == "passed") {
                 $status = LP_STATUS_COMPLETED_NUM;
             }
             if ($ex_stat == "failed") {
                 $status = LP_STATUS_FAILED_NUM;
             }
             break;
     }
     return $status;
 }
 /**
  * Determine status
  *
  * @param	integer		object id
  * @param	integer		user id
  * @param	object		object (optional depends on object type)
  * @return	integer		status
  */
 function determineStatus($a_obj_id, $a_user_id, $a_obj = null)
 {
     global $ilObjDataCache, $ilDB, $ilLog;
     $status = self::LP_STATUS_NOT_ATTEMPTED_NUM;
     // if the user has accessed the scorm object
     // the status is at least "in progress"
     include_once "./Services/Tracking/classes/class.ilChangeEvent.php";
     if (ilChangeEvent::hasAccessed($a_obj_id, $a_user_id)) {
         $status = self::LP_STATUS_IN_PROGRESS_NUM;
     }
     //$ilLog->write("-".$status."-");
     // Which sco's determine the status
     include_once './Services/Object/classes/class.ilObjectLP.php';
     $olp = ilObjectLP::getInstance($a_obj_id);
     $collection = $olp->getCollectionInstance();
     if ($collection) {
         $scos = $collection->getItems();
         if (sizeof($scos)) {
             include_once './Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php';
             $subtype = ilObjSAHSLearningModule::_lookupSubType($a_obj_id);
             switch ($subtype) {
                 case 'hacp':
                 case 'aicc':
                 case 'scorm':
                     include_once "./Modules/ScormAicc/classes/SCORM/class.ilObjSCORMTracking.php";
                     $scorm_status = ilObjSCORMTracking::_getCollectionStatus($scos, $a_obj_id, $a_user_id);
                     break;
                 case 'scorm2004':
                     include_once "./Modules/Scorm2004/classes/class.ilSCORM2004Tracking.php";
                     $scorm_status = ilSCORM2004Tracking::_getCollectionStatus($scos, $a_obj_id, $a_user_id);
                     break;
             }
             switch ($scorm_status) {
                 case "in_progress":
                     $status = self::LP_STATUS_IN_PROGRESS_NUM;
                     break;
                 case "completed":
                     $status = self::LP_STATUS_COMPLETED_NUM;
                     break;
                 case "failed":
                     $status = self::LP_STATUS_FAILED_NUM;
                     break;
             }
         }
     }
     //$ilLog->write("-".$status."-");
     return $status;
 }
 /**
  * Determine status
  *
  * @param	integer		object id
  * @param	integer		user id
  * @param	object		object (optional depends on object type)
  * @return	integer		status
  */
 function determineStatus($a_obj_id, $a_user_id, $a_obj = null)
 {
     global $ilObjDataCache, $ilDB;
     // the status completed depends on:
     // $status_info['num_objectives'] (ilLPStatusWrapper::_getStatusInfo($a_obj_id);)
     // - ilCourseObjective::_getObjectiveIds($a_obj_id);
     // - table crs_objectives manipulated in
     // - ilCourseObjective
     // $status_info['objective_result']  (ilLPStatusWrapper::_getStatusInfo($a_obj_id);)
     // table crs_objective_status (must not contain a dataset)
     // ilCourseObjectiveResult -> added ilLPStatusWrapper::_updateStatus()
     $status = self::LP_STATUS_NOT_ATTEMPTED_NUM;
     switch ($ilObjDataCache->lookupType($a_obj_id)) {
         case "crs":
             include_once "./Services/Tracking/classes/class.ilChangeEvent.php";
             if (ilChangeEvent::hasAccessed($a_obj_id, $a_user_id)) {
                 $status = self::LP_STATUS_IN_PROGRESS_NUM;
                 include_once 'Modules/Course/classes/class.ilCourseObjective.php';
                 $objectives = ilCourseObjective::_getObjectiveIds($a_obj_id);
                 if ($objectives) {
                     $set = $ilDB->query("SELECT count(objective_id) cnt FROM crs_objective_status " . "WHERE " . $ilDB->in('objective_id', $objectives, false, 'integer') . " AND user_id = " . $ilDB->quote($a_user_id, "integer"));
                     if ($rec = $ilDB->fetchAssoc($set)) {
                         if ($rec["cnt"] == count($objectives)) {
                             $status = self::LP_STATUS_COMPLETED_NUM;
                         }
                     }
                 }
             }
             break;
     }
     return $status;
 }
 /**
  * Determine status
  *
  * @param	integer		object id
  * @param	integer		user id
  * @param	object		object (optional depends on object type)
  * @return	integer		status
  */
 function determineStatus($a_obj_id, $a_user_id, $a_obj = null)
 {
     global $ilObjDataCache;
     $status['completed'] = true;
     $status['failed'] = false;
     $status['in_progress'] = false;
     switch ($ilObjDataCache->lookupType($a_obj_id)) {
         case "crs":
         case "fold":
         case "grp":
             include_once "./Services/Tracking/classes/class.ilChangeEvent.php";
             if (ilChangeEvent::hasAccessed($a_obj_id, $a_user_id)) {
                 $status['in_progress'] = true;
             }
             include_once './Services/Object/classes/class.ilObjectLP.php';
             $olp = ilObjectLP::getInstance($a_obj_id);
             $collection = $olp->getCollectionInstance();
             if ($collection) {
                 $grouped_items = $collection->getGroupedItemsForLPStatus();
             }
             if (!sizeof($grouped_items)) {
                 // #11513 - empty collections cannot be completed
                 $status['completed'] = false;
             } else {
                 foreach ($grouped_items as $grouping_id => $grouping) {
                     $isGrouping = $grouping_id ? true : false;
                     $status = self::determineGroupingStatus($status, $grouping, $a_user_id, $isGrouping);
                 }
             }
             if ($status['completed']) {
                 return self::LP_STATUS_COMPLETED_NUM;
             }
             if ($status['failed']) {
                 return self::LP_STATUS_FAILED_NUM;
             }
             if ($status['in_progress']) {
                 return self::LP_STATUS_IN_PROGRESS_NUM;
             }
             break;
     }
     return self::LP_STATUS_NOT_ATTEMPTED_NUM;
 }
 /**
  * Determine status
  *
  * @param	integer		object id
  * @param	integer		user id
  * @param	object		object (optional depends on object type)
  * @return	integer		status
  */
 function determineStatus($a_obj_id, $a_user_id, $a_obj = null)
 {
     global $ilObjDataCache, $ilDB;
     // the status completed depends on:
     // $status_info['num_objectives'] (ilLPStatusWrapper::_getStatusInfo($a_obj_id);)
     // - ilCourseObjective::_getObjectiveIds($a_obj_id);
     // - table crs_objectives manipulated in
     // - ilCourseObjective
     // $status_info['objective_result']  (ilLPStatusWrapper::_getStatusInfo($a_obj_id);)
     // table crs_objective_status (must not contain a dataset)
     // ilCourseObjectiveResult -> added ilLPStatusWrapper::_updateStatus()
     $status = self::LP_STATUS_NOT_ATTEMPTED_NUM;
     switch ($ilObjDataCache->lookupType($a_obj_id)) {
         case "crs":
             include_once "./Services/Tracking/classes/class.ilChangeEvent.php";
             if (ilChangeEvent::hasAccessed($a_obj_id, $a_user_id)) {
                 // change_event is of no use when no objective has been tried
                 // $status = self::LP_STATUS_IN_PROGRESS_NUM;
                 include_once 'Modules/Course/classes/class.ilCourseObjective.php';
                 $objectives = ilCourseObjective::_getObjectiveIds($a_obj_id, true);
                 if ($objectives) {
                     // #14051 - getSummarizedObjectiveStatusForLP() might return null
                     include_once "Modules/Course/classes/Objectives/class.ilLOUserResults.php";
                     $status = (int) ilLOUserResults::getSummarizedObjectiveStatusForLP($objectives, $a_user_id);
                 }
             }
             break;
     }
     return $status;
 }
 /**
  * Determine status
  *
  * @param	integer		object id
  * @param	integer		user id
  * @param	object		object (optional depends on object type)
  * @return	integer		status
  */
 function determineStatus($a_obj_id, $a_user_id, $a_obj = null)
 {
     global $ilObjDataCache, $ilDB;
     $status = self::LP_STATUS_NOT_ATTEMPTED_NUM;
     switch ($ilObjDataCache->lookupType($a_obj_id)) {
         case "crs":
         case "grp":
         case "exc":
             // completed?
             $set = $ilDB->query($q = "SELECT usr_id,mark FROM ut_lp_marks " . "WHERE obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " " . "AND usr_id = " . $ilDB->quote($a_user_id, 'integer') . " " . "AND completed = '1' ");
             $grade = $ilDB->fetchAssoc($ilDB->query("SELECT passing_grade FROM rubric WHERE obj_id = " . $ilDB->quote($a_obj_id, 'integer')));
             if ($rec = $ilDB->fetchAssoc($set)) {
                 if ($rec['mark'] < $grade['passing_grade']) {
                     $status = self::LP_STATUS_FAILED_NUM;
                 } else {
                     $status = self::LP_STATUS_COMPLETED_NUM;
                 }
             } else {
                 include_once './Services/Tracking/classes/class.ilChangeEvent.php';
                 if (ilChangeEvent::hasAccessed($a_obj_id, $a_user_id)) {
                     $status = self::LP_STATUS_IN_PROGRESS_NUM;
                 }
             }
             break;
     }
     return $status;
 }
 /**
  * Determine status
  *
  * @param	integer		object id
  * @param	integer		user id
  * @param	object		object (optional depends on object type)
  * @return	integer		status
  */
 function determineStatus($a_obj_id, $a_user_id, $a_obj = null)
 {
     global $ilObjDataCache;
     $status['completed'] = true;
     $status['failed'] = false;
     $status['in_progress'] = false;
     $status['not_attempted'] = true;
     switch ($ilObjDataCache->lookupType($a_obj_id)) {
         case "crs":
         case "fold":
         case "grp":
             include_once "./Services/Tracking/classes/class.ilChangeEvent.php";
             if (ilChangeEvent::hasAccessed($a_obj_id, $a_user_id)) {
                 $status['in_progress'] = true;
             }
             include_once './Services/Tracking/classes/class.ilLPCollectionCache.php';
             foreach (ilLPCollectionCache::getGroupedItems($a_obj_id, true) as $grouping_id => $grouping) {
                 $isGrouping = $grouping_id ? true : false;
                 $status = self::determineGroupingStatus($status, $grouping, $a_user_id, $isGrouping);
             }
             if ($status['completed']) {
                 return LP_STATUS_COMPLETED_NUM;
             }
             if ($status['failed']) {
                 return LP_STATUS_FAILED_NUM;
             }
             if ($status['in_progress']) {
                 return LP_STATUS_IN_PROGRESS_NUM;
             }
             return LP_STATUS_NOT_ATTEMPTED_NUM;
     }
     return LP_STATUS_NOT_ATTEMPTED_NUM;
 }