ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
ilSCORMTrackingUsersTableGUI Class Reference

Description of class. More...

+ Collaboration diagram for ilSCORMTrackingUsersTableGUI:

Public Member Functions

 __construct (int $a_obj_id, ?object $a_parent_obj, string $a_parent_cmd)
 
 getObjId ()
 
 parse ()
 Parse table content. More...
 
 handleCommand ()
 
 getFilterHTML ()
 
 getTableHTML ()
 
 getHTML ()
 

Private Member Functions

 getTrackedUserFilters ()
 
 getFilter ()
 

Private Attributes

int $obj_id
 
object $parent_obj
 
string $parent_cmd
 
ilLanguage $lng
 
FilterAdapterGUI $filter = null
 
TableAdapterGUI $table = null
 

Detailed Description

Description of class.

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om \

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

Constructor & Destructor Documentation

◆ __construct()

ilSCORMTrackingUsersTableGUI::__construct ( int  $a_obj_id,
?object  $a_parent_obj,
string  $a_parent_cmd 
)

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

40 {
41 global $DIC;
42 if ($a_parent_obj === null) {
43 throw new ilException('Missing parent object');
44 }
45
46 $this->obj_id = $a_obj_id;
47 $this->parent_obj = $a_parent_obj;
48 $this->parent_cmd = $a_parent_cmd;
49 $this->lng = $DIC->language();
50 }
Base class for ILIAS Exception handling.
global $DIC
Definition: shib_login.php:26

References $DIC, and ILIAS\Repository\lng().

+ Here is the call graph for this function:

Member Function Documentation

◆ getFilter()

ilSCORMTrackingUsersTableGUI::getFilter ( )
private

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

133 {
134 if ($this->filter === null) {
135 $this->filter = new FilterAdapterGUI(
136 'sco_tr_usrs_' . $this->obj_id,
137 [get_class($this->parent_obj)],
138 $this->parent_cmd
139 );
140 $this->filter->text('login_filter', $this->lng->txt('login'));
141 $this->filter->text('firstname_filter', $this->lng->txt('firstname'));
142 $this->filter->text('lastname_filter', $this->lng->txt('lastname'));
143 $this->filter->text('email_filter', $this->lng->txt('email'));
144 }
145 return $this->filter;
146 }
filter(string $filter_id, array $class_path, string $cmd, bool $activated=true, bool $expanded=true)

References $filter, ILIAS\Repository\filter(), and ILIAS\Repository\lng().

Referenced by getFilterHTML(), and getTrackedUserFilters().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getFilterHTML()

ilSCORMTrackingUsersTableGUI::getFilterHTML ( )

Definition at line 153 of file class.ilSCORMTrackingUsersTableGUI.php.

153 : string
154 {
155 return $this->getFilter()->render();
156 }

References getFilter().

Referenced by getHTML().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getHTML()

ilSCORMTrackingUsersTableGUI::getHTML ( )

Definition at line 163 of file class.ilSCORMTrackingUsersTableGUI.php.

References getFilterHTML(), and getTableHTML().

+ Here is the call graph for this function:

◆ getObjId()

ilSCORMTrackingUsersTableGUI::getObjId ( )

Definition at line 52 of file class.ilSCORMTrackingUsersTableGUI.php.

References $obj_id.

◆ getTableHTML()

ilSCORMTrackingUsersTableGUI::getTableHTML ( )

Definition at line 158 of file class.ilSCORMTrackingUsersTableGUI.php.

158 : string
159 {
160 return $this->table?->render() ?? '';
161 }

Referenced by getHTML().

+ Here is the caller graph for this function:

◆ getTrackedUserFilters()

ilSCORMTrackingUsersTableGUI::getTrackedUserFilters ( )
private
Returns
array<string, string>

Definition at line 121 of file class.ilSCORMTrackingUsersTableGUI.php.

121 : array
122 {
123 $filter_data = $this->getFilter()->getData() ?? [];
124 return [
125 'lastname_filter' => trim((string) ($filter_data['lastname_filter'] ?? '')),
126 'firstname_filter' => trim((string) ($filter_data['firstname_filter'] ?? '')),
127 'login_filter' => trim((string) ($filter_data['login_filter'] ?? '')),
128 'email_filter' => trim((string) ($filter_data['email_filter'] ?? '')),
129 ];
130 }

References getFilter().

Referenced by parse().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ handleCommand()

ilSCORMTrackingUsersTableGUI::handleCommand ( )

Definition at line 148 of file class.ilSCORMTrackingUsersTableGUI.php.

148 : bool
149 {
150 return $this->table?->handleCommand() ?? false;
151 }

◆ parse()

ilSCORMTrackingUsersTableGUI::parse ( )

Parse table content.

Exceptions
ilDateTimeException

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

61 : void
62 {
63 global $DIC;
64 $filters = $this->getTrackedUserFilters();
65 $ui_factory = $DIC->ui()->factory();
66
67 $users = $this->parent_obj->getObject()->getTrackedUsers($filters);
68 $attempts = $this->parent_obj->getObject()->getAttemptsForUsers();
69 $versions = $this->parent_obj->getObject()->getModuleVersionForUsers();
70
71 $data = [];
72 foreach ($users as $user) {
73 $tmp = [];
74 $tmp['id'] = (int) $user['user_id'];
75 $tmp['user'] = (int) $user['user_id'];
76 $tmp['name'] = ($user['lastname'] ?? '') . ', ' . ($user['firstname'] ?? '');
77 $tmp['login'] = (string) ($user['login'] ?? '');
78 $tmp['email'] = (string) ($user['email'] ?? '');
79 $dt = new ilDateTime($user['last_access'], IL_CAL_DATETIME);
80 $tmp['last_access'] = $dt->get(IL_CAL_UNIX);
81 $tmp['attempts'] = (int) ($attempts[$user['user_id']] ?? 0);
82 $tmp['version'] = (int) ($versions[$user['user_id']] ?? 0);
83
84 $data[] = $tmp;
85 }
86
87 $this->table = (new TableAdapterGUI(
88 'sco_tr_usrs_' . $this->obj_id,
89 '',
91 $data,
92 ['id', 'user', 'last_access', 'attempts', 'version']
93 ),
94 $this->parent_obj,
95 $this->parent_cmd,
96 '',
97 '',
98 null,
99 static function (array $row): array {
100 $row['last_access'] = ilDatePresentation::formatDate(
101 new ilDateTime((string) $row['last_access'], IL_CAL_UNIX)
102 );
103 return $row;
104 },
105 false
106 ))
107 ->filterData($filters)
108 ->column('login', $ui_factory->table()->column()->text($this->lng->txt('login'))->withIsSortable(true)->withIsOptional(true, false))
109 ->textColumn('name', $this->lng->txt('user'), true)
110 ->column('email', $ui_factory->table()->column()->text($this->lng->txt('email'))->withIsSortable(true)->withIsOptional(true, false))
111 ->textColumn('last_access', $this->lng->txt('last_access'), true)
112 ->textColumn('attempts', $this->lng->txt('attempts'), true)
113 ->textColumn('version', $this->lng->txt('version'), true)
114 ->multiAction('deleteTrackingForUser', $this->lng->txt('delete'))
115 ->multiAction('exportSelectionUsers', $this->lng->txt('export'));
116 }
const IL_CAL_UNIX
const IL_CAL_DATETIME
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
@classDescription Date and time handling
$data
Definition: storeScorm.php:45

References $data, $DIC, ilDatePresentation\formatDate(), getTrackedUserFilters(), IL_CAL_DATETIME, IL_CAL_UNIX, ILIAS\Repository\int(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

Field Documentation

◆ $filter

FilterAdapterGUI ilSCORMTrackingUsersTableGUI::$filter = null
private

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

Referenced by getFilter().

◆ $lng

ilLanguage ilSCORMTrackingUsersTableGUI::$lng
private

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

◆ $obj_id

int ilSCORMTrackingUsersTableGUI::$obj_id
private

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

Referenced by getObjId().

◆ $parent_cmd

string ilSCORMTrackingUsersTableGUI::$parent_cmd
private

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

◆ $parent_obj

object ilSCORMTrackingUsersTableGUI::$parent_obj
private

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

◆ $table

TableAdapterGUI ilSCORMTrackingUsersTableGUI::$table = null
private

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


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