ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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

@access public

Parameters

return

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

49 {
50 global $tpl, $ilCtrl, $lng;
51
52 $this->ctrl = $ilCtrl;
53 $this->tpl = $tpl;
54 $this->lng = $lng;
55 $this->lng->loadLanguageModule('event');
56 $this->lng->loadLanguageModule('crs');
57
58 $this->course_ref_id = $a_crs_ref_id;
59 $this->course_id = ilObject::_lookupObjId($this->course_ref_id);
60 $this->members_obj = $a_members;
61 }
static _lookupObjId($a_id)
global $ilCtrl
Definition: ilias.php:18

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

+ Here is the call graph for this function:

Member Function Documentation

◆ executeCommand()

ilSessionOverviewGUI::executeCommand ( )

ecxecute command

@access public

Parameters

return

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

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

◆ exportCSV()

ilSessionOverviewGUI::exportCSV ( )

Events List CSV Export.

@access public

Parameters

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

126 {
127 global $tree,$ilAccess;
128
129 include_once('Services/Utilities/classes/class.ilCSVWriter.php');
130 include_once 'Modules/Session/classes/class.ilEventParticipants.php';
131
132 $part = $GLOBALS['DIC']->access()->filterUserIdsByRbacOrPositionOfCurrentUser(
133 'manage_members',
134 'manage_members',
135 $this->course_ref_id,
136 $this->members_obj->getParticipants()
137 );
138 $members = ilUtil::_sortIds($part, 'usr_data', 'lastname', 'usr_id');
139
140 $events = array();
141 foreach ($tree->getSubtree($tree->getNodeData($this->course_ref_id), false, 'sess') as $event_id) {
142 $tmp_event = ilObjectFactory::getInstanceByRefId($event_id, false);
143 if (!is_object($tmp_event) or !$ilAccess->checkAccess('write', '', $event_id)) {
144 continue;
145 }
146 $events[] = $tmp_event;
147 }
148
149 $this->csv = new ilCSVWriter();
150 $this->csv->addColumn($this->lng->txt("lastname"));
151 $this->csv->addColumn($this->lng->txt("firstname"));
152 $this->csv->addColumn($this->lng->txt("login"));
153
154 foreach ($events as $event_obj) {
155 // TODO: do not export relative dates
156 $this->csv->addColumn($event_obj->getTitle() . ' (' . $event_obj->getFirstAppointment()->appointmentToString() . ')');
157 }
158
159 $this->csv->addRow();
160
161 foreach ($members as $user_id) {
162 $name = ilObjUser::_lookupName($user_id);
163
164 $this->csv->addColumn($name['lastname']);
165 $this->csv->addColumn($name['firstname']);
166 $this->csv->addColumn(ilObjUser::_lookupLogin($user_id));
167
168 foreach ($events as $event_obj) {
169 $event_part = new ilEventParticipants((int) $event_obj->getId());
170
171 $this->csv->addColumn($event_part->hasParticipated($user_id) ?
172 $this->lng->txt('event_participated') :
173 $this->lng->txt('event_not_participated'));
174 }
175
176 $this->csv->addRow();
177 }
178 $date = new ilDate(time(), IL_CAL_UNIX);
179 ilUtil::deliverData($this->csv->getCSVString(), $date->get(IL_CAL_FKT_DATE, 'Y-m-d') . "_course_events.csv", "text/csv");
180 }
const IL_CAL_UNIX
const IL_CAL_FKT_DATE
Helper class to generate CSV files.
Class for single dates.
static _lookupLogin($a_user_id)
lookup login
static _lookupName($a_user_id)
lookup user name
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
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,...
static deliverData($a_data, $a_filename, $mime="application/octet-stream", $charset="")
deliver data for download via browser.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
if($format !==null) $name
Definition: metadata.php:146

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

+ Here is the call graph for this function:

◆ listSessions()

ilSessionOverviewGUI::listSessions ( )

list sessions of all user

@access public

Parameters

return

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

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

References $GLOBALS, $ilErr, and $tbl.

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: