ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 static function getDefaultModes($a_lp_active)
17 {
18 return array(
21 );
22 }
23
24 public function getDefaultMode()
25 {
27 }
28
29 public function getValidModes()
30 {
31 include_once "./Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php";
32 $subtype = ilObjSAHSLearningModule::_lookupSubType($this->obj_id);
33 if($subtype != "scorm2004")
34 {
35 if($this->checkSCORMPreconditions())
36 {
38 }
39
40 include_once "Services/Tracking/classes/collection/class.ilLPCollectionOfSCOs.php";
41 $collection = new ilLPCollectionOfSCOs($this->obj_id, ilLPObjSettings::LP_MODE_SCORM);
42 if(sizeof($collection->getPossibleItems()))
43 {
46 }
48 }
49 else
50 {
51 if($this->checkSCORMPreconditions())
52 {
55 }
56
57 include_once "Services/Tracking/classes/collection/class.ilLPCollectionOfSCOs.php";
58 $collection = new ilLPCollectionOfSCOs($this->obj_id, ilLPObjSettings::LP_MODE_SCORM);
59 if(sizeof($collection->getPossibleItems()))
60 {
64 }
65
68 }
69 }
70
71 public function getCurrentMode()
72 {
73 if($this->checkSCORMPreconditions())
74 {
76 }
77 return parent::getCurrentMode();
78 }
79
80 protected function checkSCORMPreconditions()
81 {
82 include_once('./Services/AccessControl/classes/class.ilConditionHandler.php');
83 if(count(ilConditionHandler::_getConditionsOfTrigger('sahs', $this->obj_id)))
84 {
85 return true;
86 }
87 return false;
88 }
89
90 protected static function isLPMember(array &$a_res, $a_usr_id, $a_obj_ids)
91 {
92 global $ilDB;
93
94 // subtype
95 $types = array();
96 $set = $ilDB->query("SELECT id,c_type".
97 " FROM sahs_lm".
98 " WHERE ".$ilDB->in("id", $a_obj_ids, "", "integer"));
99 while($row = $ilDB->fetchAssoc($set))
100 {
101 $types[$row["c_type"]][] = $row["id"];
102 }
103
104 // 2004
105 if(isset($types["scorm2004"]))
106 {
107 $set = $ilDB->query("SELECT obj_id".
108 " FROM sahs_user".
109 " WHERE ".$ilDB->in("obj_id", $types["scorm2004"], "", "integer").
110 " AND user_id = ".$ilDB->quote($a_usr_id, "integer"));
111 while($row = $ilDB->fetchAssoc($set))
112 {
113 $a_res[$row["obj_id"]] = true;
114 }
115 }
116
117 // 1.2
118 if(isset($types["scorm"]))
119 {
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 {
127 $a_res[$row["obj_id"]] = true;
128 }
129 }
130 }
131
132 public function getMailTemplateId()
133 {
134 include_once './Modules/ScormAicc/classes/class.ilScormMailTemplateLPContext.php';
136 }
137}
138
139?>
An exception for terminatinating execution or to throw for unit testing.
static _getConditionsOfTrigger($a_trigger_obj_type, $a_trigger_id)
get all conditions of trigger object
static _lookupSubType($a_obj_id)
lookup subtype id (scorm, aicc, hacp)
static getDefaultModes($a_lp_active)
Get available type-specific default modes (no administration needed)
checkSCORMPreconditions()
static isLPMember(array &$a_res, $a_usr_id, $a_obj_ids)
Find (lp-relevant) members for given object ids.
global $ilDB