ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables Modules Pages
ilCourseObjectiveResult Class Reference

class ilcourseobjective More...

+ Collaboration diagram for ilCourseObjectiveResult:

Public Member Functions

 ilCourseObjectiveResult ($a_usr_id)
 
 getUserId ()
 
 getAccomplished ($a_crs_id)
 
 _getAccomplished ($a_user_id, $a_crs_id)
 
 getSuggested ($a_crs_id, $a_status=IL_OBJECTIVE_STATUS_FINAL)
 
 _getSuggested ($a_user_id, $a_crs_id, $a_status=IL_OBJECTIVE_STATUS_FINAL)
 
 reset ($a_course_id)
 
 getStatus ($a_course_id)
 
 hasAccomplishedObjective ($a_objective_id)
 
 readStatus ($a_crs_id)
 
 __deleteEntries ($a_objective_ids)
 
 _updateObjectiveResult ($a_user_id, $a_active_id, $a_question_id)
 
 _readAssignedObjectivesOfQuestion ($a_question_id)
 
 _readAssignedObjectives ($a_all_objectives)
 
 _updateObjectiveStatus ($a_user_id, $objectives)
 
 __isFullfilled ($question_points, $objective_data)
 
 __updatePassed ($a_user_id, $objective_ids)
 

Static Public Member Functions

static getSuggestedQuestions ($a_usr_id, $a_crs_id)
 get suggested questions ids More...
 
static _deleteUser ($user_id)
 

Data Fields

 $db = null
 
 $user_id = null
 

Detailed Description

class ilcourseobjective

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

Definition at line 19 of file class.ilCourseObjectiveResult.php.

Member Function Documentation

◆ __deleteEntries()

ilCourseObjectiveResult::__deleteEntries (   $a_objective_ids)

Definition at line 256 of file class.ilCourseObjectiveResult.php.

References $ilLog.

257  {
258  global $ilLog;
259 
260  $ilLog->logStack();
261  #$ilLog(__METHOD__.': Call of deprecated method.');
262 
263  return true;
264  }

◆ __isFullfilled()

ilCourseObjectiveResult::__isFullfilled (   $question_points,
  $objective_data 
)

Definition at line 432 of file class.ilCourseObjectiveResult.php.

Referenced by _updateObjectiveStatus().

433  {
434  if(!is_array($objective_data['questions']))
435  {
436  return false;
437  }
438  $max_points = 0;
439  $reached_points = 0;
440  foreach($objective_data['questions'] as $question_id)
441  {
442  $max_points += $question_points[$question_id]['max_points'];
443  $reached_points += $question_points[$question_id]['reached_points'];
444  }
445  if(!$max_points)
446  {
447  return false;
448  }
449 
450  return $reached_points >= $objective_data['tst_limit'] ? true : false;
451 
452  return (($reached_points / $max_points * 100) >= $objective_data['tst_limit']) ? true : false;
453  }
+ Here is the caller graph for this function:

◆ __updatePassed()

ilCourseObjectiveResult::__updatePassed (   $a_user_id,
  $objective_ids 
)

Definition at line 455 of file class.ilCourseObjectiveResult.php.

References $query, $res, $row, ilCourseParticipants\_getInstanceByObjId(), ilLPStatusWrapper\_updateStatus(), and DB_FETCHMODE_OBJECT.

Referenced by _updateObjectiveStatus().

456  {
457  global $ilDB;
458 
459  $passed = array();
460 
461  $query = "SELECT COUNT(t1.crs_id) num,t1.crs_id FROM crs_objectives t1 ".
462  "JOIN crs_objectives t2 WHERE t1.crs_id = t2.crs_id and ".
463  $ilDB->in('t1.objective_id',$objective_ids,false,'integer')." ".
464  "GROUP BY t1.crs_id";
465  $res = $ilDB->query($query);
466  $crs_ids = array();
467  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
468  {
469  $query = "SELECT COUNT(cs.objective_id) num_passed FROM crs_objective_status cs ".
470  "JOIN crs_objectives co ON cs.objective_id = co.objective_id ".
471  "WHERE crs_id = ".$ilDB->quote($row->crs_id ,'integer')." ".
472  "AND user_id = ".$ilDB->quote($a_user_id ,'integer')." ";
473 
474  $user_res = $ilDB->query($query);
475  while($user_row = $user_res->fetchRow(DB_FETCHMODE_OBJECT))
476  {
477  if($user_row->num_passed == $row->num)
478  {
479  $passed[] = $row->crs_id;
480  }
481  }
482  $crs_ids[$row->crs_id] = $row->crs_id;
483  }
484  if(count($passed))
485  {
486  foreach($passed as $crs_id)
487  {
488  include_once('Modules/Course/classes/class.ilCourseParticipants.php');
489  $members = ilCourseParticipants::_getInstanceByObjId($crs_id);
490  $members->updatePassed($a_user_id,true);
491  }
492  }
493 
494  // update tracking status
495  foreach ($crs_ids as $cid)
496  {
497  include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
498  ilLPStatusWrapper::_updateStatus($cid, $a_user_id);
499  }
500  }
static _updateStatus($a_obj_id, $a_usr_id, $a_obj=null, $a_percentage=false, $a_no_raise=false, $a_force_raise=false)
Update status.
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _deleteUser()

static ilCourseObjectiveResult::_deleteUser (   $user_id)
static

Definition at line 266 of file class.ilCourseObjectiveResult.php.

References $query, and $res.

Referenced by ilObjCourse\_deleteUser().

267  {
268  global $ilDB;
269 
270  $query = "DELETE FROM crs_objective_status ".
271  "WHERE user_id = ".$ilDB->quote($user_id ,'integer')." ";
272  $res = $ilDB->manipulate($query);
273 
274  $query = "DELETE FROM crs_objective_status_p ".
275  "WHERE user_id = ".$ilDB->quote($user_id ,'integer')." ";
276  $res = $ilDB->manipulate($query);
277  return true;
278  }
+ Here is the caller graph for this function:

◆ _getAccomplished()

ilCourseObjectiveResult::_getAccomplished (   $a_user_id,
  $a_crs_id 
)

Definition at line 42 of file class.ilCourseObjectiveResult.php.

References $query, $res, $row, ilCourseObjective\_getObjectiveIds(), and DB_FETCHMODE_OBJECT.

Referenced by getAccomplished().

43  {
44  global $ilDB;
45 
46  include_once 'Modules/Course/classes/class.ilCourseObjective.php';
47  $objectives = ilCourseObjective::_getObjectiveIds($a_crs_id);
48 
49  if(!is_array($objectives))
50  {
51  return array();
52  }
53  $query = "SELECT objective_id FROM crs_objective_status ".
54  "WHERE ".$ilDB->in('objective_id',$objectives,false,'integer').' '.
55  "AND user_id = ".$ilDB->quote($a_user_id ,'integer')." ";
56  $res = $ilDB->query($query);
57  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
58  {
59  $accomplished[] = $row->objective_id;
60  }
61  return $accomplished ? $accomplished : array();
62  }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getSuggested()

ilCourseObjectiveResult::_getSuggested (   $a_user_id,
  $a_crs_id,
  $a_status = IL_OBJECTIVE_STATUS_FINAL 
)

Definition at line 69 of file class.ilCourseObjectiveResult.php.

References $query, $res, $row, ilCourseObjective\_getObjectiveIds(), DB_FETCHMODE_OBJECT, IL_OBJECTIVE_STATUS_FINAL, and IL_OBJECTIVE_STATUS_FINISHED.

Referenced by getSuggested(), and ilCourseObjectiveResultCache\readSuggested().

70  {
71  global $ilDB;
72 
73  include_once './Modules/Course/classes/class.ilCourseObjective.php';
74  $objectives = ilCourseObjective::_getObjectiveIds($a_crs_id);
75 
76  $finished = array();
77  if($a_status == IL_OBJECTIVE_STATUS_FINAL or
78  $a_status == IL_OBJECTIVE_STATUS_FINISHED)
79  {
80  // check finished
81  $query = "SELECT objective_id FROM crs_objective_status ".
82  "WHERE ".$ilDB->in('objective_id',$objectives,false,'integer')." ".
83  "AND user_id = ".$ilDB->quote($a_user_id ,'integer')." ";
84  $res = $ilDB->query($query);
85  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
86  {
87  $finished[] = $row->objective_id;
88  }
89  }
90  else
91  {
92  // Pretest
93  $query = "SELECT objective_id FROM crs_objective_status_p ".
94  "WHERE ".$ilDB->in('objective_id',$objectives,false,'integer').' '.
95  "AND user_id = ".$ilDB->quote($a_user_id ,'integer');
96  $res = $ilDB->query($query);
97  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
98  {
99  $finished[] = $row->objective_id;
100  }
101  }
102  foreach($objectives as $objective_id)
103  {
104  if(!in_array($objective_id,$finished))
105  {
106  $suggested[] = $objective_id;
107  }
108  }
109  return $suggested ? $suggested : array();
110  }
const IL_OBJECTIVE_STATUS_FINISHED
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
const IL_OBJECTIVE_STATUS_FINAL
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _readAssignedObjectives()

ilCourseObjectiveResult::_readAssignedObjectives (   $a_all_objectives)

Definition at line 319 of file class.ilCourseObjectiveResult.php.

References $query, $res, $row, and DB_FETCHMODE_OBJECT.

Referenced by _readAssignedObjectivesOfQuestion(), getStatus(), and readStatus().

320  {
321  global $ilDB;
322 
323  // Read necessary points
324  $query = "SELECT t.objective_id obj,t.ref_id ref, question_id,tst_status,tst_limit ".
325  "FROM crs_objective_tst t JOIN crs_objective_qst q ".
326  "ON (t.objective_id = q.objective_id AND t.ref_id = q.ref_id) ".
327  "WHERE ".$ilDB->in('t.objective_id',$a_all_objectives,false,'integer');
328 
329  $res = $ilDB->query($query);
330  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
331  {
332  /*
333  $objectives[$row->obj."_".$row->ref]['questions'][$row->question_id] = $row->question_id;
334  $objectives[$row->obj."_".$row->ref]['tst_status'] = $row->tst_status;
335  $objectives[$row->obj."_".$row->ref]['tst_limit'] = $row->tst_limit;
336  $objectives[$row->obj."_".$row->ref]['objective_id'] = $row->obj;
337  */
338 
339  $objectives[$row->obj."_".$row->tst_status]['questions'][$row->question_id] = $row->question_id;
340  $objectives[$row->obj."_".$row->tst_status]['tst_status'] = $row->tst_status;
341  $objectives[$row->obj."_".$row->tst_status]['tst_limit'] = $row->tst_limit;
342  $objectives[$row->obj."_".$row->tst_status]['objective_id'] = $row->obj;
343 
344 
345  }
346  return $objectives ? $objectives : array();
347  }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
+ Here is the caller graph for this function:

◆ _readAssignedObjectivesOfQuestion()

ilCourseObjectiveResult::_readAssignedObjectivesOfQuestion (   $a_question_id)

Definition at line 294 of file class.ilCourseObjectiveResult.php.

References $query, $res, $row, _readAssignedObjectives(), and DB_FETCHMODE_OBJECT.

Referenced by _updateObjectiveResult().

295  {
296  global $ilDB;
297 
298  // get all objtives and questions this current question is assigned to
299  $query = "SELECT q2.question_id qid,q2.objective_id ob FROM crs_objective_qst q1, ".
300  "crs_objective_qst q2 ".
301  "WHERE q1.question_id = ".$ilDB->quote($a_question_id ,'integer')." ".
302  "AND q1.objective_id = q2.objective_id ";
303 
304  $res = $ilDB->query($query);
305  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
306  {
307  $objectives['all_objectives'][$row->ob] = $row->ob;
308  $objectives['all_questions'][$row->qid] = $row->qid;
309  }
310  if(!is_array($objectives))
311  {
312  return false;
313  }
314  $objectives['objectives'] = ilCourseObjectiveResult::_readAssignedObjectives($objectives['all_objectives']);
315  return $objectives ? $objectives : array();
316  }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _updateObjectiveResult()

ilCourseObjectiveResult::_updateObjectiveResult (   $a_user_id,
  $a_active_id,
  $a_question_id 
)

Definition at line 280 of file class.ilCourseObjectiveResult.php.

References _readAssignedObjectivesOfQuestion(), and _updateObjectiveStatus().

Referenced by assQuestion\_setReachedPoints(), and assQuestion\calculateResultsFromSolution().

281  {
282  // find all objectives this question is assigned to
283  if(!$objectives = ilCourseObjectiveResult::_readAssignedObjectivesOfQuestion($a_question_id))
284  {
285  // no objectives found. TODO user has passed a test. After that questions of that test are assigned to an objective.
286  // => User has not passed
287  return true;
288  }
289  ilCourseObjectiveResult::_updateObjectiveStatus($a_user_id,$objectives);
290 
291  return true;
292  }
_updateObjectiveStatus($a_user_id, $objectives)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _updateObjectiveStatus()

ilCourseObjectiveResult::_updateObjectiveStatus (   $a_user_id,
  $objectives 
)

Definition at line 349 of file class.ilCourseObjectiveResult.php.

References $data, $ilUser, $query, $res, $row, __isFullfilled(), __updatePassed(), and DB_FETCHMODE_OBJECT.

Referenced by _updateObjectiveResult(), and readStatus().

350  {
351  global $ilDB,$ilUser;
352 
353  if(!count($objectives['all_questions']) or
354  !count($objectives['all_objectives']))
355  {
356  return false;
357  }
358  // Read reachable points
359  $query = "SELECT question_id,points FROM qpl_questions ".
360  "WHERE ".$ilDB->in('question_id',(array) $objectives['all_questions'],false,'integer');
361  $res = $ilDB->query($query);
362  while($row = $ilDB->fetchAssoc($res))
363  {
364  $objectives['all_question_points'][$row['question_id']]['max_points'] = $row['points'];
365  }
366  // Read reached points
367  $query = "SELECT question_fi, MAX(points) as reached FROM tst_test_result ".
368  "JOIN tst_active ON (active_id = active_fi) ".
369  "WHERE user_fi = ".$ilDB->quote($a_user_id,'integer')." ".
370  "AND ".$ilDB->in('question_fi',(array) $objectives['all_questions'],false,'integer')." ".
371  #"AND question_fi IN (".implode(",",ilUtil::quoteArray($objectives['all_questions'])).") ".
372  "GROUP BY question_fi,user_fi";
373  $res = $ilDB->query($query);
374  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
375  {
376  $objectives['all_question_points'][$row->question_fi]['reached_points'] = $row->reached;
377  }
378 
379  // Check accomplished
380  $fullfilled = array();
381  $pretest = array();
382  foreach($objectives['objectives'] as $kind => $data)
383  {
384  // objective does not allow to change status
385  if(ilCourseObjectiveResult::__isFullfilled($objectives['all_question_points'],$data))
386  {
387  // Status 0 means pretest fullfilled, status 1 means final test fullfilled
388  if($data['tst_status'])
389  {
390  $fullfilled[] = array($data['objective_id'],$ilUser->getId(),$data['tst_status']);
391  }
392  else
393  {
394  $pretest[] = array($data['objective_id'],$ilUser->getId());
395  }
396  }
397  }
398  if(count($fullfilled))
399  {
400  foreach($fullfilled as $fullfilled_arr)
401  {
402  $ilDB->replace(
403  'crs_objective_status',
404  array(
405  'objective_id' => array('integer',$fullfilled_arr[0]),
406  'user_id' => array('integer',$fullfilled_arr[1])
407  ),
408  array(
409  'status' => array('integer',$fullfilled_arr[2])
410  )
411  );
412  }
413  ilCourseObjectiveResult::__updatePassed($a_user_id,$objectives['all_objectives']);
414  }
415  if(count($pretest))
416  {
417  foreach($pretest as $pretest_arr)
418  {
419  $ilDB->replace(
420  'crs_objective_status_p',
421  array(
422  'objective_id' => array('integer',$pretest_arr[0]),
423  'user_id' => array('integer',$pretest_arr[1])
424  ),
425  array()
426  );
427  }
428  }
429  return true;
430  }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
__updatePassed($a_user_id, $objective_ids)
while($lm_rec=$ilDB->fetchAssoc($lm_set)) $data
__isFullfilled($question_points, $objective_data)
global $ilUser
Definition: imgupload.php:15
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAccomplished()

ilCourseObjectiveResult::getAccomplished (   $a_crs_id)

Definition at line 38 of file class.ilCourseObjectiveResult.php.

References _getAccomplished(), and getUserId().

Referenced by getStatus().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getStatus()

ilCourseObjectiveResult::getStatus (   $a_course_id)

Definition at line 175 of file class.ilCourseObjectiveResult.php.

References $data, assQuestion\_areAnswered(), ilCourseObjective\_getObjectiveIds(), _readAssignedObjectives(), getAccomplished(), getSuggested(), getUserId(), IL_OBJECTIVE_STATUS_EMPTY, IL_OBJECTIVE_STATUS_FINAL, IL_OBJECTIVE_STATUS_FINISHED, IL_OBJECTIVE_STATUS_NONE, IL_OBJECTIVE_STATUS_PRETEST, and IL_OBJECTIVE_STATUS_PRETEST_NON_SUGGEST.

176  {
177  include_once './Modules/TestQuestionPool/classes/class.assQuestion.php';
178  include_once 'Modules/Course/classes/class.ilCourseObjective.php';
179  $objective_ids = ilCourseObjective::_getObjectiveIds($a_course_id);
180  $objectives = ilCourseObjectiveResult::_readAssignedObjectives($objective_ids);
181  $accomplished = $this->getAccomplished($a_course_id);
182  $suggested = $this->getSuggested($a_course_id);
183 
184  if(!count($objective_ids))
185  {
187  }
188 
189  if(count($accomplished) == count($objective_ids))
190  {
192  }
193 
194  $all_pretest_answered = false;
195  $all_final_answered = false;
196  foreach($objectives as $data)
197  {
198  if(assQuestion::_areAnswered($this->getUserId(),$data['questions']))
199  {
200  if($data['tst_status'])
201  {
202  $all_final_answered = true;
203  }
204  else
205  {
206  $all_pretest_answered = true;
207  }
208  }
209  }
210  if($all_final_answered)
211  {
213  }
214  if($all_pretest_answered and
215  !count($suggested))
216  {
218  }
219  elseif($all_pretest_answered)
220  {
222  }
224  }
const IL_OBJECTIVE_STATUS_EMPTY
const IL_OBJECTIVE_STATUS_FINISHED
static _areAnswered($a_user_id, $a_question_ids)
Checks if an array of question ids is answered by an user or not.
getSuggested($a_crs_id, $a_status=IL_OBJECTIVE_STATUS_FINAL)
const IL_OBJECTIVE_STATUS_PRETEST_NON_SUGGEST
const IL_OBJECTIVE_STATUS_NONE
const IL_OBJECTIVE_STATUS_FINAL
const IL_OBJECTIVE_STATUS_PRETEST
while($lm_rec=$ilDB->fetchAssoc($lm_set)) $data
+ Here is the call graph for this function:

◆ getSuggested()

ilCourseObjectiveResult::getSuggested (   $a_crs_id,
  $a_status = IL_OBJECTIVE_STATUS_FINAL 
)

Definition at line 64 of file class.ilCourseObjectiveResult.php.

References _getSuggested(), and getUserId().

Referenced by getStatus().

65  {
66  return ilCourseObjectiveResult::_getSuggested($this->getUserId(),$a_crs_id,$a_status);
67  }
_getSuggested($a_user_id, $a_crs_id, $a_status=IL_OBJECTIVE_STATUS_FINAL)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSuggestedQuestions()

static ilCourseObjectiveResult::getSuggestedQuestions (   $a_usr_id,
  $a_crs_id 
)
static

get suggested questions ids

Parameters
object$a_usr_id
object$a_crs_id
Returns

Definition at line 118 of file class.ilCourseObjectiveResult.php.

119  {
120  foreach(self::_getSuggested($a_usr_id,$a_crs_id) as $objective_id)
121  {
122  include_once './Modules/Course/classes/class.ilCourseObjectiveQuestion.php';
123  $obj = new ilCourseObjectiveQuestion($objective_id);
124  foreach($obj->getFinalTestQuestions() as $qst)
125  {
126  $qsts[] = $qst['question_id'];
127  }
128  }
129  return $qsts ? $qsts : array();
130  }
class ilcourseobjectiveQuestion

◆ getUserId()

ilCourseObjectiveResult::getUserId ( )

Definition at line 33 of file class.ilCourseObjectiveResult.php.

References $user_id.

Referenced by getAccomplished(), getStatus(), getSuggested(), hasAccomplishedObjective(), readStatus(), and reset().

+ Here is the caller graph for this function:

◆ hasAccomplishedObjective()

ilCourseObjectiveResult::hasAccomplishedObjective (   $a_objective_id)

Definition at line 226 of file class.ilCourseObjectiveResult.php.

References $query, $res, $row, DB_FETCHMODE_OBJECT, and getUserId().

227  {
228  global $ilDB;
229 
230  $query = "SELECT status FROM crs_objective_status ".
231  "WHERE objective_id = ".$ilDB->quote($a_objective_id ,'integer')." ".
232  "AND user_id = ".$ilDB->quote($this->getUserId() ,'integer')."";
233 
234  $res = $this->db->query($query);
235  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
236  {
237  return true;
238  }
239  return false;
240  }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
+ Here is the call graph for this function:

◆ ilCourseObjectiveResult()

ilCourseObjectiveResult::ilCourseObjectiveResult (   $a_usr_id)

Definition at line 25 of file class.ilCourseObjectiveResult.php.

26  {
27  global $ilDB;
28 
29  $this->db =& $ilDB;
30 
31  $this->user_id = $a_usr_id;
32  }

◆ readStatus()

ilCourseObjectiveResult::readStatus (   $a_crs_id)

Definition at line 242 of file class.ilCourseObjectiveResult.php.

References ilCourseObjective\_getObjectiveIds(), _readAssignedObjectives(), _updateObjectiveStatus(), and getUserId().

243  {
244  include_once './Modules/Course/classes/class.ilCourseObjective.php';
245 
246  $objective_ids = ilCourseObjective::_getObjectiveIds($a_crs_id);
247  $objectives = ilCourseObjectiveResult::_readAssignedObjectives($objective_ids);
249  return true;
250  }
_updateObjectiveStatus($a_user_id, $objectives)
+ Here is the call graph for this function:

◆ reset()

ilCourseObjectiveResult::reset (   $a_course_id)

Definition at line 132 of file class.ilCourseObjectiveResult.php.

References $query, $res, ilCourseObjective\_getObjectiveIds(), ilLPStatusWrapper\_updateStatus(), ilObjectFactory\getInstanceByRefId(), and getUserId().

Referenced by ilObjCourseGUI\cciResetObject(), ilCourseObjectivePresentationGUI\reset(), and ilObjCourseGUI\resetObject().

133  {
134  global $ilDB;
135 
136  include_once './Modules/Course/classes/class.ilCourseObjective.php';
137  include_once './Modules/Course/classes/class.ilCourseObjectiveQuestion.php';
138 
139 
140  foreach($objectives = ilCourseObjective::_getObjectiveIds($a_course_id) as $objective_id)
141  {
142  $tmp_obj_question =& new ilCourseObjectiveQuestion($objective_id);
143 
144  foreach($tmp_obj_question->getTests() as $test_data)
145  {
146  #$this->__deleteEntries($tmp_obj_question->getQuestionsByTest($test_data['ref_id']));
147 
148  if($tmp_test =& ilObjectFactory::getInstanceByRefId($test_data['ref_id']))
149  {
150  $tmp_test->removeTestResultsForUser($this->getUserId());
151  unset($tmp_test);
152  }
153  }
154  }
155 
156  if(count($objectives))
157  {
158  $query = "DELETE FROM crs_objective_status ".
159  "WHERE ".$ilDB->in('objective_id',$objectives,false,'integer').' '.
160  "AND user_id = ".$ilDB->quote($this->getUserId() ,'integer')." ";
161  $res = $ilDB->manipulate($query);
162 
163  $query = "DELETE FROM crs_objective_status_p ".
164  "WHERE ".$ilDB->in('objective_id',$objectives,false,'integer').' '.
165  "AND user_id = ".$ilDB->quote($this->getUserId())."";
166  $res = $ilDB->manipulate($query);
167  }
168 
169  include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
170  ilLPStatusWrapper::_updateStatus($a_course_id, $this->getUserId());
171 
172  return true;
173  }
getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
static _updateStatus($a_obj_id, $a_usr_id, $a_obj=null, $a_percentage=false, $a_no_raise=false, $a_force_raise=false)
Update status.
class ilcourseobjectiveQuestion
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $db

ilCourseObjectiveResult::$db = null

Definition at line 21 of file class.ilCourseObjectiveResult.php.

◆ $user_id

ilCourseObjectiveResult::$user_id = null

Definition at line 22 of file class.ilCourseObjectiveResult.php.

Referenced by getUserId().


The documentation for this class was generated from the following file: