ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilLPCollection Class Reference

LP collection base class. More...

+ Inheritance diagram for ilLPCollection:
+ Collaboration diagram for ilLPCollection:

Public Member Functions

 __construct ($a_obj_id, $a_mode)
 
 hasSelectableItems ()
 
 cloneCollection ($a_target_id, $a_copy_id)
 
 getItems ()
 
 delete ()
 
 isAssignedEntry ($a_item_id)
 
 deactivateEntries (array $a_item_ids)
 
 activateEntries (array $a_item_ids)
 

Static Public Member Functions

static getInstanceByMode ($a_obj_id, $a_mode)
 
static getCollectionModes ()
 

Protected Member Functions

 read ($a_obj_id)
 
 validateEntry ($a_item_id)
 
 addEntry ($a_item_id)
 
 deleteEntry ($a_item_id)
 

Protected Attributes

 $obj_id
 
 $mode
 
 $items
 

Detailed Description

LP collection base class.

Author
Jörg Lützenkirchen luetz.nosp@m.enki.nosp@m.rchen.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
Id
class.ilLPCollections.php 40326 2013-03-05 11:39:24Z jluetzen

Definition at line 14 of file class.ilLPCollection.php.

Constructor & Destructor Documentation

◆ __construct()

ilLPCollection::__construct (   $a_obj_id,
  $a_mode 
)

Definition at line 20 of file class.ilLPCollection.php.

21 {
22 $this->obj_id = $a_obj_id;
23 $this->mode = $a_mode;
24
25 if ($a_obj_id) {
26 $this->read($a_obj_id);
27 }
28 }

References read().

+ Here is the call graph for this function:

Member Function Documentation

◆ activateEntries()

ilLPCollection::activateEntries ( array  $a_item_ids)

Reimplemented in ilLPCollectionOfRepositoryObjects.

Definition at line 198 of file class.ilLPCollection.php.

199 {
200 foreach ($a_item_ids as $item_id) {
201 $this->addEntry($item_id);
202 }
203 }

References addEntry().

+ Here is the call graph for this function:

◆ addEntry()

ilLPCollection::addEntry (   $a_item_id)
protected

Reimplemented in ilLPCollectionOfRepositoryObjects.

Definition at line 163 of file class.ilLPCollection.php.

164 {
165 global $ilDB;
166
167 if (!$this->isAssignedEntry($a_item_id)) {
168 $query = "INSERT INTO ut_lp_collections" .
169 " (obj_id, lpmode, item_id)" .
170 " VALUES (" . $ilDB->quote($this->obj_id, "integer") .
171 ", " . $ilDB->quote($this->mode, "integer") .
172 ", " . $ilDB->quote($a_item_id, "integer") .
173 ")";
174 $ilDB->manipulate($query);
175 $this->items[] = $a_item_id;
176 }
177 return true;
178 }
isAssignedEntry($a_item_id)
$query
global $ilDB

References $ilDB, $query, and isAssignedEntry().

Referenced by activateEntries().

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

◆ cloneCollection()

ilLPCollection::cloneCollection (   $a_target_id,
  $a_copy_id 
)

Reimplemented in ilLPCollectionOfRepositoryObjects, and ilLPCollectionOfSCOs.

Definition at line 76 of file class.ilLPCollection.php.

77 {
78 global $ilLog;
79
80 $target_obj_id = ilObject::_lookupObjId($a_target_id);
81
82 include_once('Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
83 $cwo = ilCopyWizardOptions::_getInstance($a_copy_id);
84 $mappings = $cwo->getMappings();
85
86 // #12067
87 $new_collection = new static($target_obj_id, $this->mode);
88 foreach ($this->items as $item) {
89 if (!isset($mappings[$item]) or !$mappings[$item]) {
90 continue;
91 }
92
93 $new_collection->addEntry($mappings[$item]);
94 }
95
96 $ilLog->write(__METHOD__ . ': cloned learning progress collection.');
97 }
static _getInstance($a_copy_id)
Get instance of copy wizard options.
static _lookupObjId($a_id)

References $ilLog, $mode, ilCopyWizardOptions\_getInstance(), and ilObject\_lookupObjId().

+ Here is the call graph for this function:

◆ deactivateEntries()

ilLPCollection::deactivateEntries ( array  $a_item_ids)

Reimplemented in ilLPCollectionOfRepositoryObjects.

Definition at line 191 of file class.ilLPCollection.php.

192 {
193 foreach ($a_item_ids as $item_id) {
194 $this->deleteEntry($item_id);
195 }
196 }

References deleteEntry().

+ Here is the call graph for this function:

◆ delete()

ilLPCollection::delete ( )

Definition at line 128 of file class.ilLPCollection.php.

129 {
130 global $ilDB;
131
132 $query = "DELETE FROM ut_lp_collections" .
133 " WHERE obj_id = " . $ilDB->quote($this->obj_id, "integer");
134 $ilDB->manipulate($query);
135
136 $query = "DELETE FROM ut_lp_coll_manual" .
137 " WHERE obj_id = " . $ilDB->quote($this->obj_id, "integer");
138 $ilDB->manipulate($query);
139
140 // #15462 - reset internal data
141 $this->items = array();
142
143 return true;
144 }

References $ilDB, and $query.

◆ deleteEntry()

ilLPCollection::deleteEntry (   $a_item_id)
protected

Reimplemented in ilLPCollectionOfRepositoryObjects.

Definition at line 180 of file class.ilLPCollection.php.

181 {
182 global $ilDB;
183
184 $query = "DELETE FROM ut_lp_collections" .
185 " WHERE obj_id = " . $ilDB->quote($this->obj_id, "integer") .
186 " AND item_id = " . $ilDB->quote($a_item_id, "integer");
187 $ilDB->manipulate($query);
188 return true;
189 }

References $ilDB, and $query.

Referenced by deactivateEntries(), and read().

+ Here is the caller graph for this function:

◆ getCollectionModes()

◆ getInstanceByMode()

static ilLPCollection::getInstanceByMode (   $a_obj_id,
  $a_mode 
)
static

Definition at line 30 of file class.ilLPCollection.php.

31 {
32 $path = "Services/Tracking/classes/collection/";
33
34 switch ($a_mode) {
37 include_once $path . "class.ilLPCollectionOfRepositoryObjects.php";
38 return new ilLPCollectionOfRepositoryObjects($a_obj_id, $a_mode);
39
41 include_once $path . "class.ilLPCollectionOfObjectives.php";
42 return new ilLPCollectionOfObjectives($a_obj_id, $a_mode);
43
45 include_once $path . "class.ilLPCollectionOfSCOs.php";
46 return new ilLPCollectionOfSCOs($a_obj_id, $a_mode);
47
50 include_once $path . "class.ilLPCollectionOfLMChapters.php";
51 return new ilLPCollectionOfLMChapters($a_obj_id, $a_mode);
52
54 include_once $path . "class.ilLPCollectionOfMediaObjects.php";
55 return new ilLPCollectionOfMediaObjects($a_obj_id, $a_mode);
56 }
57 }
LP collection of learning module chapters.

References $path, ilLPObjSettings\LP_MODE_COLLECTION, ilLPObjSettings\LP_MODE_COLLECTION_MANUAL, ilLPObjSettings\LP_MODE_COLLECTION_MOBS, ilLPObjSettings\LP_MODE_COLLECTION_TLT, ilLPObjSettings\LP_MODE_MANUAL_BY_TUTOR, ilLPObjSettings\LP_MODE_OBJECTIVES, and ilLPObjSettings\LP_MODE_SCORM.

Referenced by ilObjectLP\getCollectionInstance().

+ Here is the caller graph for this function:

◆ getItems()

ilLPCollection::getItems ( )

Definition at line 104 of file class.ilLPCollection.php.

105 {
106 return $this->items;
107 }

References $items.

Referenced by ilLPCollectionOfRepositoryObjects\getGroupedItemsForLPStatus().

+ Here is the caller graph for this function:

◆ hasSelectableItems()

ilLPCollection::hasSelectableItems ( )

Reimplemented in ilLPCollectionOfObjectives.

Definition at line 71 of file class.ilLPCollection.php.

72 {
73 return true;
74 }

◆ isAssignedEntry()

ilLPCollection::isAssignedEntry (   $a_item_id)

Definition at line 155 of file class.ilLPCollection.php.

156 {
157 if (is_array($this->items)) {
158 return (bool) in_array($a_item_id, $this->items);
159 }
160 return false;
161 }

Referenced by addEntry(), ilLPCollectionOfRepositoryObjects\addEntry(), ilLPCollectionOfRepositoryObjects\getPossibleItems(), ilLPCollectionOfLMChapters\getTableGUIData(), ilLPCollectionOfMediaObjects\getTableGUIData(), ilLPCollectionOfSCOs\getTableGUIData(), and ilLPCollectionOfRepositoryObjects\parseTableGUIItem().

+ Here is the caller graph for this function:

◆ read()

ilLPCollection::read (   $a_obj_id)
protected

Reimplemented in ilLPCollectionOfObjectives, and ilLPCollectionOfRepositoryObjects.

Definition at line 109 of file class.ilLPCollection.php.

110 {
111 global $ilDB;
112
113 $items = array();
114
115 $res = $ilDB->query("SELECT * FROM ut_lp_collections" .
116 " WHERE obj_id = " . $ilDB->quote($a_obj_id, "integer"));
117 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
118 if ($this->validateEntry($row->item_id)) {
119 $items[] = $row->item_id;
120 } else {
121 $this->deleteEntry($row->item_id);
122 }
123 }
124
125 $this->items = $items;
126 }
foreach($_POST as $key=> $value) $res

References $ilDB, $items, $res, $row, deleteEntry(), ilDBConstants\FETCHMODE_OBJECT, and validateEntry().

Referenced by __construct().

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

◆ validateEntry()

ilLPCollection::validateEntry (   $a_item_id)
protected

Definition at line 150 of file class.ilLPCollection.php.

151 {
152 return true;
153 }

Referenced by read().

+ Here is the caller graph for this function:

Field Documentation

◆ $items

◆ $mode

◆ $obj_id


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