ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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  $this->read($a_obj_id);
27  }
28  }
+ Here is the call graph for this function:

Member Function Documentation

◆ activateEntries()

ilLPCollection::activateEntries ( array  $a_item_ids)

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

References addEntry().

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

◆ addEntry()

ilLPCollection::addEntry (   $a_item_id)
protected

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

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

Referenced by activateEntries().

170  {
171  global $DIC;
172 
173  $ilDB = $DIC['ilDB'];
174 
175  if (!$this->isAssignedEntry($a_item_id)) {
176  $query = "INSERT INTO ut_lp_collections" .
177  " (obj_id, lpmode, item_id)" .
178  " VALUES (" . $ilDB->quote($this->obj_id, "integer") .
179  ", " . $ilDB->quote($this->mode, "integer") .
180  ", " . $ilDB->quote($a_item_id, "integer") .
181  ")";
182  $ilDB->manipulate($query);
183  $this->items[] = $a_item_id;
184  }
185  return true;
186  }
global $DIC
Definition: saml.php:7
$query
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 76 of file class.ilLPCollection.php.

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

77  {
78  global $DIC;
79 
80  $ilLog = $DIC['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  if (!isset($mappings[$item]) or !$mappings[$item]) {
92  continue;
93  }
94 
95  $new_collection->addEntry($mappings[$item]);
96  }
97 
98  $ilLog->write(__METHOD__ . ': cloned learning progress collection.');
99  }
global $DIC
Definition: saml.php:7
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  $this->deleteEntry($item_id);
205  }
206  }
+ Here is the call graph for this function:

◆ delete()

ilLPCollection::delete ( )

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

References $DIC, $ilDB, and $query.

133  {
134  global $DIC;
135 
136  $ilDB = $DIC['ilDB'];
137 
138  $query = "DELETE FROM ut_lp_collections" .
139  " WHERE obj_id = " . $ilDB->quote($this->obj_id, "integer");
140  $ilDB->manipulate($query);
141 
142  $query = "DELETE FROM ut_lp_coll_manual" .
143  " WHERE obj_id = " . $ilDB->quote($this->obj_id, "integer");
144  $ilDB->manipulate($query);
145 
146  // #15462 - reset internal data
147  $this->items = array();
148 
149  return true;
150  }
global $DIC
Definition: saml.php:7
$query
global $ilDB

◆ deleteEntry()

ilLPCollection::deleteEntry (   $a_item_id)
protected

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

References $DIC, $ilDB, and $query.

Referenced by deactivateEntries(), and read().

189  {
190  global $DIC;
191 
192  $ilDB = $DIC['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 $DIC
Definition: saml.php:7
$query
global $ilDB
+ 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.

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 ilLearningSequenceImporter\buildLPSettings(), ilObjectLP\getCollectionInstance(), and ilLearningSequenceXMLWriter\writeLPSettings().

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  }
$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 106 of file class.ilLPCollection.php.

References $items.

Referenced by ilLPCollectionOfRepositoryObjects\getGroupedItemsForLPStatus().

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

◆ hasSelectableItems()

ilLPCollection::hasSelectableItems ( )

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

72  {
73  return true;
74  }

◆ isAssignedEntry()

ilLPCollection::isAssignedEntry (   $a_item_id)

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

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

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

◆ read()

ilLPCollection::read (   $a_obj_id)
protected

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

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

Referenced by __construct().

112  {
113  global $DIC;
114 
115  $ilDB = $DIC['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  if ($this->validateEntry($row->item_id)) {
123  $items[] = $row->item_id;
124  } else {
125  $this->deleteEntry($row->item_id);
126  }
127  }
128 
129  $this->items = $items;
130  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$row
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 156 of file class.ilLPCollection.php.

Referenced by read().

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