ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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.

References read().

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  }
+ Here is the call graph for this function:

Member Function Documentation

◆ activateEntries()

ilLPCollection::activateEntries ( array  $a_item_ids)

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

References addEntry().

210  {
211  foreach($a_item_ids as $item_id)
212  {
213  $this->addEntry($item_id);
214  }
215  }
+ Here is the call graph for this function:

◆ addEntry()

ilLPCollection::addEntry (   $a_item_id)
protected

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

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

Referenced by activateEntries().

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
+ 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 
)

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

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

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)
+ Here is the call graph for this function:

◆ deactivateEntries()

ilLPCollection::deactivateEntries ( array  $a_item_ids)

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

References deleteEntry().

202  {
203  foreach($a_item_ids as $item_id)
204  {
205  $this->deleteEntry($item_id);
206  }
207  }
+ Here is the call graph for this function:

◆ delete()

ilLPCollection::delete ( )

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

References $ilDB, $query, and array.

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  }
Create styles array
The data for the language used.
global $ilDB

◆ deleteEntry()

ilLPCollection::deleteEntry (   $a_item_id)
protected

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

References $ilDB, and $query.

Referenced by deactivateEntries(), and read().

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  }
global $ilDB
+ 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.

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

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  }
$path
Definition: aliased.php:25
LP collection of learning module chapters.
+ Here is the caller graph for this function:

◆ getItems()

ilLPCollection::getItems ( )

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

References $items.

Referenced by ilLPCollectionOfRepositoryObjects\getGroupedItemsForLPStatus().

109  {
110  return $this->items;
111  }
+ Here is the caller graph for this function:

◆ hasSelectableItems()

ilLPCollection::hasSelectableItems ( )

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.

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

164  {
165  if(is_array($this->items))
166  {
167  return (bool)in_array($a_item_id, $this->items);
168  }
169  return false;
170  }
+ Here is the caller graph for this function:

◆ read()

ilLPCollection::read (   $a_obj_id)
protected

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

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

Referenced by __construct().

114  {
115  global $ilDB;
116 
117  $items = array();
118 
119  $res = $ilDB->query("SELECT * FROM ut_lp_collections".
120  " WHERE obj_id = ".$ilDB->quote($a_obj_id, "integer"));
121  while($row = $res->fetchRow(ilDBConstants::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  }
Create styles array
The data for the language used.
global $ilDB
+ 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.

Referenced by read().

159  {
160  return true;
161  }
+ 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: