ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilSessionOverviewGUI Class Reference
+ Collaboration diagram for ilSessionOverviewGUI:

Public Member Functions

 __construct ($a_crs_ref_id, ilParticipants $a_members)
 constructor More...
 
 executeCommand ()
 ecxecute command More...
 
 listSessions ()
 list sessions of all user More...
 
 exportCSV ()
 Events List CSV Export. More...
 

Protected Attributes

 $course_ref_id = null
 
 $course_id = null
 
 $lng
 
 $tpl
 
 $ctrl
 

Detailed Description

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

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

Constructor & Destructor Documentation

◆ __construct()

ilSessionOverviewGUI::__construct (   $a_crs_ref_id,
ilParticipants  $a_members 
)

constructor

public

Parameters

Definition at line 48 of file class.ilSessionOverviewGUI.php.

References $DIC, $ilCtrl, $lng, $tpl, and ilObject\_lookupObjId().

49  {
50  global $DIC;
51 
52  $tpl = $DIC['tpl'];
53  $ilCtrl = $DIC['ilCtrl'];
54  $lng = $DIC['lng'];
55 
56  $this->ctrl = $ilCtrl;
57  $this->tpl = $tpl;
58  $this->lng = $lng;
59  $this->lng->loadLanguageModule('event');
60  $this->lng->loadLanguageModule('crs');
61 
62  $this->course_ref_id = $a_crs_ref_id;
63  $this->course_id = ilObject::_lookupObjId($this->course_ref_id);
64  $this->members_obj = $a_members;
65  }
global $DIC
Definition: saml.php:7
global $ilCtrl
Definition: ilias.php:18
static _lookupObjId($a_id)
+ Here is the call graph for this function:

Member Function Documentation

◆ executeCommand()

ilSessionOverviewGUI::executeCommand ( )

ecxecute command

public

Parameters

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

75  {
76  $next_class = $this->ctrl->getNextClass($this);
77  $cmd = $this->ctrl->getCmd();
78 
79  switch ($next_class) {
80  default:
81  if (!$cmd) {
82  $cmd = "listSessions";
83  }
84  $this->$cmd();
85  break;
86  }
87  }

◆ exportCSV()

ilSessionOverviewGUI::exportCSV ( )

Events List CSV Export.

public

Parameters

Definition at line 132 of file class.ilSessionOverviewGUI.php.

References $DIC, $events, $GLOBALS, $name, $tree, ilObjUser\_lookupLogin(), ilObjUser\_lookupName(), ilUtil\_sortIds(), ilUtil\deliverData(), ilObjectFactory\getInstanceByRefId(), IL_CAL_FKT_DATE, and IL_CAL_UNIX.

133  {
134  global $DIC;
135 
136  $tree = $DIC['tree'];
137  $ilAccess = $DIC['ilAccess'];
138 
139  include_once('Services/Utilities/classes/class.ilCSVWriter.php');
140  include_once 'Modules/Session/classes/class.ilEventParticipants.php';
141 
142  $part = $GLOBALS['DIC']->access()->filterUserIdsByRbacOrPositionOfCurrentUser(
143  'manage_members',
144  'manage_members',
145  $this->course_ref_id,
146  $this->members_obj->getParticipants()
147  );
148  $members = ilUtil::_sortIds($part, 'usr_data', 'lastname', 'usr_id');
149 
150  $events = array();
151  foreach ($tree->getSubtree($tree->getNodeData($this->course_ref_id), false, 'sess') as $event_id) {
152  $tmp_event = ilObjectFactory::getInstanceByRefId($event_id, false);
153  if (!is_object($tmp_event) or !$ilAccess->checkAccess('manage_members', '', $event_id)) {
154  continue;
155  }
156  $events[] = $tmp_event;
157  }
158 
159  $this->csv = new ilCSVWriter();
160  $this->csv->addColumn($this->lng->txt("lastname"));
161  $this->csv->addColumn($this->lng->txt("firstname"));
162  $this->csv->addColumn($this->lng->txt("login"));
163 
164  foreach ($events as $event_obj) {
165  // TODO: do not export relative dates
166  $this->csv->addColumn($event_obj->getTitle() . ' (' . $event_obj->getFirstAppointment()->appointmentToString() . ')');
167  }
168 
169  $this->csv->addRow();
170 
171  foreach ($members as $user_id) {
172  $name = ilObjUser::_lookupName($user_id);
173 
174  $this->csv->addColumn($name['lastname']);
175  $this->csv->addColumn($name['firstname']);
176  $this->csv->addColumn(ilObjUser::_lookupLogin($user_id));
177 
178  foreach ($events as $event_obj) {
179  $event_part = new ilEventParticipants((int) $event_obj->getId());
180 
181  $this->csv->addColumn($event_part->hasParticipated($user_id) ?
182  $this->lng->txt('event_participated') :
183  $this->lng->txt('event_not_participated'));
184  }
185 
186  $this->csv->addRow();
187  }
188  $date = new ilDate(time(), IL_CAL_UNIX);
189  ilUtil::deliverData($this->csv->getCSVString(), $date->get(IL_CAL_FKT_DATE, 'Y-m-d') . "_course_events.csv", "text/csv");
190  }
static _lookupLogin($a_user_id)
lookup login
static _lookupName($a_user_id)
lookup user name
static deliverData($a_data, $a_filename, $mime="application/octet-stream", $charset="")
deliver data for download via browser.
Helper class to generate CSV files.
global $DIC
Definition: saml.php:7
if($argc< 2) $events
const IL_CAL_UNIX
Class for single dates.
static _sortIds($a_ids, $a_table, $a_field, $a_id_name)
Function that sorts ids by a given table field using WHERE IN E.g: __sort(array(6,7),&#39;usr_data&#39;,&#39;lastname&#39;,&#39;usr_id&#39;) => sorts by lastname.
const IL_CAL_FKT_DATE
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
+ Here is the call graph for this function:

◆ listSessions()

ilSessionOverviewGUI::listSessions ( )

list sessions of all user

public

Parameters

Definition at line 95 of file class.ilSessionOverviewGUI.php.

References $DIC, $GLOBALS, $ilErr, and $tbl.

96  {
97  global $DIC;
98 
99  $ilToolbar = $DIC['ilToolbar'];
100  $ilErr = $DIC['ilErr'];
101 
102  if (!$GLOBALS['DIC']->access()->checkRbacOrPositionPermissionAccess('manage_members', 'manage_members', $this->course_ref_id)) {
103  $ilErr->raiseError($this->lng->txt('msg_no_perm_read'), $ilErr->MESSAGE);
104  }
105 
106  $ilToolbar->addButton(
107  $this->lng->txt('event_csv_export'),
108  $this->ctrl->getLinkTarget($this, 'exportCSV')
109  );
110 
111  include_once 'Modules/Session/classes/class.ilSessionOverviewTableGUI.php';
112 
113  $part = $this->members_obj->getParticipants();
114  $part = $GLOBALS['DIC']->access()->filterUserIdsByRbacOrPositionOfCurrentUser(
115  'manage_members',
116  'manage_members',
117  $this->course_ref_id,
118  $part
119  );
120 
121  $tbl = new ilSessionOverviewTableGUI($this, 'listSessions', $this->course_ref_id, $part);
122  $this->tpl->setContent($tbl->getHTML());
123  }
global $DIC
Definition: saml.php:7
$tbl
Definition: example_048.php:81
Table presentation for session overview.
$ilErr
Definition: raiseError.php:18
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.

Field Documentation

◆ $course_id

ilSessionOverviewGUI::$course_id = null
protected

Definition at line 35 of file class.ilSessionOverviewGUI.php.

◆ $course_ref_id

ilSessionOverviewGUI::$course_ref_id = null
protected

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

◆ $ctrl

ilSessionOverviewGUI::$ctrl
protected

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

◆ $lng

ilSessionOverviewGUI::$lng
protected

Definition at line 37 of file class.ilSessionOverviewGUI.php.

Referenced by __construct().

◆ $tpl

ilSessionOverviewGUI::$tpl
protected

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

Referenced by __construct().


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