ILIAS  release_4-4 Revision
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)
 

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.

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

References addEntry().

168  {
169  foreach($a_item_ids as $item_id)
170  {
171  $this->addEntry($item_id);
172  }
173  }
+ Here is the call graph for this function:

◆ addEntry()

ilLPCollection::addEntry (   $a_item_id)
protected

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

References $query, and isAssignedEntry().

Referenced by activateEntries().

131  {
132  global $ilDB;
133 
134  if(!$this->isAssignedEntry($a_item_id))
135  {
136  $query = "INSERT INTO ut_lp_collections".
137  " (obj_id, lpmode, item_id)".
138  " VALUES (".$ilDB->quote($this->obj_id , "integer").
139  ", ".$ilDB->quote($this->mode, "integer").
140  ", ".$ilDB->quote($a_item_id , "integer").
141  ")";
142  $ilDB->manipulate($query);
143  $this->items[] = $a_item_id;
144  }
145  return true;
146  }
isAssignedEntry($a_item_id)
+ 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 36 of file class.ilLPCollection.php.

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

37  {
38  global $ilLog;
39 
40  $target_obj_id = ilObject::_lookupObjId($a_target_id);
41 
42  include_once('Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
43  $cwo = ilCopyWizardOptions::_getInstance($a_copy_id);
44  $mappings = $cwo->getMappings();
45 
46  // #12067
47  $new_collection = new static($target_obj_id, $this->mode);
48  foreach($this->items as $item)
49  {
50  if(!isset($mappings[$item]) or !$mappings[$item])
51  {
52  continue;
53  }
54 
55  $new_collection->addEntry($mappings[$item]);
56  }
57 
58  $ilLog->write(__METHOD__.': cloned learning progress collection.');
59  }
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 159 of file class.ilLPCollection.php.

References deleteEntry().

160  {
161  foreach($a_item_ids as $item_id)
162  {
163  $this->deleteEntry($item_id);
164  }
165  }
+ Here is the call graph for this function:

◆ delete()

ilLPCollection::delete ( )

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

References $query.

95  {
96  global $ilDB;
97 
98  $query = "DELETE FROM ut_lp_collections".
99  " WHERE obj_id = ".$ilDB->quote($this->obj_id ,"integer");
100  $ilDB->manipulate($query);
101 
102  $query = "DELETE FROM ut_lp_coll_manual".
103  " WHERE obj_id = ".$ilDB->quote($this->obj_id, "integer");
104  $ilDB->manipulate($query);
105 
106  // #15462 - reset internal data
107  $this->items = array();
108 
109  return true;
110  }

◆ deleteEntry()

ilLPCollection::deleteEntry (   $a_item_id)
protected

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

References $query.

Referenced by deactivateEntries(), and read().

149  {
150  global $ilDB;
151 
152  $query = "DELETE FROM ut_lp_collections".
153  " WHERE obj_id = ".$ilDB->quote($this->obj_id, "integer").
154  " AND item_id = ".$ilDB->quote($a_item_id, "integer");
155  $ilDB->manipulate($query);
156  return true;
157  }
+ Here is the caller graph for this function:

◆ getItems()

ilLPCollection::getItems ( )

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

References $items.

Referenced by ilLPCollectionOfRepositoryObjects\getGroupedItemsForLPStatus().

67  {
68  return $this->items;
69  }
+ Here is the caller graph for this function:

◆ hasSelectableItems()

ilLPCollection::hasSelectableItems ( )

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

32  {
33  return true;
34  }

◆ isAssignedEntry()

ilLPCollection::isAssignedEntry (   $a_item_id)

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

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

122  {
123  if(is_array($this->items))
124  {
125  return (bool)in_array($a_item_id, $this->items);
126  }
127  return false;
128  }
+ Here is the caller graph for this function:

◆ read()

ilLPCollection::read ( )
protected

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

References $items, $res, $row, DB_FETCHMODE_OBJECT, deleteEntry(), and validateEntry().

Referenced by __construct().

72  {
73  global $ilDB;
74 
75  $items = array();
76 
77  $res = $ilDB->query("SELECT * FROM ut_lp_collections".
78  " WHERE obj_id = ".$ilDB->quote($this->obj_id, "integer"));
79  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
80  {
81  if($this->validateEntry($row->item_id))
82  {
83  $items[] = $row->item_id;
84  }
85  else
86  {
87  $this->deleteEntry($row->item_id);
88  }
89  }
90 
91  $this->items = $items;
92  }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
+ 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 116 of file class.ilLPCollection.php.

Referenced by read().

117  {
118  return true;
119  }
+ Here is the caller graph for this function:

Field Documentation

◆ $items

◆ $mode

ilLPCollection::$mode
protected

◆ $obj_id

ilLPCollection::$obj_id
protected

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