ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
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.

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

168 {
169 foreach($a_item_ids as $item_id)
170 {
171 $this->addEntry($item_id);
172 }
173 }

References addEntry().

+ Here is the call graph for this function:

◆ addEntry()

ilLPCollection::addEntry (   $a_item_id)
protected

Reimplemented in ilLPCollectionOfRepositoryObjects.

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

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

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)

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

160 {
161 foreach($a_item_ids as $item_id)
162 {
163 $this->deleteEntry($item_id);
164 }
165 }

References deleteEntry().

+ Here is the call graph for this function:

◆ delete()

ilLPCollection::delete ( )

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

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 }

References $ilDB, and $query.

◆ deleteEntry()

ilLPCollection::deleteEntry (   $a_item_id)
protected

Reimplemented in ilLPCollectionOfRepositoryObjects.

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

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 }

References $ilDB, and $query.

Referenced by deactivateEntries(), and read().

+ Here is the caller graph for this function:

◆ getItems()

ilLPCollection::getItems ( )

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

67 {
68 return $this->items;
69 }

References $items.

Referenced by ilLPCollectionOfRepositoryObjects\getGroupedItemsForLPStatus().

+ Here is the caller graph for this function:

◆ hasSelectableItems()

ilLPCollection::hasSelectableItems ( )

Reimplemented in ilLPCollectionOfObjectives.

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.

122 {
123 if(is_array($this->items))
124 {
125 return (bool)in_array($a_item_id, $this->items);
126 }
127 return false;
128 }

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

+ Here is the caller graph for this function:

◆ read()

ilLPCollection::read ( )
protected

Reimplemented in ilLPCollectionOfRepositoryObjects.

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

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

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

117 {
118 return true;
119 }

Referenced by read().

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