ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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 ()
 
 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 {
27 $this->read($a_obj_id);
28 }
29 }

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 209 of file class.ilLPCollection.php.

210 {
211 foreach($a_item_ids as $item_id)
212 {
213 $this->addEntry($item_id);
214 }
215 }

References addEntry().

+ Here is the call graph for this function:

◆ addEntry()

ilLPCollection::addEntry (   $a_item_id)
protected

Reimplemented in ilLPCollectionOfRepositoryObjects.

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

173 {
174 global $ilDB;
175
176 if(!$this->isAssignedEntry($a_item_id))
177 {
178 $query = "INSERT INTO ut_lp_collections".
179 " (obj_id, lpmode, item_id)".
180 " VALUES (".$ilDB->quote($this->obj_id , "integer").
181 ", ".$ilDB->quote($this->mode, "integer").
182 ", ".$ilDB->quote($a_item_id , "integer").
183 ")";
184 $ilDB->manipulate($query);
185 $this->items[] = $a_item_id;
186 }
187 return true;
188 }
isAssignedEntry($a_item_id)
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.

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

79 {
80 global $ilLog;
81
82 $target_obj_id = ilObject::_lookupObjId($a_target_id);
83
84 include_once('Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
85 $cwo = ilCopyWizardOptions::_getInstance($a_copy_id);
86 $mappings = $cwo->getMappings();
87
88 // #12067
89 $new_collection = new static($target_obj_id, $this->mode);
90 foreach($this->items as $item)
91 {
92 if(!isset($mappings[$item]) or !$mappings[$item])
93 {
94 continue;
95 }
96
97 $new_collection->addEntry($mappings[$item]);
98 }
99
100 $ilLog->write(__METHOD__.': cloned learning progress collection.');
101 }
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 201 of file class.ilLPCollection.php.

202 {
203 foreach($a_item_ids as $item_id)
204 {
205 $this->deleteEntry($item_id);
206 }
207 }

References deleteEntry().

+ Here is the call graph for this function:

◆ delete()

ilLPCollection::delete ( )

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

137 {
138 global $ilDB;
139
140 $query = "DELETE FROM ut_lp_collections".
141 " WHERE obj_id = ".$ilDB->quote($this->obj_id ,"integer");
142 $ilDB->manipulate($query);
143
144 $query = "DELETE FROM ut_lp_coll_manual".
145 " WHERE obj_id = ".$ilDB->quote($this->obj_id, "integer");
146 $ilDB->manipulate($query);
147
148 // #15462 - reset internal data
149 $this->items = array();
150
151 return true;
152 }

References $ilDB, and $query.

◆ deleteEntry()

ilLPCollection::deleteEntry (   $a_item_id)
protected

Reimplemented in ilLPCollectionOfRepositoryObjects.

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

191 {
192 global $ilDB;
193
194 $query = "DELETE FROM ut_lp_collections".
195 " WHERE obj_id = ".$ilDB->quote($this->obj_id, "integer").
196 " AND item_id = ".$ilDB->quote($a_item_id, "integer");
197 $ilDB->manipulate($query);
198 return true;
199 }

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 31 of file class.ilLPCollection.php.

32 {
33 $path = "Services/Tracking/classes/collection/";
34
35 switch($a_mode)
36 {
39 include_once $path."class.ilLPCollectionOfRepositoryObjects.php";
40 return new ilLPCollectionOfRepositoryObjects($a_obj_id, $a_mode);
41
43 include_once $path."class.ilLPCollectionOfObjectives.php";
44 return new ilLPCollectionOfObjectives($a_obj_id, $a_mode);
45
47 include_once $path."class.ilLPCollectionOfSCOs.php";
48 return new ilLPCollectionOfSCOs($a_obj_id, $a_mode);
49
52 include_once $path."class.ilLPCollectionOfLMChapters.php";
53 return new ilLPCollectionOfLMChapters($a_obj_id, $a_mode);
54
56 include_once $path."class.ilLPCollectionOfMediaObjects.php";
57 return new ilLPCollectionOfMediaObjects($a_obj_id, $a_mode);
58 }
59 }
LP collection of learning module chapters.
$path
Definition: index.php:22

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 108 of file class.ilLPCollection.php.

109 {
110 return $this->items;
111 }

References $items.

Referenced by ilLPCollectionOfRepositoryObjects\getGroupedItemsForLPStatus().

+ Here is the caller graph for this function:

◆ hasSelectableItems()

ilLPCollection::hasSelectableItems ( )

Reimplemented in ilLPCollectionOfObjectives.

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

74 {
75 return true;
76 }

◆ isAssignedEntry()

ilLPCollection::isAssignedEntry (   $a_item_id)

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

164 {
165 if(is_array($this->items))
166 {
167 return (bool)in_array($a_item_id, $this->items);
168 }
169 return false;
170 }

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 ( )
protected

Reimplemented in ilLPCollectionOfRepositoryObjects.

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

114 {
115 global $ilDB;
116
117 $items = array();
118
119 $res = $ilDB->query("SELECT * FROM ut_lp_collections".
120 " WHERE obj_id = ".$ilDB->quote($this->obj_id, "integer"));
121 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
122 {
123 if($this->validateEntry($row->item_id))
124 {
125 $items[] = $row->item_id;
126 }
127 else
128 {
129 $this->deleteEntry($row->item_id);
130 }
131 }
132
133 $this->items = $items;
134 }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11

References $ilDB, $items, $res, $row, DB_FETCHMODE_OBJECT, deleteEntry(), 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 158 of file class.ilLPCollection.php.

159 {
160 return true;
161 }

Referenced by read().

+ Here is the caller graph for this function:

Field Documentation

◆ $items

◆ $mode

ilLPCollection::$mode
protected

◆ $obj_id


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