4 include_once(
"./Services/Table/classes/class.ilTable2GUI.php");
34 public function __construct($a_parent_obj, $a_parent_cmd, $a_mode = self::MODE_USER_FOLDER, $a_load_items =
true)
38 $ilCtrl = $DIC->ctrl();
39 $lng = $DIC->language();
41 $this->user_folder_id = $a_parent_obj->object->getRefId();
43 if ($DIC[
'rbacsystem']->checkAccess(
'write', $this->user_folder_id)
44 || $DIC[
'rbacsystem']->checkAccess(
'cat_administrate_users', $this->user_folder_id)) {
45 $this->with_write_access =
true;
56 $this->
addColumn($this->lng->txt(
"login"),
"login");
67 if ($this->
getMode() == self::MODE_LOCAL_USER) {
68 $this->
addColumn($this->lng->txt(
'context'),
'time_limit_owner');
69 $this->
addColumn($this->lng->txt(
'role_assignment'));
77 $this->
setFormAction($ilCtrl->getFormAction($this->parent_obj,
"applyFilter"));
89 if ($this->
getMode() == self::MODE_USER_FOLDER) {
92 $cmds = $a_parent_obj->getUserMultiCommands();
93 foreach ($cmds as $cmd => $caption) {
107 $this->mode = $a_mode;
125 include_once
'./Services/User/classes/class.ilUserDefinedFields.php';
127 foreach ($user_defined_fields->getDefinitions() as $field => $definition) {
128 $this->udf_fields[
"udf_" . $field] = array(
129 "txt" => $definition[
"field_name"],
131 "options" => $definition[
"field_values"],
132 "type" => $definition[
"field_type"],
145 if (isset($this->udf_fields[$a_key])) {
146 return $this->udf_fields[$a_key];
158 if (substr($a_key, 0, 4) ==
"udf_") {
177 include_once(
"./Services/User/classes/class.ilUserProfile.php");
179 $up->skipGroup(
"preferences");
180 $up->skipGroup(
"interests");
181 $up->skipGroup(
"settings");
187 $cols[
"firstname"] = array(
188 "txt" =>
$lng->txt(
"firstname"),
190 $cols[
"lastname"] = array(
191 "txt" =>
$lng->txt(
"lastname"),
193 if ($this->
getMode() == self::MODE_USER_FOLDER) {
194 $ufs = $up->getStandardFields();
196 $cols[
"access_until"] = array(
197 "txt" =>
$lng->txt(
"access_until"),
199 $cols[
"last_login"] = array(
200 "txt" =>
$lng->txt(
"last_login"),
204 $cols[
"create_date"] = array(
205 "txt" =>
$lng->txt(
"create_date"));
206 $cols[
"approve_date"] = array(
207 "txt" =>
$lng->txt(
"approve_date"));
208 $cols[
"agree_date"] = array(
209 "txt" =>
$lng->txt(
"agree_date"));
211 $ufs = $up->getLocalUserAdministrationFields();
215 if (isset($ufs[
"email"])) {
216 $cols[
"email"] = array(
217 "txt" =>
$lng->txt(
"email"),
220 if (isset($ufs[
"second_email"])) {
221 $cols[
"second_email"] = array(
222 "txt" =>
$lng->txt(
"second_email"),
226 foreach ($ufs as
$f => $fd) {
227 if (!isset($cols[
$f]) && !$fd[
"lists_hide"]) {
229 $caption = $fd[
"lang_var"]
233 "txt" =>
$lng->txt($caption),
242 $cols[
"auth_mode"] = array(
243 "txt" =>
$lng->txt(
"auth_mode"),
248 if ($this->
getMode() == self::MODE_USER_FOLDER) {
249 foreach ($this->udf_fields as $k => $field) {
255 unset($cols[
"username"]);
270 if ($this->
getMode() == self::MODE_USER_FOLDER) {
272 include_once
'./Services/User/classes/class.ilLocalUser.php';
275 if ($this->
filter[
'time_limit_owner']) {
276 $user_filter = array($this->
filter[
'time_limit_owner']);
279 include_once
'./Services/User/classes/class.ilLocalUser.php';
287 if (!count($user_filter)) {
293 if (is_array($this->
filter[
'user_ids']) && !count($this->
filter[
'user_ids'])) {
300 unset($additional_fields[
"firstname"]);
301 unset($additional_fields[
"lastname"]);
302 unset($additional_fields[
"email"]);
303 unset($additional_fields[
"second_email"]);
304 unset($additional_fields[
"last_login"]);
305 unset($additional_fields[
"access_until"]);
306 unset($additional_fields[
'org_units']);
308 $udf_filter = array();
309 foreach ($this->
filter as $k => $v) {
310 if (substr($k, 0, 4) ==
"udf_") {
311 $udf_filter[$k] = $v;
317 if (substr($order_field, 0, 4) !=
"udf_" || isset($additional_fields[$order_field])) {
318 $query->setOrderField($order_field);
326 $query->setLimitedAccessFilter($this->
filter[
'limited_access']);
329 $query->setCourseGroupFilter($this->
filter[
'course_group']);
331 $query->setAdditionalFields($additional_fields);
332 $query->setUserFolder($user_filter);
334 $query->setUdfFilter($udf_filter);
336 $query->setAuthenticationFilter($this->
filter[
'authentication']);
337 $usr_data =
$query->query();
339 if (count($usr_data[
"set"]) == 0 && $this->
getOffset() > 0) {
342 $usr_data =
$query->query();
345 foreach ($usr_data[
"set"] as $k => $user) {
351 $current_time = time();
352 if ($user[
'active']) {
353 if ($user[
"time_limit_unlimited"]) {
354 $txt_access =
$lng->txt(
"access_unlimited");
355 $usr_data[
"set"][$k][
"access_class"] =
"smallgreen";
356 } elseif ($user[
"time_limit_until"] < $current_time) {
357 $txt_access =
$lng->txt(
"access_expired");
358 $usr_data[
"set"][$k][
"access_class"] =
"smallred";
361 $usr_data[
"set"][$k][
"access_class"] =
"small";
364 $txt_access =
$lng->txt(
"inactive");
365 $usr_data[
"set"][$k][
"access_class"] =
"smallred";
367 $usr_data[
"set"][$k][
"access_until"] = $txt_access;
371 $this->
setData($usr_data[
"set"]);
381 if ($this->
getMode() == self::MODE_USER_FOLDER) {
383 include_once
'./Services/User/classes/class.ilLocalUser.php';
386 if ($this->
filter[
'time_limit_owner']) {
387 $user_filter = array($this->
filter[
'time_limit_owner']);
390 include_once
'./Services/User/classes/class.ilLocalUser.php';
395 if (!isset($this->
filter[
'user_ids'])) {
396 $this->
filter[
'user_ids'] = array();
397 $this->
filter[
'user_ids'] = null;
400 include_once(
"./Services/User/classes/class.ilUserQuery.php");
407 $query->setAuthenticationFilter($this->
filter[
'authentication']);
409 $query->setLimitedAccessFilter($this->
filter[
'limited_access']);
412 $query->setCourseGroupFilter($this->
filter[
'course_group']);
414 $query->setUserFolder($user_filter);
423 $usr_data =
$query->query();
426 foreach ($usr_data[
"set"] as $item) {
429 $user_ids[] = $item[
"usr_id"];
444 $rbacreview = $DIC[
'rbacreview'];
446 $ilCtrl = $DIC[
'ilCtrl'];
450 if ($this->
getMode() == self::MODE_LOCAL_USER) {
451 include_once
'./Services/User/classes/class.ilLocalUser.php';
454 if (count($parent_ids) > 1) {
455 include_once(
"./Services/Form/classes/class.ilSelectInputGUI.php");
460 $opt[0] = $this->lng->txt(
'all_users');
463 foreach ($parent_ids as $parent_id) {
467 switch ($parent_id) {
477 $co->setOptions($opt);
479 $co->readFromSession();
480 $this->
filter[
'time_limit_owner'] = $co->getValue();
485 include_once(
"./Services/Form/classes/class.ilTextInputGUI.php");
487 $lng->txt(
"name"),
"query");
488 $ul->setDataSource($ilCtrl->getLinkTarget(
489 $this->getParentObject(),
490 "addUserAutoComplete",
495 $ul->setSubmitFormOnEnter(
true);
497 $ul->readFromSession();
498 $this->
filter[
"query"] = $ul->getValue();
501 include_once(
"./Services/Form/classes/class.ilSelectInputGUI.php");
503 "" =>
$lng->txt(
"user_all"),
504 "active" =>
$lng->txt(
"active"),
505 "inactive" =>
$lng->txt(
"inactive"),
508 $si->setOptions($options);
510 $si->readFromSession();
511 $this->
filter[
"activation"] = $si->getValue();
514 include_once(
"./Services/Form/classes/class.ilCheckboxInputGUI.php");
515 $cb =
new ilCheckboxInputGUI($this->lng->txt(
"user_limited_access"),
"limited_access");
517 $cb->readFromSession();
518 $this->
filter[
"limited_access"] = $cb->getChecked();
521 include_once(
"./Services/Form/classes/class.ilDateTimeInputGUI.php");
522 $di =
new ilDateTimeInputGUI($this->lng->txt(
"user_last_login_before"),
"last_login");
527 $di->readFromSession();
528 $this->
filter[
"last_login"] = $di->getDate();
530 if ($this->
getMode() == self::MODE_USER_FOLDER) {
532 include_once(
"./Services/Form/classes/class.ilCheckboxInputGUI.php");
535 $cb->readFromSession();
536 $this->
filter[
"no_courses"] = $cb->getChecked();
539 include_once(
"./Services/Form/classes/class.ilCheckboxInputGUI.php");
542 $ng->readFromSession();
543 $this->
filter[
'no_groups'] = $ng->getChecked();
546 include_once(
"./Services/Form/classes/class.ilRepositorySelectorInputGUI.php");
548 $rs->setSelectText(
$lng->txt(
"user_select_course_group"));
549 $rs->setHeaderMessage(
$lng->txt(
"user_please_select_course_group"));
550 $rs->setClickableTypes(array(
"crs",
"grp"));
552 $rs->readFromSession();
553 $this->
filter[
"course_group"] = $rs->getValue();
558 "" =>
$lng->txt(
"user_any"),
560 $roles = $rbacreview->getRolesByFilter(2,
$ilUser->getId());
561 foreach ($roles as $role) {
562 $options[$role[
"rol_id"]] = $role[
"title"];
564 $si =
new ilSelectInputGUI($this->lng->txt(
"user_global_role"),
"global_role");
565 $si->setOptions($options);
567 $si->readFromSession();
568 $this->
filter[
"global_role"] = $si->getValue();
573 "" =>
$lng->txt(
"user_any"),
575 foreach ($auth_methods as $method => $value) {
576 if ($method ==
'default') {
582 $si =
new ilSelectInputGUI($this->lng->txt(
"auth_mode"),
"authentication_method");
583 $si->setOptions($options);
585 $si->readFromSession();
586 $this->
filter[
"authentication"] = $si->getValue();
589 foreach ($this->udf_fields as $id =>
$f) {
610 $caption =
$lng->txt($id);
613 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
617 include_once(
"./Services/Form/classes/class.ilSelectInputGUI.php");
619 $sel_options = array(
"" => $this->lng->txt(
"user_all"));
620 foreach ($a_options as $o) {
621 $sel_options[$o] = $o;
623 $item->setOptions($sel_options);
627 include_once(
"./Services/Form/classes/class.ilTextInputGUI.php");
629 $item->setMaxLength(64);
640 $item->readFromSession();
641 $this->
filter[$id] = $item->getValue();
653 $ilCtrl = $DIC[
'ilCtrl'];
656 $ilCtrl->setParameterByClass(
"ilobjusergui",
"letter",
$_GET[
"letter"]);
659 if ($c ==
"access_until") {
660 $this->tpl->setCurrentBlock(
"access_until");
661 $this->tpl->setVariable(
"VAL_ACCESS_UNTIL", $user[
"access_until"]);
662 $this->tpl->setVariable(
"CLASS_ACCESS_UNTIL", $user[
"access_class"]);
663 } elseif ($c ==
"last_login") {
664 $this->tpl->setCurrentBlock(
"last_login");
665 $this->tpl->setVariable(
669 } elseif (in_array($c, array(
"firstname",
"lastname"))) {
670 $this->tpl->setCurrentBlock($c);
671 $this->tpl->setVariable(
"VAL_" . strtoupper($c), (
string) $user[$c]);
672 } elseif ($c ==
'auth_mode') {
673 $this->tpl->setCurrentBlock(
'user_field');
675 $this->tpl->parseCurrentBlock();
677 $this->tpl->setCurrentBlock(
"user_field");
678 $val = (trim($user[$c]) ==
"")
681 if ($user[$c] !=
"") {
688 $val =
$lng->txt(
"gender_" . $user[$c]);
699 $this->tpl->setVariable(
"VAL_UF", $val);
702 $this->tpl->parseCurrentBlock();
705 if ($user[
"usr_id"] != 6
706 && ($this->
getMode() == self::MODE_USER_FOLDER || $user[
'time_limit_owner'] == $this->
getUserFolderId())) {
707 $this->tpl->setCurrentBlock(
"checkb");
708 $this->tpl->setVariable(
"ID", $user[
"usr_id"]);
709 $this->tpl->parseCurrentBlock();
712 if ($this->with_write_access
713 && ($this->
getMode() == self::MODE_USER_FOLDER
715 $this->tpl->setVariable(
"VAL_LOGIN", $user[
"login"]);
716 $ilCtrl->setParameterByClass(
"ilobjusergui",
"obj_id", $user[
"usr_id"]);
717 $this->tpl->setVariable(
719 $ilCtrl->getLinkTargetByClass(
"ilobjusergui",
"view")
721 $ilCtrl->setParameterByClass(
"ilobjusergui",
"obj_id",
"");
723 $this->tpl->setVariable(
'VAL_LOGIN_PLAIN', $user[
'login']);
726 if ($this->
getMode() == self::MODE_LOCAL_USER) {
727 $this->tpl->setCurrentBlock(
'context');
729 $this->tpl->parseCurrentBlock();
731 $this->tpl->setCurrentBlock(
'roles');
732 $ilCtrl->setParameter($this->
getParentObject(),
'obj_id', $user[
'usr_id']);
733 $this->tpl->setVariable(
'ROLE_LINK', $ilCtrl->getLinkTarget($this->getParentObject(),
'assignRoles'));
734 $this->tpl->setVariable(
'TXT_ROLES', $this->lng->txt(
'edit'));
736 $this->tpl->parseCurrentBlock();
getUserDefinedField($a_key)
Get user defined field.
setExternalSorting($a_val)
Set external sorting.
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
static _getInstance()
Get instance.
addFilterItemValue($filter, $value)
const SYSTEM_USER_ID
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setExternalSegmentation($a_val)
Set external segmentation.
resetOffset($a_in_determination=false)
Reset offset.
getSelectableColumns()
Get selectable columns.
addFilterItem($a_input_item, $a_optional=false)
Add filter item.
static _lookupTitle($a_id)
lookup object title
static _getActiveAuthModes()
static getAuthModeTranslation($a_auth_key, $auth_name='')
getOrderDirection()
Get order direction.
static _getAuthMode($a_auth_mode, $a_db_handler='')
static _getAuthModeName($a_auth_key)
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
getParentObject()
Get parent object.
setDefaultOrderDirection($a_defaultorderdirection)
Set Default order direction.
static lookupOrgUnitsRepresentation($a_usr_id)
lokup org unit representation
TableGUI class for user administration.
static _getFolderIds($access_with_orgunit=false)
setTopCommands($a_val)
Set top commands (display command buttons on top of table, too)
readUserDefinedFieldsDefinitions()
Read user defined fields definitions.
setSelectAllCheckbox($a_select_all_checkbox, $a_select_all_on_top=false)
Set the name of the checkbox that should be toggled with a select all button.
static _lookupObjId($a_id)
addMultiCommand($a_cmd, $a_text)
Add Command button.
getSelectedColumns()
Get selected columns.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
setEnableAllCommand($a_value)
Enable actions for all entries in current result.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
isUdfColumn($a_key)
Field key.
determineOffsetAndOrder($a_omit_offset=false)
Determine offset and order.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
__construct($a_parent_obj, $a_parent_cmd, $a_mode=self::MODE_USER_FOLDER, $a_load_items=true)
Constructor.
fillRow($user)
Fill table row.
__construct(Container $dic, ilPlugin $plugin)
addColumn( $a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="", $a_tooltip_with_html=false)
Add a column to the header.
setShowRowsSelector($a_value)
Toggle rows-per-page selector.
setEnableHeader($a_enableheader)
Set Enable Header.
setMaxCount($a_max_count)
set max.
setEnableTitle($a_enabletitle)
Set Enable Title.
getItems()
Get user items.
addFilterItemByUdfType($id, $type, $a_optional=false, $caption=null, $a_options=array())
Add filter by standard type.
setFilterCommand($a_val, $a_caption=null)
Set filter command.