ILIAS  trunk Revision v11.0_alpha-1761-g6dbbfa7b760
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilLPCollection Class Reference

LP collection base class. More...

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

Public Member Functions

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

Static Public Member Functions

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

Protected Member Functions

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

Protected Attributes

int $obj_id
 
int $mode
 
array $items = []
 
ilDBInterface $db
 
ilLogger $logger
 

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

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

Constructor & Destructor Documentation

◆ __construct()

ilLPCollection::__construct ( int  $a_obj_id,
int  $a_mode 
)

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

References $DIC, ILIAS\Repository\logger(), and read().

35  {
36  global $DIC;
37 
38  $this->db = $DIC->database();
39  $this->logger = $DIC->logger()->trac();
40 
41  $this->obj_id = $a_obj_id;
42  $this->mode = $a_mode;
43 
44  if ($a_obj_id) {
45  $this->read($a_obj_id);
46  }
47  }
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:

Member Function Documentation

◆ activateEntries()

ilLPCollection::activateEntries ( array  $a_item_ids)
Parameters
int[]$a_item_ids

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

References addEntry().

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

◆ addEntry()

ilLPCollection::addEntry ( int  $a_item_id)
protected

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

References isAssignedEntry().

Referenced by activateEntries().

171  : bool
172  {
173  if (!$this->isAssignedEntry($a_item_id)) {
174  $query = "INSERT INTO ut_lp_collections" .
175  " (obj_id, lpmode, item_id)" .
176  " VALUES (" . $this->db->quote($this->obj_id, "integer") .
177  ", " . $this->db->quote($this->mode, "integer") .
178  ", " . $this->db->quote($a_item_id, "integer") .
179  ")";
180  $this->db->manipulate($query);
181  $this->items[] = $a_item_id;
182  }
183  return true;
184  }
isAssignedEntry(int $a_item_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cloneCollection()

ilLPCollection::cloneCollection ( int  $a_target_id,
int  $a_copy_id 
)

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

References $mode, ilCopyWizardOptions\_getInstance(), ilObject\_lookupObjId(), and ILIAS\Repository\logger().

101  : void
102  {
103  $target_obj_id = ilObject::_lookupObjId($a_target_id);
104  $cwo = ilCopyWizardOptions::_getInstance($a_copy_id);
105  $mappings = $cwo->getMappings();
106 
107  // #12067
108  $new_collection = new static($target_obj_id, $this->mode);
109  foreach ($this->items as $item) {
110  if (!isset($mappings[$item]) or !$mappings[$item]) {
111  continue;
112  }
113 
114  $new_collection->addEntry($mappings[$item]);
115  }
116  $this->logger->debug('cloned learning progress collection.');
117  }
static _lookupObjId(int $ref_id)
static _getInstance(int $a_copy_id)
+ Here is the call graph for this function:

◆ deactivateEntries()

ilLPCollection::deactivateEntries ( array  $a_item_ids)
Parameters
int[]$a_item_ids

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

References deleteEntry().

198  : void
199  {
200  foreach ($a_item_ids as $item_id) {
201  $this->deleteEntry($item_id);
202  }
203  }
deleteEntry(int $a_item_id)
+ Here is the call graph for this function:

◆ delete()

ilLPCollection::delete ( )

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

141  : void
142  {
143  $query = "DELETE FROM ut_lp_collections" .
144  " WHERE obj_id = " . $this->db->quote($this->obj_id, "integer");
145  $this->db->manipulate($query);
146 
147  $query = "DELETE FROM ut_lp_coll_manual" .
148  " WHERE obj_id = " . $this->db->quote($this->obj_id, "integer");
149  $this->db->manipulate($query);
150  // #15462 - reset internal data
151  $this->items = array();
152  }

◆ deleteEntry()

ilLPCollection::deleteEntry ( int  $a_item_id)
protected

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

Referenced by deactivateEntries(), and read().

186  : bool
187  {
188  $query = "DELETE FROM ut_lp_collections" .
189  " WHERE obj_id = " . $this->db->quote($this->obj_id, "integer") .
190  " AND item_id = " . $this->db->quote($a_item_id, "integer");
191  $this->db->manipulate($query);
192  return true;
193  }
+ Here is the caller graph for this function:

◆ getCollectionModes()

◆ getInstanceByMode()

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

Definition at line 49 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, ilLPObjSettings\LP_MODE_SCORM, and null.

Referenced by ilLearningSequenceImporter\buildLPSettings(), ilObjectLP\getCollectionInstance(), ilTrackingCollectionTest\testCollectionInstance(), and ilLearningSequenceXMLWriter\writeLPSettings().

52  : ?ilLPCollection {
53  $path = "components/ILIAS/Tracking/classes/collection/";
54 
55  switch ($a_mode) {
59  $a_obj_id,
60  $a_mode
61  );
62 
64  return new ilLPCollectionOfObjectives($a_obj_id, $a_mode);
65 
67  return new ilLPCollectionOfSCOs($a_obj_id, $a_mode);
68 
71  return new ilLPCollectionOfLMChapters($a_obj_id, $a_mode);
72 
74  return new ilLPCollectionOfMediaObjects($a_obj_id, $a_mode);
75  }
76  return null;
77  }
LP collection of learning module chapters.
$path
Definition: ltiservices.php:29
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
LP collection base class.
+ Here is the caller graph for this function:

◆ getItems()

ilLPCollection::getItems ( )

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

References $items.

Referenced by ilLPCollectionOfRepositoryObjects\getGroupedItemsForLPStatus().

119  : array
120  {
121  return $this->items;
122  }
+ Here is the caller graph for this function:

◆ hasSelectableItems()

ilLPCollection::hasSelectableItems ( )

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

96  : bool
97  {
98  return true;
99  }

◆ isAssignedEntry()

ilLPCollection::isAssignedEntry ( int  $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().

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

◆ read()

ilLPCollection::read ( int  $a_obj_id)
protected

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

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

Referenced by __construct().

124  : void
125  {
126  $items = array();
127  $res = $this->db->query(
128  "SELECT * FROM ut_lp_collections" .
129  " WHERE obj_id = " . $this->db->quote($a_obj_id, "integer")
130  );
131  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
132  if ($this->validateEntry((int) $row->item_id)) {
133  $items[] = $row->item_id;
134  } else {
135  $this->deleteEntry($row->item_id);
136  }
137  }
138  $this->items = $items;
139  }
$res
Definition: ltiservices.php:66
deleteEntry(int $a_item_id)
validateEntry(int $a_item_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ validateEntry()

ilLPCollection::validateEntry ( int  $a_item_id)
protected

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

Referenced by read().

158  : bool
159  {
160  return true;
161  }
+ Here is the caller graph for this function:

Field Documentation

◆ $db

ilDBInterface ilLPCollection::$db
protected

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

◆ $items

◆ $logger

ilLogger ilLPCollection::$logger
protected

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

◆ $mode

◆ $obj_id


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