ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilEventItems Class Reference

class ilEvent More...

+ Collaboration diagram for ilEventItems:

Public Member Functions

 __construct ($a_event_id)
 
 getEventId ()
 
 setEventId ($a_event_id)
 
 getItems ()
 get assigned items More...
 
 setItems ($a_items)
 
 addItem ($a_item_ref_id)
 Add one item. More...
 
 delete ()
 
 update ()
 
 _isAssigned ($a_item_id)
 
 cloneItems ($a_source_id, $a_copy_id)
 Clone items. More...
 
 __read ()
 

Static Public Member Functions

static _delete ($a_event_id)
 
static _getItemsOfContainer ($a_ref_id)
 
static _getItemsOfEvent ($a_event_id)
 Get items by event. More...
 

Data Fields

 $ilErr
 
 $ilDB
 
 $tree
 
 $lng
 
 $event_id = null
 
 $items = array()
 

Detailed Description

class ilEvent

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 34 of file class.ilEventItems.php.

Constructor & Destructor Documentation

◆ __construct()

ilEventItems::__construct (   $a_event_id)

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

References $ilDB, $ilErr, $lng, $tree, and __read().

46  {
47  global $ilErr,$ilDB,$lng,$tree;
48 
49  $this->ilErr = $ilErr;
50  $this->db = $ilDB;
51  $this->lng = $lng;
52 
53  $this->event_id = $a_event_id;
54  $this->__read();
55  }
+ Here is the call graph for this function:

Member Function Documentation

◆ __read()

ilEventItems::__read ( )

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

References $ilDB, $query, $res, $row, $tree, array, ilDBConstants\FETCHMODE_OBJECT, and getEventId().

Referenced by __construct().

214  {
215  global $ilDB,$tree;
216 
217  $query = "SELECT * FROM event_items " .
218  "WHERE event_id = " . $ilDB->quote($this->getEventId(), 'integer') . " ";
219 
220  $res = $this->db->query($query);
221  $this->items = array();
222  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
223  if ($tree->isDeleted($row->item_id)) {
224  continue;
225  }
226  if (!$tree->isInTree($row->item_id)) {
227  $query = "DELETE FROM event_items " .
228  "WHERE item_id = " . $ilDB->quote($row->item_id, 'integer');
229  $ilDB->manipulate($query);
230  continue;
231  }
232 
233  $this->items[] = (int) $row->item_id;
234  }
235  return true;
236  }
foreach($_POST as $key=> $value) $res
$query
Create styles array
The data for the language used.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _delete()

static ilEventItems::_delete (   $a_event_id)
static

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

References $ilDB, $query, and $res.

Referenced by delete(), and ilObjSession\delete().

100  {
101  global $ilDB;
102 
103  $query = "DELETE FROM event_items " .
104  "WHERE event_id = " . $ilDB->quote($a_event_id, 'integer') . " ";
105  $res = $ilDB->manipulate($query);
106  return true;
107  }
foreach($_POST as $key=> $value) $res
$query
+ Here is the caller graph for this function:

◆ _getItemsOfContainer()

static ilEventItems::_getItemsOfContainer (   $a_ref_id)
static

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

References $ilDB, $items, $query, $res, $row, $tree, array, and ilDBConstants\FETCHMODE_OBJECT.

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

127  {
128  global $ilDB,$tree;
129 
130  $session_nodes = $tree->getChildsByType($a_ref_id, 'sess');
131  $session_ids = [];
132  foreach ($session_nodes as $node) {
133  $session_ids[] = $node['obj_id'];
134  }
135  $query = "SELECT item_id FROM event_items " .
136  "WHERE " . $ilDB->in('event_id', $session_ids, false, 'integer');
137 
138 
139  $res = $ilDB->query($query);
140  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
141  $items[] = $row->item_id;
142  }
143  return $items ? $items : array();
144  }
foreach($_POST as $key=> $value) $res
$query
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ _getItemsOfEvent()

static ilEventItems::_getItemsOfEvent (   $a_event_id)
static

Get items by event.

public

Parameters
intevent id

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

References $ilDB, $items, $query, $res, $row, array, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by cloneItems().

155  {
156  global $ilDB;
157 
158  $query = "SELECT * FROM event_items " .
159  "WHERE event_id = " . $ilDB->quote($a_event_id, 'integer');
160  $res = $ilDB->query($query);
161  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
162  $items[] = $row->item_id;
163  }
164  return $items ? $items : array();
165  }
foreach($_POST as $key=> $value) $res
$query
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ _isAssigned()

ilEventItems::_isAssigned (   $a_item_id)

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

References $ilDB, $query, and $res.

168  {
169  global $ilDB;
170 
171  $query = "SELECT * FROM event_items " .
172  "WHERE item_id = " . $ilDB->quote($a_item_id, 'integer') . " ";
173  $res = $ilDB->query($query);
174 
175  return $res->numRows() ? true : false;
176  }
foreach($_POST as $key=> $value) $res
$query

◆ addItem()

ilEventItems::addItem (   $a_item_ref_id)

Add one item.

Parameters
object$a_item_ref_id
Returns

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

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

89  {
90  $this->items[] = (int) $a_item_ref_id;
91  }
+ Here is the caller graph for this function:

◆ cloneItems()

ilEventItems::cloneItems (   $a_source_id,
  $a_copy_id 
)

Clone items.

public

Parameters
intsource event id
intcopy id

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

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

187  {
188  global $ilObjDataCache,$ilLog;
189 
190  $ilLog->write(__METHOD__ . ': Begin cloning session materials ...');
191 
192  include_once('Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
193  $cwo = ilCopyWizardOptions::_getInstance($a_copy_id);
194  $mappings = $cwo->getMappings();
195 
196  $new_items = array();
197  foreach (ilEventItems::_getItemsOfEvent($a_source_id) as $item_id) {
198  if (isset($mappings[$item_id]) and $mappings[$item_id]) {
199  $ilLog->write(__METHOD__ . ': Clone session material nr. ' . $item_id);
200  $new_items[] = $mappings[$item_id];
201  } else {
202  $ilLog->write(__METHOD__ . ': No mapping found for session material nr. ' . $item_id);
203  }
204  }
205  $this->setItems($new_items);
206  $this->update();
207  $ilLog->write(__METHOD__ . ': Finished cloning session materials ...');
208  return true;
209  }
static _getInstance($a_copy_id)
Get instance of copy wizard options.
Create styles array
The data for the language used.
static _getItemsOfEvent($a_event_id)
Get items by event.
+ Here is the call graph for this function:

◆ delete()

ilEventItems::delete ( )

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

References _delete(), and getEventId().

95  {
96  return ilEventItems::_delete($this->getEventId());
97  }
static _delete($a_event_id)
+ Here is the call graph for this function:

◆ getEventId()

ilEventItems::getEventId ( )

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

References $event_id.

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

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

◆ getItems()

ilEventItems::getItems ( )

get assigned items

Returns
array $items Assigned items.

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

References array.

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

71  {
72  return $this->items ? $this->items : array();
73  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ setEventId()

ilEventItems::setEventId (   $a_event_id)

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

62  {
63  $this->event_id = $a_event_id;
64  }

◆ setItems()

ilEventItems::setItems (   $a_items)

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

References array.

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

75  {
76  $this->items = array();
77  foreach ($a_items as $item_id) {
78  $this->items[] = (int) $item_id;
79  }
80  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ update()

ilEventItems::update ( )

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

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

Referenced by cloneItems().

110  {
111  global $ilDB;
112 
113  $this->delete();
114 
115  foreach ($this->items as $item) {
116  $query = "INSERT INTO event_items (event_id,item_id) " .
117  "VALUES( " .
118  $ilDB->quote($this->getEventId(), 'integer') . ", " .
119  $ilDB->quote($item, 'integer') . " " .
120  ")";
121  $res = $ilDB->manipulate($query);
122  }
123  return true;
124  }
foreach($_POST as $key=> $value) $res
$query
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $event_id

ilEventItems::$event_id = null

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

Referenced by getEventId().

◆ $ilDB

ilEventItems::$ilDB

◆ $ilErr

ilEventItems::$ilErr

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

Referenced by __construct().

◆ $items

ilEventItems::$items = array()

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

Referenced by _getItemsOfContainer(), and _getItemsOfEvent().

◆ $lng

ilEventItems::$lng

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

Referenced by __construct().

◆ $tree

ilEventItems::$tree

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

Referenced by __construct(), __read(), and _getItemsOfContainer().


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