ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilUserLPTableGUI.php
Go to the documentation of this file.
1<?php
2
24{
25 protected bool $lp_active = false;
26 protected int $ref_id;
27
28 public function __construct(
29 object $a_parent_obj,
30 string $a_parent_cmd,
31 int $a_ref_id
32 ) {
33 global $DIC;
34
35 $ilCtrl = $DIC['ilCtrl'];
36
37 $this->ref_id = $a_ref_id;
38 $this->setId("admusrlp");
39
40 parent::__construct($a_parent_obj, $a_parent_cmd);
41 // $this->setTitle($this->lng->txt("obj_usr"));
42
43 $this->addColumn($this->lng->txt("login"), "login");
44 $this->addColumn($this->lng->txt("firstname"), "firstname");
45 $this->addColumn($this->lng->txt("lastname"), "lastname");
46 $this->addColumn($this->lng->txt("online_time"), "online_time");
47 $this->addColumn($this->lng->txt("last_login"), "last_login");
48 $this->setExternalSorting(true);
49 $this->setExternalSegmentation(true);
50
51 $this->setFormAction($ilCtrl->getFormAction($this->parent_obj));
52
53 $this->setRowTemplate("tpl.user_list_lp_row.html", "components/ILIAS/User");
54
55 $this->setDefaultOrderField("login");
56 $this->setDefaultOrderDirection("asc");
57
58 $this->setExportFormats([self::EXPORT_EXCEL]);
59
60 $this->getItems();
61 }
62
63 public function getItems(): void
64 {
66
72 null,
73 null,
74 null,
75 null,
76 null,
77 null,
78 null,
79 null,
80 ["online_time"],
81 null,
82 null
83 );
84
85 if (count($usr_data["set"]) == 0 && $this->getOffset() > 0) {
86 $this->resetOffset();
92 null,
93 null,
94 null,
95 null,
96 null,
97 null,
98 null,
99 null,
100 ["online_time"],
101 null,
102 null
103 );
104 }
105
106 $this->setMaxCount($usr_data["cnt"]);
107 $this->setData($usr_data["set"]);
108
110 }
111
117 protected function fillRow(array $a_set): void
118 {
119 global $DIC;
120
121 $ilCtrl = $DIC['ilCtrl'];
122
123 if ($this->lp_active) {
124 $ilCtrl->setParameterByClass("illearningprogressgui", "ref_id", $this->ref_id);
125 $ilCtrl->setParameterByClass("illearningprogressgui", "obj_id", $a_set["usr_id"]);
126 $link = $ilCtrl->getLinkTargetByClass(["ilobjusergui",'illearningprogressgui'], "");
127
128 $this->tpl->setCurrentBlock("login_link");
129 $this->tpl->setVariable("HREF_LOGIN", $link);
130 $this->tpl->setVariable("VAL_LOGIN", $a_set["login"]);
131 } else {
132 $this->tpl->setCurrentBlock("login_plain");
133 $this->tpl->setVariable("VAL_LOGIN_PLAIN", $a_set["login"]);
134 }
135 $this->tpl->parseCurrentBlock();
136
137 $this->tpl->setVariable("VAL_FIRSTNAME", $a_set["firstname"]);
138 $this->tpl->setVariable("VAL_LASTNAME", $a_set["lastname"]);
139 $this->tpl->setVariable(
140 "VAL_ONLINE_TIME",
141 self::secondsToShortString($a_set["online_time"])
142 );
143 $this->tpl->setVariable(
144 "VAL_LAST_LOGIN",
146 );
147 }
148
149 protected function fillRowExcel(ilExcel $a_excel, int &$a_row, array $a_set): void // Missing array type.
150 {
151 $a_excel->setCell($a_row, 0, $a_set["login"]);
152 $a_excel->setCell($a_row, 1, $a_set["firstname"]);
153 $a_excel->setCell($a_row, 2, $a_set["lastname"]);
154 $a_excel->setCell(
155 $a_row,
156 3,
157 self::secondsToShortString($a_set["online_time"])
158 );
159 $a_excel->setCell($a_row, 4, new ilDateTime($a_set["last_login"], IL_CAL_DATETIME));
160 }
161
166 protected static function secondsToShortString(int $seconds): string
167 {
168 $seconds = $seconds ?: 0;
169 $days = floor($seconds / 86400);
170 $rest = $seconds % 86400;
171
172 $hours = floor($rest / 3600);
173 $rest %= 3600;
174
175 $minutes = floor($rest / 60);
176 $rest %= 60;
177
178 return sprintf("%02d:%02d:%02d:%02d", $days, $hours, $minutes, $rest);
179 }
180}
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
setCell(int $a_row, int $col, $value, ?string $datatype=null, bool $disable_strip_tags_for_strings=false)
Set cell value.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
determineOffsetAndOrder(bool $a_omit_offset=false)
setExportFormats(array $formats)
Set available export formats.
setExternalSegmentation(bool $a_val)
setFormAction(string $a_form_action, bool $a_multipart=false)
resetOffset(bool $a_in_determination=false)
addColumn(string $a_text, string $a_sort_field="", string $a_width="", bool $a_is_checkbox_action_column=false, string $a_class="", string $a_tooltip="", bool $a_tooltip_with_html=false)
setDefaultOrderField(string $a_defaultorderfield)
setExternalSorting(bool $a_val)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setId(string $a_val)
setDefaultOrderDirection(string $a_defaultorderdirection)
setData(array $a_data)
Set table data.
setMaxCount(int $a_max_count)
set max.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static secondsToShortString(int $seconds)
converts seconds to string: Long: 7 days 4 hour(s) ...
__construct(object $a_parent_obj, string $a_parent_cmd, int $a_ref_id)
fillRowExcel(ilExcel $a_excel, int &$a_row, array $a_set)
Excel Version of Fill Row.
static getUserListData(string $a_order_field, string $a_order_dir, int $a_offset, int $a_limit, string $a_string_filter="", string $a_activation_filter="", ?ilDateTime $a_last_login_filter=null, bool $a_limited_access_filter=false, bool $a_no_courses_filter=false, int $a_course_group_filter=0, int $a_role_filter=0, ?array $a_user_folder_filter=null, ?array $a_additional_fields=null, ?array $a_user_filter=null, string $a_first_letter="", string $a_authentication_filter="")
Get data for user administration list.
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26