ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilSessionOverviewGUI Class Reference
+ Collaboration diagram for ilSessionOverviewGUI:

Public Member Functions

 __construct (int $a_crs_ref_id, ilParticipants $a_members)
 
 executeCommand ()
 
 listSessions ()
 list sessions of all user More...
 
 exportCSV ()
 

Protected Attributes

ilLanguage $lng
 
ilGlobalTemplateInterface $tpl
 
ilCtrl $ctrl
 
ilToolbarGUI $toolbar
 
ilErrorHandling $error
 
ilTree $tree
 
ilAccessHandler $access
 
int $course_ref_id = 0
 
int $course_id = 0
 
ilParticipants $members_obj
 
ilCSVWriter $csv
 

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 28 of file class.ilSessionOverviewGUI.php.

Constructor & Destructor Documentation

◆ __construct()

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

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

43 {
44 global $DIC;
45
46 $this->tpl = $DIC->ui()->mainTemplate();
47 $this->ctrl = $DIC->ctrl();
48 $this->lng = $DIC->language();
49 $this->toolbar = $DIC->toolbar();
50 $this->error = $DIC['ilErr'];
51 $this->tree = $DIC->repositoryTree();
52 $this->access = $DIC->access();
53
54 $this->lng->loadLanguageModule('event');
55 $this->lng->loadLanguageModule('crs');
56
57 $this->course_ref_id = $a_crs_ref_id;
58 $this->course_id = ilObject::_lookupObjId($this->course_ref_id);
59 $this->members_obj = $a_members;
60 }
error(string $a_errmsg)
static _lookupObjId(int $ref_id)
global $DIC
Definition: shib_login.php:26

References $DIC, ilObject\_lookupObjId(), ILIAS\Repository\access(), ILIAS\Repository\ctrl(), error(), ILIAS\Repository\lng(), and ILIAS\Repository\toolbar().

+ Here is the call graph for this function:

Member Function Documentation

◆ executeCommand()

ilSessionOverviewGUI::executeCommand ( )

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

62 : void
63 {
64 $next_class = $this->ctrl->getNextClass($this);
65 $cmd = $this->ctrl->getCmd();
66
67 switch ($next_class) {
68 default:
69 if (!$cmd) {
70 $cmd = "listSessions";
71 }
72 $this->$cmd();
73 break;
74 }
75 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ exportCSV()

ilSessionOverviewGUI::exportCSV ( )

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

107 : void
108 {
110 $ilAccess = $this->access;
111
113 'manage_members',
114 'manage_members',
115 $this->course_ref_id,
116 $this->members_obj->getParticipants()
117 );
118
119 $sortedMembers = [];
120 foreach ($part as $user_id) {
122 $sortedMembers[] = [
123 'userid' => (int) $user_id,
124 'firstname' => (string) $name["firstname"],
125 'lastname' => (string) $name['lastname']
126 ];
127 }
128 usort($sortedMembers, function ($a, $b) {
129 return $a['lastname'] <=> $b['lastname'];
130 });
131
132 $events = [];
133 foreach ($tree->getSubtree($tree->getNodeData($this->course_ref_id), false, ['sess']) as $event_id) {
134 $tmp_event = ilObjectFactory::getInstanceByRefId($event_id, false);
135 if (!is_object($tmp_event) || !$ilAccess->checkAccess('manage_members', '', $event_id)) {
136 continue;
137 }
138 $events[] = $tmp_event;
139 }
140
141 $this->csv = new ilCSVWriter();
142 $this->csv->addColumn($this->lng->txt("lastname"));
143 $this->csv->addColumn($this->lng->txt("firstname"));
144 $this->csv->addColumn($this->lng->txt("login"));
145
146 foreach ($events as $event_obj) {
147 // TODO: do not export relative dates
148 $this->csv->addColumn($event_obj->getTitle() . ' (' . $event_obj->getFirstAppointment()->appointmentToString() . ')');
149 }
150
151 $this->csv->addRow();
152
153 foreach ($sortedMembers as $member) {
154 $this->csv->addColumn($member['lastname']);
155 $this->csv->addColumn($member['firstname']);
156 $this->csv->addColumn(ilObjUser::_lookupLogin($member['userid']));
157
158 foreach ($events as $event_obj) {
159 $event_part = new ilEventParticipants($event_obj->getId());
160
161 $this->csv->addColumn($event_part->hasParticipated($member['userid']) ?
162 $this->lng->txt('event_participated') :
163 $this->lng->txt('event_not_participated'));
164 }
165
166 $this->csv->addRow();
167 }
168 $date = new ilDate(time(), IL_CAL_UNIX);
169
171 $this->csv->getCSVString(),
172 $date->get(IL_CAL_FKT_DATE, 'Y-m-d') . "_course_events.csv",
173 "text/csv"
174 );
175 }
const IL_CAL_UNIX
const IL_CAL_FKT_DATE
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class for single dates.
class ilEventParticipants
static _lookupName(int $a_user_id)
static _lookupLogin(int $a_user_id)
static getInstanceByRefId(int $ref_id, bool $stop_on_error=true)
get an instance of an Ilias object by reference id
getNodeData(int $a_node_id, ?int $a_tree_pk=null)
get all information of a node.
static deliverData(string $a_data, string $a_filename, string $mime="application/octet-stream")
filterUserIdsByRbacOrPositionOfCurrentUser(string $rbac_perm, string $pos_perm, int $ref_id, array $user_ids)
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples

References Vendor\Package\$a, $access, Vendor\Package\$b, $tree, $user_id, ilObjUser\_lookupLogin(), ilObjUser\_lookupName(), ilUtil\deliverData(), ilOrgUnitPositionAndRBACAccessHandler\filterUserIdsByRbacOrPositionOfCurrentUser(), ilObjectFactory\getInstanceByRefId(), ilTree\getNodeData(), IL_CAL_FKT_DATE, IL_CAL_UNIX, ILIAS\Repository\int(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ listSessions()

ilSessionOverviewGUI::listSessions ( )

list sessions of all user

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

81 {
82 $ilToolbar = $this->toolbar;
84 $ilAccess = $this->access;
85
86 if (!$ilAccess->checkRbacOrPositionPermissionAccess('manage_members', 'manage_members', $this->course_ref_id)) {
87 $ilErr->raiseError($this->lng->txt('msg_no_perm_read'), $ilErr->MESSAGE);
88 }
89
90 $ilToolbar->addButton(
91 $this->lng->txt('event_csv_export'),
92 $this->ctrl->getLinkTarget($this, 'exportCSV')
93 );
94
95 $part = $this->members_obj->getParticipants();
96 $part = $ilAccess->filterUserIdsByRbacOrPositionOfCurrentUser(
97 'manage_members',
98 'manage_members',
99 $this->course_ref_id,
100 $part
101 );
102
103 $tbl = new ilSessionOverviewTableGUI($this, 'listSessions', $this->course_ref_id, $part);
104 $this->tpl->setContent($tbl->getHTML());
105 }
Table presentation for session overview.
$ilErr
Definition: raiseError.php:33

References $access, $error, $ilErr, $toolbar, and ILIAS\Repository\lng().

+ Here is the call graph for this function:

Field Documentation

◆ $access

ilAccessHandler ilSessionOverviewGUI::$access
protected

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

Referenced by exportCSV(), and listSessions().

◆ $course_id

int ilSessionOverviewGUI::$course_id = 0
protected

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

◆ $course_ref_id

int ilSessionOverviewGUI::$course_ref_id = 0
protected

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

◆ $csv

ilCSVWriter ilSessionOverviewGUI::$csv
protected

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

◆ $ctrl

ilCtrl ilSessionOverviewGUI::$ctrl
protected

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

◆ $error

ilErrorHandling ilSessionOverviewGUI::$error
protected

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

Referenced by listSessions().

◆ $lng

ilLanguage ilSessionOverviewGUI::$lng
protected

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

◆ $members_obj

ilParticipants ilSessionOverviewGUI::$members_obj
protected

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

◆ $toolbar

ilToolbarGUI ilSessionOverviewGUI::$toolbar
protected

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

Referenced by listSessions().

◆ $tpl

ilGlobalTemplateInterface ilSessionOverviewGUI::$tpl
protected

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

◆ $tree

ilTree ilSessionOverviewGUI::$tree
protected

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

Referenced by exportCSV().


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