ILIAS  release_7 Revision v7.30-3-g800a261c036
ilContainerStartObjects Class Reference

ilContainerStartObjects More...

+ Collaboration diagram for ilContainerStartObjects:

Public Member Functions

 __construct ($a_object_ref_id, $a_object_id)
 
 getObjId ()
 
 getRefId ()
 
 getStartObjects ()
 
 delete ($a_crs_start_id)
 Delete item by sequence id. More...
 
 deleteItem ($a_item_ref_id)
 Delete item by ref_id. More...
 
 exists ($a_item_ref_id)
 
 add ($a_item_ref_id)
 
 __deleteAll ()
 
 setObjectPos ($a_start_id, $a_pos)
 
 getPossibleStarters ()
 
 allFullfilled ($a_user_id)
 
 isFullfilled ($a_user_id, $a_item_id)
 
 cloneDependencies ($a_target_id, $a_copy_id)
 

Static Public Member Functions

static isStartObject ($a_container_id, $a_item_ref_id)
 Check if object is start object. More...
 

Protected Member Functions

 setObjId ($a_id)
 
 setRefId ($a_ref_id)
 
 __read ()
 

Protected Attributes

 $tree
 
 $db
 
 $obj_data_cache
 
 $log
 
 $ref_id
 
 $obj_id
 
 $start_objs = array()
 

Detailed Description

ilContainerStartObjects

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
Id
class.ilCourseStart.php 44362 2013-08-22 08:36:03Z jluetzen

Definition at line 12 of file class.ilContainerStartObjects.php.

Constructor & Destructor Documentation

◆ __construct()

ilContainerStartObjects::__construct (   $a_object_ref_id,
  $a_object_id 
)

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

39 {
40 global $DIC;
41
42 $this->tree = $DIC->repositoryTree();
43 $this->db = $DIC->database();
44 $this->obj_data_cache = $DIC["ilObjDataCache"];
45 $this->log = $DIC["ilLog"];
46 $this->setRefId($a_object_ref_id);
47 $this->setObjId($a_object_id);
48
49 $this->__read();
50 }
global $DIC
Definition: goto.php:24

References $DIC, __read(), setObjId(), and setRefId().

+ Here is the call graph for this function:

Member Function Documentation

◆ __deleteAll()

ilContainerStartObjects::__deleteAll ( )

Definition at line 166 of file class.ilContainerStartObjects.php.

167 {
169
170 $query = "DELETE FROM crs_start" .
171 " WHERE crs_id = " . $ilDB->quote($this->getObjId(), 'integer');
172 $ilDB->manipulate($query);
173 return true;
174 }
$query
global $ilDB

References $db, $ilDB, $query, and getObjId().

+ Here is the call graph for this function:

◆ __read()

ilContainerStartObjects::__read ( )
protected

Definition at line 77 of file class.ilContainerStartObjects.php.

78 {
81
82 $this->start_objs = array();
83
84 $query = "SELECT * FROM crs_start" .
85 " WHERE crs_id = " . $ilDB->quote($this->getObjId(), 'integer') .
86 " ORDER BY pos, crs_start_id";
87 $res = $ilDB->query($query);
88 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
89 if ($tree->isInTree($row->item_ref_id)) {
90 $this->start_objs[$row->crs_start_id]['item_ref_id'] = $row->item_ref_id;
91 } else {
92 $this->delete($row->item_ref_id);
93 }
94 }
95 return true;
96 }
foreach($_POST as $key=> $value) $res

References $db, $ilDB, $query, $res, $tree, ilDBConstants\FETCHMODE_OBJECT, and getObjId().

Referenced by __construct().

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

◆ add()

ilContainerStartObjects::add (   $a_item_ref_id)

Definition at line 141 of file class.ilContainerStartObjects.php.

142 {
144
145 if ($a_item_ref_id) {
146 $max_pos = $ilDB->query("SELECT max(pos) pos FROM crs_start" .
147 " WHERE crs_id = " . $ilDB->quote($this->getObjId(), "integer"));
148 $max_pos = $ilDB->fetchAssoc($max_pos);
149 $max_pos = ((int) $max_pos["pos"]) + 10;
150
151 $next_id = $ilDB->nextId('crs_start');
152 $query = "INSERT INTO crs_start" .
153 " (crs_start_id,crs_id,item_ref_id,pos)" .
154 " VALUES" .
155 " (" . $ilDB->quote($next_id, 'integer') .
156 ", " . $ilDB->quote($this->getObjId(), 'integer') .
157 ", " . $ilDB->quote($a_item_ref_id, 'integer') .
158 ", " . $ilDB->quote($max_pos, 'integer') .
159 ")";
160 $ilDB->manipulate($query);
161 return true;
162 }
163 return false;
164 }

References $db, $ilDB, $query, and getObjId().

Referenced by ilLOSettings\updateStartObjects().

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

◆ allFullfilled()

ilContainerStartObjects::allFullfilled (   $a_user_id)

Definition at line 207 of file class.ilContainerStartObjects.php.

208 {
209 foreach ($this->getStartObjects() as $item) {
210 if (!$this->isFullfilled($a_user_id, $item['item_ref_id'])) {
211 return false;
212 }
213 }
214 return true;
215 }

References getStartObjects(), and isFullfilled().

+ Here is the call graph for this function:

◆ cloneDependencies()

ilContainerStartObjects::cloneDependencies (   $a_target_id,
  $a_copy_id 
)

Definition at line 265 of file class.ilContainerStartObjects.php.

266 {
267 $ilObjDataCache = $this->obj_data_cache;
268 $ilLog = $this->log;
269
270 $ilLog->write(__METHOD__ . ': Begin course start objects...');
271
272 $new_obj_id = $ilObjDataCache->lookupObjId($a_target_id);
273 $start = new self($a_target_id, $new_obj_id);
274
275 include_once('Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
276 $cwo = ilCopyWizardOptions::_getInstance($a_copy_id);
277 $mappings = $cwo->getMappings();
278 foreach ($this->getStartObjects() as $data) {
279 $item_ref_id = $data['item_ref_id'];
280 if (isset($mappings[$item_ref_id]) and $mappings[$item_ref_id]) {
281 $ilLog->write(__METHOD__ . ': Clone start object nr. ' . $item_ref_id);
282 $start->add($mappings[$item_ref_id]);
283 } else {
284 $ilLog->write(__METHOD__ . ': No mapping found for start object nr. ' . $item_ref_id);
285 }
286 }
287 $ilLog->write(__METHOD__ . ': ... end course start objects');
288 return true;
289 }
static _getInstance($a_copy_id)
Get instance of copy wizard options.
$data
Definition: storeScorm.php:23

References $data, $log, $obj_data_cache, ilCopyWizardOptions\_getInstance(), and getStartObjects().

+ Here is the call graph for this function:

◆ delete()

ilContainerStartObjects::delete (   $a_crs_start_id)

Delete item by sequence id.

Parameters
type$a_crs_start_id
Returns
boolean

Definition at line 103 of file class.ilContainerStartObjects.php.

104 {
106
107 $query = "DELETE FROM crs_start" .
108 " WHERE crs_start_id = " . $ilDB->quote($a_crs_start_id, 'integer') .
109 " AND crs_id = " . $ilDB->quote($this->getObjId(), 'integer');
110 $ilDB->manipulate($query);
111 return true;
112 }

References $db, $ilDB, $query, and getObjId().

+ Here is the call graph for this function:

◆ deleteItem()

ilContainerStartObjects::deleteItem (   $a_item_ref_id)

Delete item by ref_id.

Parameters
type$a_item_ref_id

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

119 {
121
122 $query = "DELETE FROM crs_start" .
123 " WHERE crs_id = " . $ilDB->quote($this->getObjId(), 'integer') .
124 " AND item_ref_id = " . $ilDB->quote($a_item_ref_id, 'integer');
125 $ilDB->manipulate($query);
126 return true;
127 }

References $db, $ilDB, $query, and getObjId().

Referenced by ilLOSettings\updateStartObjects().

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

◆ exists()

ilContainerStartObjects::exists (   $a_item_ref_id)

Definition at line 129 of file class.ilContainerStartObjects.php.

130 {
132
133 $query = "SELECT * FROM crs_start" .
134 " WHERE crs_id = " . $ilDB->quote($this->getObjId(), 'integer') .
135 " AND item_ref_id = " . $ilDB->quote($a_item_ref_id, 'integer');
136 $res = $ilDB->query($query);
137
138 return $res->numRows() ? true : false;
139 }
return true
Flag indicating whether or not HTTP headers will be sent when outputting captcha image/audio.

References $db, $ilDB, $query, $res, getObjId(), and true.

Referenced by ilLOSettings\updateStartObjects().

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

◆ getObjId()

ilContainerStartObjects::getObjId ( )

Definition at line 57 of file class.ilContainerStartObjects.php.

References $obj_id.

Referenced by __deleteAll(), __read(), add(), delete(), deleteItem(), and exists().

+ Here is the caller graph for this function:

◆ getPossibleStarters()

ilContainerStartObjects::getPossibleStarters ( )

Definition at line 190 of file class.ilContainerStartObjects.php.

191 {
192 include_once "Services/Object/classes/class.ilObjectActivation.php";
193 foreach (ilObjectActivation::getItems($this->getRefId(), false) as $node) {
194 switch ($node['type']) {
195 case 'lm':
196 case 'sahs':
197 case 'svy':
198 case 'copa':
199 case 'tst':
200 $poss_items[] = $node['ref_id'];
201 break;
202 }
203 }
204 return $poss_items ? $poss_items : array();
205 }
static getItems($a_parent_id, $a_with_list_data=true)
Get sub item data.

References ilObjectActivation\getItems(), and getRefId().

+ Here is the call graph for this function:

◆ getRefId()

ilContainerStartObjects::getRefId ( )

Definition at line 67 of file class.ilContainerStartObjects.php.

References $ref_id.

Referenced by getPossibleStarters(), and isFullfilled().

+ Here is the caller graph for this function:

◆ getStartObjects()

ilContainerStartObjects::getStartObjects ( )

Definition at line 72 of file class.ilContainerStartObjects.php.

73 {
74 return $this->start_objs ? $this->start_objs : array();
75 }

Referenced by allFullfilled(), and cloneDependencies().

+ Here is the caller graph for this function:

◆ isFullfilled()

ilContainerStartObjects::isFullfilled (   $a_user_id,
  $a_item_id 
)

Definition at line 217 of file class.ilContainerStartObjects.php.

218 {
219 $ilObjDataCache = $this->obj_data_cache;
220
221 $obj_id = $ilObjDataCache->lookupObjId($a_item_id);
222 $type = $ilObjDataCache->lookupType($obj_id);
223
224 switch ($type) {
225 case 'tst':
226 include_once './Modules/Test/classes/class.ilObjTestAccess.php';
227 if (!ilObjTestAccess::checkCondition($obj_id, 'finished', '', $a_user_id)) { // #14000
228 return false;
229 }
230 break;
231
232 case 'svy':
233
235 return false;
236 }
237 break;
238
239 case 'sahs':
240 include_once 'Services/Tracking/classes/class.ilLPStatus.php';
241 if (!ilLPStatus::_hasUserCompleted($obj_id, $a_user_id)) {
242 return false;
243 }
244 break;
245
246 case 'copa':
247 if (!ilLPStatus::_hasUserCompleted($obj_id, $a_user_id)) {
248 return false;
249 }
250 break;
251
252 default:
253 include_once './Modules/Course/classes/class.ilCourseLMHistory.php';
254 $lm_continue = new ilCourseLMHistory($this->getRefId(), $a_user_id);
255 $continue_data = $lm_continue->getLMHistory();
256 if (!isset($continue_data[$a_item_id])) {
257 return false;
258 }
259 break;
260 }
261
262 return true;
263 }
class ilCourseLMHistory
static _hasUserCompleted($a_obj_id, $a_user_id)
Lookup user object completion.
static _lookupFinished($a_obj_id, $a_user_id="")
get finished status
static checkCondition($a_obj_id, $a_operator, $a_value, $a_usr_id)
check condition
$type

References $obj_data_cache, $obj_id, $type, ilLPStatus\_hasUserCompleted(), ilObjSurveyAccess\_lookupFinished(), ilObjTestAccess\checkCondition(), and getRefId().

Referenced by allFullfilled().

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

◆ isStartObject()

static ilContainerStartObjects::isStartObject (   $a_container_id,
  $a_item_ref_id 
)
static

Check if object is start object.

Parameters
type$a_container_id
type$a_item_ref_id
Returns
boolean

Definition at line 297 of file class.ilContainerStartObjects.php.

298 {
299 global $DIC;
300
301 $ilDB = $DIC->database();
302
303 $query = 'SELECT crs_start_id FROM crs_start ' .
304 'WHERE crs_id = ' . $ilDB->quote($a_container_id, 'integer') . ' ' .
305 'AND item_ref_id = ' . $ilDB->quote($a_item_ref_id, 'integer');
306 $res = $ilDB->query($query);
307 if ($res->numRows() >= 1) {
308 return true;
309 }
310 return false;
311 }

References $DIC, $ilDB, $query, and $res.

Referenced by ilLOTestQuestionAdapter\isQualifiedStartRun().

+ Here is the caller graph for this function:

◆ setObjectPos()

ilContainerStartObjects::setObjectPos (   $a_start_id,
  $a_pos 
)

Definition at line 176 of file class.ilContainerStartObjects.php.

177 {
179
180 if (!(int) $a_start_id || !(int) $a_pos) {
181 return;
182 }
183
184 $ilDB->manipulate("UPDATE crs_start" .
185 " SET pos = " . $ilDB->quote($a_pos, "integer") .
186 " WHERE crs_id = " . $ilDB->quote($this->getObjId(), 'integer') .
187 " AND crs_start_id = " . $ilDB->quote($a_start_id, 'integer'));
188 }

References $db, and $ilDB.

◆ setObjId()

ilContainerStartObjects::setObjId (   $a_id)
protected

Definition at line 52 of file class.ilContainerStartObjects.php.

53 {
54 $this->obj_id = $a_id;
55 }

Referenced by __construct().

+ Here is the caller graph for this function:

◆ setRefId()

ilContainerStartObjects::setRefId (   $a_ref_id)
protected

Definition at line 62 of file class.ilContainerStartObjects.php.

63 {
64 $this->ref_id = $a_ref_id;
65 }

Referenced by __construct().

+ Here is the caller graph for this function:

Field Documentation

◆ $db

ilContainerStartObjects::$db
protected

◆ $log

ilContainerStartObjects::$log
protected

Definition at line 32 of file class.ilContainerStartObjects.php.

Referenced by cloneDependencies().

◆ $obj_data_cache

ilContainerStartObjects::$obj_data_cache
protected

Definition at line 27 of file class.ilContainerStartObjects.php.

Referenced by cloneDependencies(), and isFullfilled().

◆ $obj_id

ilContainerStartObjects::$obj_id
protected

Definition at line 35 of file class.ilContainerStartObjects.php.

Referenced by getObjId(), and isFullfilled().

◆ $ref_id

ilContainerStartObjects::$ref_id
protected

Definition at line 34 of file class.ilContainerStartObjects.php.

Referenced by getRefId().

◆ $start_objs

ilContainerStartObjects::$start_objs = array()
protected

Definition at line 36 of file class.ilContainerStartObjects.php.

◆ $tree

ilContainerStartObjects::$tree
protected

Definition at line 17 of file class.ilContainerStartObjects.php.

Referenced by __read().


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