ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilScormLP.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
5 include_once "Services/Object/classes/class.ilObjectLP.php";
6 
14 class ilScormLP extends ilObjectLP
15 {
19  protected $precondition_cache = null;
20 
21  public static function getDefaultModes($a_lp_active)
22  {
23  return array(
26  );
27  }
28 
29  public function getDefaultMode()
30  {
32  }
33 
34  public function getValidModes()
35  {
36  include_once "./Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php";
37  $subtype = ilObjSAHSLearningModule::_lookupSubType($this->obj_id);
38  if ($subtype != "scorm2004") {
39  if ($this->checkSCORMPreconditions()) {
41  }
42 
43  include_once "Services/Tracking/classes/collection/class.ilLPCollectionOfSCOs.php";
44  $collection = new ilLPCollectionOfSCOs($this->obj_id, ilLPObjSettings::LP_MODE_SCORM);
45  if (sizeof($collection->getPossibleItems())) {
48  }
50  } else {
51  if ($this->checkSCORMPreconditions()) {
54  }
55 
56  include_once "Services/Tracking/classes/collection/class.ilLPCollectionOfSCOs.php";
57  $collection = new ilLPCollectionOfSCOs($this->obj_id, ilLPObjSettings::LP_MODE_SCORM);
58  if (sizeof($collection->getPossibleItems())) {
62  }
63 
66  }
67  }
68 
69  public function getCurrentMode()
70  {
71  if ($this->checkSCORMPreconditions()) {
73  }
74  return parent::getCurrentMode();
75  }
76 
81  protected function checkSCORMPreconditions()
82  {
83  if (!is_null($this->precondition_cache)) {
85  }
86 
87  $this->precondition_cache =
88  ilConditionHandler::getNumberOfConditionsOfTrigger('sahs', $this->obj_id) > 0 ?
89  true :
90  false;
92  }
93 
94  protected static function isLPMember(array &$a_res, $a_usr_id, $a_obj_ids)
95  {
96  global $ilDB;
97 
98  // subtype
99  $types = array();
100  $set = $ilDB->query("SELECT id,c_type" .
101  " FROM sahs_lm" .
102  " WHERE " . $ilDB->in("id", $a_obj_ids, "", "integer"));
103  while ($row = $ilDB->fetchAssoc($set)) {
104  $types[$row["c_type"]][] = $row["id"];
105  }
106 
107  // 2004
108  if (isset($types["scorm2004"])) {
109  $set = $ilDB->query("SELECT obj_id" .
110  " FROM sahs_user" .
111  " WHERE " . $ilDB->in("obj_id", $types["scorm2004"], "", "integer") .
112  " AND user_id = " . $ilDB->quote($a_usr_id, "integer"));
113  while ($row = $ilDB->fetchAssoc($set)) {
114  $a_res[$row["obj_id"]] = true;
115  }
116  }
117 
118  // 1.2
119  if (isset($types["scorm"])) {
120  $set = $ilDB->query("SELECT obj_id" .
121  " FROM scorm_tracking" .
122  " WHERE " . $ilDB->in("obj_id", $types["scorm"], "", "integer") .
123  " AND user_id = " . $ilDB->quote($a_usr_id, "integer") .
124  " AND lvalue = " . $ilDB->quote("cmi.core.lesson_status", "text"));
125  while ($row = $ilDB->fetchAssoc($set)) {
126  $a_res[$row["obj_id"]] = true;
127  }
128  }
129  }
130 
131  public function getMailTemplateId()
132  {
133  include_once './Modules/ScormAicc/classes/class.ilScormMailTemplateLPContext.php';
135  }
136 }
static _lookupSubType($a_obj_id)
lookup subtype id (scorm, )
static isLPMember(array &$a_res, $a_usr_id, $a_obj_ids)
Create styles array
The data for the language used.
global $ilDB
checkSCORMPreconditions()
static getNumberOfConditionsOfTrigger($a_trigger_obj_type, $a_trigger_id)
static getDefaultModes($a_lp_active)