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

class ilEventItems More...

+ Collaboration diagram for ilEventItems:

Public Member Functions

 __construct (int $a_event_id)
 
 getEventId ()
 
 setEventId (int $a_event_id)
 
 getItems ()
 
 setItems (array $a_items)
 
 addItem (int $a_item_ref_id)
 
 delete ()
 
 removeItems (array $a_items)
 
 update ()
 
 _isAssigned (int $a_item_id)
 
 cloneItems (int $a_source_id, int $a_copy_id)
 

Static Public Member Functions

static _delete (int $a_event_id)
 
static _getItemsOfContainer (int $a_ref_id)
 
static _getItemsOfEvent (int $a_event_id)
 
static getEventsForItemOrderedByStartingTime (int $item_ref_id)
 

Protected Member Functions

 __read ()
 

Protected Attributes

ilDBInterface $db
 
ilTree $tree
 
int $event_id = 0
 
array $items = []
 

Detailed Description

class ilEventItems

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
Id
class.ilEventItems.php 15697 2008-01-08 20:04:33Z hschottm

Definition at line 28 of file class.ilEventItems.php.

Constructor & Destructor Documentation

◆ __construct()

ilEventItems::__construct ( int  $a_event_id)

Definition at line 36 of file class.ilEventItems.php.

References $DIC, and __read().

37  {
38  global $DIC;
39 
40  $this->db = $DIC->database();
41  $this->tree = $DIC->repositoryTree();
42 
43  $this->event_id = $a_event_id;
44  $this->__read();
45  }
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:

Member Function Documentation

◆ __read()

ilEventItems::__read ( )
protected

Definition at line 224 of file class.ilEventItems.php.

References $db, $DIC, $ilDB, $res, $tree, ilDBConstants\FETCHMODE_OBJECT, getEventId(), ILIAS\Repository\int(), ilTree\isDeleted(), and ilTree\isInTree().

Referenced by __construct().

224  : bool
225  {
226  global $DIC;
227 
228  $ilDB = $this->db;
229  $tree = $this->tree;
230 
231  $query = "SELECT * FROM event_items " .
232  "WHERE event_id = " . $ilDB->quote($this->getEventId(), 'integer') . " ";
233 
234  $res = $this->db->query($query);
235  $this->items = [];
236  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
237  if ($tree->isDeleted((int) $row->item_id)) {
238  continue;
239  }
240  if (!$tree->isInTree((int) $row->item_id)) {
241  $query = "DELETE FROM event_items " .
242  "WHERE item_id = " . $ilDB->quote($row->item_id, 'integer');
243  $ilDB->manipulate($query);
244  continue;
245  }
246 
247  $this->items[] = (int) $row->item_id;
248  }
249  return true;
250  }
$res
Definition: ltiservices.php:66
ilDBInterface $db
isInTree(?int $a_node_id)
get all information of a node.
isDeleted(int $a_node_id)
This is a wrapper for isSaved() with a more useful name.
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _delete()

static ilEventItems::_delete ( int  $a_event_id)
static

Definition at line 80 of file class.ilEventItems.php.

References $DIC, $ilDB, and $res.

Referenced by ilObjSession\delete().

80  : bool
81  {
82  global $DIC;
83 
84  $ilDB = $DIC->database();
85 
86  $query = "DELETE FROM event_items " .
87  "WHERE event_id = " . $ilDB->quote($a_event_id, 'integer') . " ";
88  $res = $ilDB->manipulate($query);
89  return true;
90  }
$res
Definition: ltiservices.php:66
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ _getItemsOfContainer()

static ilEventItems::_getItemsOfContainer ( int  $a_ref_id)
static

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

References $DIC, $ilDB, $items, $res, ilDBConstants\FETCHMODE_OBJECT, and ilTree\getChildsByType().

Referenced by ilObjectActivation\getTimingsItems(), ilContainerContentGUI\initRenderer(), ilRepositoryExplorerGUI\isNodeVisible(), ilRepositoryExplorer\isVisible(), and ilContainerGUI\redrawListItemObject().

121  : array
122  {
123  global $DIC;
124 
125  $ilDB = $DIC->database();
126  $tree = $DIC->repositoryTree();
127 
128  $session_nodes = $tree->getChildsByType($a_ref_id, 'sess');
129  $session_ids = [];
130  foreach ($session_nodes as $node) {
131  $session_ids[] = $node['obj_id'];
132  }
133  $query = "SELECT item_id FROM event_items " .
134  "WHERE " . $ilDB->in('event_id', $session_ids, false, 'integer');
135 
136 
137  $res = $ilDB->query($query);
138  $items = [];
139  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
140  $items[] = $row->item_id;
141  }
142  return $items;
143  }
$res
Definition: ltiservices.php:66
getChildsByType(int $a_node_id, string $a_type)
get child nodes of given node by object type
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getItemsOfEvent()

static ilEventItems::_getItemsOfEvent ( int  $a_event_id)
static

Definition at line 145 of file class.ilEventItems.php.

References $DIC, $ilDB, $items, $res, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by cloneItems().

145  : array
146  {
147  global $DIC;
148 
149  $ilDB = $DIC->database();
150 
151  $query = "SELECT * FROM event_items " .
152  "WHERE event_id = " . $ilDB->quote($a_event_id, 'integer');
153  $res = $ilDB->query($query);
154  $items = [];
155  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
156  $items[] = $row->item_id;
157  }
158  return $items;
159  }
$res
Definition: ltiservices.php:66
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ _isAssigned()

ilEventItems::_isAssigned ( int  $a_item_id)

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

References $DIC, $ilDB, and $res.

161  : bool
162  {
163  global $DIC;
164 
165  $ilDB = $DIC->database();
166 
167  $query = "SELECT * FROM event_items " .
168  "WHERE item_id = " . $ilDB->quote($a_item_id, 'integer') . " ";
169  $res = $ilDB->query($query);
170 
171  return $res->numRows() ? true : false;
172  }
$res
Definition: ltiservices.php:66
global $DIC
Definition: shib_login.php:22

◆ addItem()

ilEventItems::addItem ( int  $a_item_ref_id)

Definition at line 70 of file class.ilEventItems.php.

Referenced by ilObjSessionGUI\afterSaveCallback(), and ilSessionDataSet\importRecord().

70  : void
71  {
72  $this->items[] = $a_item_ref_id;
73  }
+ Here is the caller graph for this function:

◆ cloneItems()

ilEventItems::cloneItems ( int  $a_source_id,
int  $a_copy_id 
)

Definition at line 197 of file class.ilEventItems.php.

References $DIC, ilCopyWizardOptions\_getInstance(), _getItemsOfEvent(), setItems(), and update().

197  : bool
198  {
199  global $DIC;
200 
201  $ilObjDataCache = $DIC['ilObjDataCache'];
202  $ilLog = $DIC->logger()->sess();
203 
204  $ilLog->debug('Begin cloning session materials ...');
205 
206  $cwo = ilCopyWizardOptions::_getInstance($a_copy_id);
207  $mappings = $cwo->getMappings();
208 
209  $new_items = [];
210  foreach (ilEventItems::_getItemsOfEvent($a_source_id) as $item_id) {
211  if (isset($mappings[$item_id]) && $mappings[$item_id]) {
212  $ilLog->debug('Clone session material nr. ' . $item_id);
213  $new_items[] = $mappings[$item_id];
214  } else {
215  $ilLog->debug('No mapping found for session material nr. ' . $item_id);
216  }
217  }
218  $this->setItems($new_items);
219  $this->update();
220  $ilLog->debug('Finished cloning session materials ...');
221  return true;
222  }
setItems(array $a_items)
global $DIC
Definition: shib_login.php:22
static _getItemsOfEvent(int $a_event_id)
static _getInstance(int $a_copy_id)
+ Here is the call graph for this function:

◆ delete()

ilEventItems::delete ( )

Definition at line 75 of file class.ilEventItems.php.

References getEventId().

75  : bool
76  {
77  return self::_delete($this->getEventId());
78  }
+ Here is the call graph for this function:

◆ getEventId()

ilEventItems::getEventId ( )

Definition at line 47 of file class.ilEventItems.php.

References $event_id.

Referenced by __read(), delete(), and update().

47  : int
48  {
49  return $this->event_id;
50  }
+ Here is the caller graph for this function:

◆ getEventsForItemOrderedByStartingTime()

static ilEventItems::getEventsForItemOrderedByStartingTime ( int  $item_ref_id)
static
Parameters
int$item_ref_id
Returns
int[]

Definition at line 178 of file class.ilEventItems.php.

References $DIC, $res, ilDBConstants\FETCHMODE_OBJECT, IL_CAL_DATETIME, ilDBInterface\query(), and ilDBInterface\quote().

Referenced by ilSessionClassificationPathGUI\findSessionContainerForItem().

178  : array
179  {
180  global $DIC;
181 
182  $db = $DIC->database();
183  $query = 'SELECT e.event_id,e_start FROM event_items e ' .
184  'JOIN event_appointment ea ON e.event_id = ea.event_id ' .
185  'WHERE item_id = ' . $db->quote($item_ref_id, 'integer') . ' ' .
186  'ORDER BY (e_start)';
187  $res = $db->query($query);
188 
189  $events = [];
190  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
191  $dt = new ilDateTime($row->e_start, IL_CAL_DATETIME);
192  $events[$row->event_id] = $dt->getUnixTime();
193  }
194  return $events;
195  }
$res
Definition: ltiservices.php:66
const IL_CAL_DATETIME
ilDBInterface $db
quote($value, string $type)
global $DIC
Definition: shib_login.php:22
query(string $query)
Run a (read-only) Query on the database.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getItems()

ilEventItems::getItems ( )

Definition at line 57 of file class.ilEventItems.php.

References $items.

Referenced by ilObjSessionGUI\createRecurringSessions(), ilObjSessionGUI\handleFileUpload(), and ilObjSessionGUI\saveMaterialsObject().

57  : array
58  {
59  return $this->items;
60  }
+ Here is the caller graph for this function:

◆ removeItems()

ilEventItems::removeItems ( array  $a_items)

Definition at line 92 of file class.ilEventItems.php.

References $res.

Referenced by ilObjSessionGUI\removeMaterialsObject().

92  : bool
93  {
94  $query = "DELETE FROM event_items WHERE " . $this->db->in('item_id', $a_items, false, 'integer') .
95  " AND event_id = " . $this->db->quote($this->event_id, 'integer');
96 
97  $res = $this->db->manipulate($query);
98 
99  return true;
100  }
$res
Definition: ltiservices.php:66
+ Here is the caller graph for this function:

◆ setEventId()

ilEventItems::setEventId ( int  $a_event_id)

Definition at line 52 of file class.ilEventItems.php.

Referenced by EventItemsTest\testSetEventId().

52  : void
53  {
54  $this->event_id = $a_event_id;
55  }
+ Here is the caller graph for this function:

◆ setItems()

ilEventItems::setItems ( array  $a_items)

Definition at line 62 of file class.ilEventItems.php.

References ILIAS\Repository\int().

Referenced by cloneItems(), ilObjSessionGUI\createRecurringSessions(), and ilObjSessionGUI\handleFileUpload().

62  : void
63  {
64  $this->items = [];
65  foreach ($a_items as $item_id) {
66  $this->items[] = (int) $item_id;
67  }
68  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ update()

ilEventItems::update ( )

Definition at line 102 of file class.ilEventItems.php.

References $DIC, $ilDB, $res, and getEventId().

Referenced by ilObjSessionGUI\afterSaveCallback(), and cloneItems().

102  : bool
103  {
104  global $DIC;
105 
106  $ilDB = $DIC->database();
107 
108  $this->delete();
109 
110  foreach ($this->items as $item) {
111  $query = "INSERT INTO event_items (event_id,item_id) " .
112  "VALUES( " .
113  $ilDB->quote($this->getEventId(), 'integer') . ", " .
114  $ilDB->quote($item, 'integer') . " " .
115  ")";
116  $res = $ilDB->manipulate($query);
117  }
118  return true;
119  }
$res
Definition: ltiservices.php:66
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $db

ilDBInterface ilEventItems::$db
protected

Definition at line 30 of file class.ilEventItems.php.

Referenced by __read().

◆ $event_id

int ilEventItems::$event_id = 0
protected

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

Referenced by getEventId().

◆ $items

array ilEventItems::$items = []
protected

Definition at line 33 of file class.ilEventItems.php.

Referenced by _getItemsOfContainer(), _getItemsOfEvent(), and getItems().

◆ $tree

ilTree ilEventItems::$tree
protected

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

Referenced by __read().


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