ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilTestLP.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 include_once "Services/Object/classes/class.ilObjectLP.php";
5 
13 class ilTestLP extends ilObjectLP
14 {
15  public function getDefaultMode()
16  {
18  }
19 
20  public function getValidModes()
21  {
22  return array(
26  );
27  }
28 
29  public function isAnonymized()
30  {
31  include_once './Modules/Test/classes/class.ilObjTest.php';
32  return (bool)ilObjTest::_lookupAnonymity($this->obj_id);
33  }
34 
35  protected function resetCustomLPDataForUserIds(array $a_user_ids, $a_recursive = true)
36  {
37  /* @var ilObjTest $testOBJ */
38  require_once 'Services/Object/classes/class.ilObjectFactory.php';
39  $testOBJ = ilObjectFactory::getInstanceByObjId($this->obj_id);
40  $testOBJ->removeTestResultsByUserIds($a_user_ids);
41 
42  // :TODO: there has to be a better way
43  $test_ref_id = (int)$_REQUEST["ref_id"];
44  if($test_ref_id)
45  {
46  require_once "Modules/Course/classes/Objectives/class.ilLOSettings.php";
47  $course_obj_id = ilLOSettings::isObjectiveTest($test_ref_id);
48  if($course_obj_id)
49  {
50  // is test initial and/or qualified?
51  $lo_settings = ilLOSettings::getInstanceByObjId($course_obj_id);
52  $is_i = ($lo_settings->getInitialTest() == $test_ref_id);
53  $is_q = ($lo_settings->getQualifiedTest() == $test_ref_id);
54 
55  // remove objective results data
56  require_once "Modules/Course/classes/Objectives/class.ilLOUserResults.php";
57  ilLOUserResults::deleteResultsFromLP($course_obj_id, $a_user_ids, $is_i, $is_q);
58 
59  // refresh LP - see ilLPStatusWrapper::_updateStatus()
60  require_once "Services/Tracking/classes/class.ilLPStatusFactory.php";
61  $lp_status = ilLPStatusFactory::_getInstance($course_obj_id);
62  if (strtolower(get_class($lp_status)) != "illpstatus")
63  {
64  foreach($a_user_ids as $user_id)
65  {
66  $lp_status->_updateStatus($course_obj_id, $user_id);
67  }
68  }
69  }
70  }
71  }
72 }
73 
74 ?>