5 define(
'IL_OBJECTIVE_STATUS_EMPTY',
'empty');
6 define(
'IL_OBJECTIVE_STATUS_PRETEST',
'pretest');
7 define(
'IL_OBJECTIVE_STATUS_FINAL',
'final');
8 define(
'IL_OBJECTIVE_STATUS_NONE',
'none');
9 define(
'IL_OBJECTIVE_STATUS_FINISHED',
'finished');
10 define(
'IL_OBJECTIVE_STATUS_PRETEST_NON_SUGGEST',
'pretest_non_suggest');
35 $this->user_id = $a_usr_id;
50 include_once
'Modules/Course/classes/class.ilCourseObjective.php';
55 if(!is_array($objectives))
59 $query =
"SELECT objective_id FROM crs_objective_status ".
60 "WHERE ".$ilDB->in(
'objective_id',$objectives,
false,
'integer').
' '.
61 "AND user_id = ".$ilDB->quote($a_user_id ,
'integer').
" ";
65 $accomplished[] =
$row->objective_id;
67 return $accomplished ? $accomplished :
array();
79 include_once
'./Modules/Course/classes/class.ilCourseObjective.php';
89 $query =
"SELECT objective_id FROM crs_objective_status ".
90 "WHERE ".$ilDB->in(
'objective_id',$objectives,
false,
'integer').
" ".
91 "AND user_id = ".$ilDB->quote($a_user_id ,
'integer').
" ";
95 $finished[] =
$row->objective_id;
101 $query =
"SELECT objective_id FROM crs_objective_status_p ".
102 "WHERE ".$ilDB->in(
'objective_id',$objectives,
false,
'integer').
' '.
103 "AND user_id = ".$ilDB->quote($a_user_id ,
'integer');
107 $finished[] =
$row->objective_id;
110 foreach($objectives as $objective_id)
112 if(!in_array($objective_id,$finished))
114 $suggested[] = $objective_id;
117 return $suggested ? $suggested :
array();
128 foreach(self::_getSuggested($a_usr_id,$a_crs_id) as $objective_id)
130 include_once
'./Modules/Course/classes/class.ilCourseObjectiveQuestion.php';
132 foreach($obj->getFinalTestQuestions() as $qst)
134 $qsts[] = $qst[
'question_id'];
137 return $qsts ? $qsts :
array();
146 include_once
"Modules/Test/classes/class.ilTestLP.php";
148 $test_lp->resetLPDataForUserIds(
array($a_user_id));
162 include_once
'./Modules/Course/classes/class.ilCourseObjective.php';
163 include_once
'./Modules/Course/classes/class.ilCourseObjectiveQuestion.php';
165 include_once
'./Services/Object/classes/class.ilObjectFactory.php';
168 include_once
'./Modules/Course/classes/Objectives/class.ilLOTestAssignments.php';
169 include_once
'./Modules/Course/classes/Objectives/class.ilLOSettings.php';
178 $tst = $factory->getInstanceByRefId($assignment->getTestRefId(),FALSE);
183 require_once
'Modules/Test/classes/class.ilTestParticipantData.php';
186 $participantData->load($tst->getTestId());
187 $tst->removeTestResults($participantData);
193 $initial_tst = $factory->getInstanceByRefId($initial, FALSE);
200 $qualified_tst = $factory->getInstanceByRefId($qualified, FALSE);
201 if($qualified_tst instanceof ilObjTest)
208 if(count($objectives))
210 $query =
"DELETE FROM crs_objective_status ".
211 "WHERE ".$ilDB->in(
'objective_id',$objectives,
false,
'integer').
' '.
212 "AND user_id = ".$ilDB->quote($this->
getUserId() ,
'integer').
" ";
215 $query =
"DELETE FROM crs_objective_status_p ".
216 "WHERE ".$ilDB->in(
'objective_id',$objectives,
false,
'integer').
' '.
217 "AND user_id = ".$ilDB->quote($this->
getUserId()).
"";
220 $query =
"DELETE FROM loc_user_results ".
221 "WHERE ".$ilDB->in(
'objective_id',$objectives,
false,
'integer').
' '.
222 "AND user_id = ".$ilDB->quote($this->
getUserId()).
"";
226 include_once
'./Services/Tracking/classes/class.ilLPStatusWrapper.php';
234 include_once
'./Modules/TestQuestionPool/classes/class.assQuestion.php';
235 include_once
'Modules/Course/classes/class.ilCourseObjective.php';
243 if(!count($objective_ids))
248 if(count($accomplished) == count($objective_ids))
253 $all_pretest_answered =
false;
254 $all_final_answered =
false;
255 foreach($objectives as
$data)
259 if($data[
'tst_status'])
261 $all_final_answered =
true;
265 $all_pretest_answered =
true;
269 if($all_final_answered)
273 if($all_pretest_answered
and 278 elseif($all_pretest_answered)
289 $query =
"SELECT status FROM crs_objective_status ".
290 "WHERE objective_id = ".$ilDB->quote($a_objective_id ,
'integer').
" ".
291 "AND user_id = ".$ilDB->quote($this->
getUserId() ,
'integer').
"";
303 include_once
'./Modules/Course/classes/class.ilCourseObjective.php';
322 #$ilLog(__METHOD__.': Call of deprecated method.'); 331 $query =
"DELETE FROM crs_objective_status ".
332 "WHERE user_id = ".$ilDB->quote($user_id ,
'integer').
" ";
335 $query =
"DELETE FROM crs_objective_status_p ".
336 "WHERE user_id = ".$ilDB->quote($user_id ,
'integer').
" ";
344 if(!$objectives = self::_readAssignedObjectivesOfQuestion($a_question_id))
350 self::_updateObjectiveStatus($a_user_id,$objectives);
360 $query =
"SELECT q2.question_id qid,q2.objective_id ob FROM crs_objective_qst q1, ".
361 "crs_objective_qst q2 ".
362 "WHERE q1.question_id = ".$ilDB->quote($a_question_id ,
'integer').
" ".
363 "AND q1.objective_id = q2.objective_id ";
368 $objectives[
'all_objectives'][
$row->ob] =
$row->ob;
369 $objectives[
'all_questions'][
$row->qid] =
$row->qid;
371 if(!is_array($objectives))
375 $objectives[
'objectives'] = self::_readAssignedObjectives($objectives[
'all_objectives']);
376 return $objectives ? $objectives :
array();
385 $query =
"SELECT t.objective_id obj,t.ref_id ref, question_id,tst_status,tst_limit ".
386 "FROM crs_objective_tst t JOIN crs_objective_qst q ".
387 "ON (t.objective_id = q.objective_id AND t.ref_id = q.ref_id) ".
388 "WHERE ".$ilDB->in(
't.objective_id',$a_all_objectives,
false,
'integer');
400 $objectives[
$row->obj.
"_".
$row->tst_status][
'questions'][
$row->question_id] =
$row->question_id;
401 $objectives[
$row->obj.
"_".
$row->tst_status][
'tst_status'] =
$row->tst_status;
402 $objectives[
$row->obj.
"_".
$row->tst_status][
'tst_limit'] =
$row->tst_limit;
403 $objectives[
$row->obj.
"_".
$row->tst_status][
'objective_id'] =
$row->obj;
407 return $objectives ? $objectives :
array();
414 if(!count($objectives[
'all_questions'])
or 415 !count($objectives[
'all_objectives']))
420 $query =
"SELECT question_id,points FROM qpl_questions ".
421 "WHERE ".$ilDB->in(
'question_id',(
array) $objectives[
'all_questions'],
false,
'integer');
423 while(
$row = $ilDB->fetchAssoc(
$res))
425 $objectives[
'all_question_points'][
$row[
'question_id']][
'max_points'] = $row[
'points'];
428 $query =
"SELECT question_fi, MAX(points) as reached FROM tst_test_result ".
429 "JOIN tst_active ON (active_id = active_fi) ".
430 "WHERE user_fi = ".$ilDB->quote($a_user_id,
'integer').
" ".
431 "AND ".$ilDB->in(
'question_fi',(
array) $objectives[
'all_questions'],
false,
'integer').
" ".
432 #"AND question_fi IN (".implode(",",ilUtil::quoteArray($objectives['all_questions'])).") ". 433 "GROUP BY question_fi,user_fi";
437 $objectives[
'all_question_points'][
$row->question_fi][
'reached_points'] =
$row->reached;
441 $fullfilled =
array();
443 foreach($objectives[
'objectives'] as $kind =>
$data)
449 if(
$data[
'tst_status'])
451 $fullfilled[] =
array(
$data[
'objective_id'],$ilUser->getId(),
$data[
'tst_status']);
455 $pretest[] =
array(
$data[
'objective_id'],$ilUser->getId());
459 if(count($fullfilled))
461 foreach($fullfilled as $fullfilled_arr)
464 'crs_objective_status',
466 'objective_id' =>
array(
'integer',$fullfilled_arr[0]),
467 'user_id' =>
array(
'integer',$fullfilled_arr[1])
470 'status' =>
array(
'integer',$fullfilled_arr[2])
478 foreach($pretest as $pretest_arr)
481 'crs_objective_status_p',
483 'objective_id' =>
array(
'integer',$pretest_arr[0]),
484 'user_id' =>
array(
'integer',$pretest_arr[1])
495 if(!is_array($objective_data[
'questions']))
501 foreach($objective_data[
'questions'] as $question_id)
503 $max_points += $question_points[$question_id][
'max_points'];
504 $reached_points += $question_points[$question_id][
'reached_points'];
511 return $reached_points >= $objective_data[
'tst_limit'] ? true :
false;
513 return (($reached_points / $max_points * 100) >= $objective_data[
'tst_limit']) ? true :
false;
529 $query =
"SELECT COUNT(t1.crs_id) num,t1.crs_id FROM crs_objectives t1 ".
530 "JOIN crs_objectives t2 WHERE t1.crs_id = t2.crs_id and ".
531 $ilDB->in(
't1.objective_id',$objective_ids,
false,
'integer').
" ".
532 "GROUP BY t1.crs_id";
537 $query =
"SELECT COUNT(cs.objective_id) num_passed FROM crs_objective_status cs ".
538 "JOIN crs_objectives co ON cs.objective_id = co.objective_id ".
539 "WHERE crs_id = ".$ilDB->quote(
$row->crs_id ,
'integer').
" ".
540 "AND user_id = ".$ilDB->quote($a_user_id ,
'integer').
" ";
542 $user_res = $ilDB->query(
$query);
545 if($user_row->num_passed ==
$row->num)
547 $passed[] =
$row->crs_id;
550 $crs_ids[
$row->crs_id] =
$row->crs_id;
554 foreach($passed as $crs_id)
556 include_once(
'Modules/Course/classes/class.ilCourseParticipants.php');
558 $members->updatePassed($a_user_id,
true);
563 foreach ($crs_ids as $cid)
565 include_once(
"./Services/Tracking/classes/class.ilLPStatusWrapper.php");
static _readAssignedObjectivesOfQuestion($a_question_id)
static getInstanceByObjId($a_obj_id)
get singleton instance
static getInstance($a_container_id)
Get instance by container id.
static getSuggestedQuestions($a_usr_id, $a_crs_id)
get suggested questions ids
const IL_OBJECTIVE_STATUS_EMPTY
const IL_OBJECTIVE_STATUS_FINISHED
static _updateStatus($a_obj_id, $a_usr_id, $a_obj=null, $a_percentage=false, $a_force_raise=false)
Update status.
static _areAnswered($a_user_id, $a_question_ids)
Checks if an array of question ids is answered by an user or not.
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
static _getObjectiveIds($course_id, $a_activated_only=false)
getSuggested($a_crs_id, $a_status=IL_OBJECTIVE_STATUS_FINAL)
resetTestForUser(ilObjTest $a_test, $a_user_id)
const IL_OBJECTIVE_STATUS_PRETEST_NON_SUGGEST
static _getSuggested($a_user_id, $a_crs_id, $a_status=IL_OBJECTIVE_STATUS_FINAL)
getActiveIdOfUser($user_id="", $anonymous_id="")
Gets the active id of a given user.
getId()
get object id public
__deleteEntries($a_objective_ids)
removeTestActives($activeIds)
const IL_OBJECTIVE_STATUS_NONE
hasAccomplishedObjective($a_objective_id)
static _updateObjectiveResult($a_user_id, $a_active_id, $a_question_id)
static _getAccomplished($a_user_id, $a_crs_id)
const IL_OBJECTIVE_STATUS_FINAL
Create styles array
The data for the language used.
getAccomplished($a_crs_id)
static _deleteUser($user_id)
const IL_OBJECTIVE_STATUS_PRETEST
__construct($a_usr_id)
Constructor.
static _readAssignedObjectives($a_all_objectives)
static __updatePassed($a_user_id, $objective_ids)
can be protected?
const TYPE_TEST_QUALIFIED
static _updateObjectiveStatus($a_user_id, $objectives)
static getInstance($a_obj_id)
class ilcourseobjectiveQuestion
static __isFullfilled($question_points, $objective_data)