ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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
5include_once "Services/Object/classes/class.ilObjectLP.php";
6
14class ilScormLP extends ilObjectLP
15{
16 public function getDefaultMode()
17 {
19 }
20
21 public function getValidModes()
22 {
23 include_once "./Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php";
24 $subtype = ilObjSAHSLearningModule::_lookupSubType($this->obj_id);
25 if($subtype != "scorm2004")
26 {
27 if($this->checkSCORMPreconditions())
28 {
30 }
31
32 include_once "Services/Tracking/classes/collection/class.ilLPCollectionOfSCOs.php";
33 $collection = new ilLPCollectionOfSCOs($this->obj_id, ilLPObjSettings::LP_MODE_SCORM);
34 if(sizeof($collection->getPossibleItems()))
35 {
38 }
40 }
41 else
42 {
43 if($this->checkSCORMPreconditions())
44 {
47 }
48
49 include_once "Services/Tracking/classes/collection/class.ilLPCollectionOfSCOs.php";
50 $collection = new ilLPCollectionOfSCOs($this->obj_id, ilLPObjSettings::LP_MODE_SCORM);
51 if(sizeof($collection->getPossibleItems()))
52 {
56 }
57
60 }
61 }
62
63 public function getCurrentMode()
64 {
65 if($this->checkSCORMPreconditions())
66 {
68 }
69 return parent::getCurrentMode();
70 }
71
72 protected function checkSCORMPreconditions()
73 {
74 include_once('./Services/AccessControl/classes/class.ilConditionHandler.php');
75 if(count(ilConditionHandler::_getConditionsOfTrigger('sahs', $this->obj_id)))
76 {
77 return true;
78 }
79 return false;
80 }
81
82 protected static function isLPMember(array &$a_res, $a_usr_id, array $a_obj_ids)
83 {
84 global $ilDB;
85
86 // subtype
87 $types = array();
88 $set = $ilDB->query("SELECT id,c_type".
89 " FROM sahs_lm".
90 " WHERE ".$ilDB->in("id", $a_obj_ids, "", "integer"));
91 while($row = $ilDB->fetchAssoc($set))
92 {
93 $types[$row["c_type"]][] = $row["id"];
94 }
95
96 // 2004
97 if(isset($types["scorm2004"]))
98 {
99 $set = $ilDB->query("SELECT obj_id".
100 " FROM sahs_user".
101 " WHERE ".$ilDB->in("obj_id", $types["scorm2004"], "", "integer").
102 " AND user_id = ".$ilDB->quote($a_usr_id, "integer"));
103 while($row = $ilDB->fetchAssoc($set))
104 {
105 $a_res[$row["obj_id"]] = true;
106 }
107 }
108
109 // 1.2
110 if(isset($types["scorm"]))
111 {
112 $set = $ilDB->query("SELECT obj_id".
113 " FROM scorm_tracking".
114 " WHERE ".$ilDB->in("obj_id", $types["scorm"], "", "integer").
115 " AND user_id = ".$ilDB->quote($a_usr_id, "integer").
116 " AND lvalue = ".$ilDB->quote("cmi.core.lesson_status", "text"));
117 while($row = $ilDB->fetchAssoc($set))
118 {
119 $a_res[$row["obj_id"]] = true;
120 }
121 }
122 }
123
124 public function getMailTemplateId()
125 {
126 include_once './Modules/ScormAicc/classes/class.ilScormMailTemplateLPContext.php';
128 }
129}
130
131?>
_getConditionsOfTrigger($a_trigger_obj_type, $a_trigger_id)
get all conditions of trigger object
_lookupSubType($a_obj_id)
lookup subtype id (scorm, aicc, hacp)
static isLPMember(array &$a_res, $a_usr_id, array $a_obj_ids)
checkSCORMPreconditions()
global $ilDB