ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
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
 
OverviewTableFactory $overview_table_factory
 

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

Constructor & Destructor Documentation

◆ __construct()

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

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

47 {
48 global $DIC;
49
50 $this->tpl = $DIC->ui()->mainTemplate();
51 $this->ctrl = $DIC->ctrl();
52 $this->lng = $DIC->language();
53 $this->toolbar = $DIC->toolbar();
54 $this->error = $DIC['ilErr'];
55 $this->tree = $DIC->repositoryTree();
56 $this->access = $DIC->access();
57
58 $this->lng->loadLanguageModule('event');
59 $this->lng->loadLanguageModule('crs');
60
61 $this->course_ref_id = $a_crs_ref_id;
62 $this->course_id = ilObject::_lookupObjId($this->course_ref_id);
63 $this->members_obj = $a_members;
64
65 $this->overview_table_factory = new OverviewTableFactory(
66 new DataFactory(),
67 $DIC->ui(),
68 $DIC->language(),
69 $DIC->http(),
70 $DIC->repositoryTree(),
71 $DIC->access()
72 );
73 }
static _lookupObjId(int $ref_id)
global $DIC
Definition: shib_login.php:26

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

+ Here is the call graph for this function:

Member Function Documentation

◆ executeCommand()

ilSessionOverviewGUI::executeCommand ( )

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

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

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ exportCSV()

ilSessionOverviewGUI::exportCSV ( )

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

125 : void
126 {
128 $ilAccess = $this->access;
129
131 'manage_members',
132 'manage_members',
133 $this->course_ref_id,
134 $this->members_obj->getParticipants()
135 );
136
137 $sortedMembers = [];
138 foreach ($part as $user_id) {
140 $sortedMembers[] = [
141 'userid' => (int) $user_id,
142 'firstname' => (string) $name["firstname"],
143 'lastname' => (string) $name['lastname']
144 ];
145 }
146 usort($sortedMembers, function ($a, $b) {
147 return $a['lastname'] <=> $b['lastname'];
148 });
149
150 $events = [];
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) || !$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 ($sortedMembers as $member) {
172 $this->csv->addColumn($member['lastname']);
173 $this->csv->addColumn($member['firstname']);
174 $this->csv->addColumn(ilObjUser::_lookupLogin($member['userid']));
175
176 foreach ($events as $event_obj) {
177 $event_part = new ilEventParticipants($event_obj->getId());
178
179 $this->csv->addColumn($event_part->hasParticipated($member['userid']) ?
180 $this->lng->txt('event_participated') :
181 $this->lng->txt('event_not_participated'));
182 }
183
184 $this->csv->addRow();
185 }
186 $date = new ilDate(time(), IL_CAL_UNIX);
187
189 $this->csv->getCSVString(),
190 $date->get(IL_CAL_FKT_DATE, 'Y-m-d') . "_course_events.csv",
191 "text/csv"
192 );
193 }
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 93 of file class.ilSessionOverviewGUI.php.

94 {
95 $ilToolbar = $this->toolbar;
96 $ilErr = $this->error;
97 $ilAccess = $this->access;
98
99 if (!$ilAccess->checkRbacOrPositionPermissionAccess('manage_members', 'manage_members', $this->course_ref_id)) {
100 $ilErr->raiseError($this->lng->txt('msg_no_perm_read'), $ilErr->MESSAGE);
101 }
102
103 $ilToolbar->addButton(
104 $this->lng->txt('event_csv_export'),
105 $this->ctrl->getLinkTarget($this, 'exportCSV')
106 );
107
108 $part = $this->members_obj->getParticipants();
110 'manage_members',
111 'manage_members',
112 $this->course_ref_id,
113 $part
114 );
115
116 $data_retrieval = $this->overview_table_factory->dataRetrieval(
117 $this->course_ref_id,
118 ...$part
119 );
120 $overview_table = $this->overview_table_factory->handler($data_retrieval);
121
122 $this->tpl->setContent($overview_table->getHTML());
123 }

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

+ Here is the call graph for this function:

Field Documentation

◆ $access

ilAccessHandler ilSessionOverviewGUI::$access
protected

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

Referenced by exportCSV(), and listSessions().

◆ $course_id

int ilSessionOverviewGUI::$course_id = 0
protected

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

◆ $course_ref_id

int ilSessionOverviewGUI::$course_ref_id = 0
protected

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

◆ $csv

ilCSVWriter ilSessionOverviewGUI::$csv
protected

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

◆ $ctrl

ilCtrl ilSessionOverviewGUI::$ctrl
protected

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

◆ $error

ilErrorHandling ilSessionOverviewGUI::$error
protected

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

Referenced by listSessions().

◆ $lng

ilLanguage ilSessionOverviewGUI::$lng
protected

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

◆ $members_obj

ilParticipants ilSessionOverviewGUI::$members_obj
protected

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

◆ $overview_table_factory

OverviewTableFactory ilSessionOverviewGUI::$overview_table_factory
protected

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

◆ $toolbar

ilToolbarGUI ilSessionOverviewGUI::$toolbar
protected

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

Referenced by listSessions().

◆ $tpl

ilGlobalTemplateInterface ilSessionOverviewGUI::$tpl
protected

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

◆ $tree

ilTree ilSessionOverviewGUI::$tree
protected

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

Referenced by exportCSV().


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