1<?php 2/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */ 3 4include_once("./Services/Table/classes/class.ilTable2GUI.php"); 5 6/** 7* TableGUI class for user administration 8* 9* @author Alex Killing <alex.killing@gmx.de> 10* @version $Id$ 11* 12* @ilCtrl_Calls ilUserTableGUI: ilFormPropertyDispatchGUI 13* @ingroup ServicesUser 14*/ 15class ilUserTableGUI extends ilTable2GUI 16{ 17 const MODE_USER_FOLDER = 1; 18 const MODE_LOCAL_USER = 2; 19 20 private $mode = null; 21 private $user_folder_id = 0; 22 23 /** 24 * @var array 25 */ 26 protected $udf_fields = array(); 27 28 /** @var array */ 29 protected $filter = array(); 30 31 /** 32 * @var null | \ilLoggerFactory 33 */ 34 private $logger = null; 35 36 /** 37 * Constructor 38 */ 39 public function __construct($a_parent_obj, $a_parent_cmd, $a_mode = self::MODE_USER_FOLDER, $a_load_items = true) 40 { 41 global $DIC; 42 43 $ilCtrl = $DIC->ctrl(); 44 $lng = $DIC->language(); 45 46 $this->logger = $DIC->logger()->usr(); 47 48 $this->user_folder_id = $a_parent_obj->object->getRefId(); 49 50 $this->setMode($a_mode); 51 $this->setId("user" . $this->getUserFolderId()); 52 $this->readUserDefinedFieldsDefinitions(); 53 54 parent::__construct($a_parent_obj, $a_parent_cmd); 55 // $this->setTitle($this->lng->txt("users")); 56 57 $this->addColumn("", "", "1", true); 58 $this->addColumn($this->lng->txt("login"), "login"); 59 60 foreach ($this->getSelectedColumns() as $c) { 61 if ($this->isUdfColumn($c)) { 62 $f = $this->getUserDefinedField($c); 63 $this->addColumn($f["txt"], $f["sortable"] ? $c : ""); 64 } else { // usual column 65 $this->addColumn($this->lng->txt($c), $c); 66 } 67 } 68 69 if ($this->getMode() == self::MODE_LOCAL_USER) { 70 $this->addColumn($this->lng->txt('context'), 'time_limit_owner'); 71 $this->addColumn($this->lng->txt('role_assignment')); 72 } 73 74 $this->setShowRowsSelector(true); 75 $this->setExternalSorting(true); 76 $this->setExternalSegmentation(true); 77 $this->setEnableHeader(true); 78 79 $this->setFormAction($ilCtrl->getFormAction($this->parent_obj, "applyFilter")); 80 $this->setRowTemplate("tpl.user_list_row.html", "Services/User"); 81 //$this->disable("footer"); 82 $this->setEnableTitle(true); 83 $this->initFilter(); 84 $this->setFilterCommand("applyFilter"); 85 $this->setDefaultOrderField("login"); 86 $this->setDefaultOrderDirection("asc"); 87 88 $this->setSelectAllCheckbox("id[]"); 89 $this->setTopCommands(true); 90 91 92 if ($this->getMode() == self::MODE_USER_FOLDER) { 93 $this->setEnableAllCommand(true); 94 95 $cmds = $a_parent_obj->getUserMultiCommands(); 96 foreach ($cmds as $cmd => $caption) { 97 $this->addMultiCommand($cmd, $caption); 98 } 99 } else { 100 $this->addMultiCommand("deleteUsers", $lng->txt("delete")); 101 } 102 103 if ($a_load_items) { 104 $this->getItems(); 105 } 106 } 107 108 protected function setMode($a_mode) 109 { 110 $this->mode = $a_mode; 111 } 112 113 protected function getMode() 114 { 115 return $this->mode; 116 } 117 118 protected function getUserFolderId() 119 { 120 return $this->user_folder_id; 121 } 122 123 /** 124 * Read user defined fields definitions 125 */ 126 public function readUserDefinedFieldsDefinitions() 127 { 128 include_once './Services/User/classes/class.ilUserDefinedFields.php'; 129 $user_defined_fields = ilUserDefinedFields::_getInstance(); 130 foreach ($user_defined_fields->getDefinitions() as $field => $definition) { 131 $this->udf_fields["udf_" . $field] = array( 132 "txt" => $definition["field_name"], 133 "default" => false, 134 "options" => $definition["field_values"], 135 "type" => $definition["field_type"], 136 "sortable" => in_array($definition["field_type"], array(UDF_TYPE_TEXT, UDF_TYPE_SELECT)) 137 ); 138 } 139 } 140 141 /** 142 * Get user defined field 143 * @param string $a_key field key 144 * @return array 145 */ 146 public function getUserDefinedField($a_key) 147 { 148 if (isset($this->udf_fields[$a_key])) { 149 return $this->udf_fields[$a_key]; 150 } 151 return array(); 152 } 153 154 /** 155 * Field key 156 * @param string $a_key field key 157 * @return bool 158 */ 159 public function isUdfColumn($a_key) 160 { 161 if (substr($a_key, 0, 4) == "udf_") { 162 return true; 163 } 164 return false; 165 } 166 167 168 /** 169 * Get selectable columns 170 * 171 * @param 172 * @return 173 */ 174 public function getSelectableColumns() 175 { 176 global $DIC; 177 178 $lng = $DIC['lng']; 179 180 include_once("./Services/User/classes/class.ilUserProfile.php"); 181 $up = new ilUserProfile(); 182 $up->skipGroup("preferences"); 183 $up->skipGroup("interests"); 184 $up->skipGroup("settings"); 185 186 // default fields 187 $cols = array(); 188 189 // first and last name cannot be hidden 190 $cols["firstname"] = array( 191 "txt" => $lng->txt("firstname"), 192 "default" => true); 193 $cols["lastname"] = array( 194 "txt" => $lng->txt("lastname"), 195 "default" => true); 196 if ($this->getMode() == self::MODE_USER_FOLDER) { 197 $ufs = $up->getStandardFields(); 198 199 $cols["access_until"] = array( 200 "txt" => $lng->txt("access_until"), 201 "default" => true); 202 $cols["last_login"] = array( 203 "txt" => $lng->txt("last_login"), 204 "default" => true); 205 206 // #13967 207 $cols["create_date"] = array( 208 "txt" => $lng->txt("create_date")); 209 $cols["approve_date"] = array( 210 "txt" => $lng->txt("approve_date")); 211 $cols["agree_date"] = array( 212 "txt" => $lng->txt("agree_date")); 213 } else { 214 $ufs = $up->getLocalUserAdministrationFields(); 215 } 216 217 // email should be the 1st "optional" field (can be hidden) 218 if (isset($ufs["email"])) { 219 $cols["email"] = array( 220 "txt" => $lng->txt("email"), 221 "default" => true); 222 } 223 if (isset($ufs["second_email"])) { 224 $cols["second_email"] = array( 225 "txt" => $lng->txt("second_email"), 226 "default" => true); 227 } 228 // other user profile fields 229 foreach ($ufs as $f => $fd) { 230 if (!isset($cols[$f]) && !$fd["lists_hide"]) { 231 // #18795 232 $caption = $fd["lang_var"] 233 ? $fd["lang_var"] 234 : $f; 235 $cols[$f] = array( 236 "txt" => $lng->txt($caption), 237 "default" => false); 238 } 239 } 240 241 242 /** 243 * LTI, showing depending by mode user? 244 */ 245 $cols["auth_mode"] = array( 246 "txt" => $lng->txt("auth_mode"), 247 "default" => false); 248 249 250 // custom user fields 251 if ($this->getMode() == self::MODE_USER_FOLDER) { 252 foreach ($this->udf_fields as $k => $field) { 253 $cols[$k] = $field; 254 } 255 } 256 257 // fields that are always shown 258 unset($cols["username"]); 259 260 return $cols; 261 } 262 263 /** 264 * Get user items 265 */ 266 public function getItems() 267 { 268 global $DIC; 269 270 $lng = $DIC['lng']; 271 272 $this->determineOffsetAndOrder(); 273 if ($this->getMode() == self::MODE_USER_FOLDER) { 274 // All accessible users 275 include_once './Services/User/classes/class.ilLocalUser.php'; 276 $user_filter = ilLocalUser::_getFolderIds(true); 277 } else { 278 if ($this->filter['time_limit_owner']) { 279 $user_filter = array($this->filter['time_limit_owner']); 280 } else { 281 // All accessible users 282 include_once './Services/User/classes/class.ilLocalUser.php'; 283 $user_filter = ilLocalUser::_getFolderIds(); 284 } 285 } 286 287 288 289 //#13221 don't show all users if user filter is empty! 290 if (!count($user_filter)) { 291 $this->setMaxCount(0); 292 $this->setData([]); 293 return; 294 } 295 296 if (is_array($this->filter['user_ids']) && !count($this->filter['user_ids'])) { 297 $this->setMaxCount(0); 298 $this->setData([]); 299 return; 300 } 301 302 $additional_fields = $this->getSelectedColumns(); 303 unset($additional_fields["firstname"]); 304 unset($additional_fields["lastname"]); 305 unset($additional_fields["email"]); 306 unset($additional_fields["second_email"]); 307 unset($additional_fields["last_login"]); 308 unset($additional_fields["access_until"]); 309 unset($additional_fields['org_units']); 310 311 $udf_filter = array(); 312 foreach ($this->filter as $k => $v) { 313 if (substr($k, 0, 4) == "udf_") { 314 $udf_filter[$k] = $v; 315 } 316 } 317 318 $query = new ilUserQuery(); 319 $order_field = $this->getOrderField(); 320 if (substr($order_field, 0, 4) != "udf_" || isset($additional_fields[$order_field])) { 321 $query->setOrderField($order_field); 322 $query->setOrderDirection($this->getOrderDirection()); 323 } 324 $query->setOffset($this->getOffset()); 325 $query->setLimit($this->getLimit()); 326 $query->setTextFilter($this->filter['query']); 327 $query->setActionFilter($this->filter['activation']); 328 $query->setLastLogin($this->filter['last_login']); 329 $query->setLimitedAccessFilter($this->filter['limited_access']); 330 $query->setNoCourseFilter($this->filter['no_courses']); 331 $query->setNoGroupFilter($this->filter['no_groups']); 332 $query->setCourseGroupFilter($this->filter['course_group']); 333 $query->setRoleFilter($this->filter['global_role']); 334 $query->setAdditionalFields($additional_fields); 335 $query->setUserFolder($user_filter); 336 $query->setUserFilter($this->filter['user_ids']); 337 $query->setUdfFilter($udf_filter); 338 $query->setFirstLetterLastname(ilUtil::stripSlashes($_GET['letter'])); 339 $query->setAuthenticationFilter($this->filter['authentication']); 340 $usr_data = $query->query(); 341 342 if (count($usr_data["set"]) == 0 && $this->getOffset() > 0) { 343 $this->resetOffset(); 344 $query->setOffset($this->getOffset()); 345 $usr_data = $query->query(); 346 } 347 348 foreach ($usr_data["set"] as $k => $user) { 349 if (in_array('org_units', $this->getSelectedColumns())) { 350 $usr_data['set'][$k]['org_units'] = ilObjUser::lookupOrgUnitsRepresentation($user['usr_id']); 351 } 352 353 354 $current_time = time(); 355 if ($user['active']) { 356 if ($user["time_limit_unlimited"]) { 357 $txt_access = $lng->txt("access_unlimited"); 358 $usr_data["set"][$k]["access_class"] = "smallgreen"; 359 } elseif ($user["time_limit_until"] < $current_time) { 360 $txt_access = $lng->txt("access_expired"); 361 $usr_data["set"][$k]["access_class"] = "smallred"; 362 } else { 363 $txt_access = ilDatePresentation::formatDate(new ilDateTime($user["time_limit_until"], IL_CAL_UNIX)); 364 $usr_data["set"][$k]["access_class"] = "small"; 365 } 366 } else { 367 $txt_access = $lng->txt("inactive"); 368 $usr_data["set"][$k]["access_class"] = "smallred"; 369 } 370 $usr_data["set"][$k]["access_until"] = $txt_access; 371 } 372 373 $this->setMaxCount($usr_data["cnt"]); 374 $this->setData($usr_data["set"]); 375 } 376 377 public function addFilterItemValue($filter, $value) 378 { 379 $this->filter[$filter] = $value; 380 } 381 382 public function getUserIdsForFilter() 383 { 384 if ($this->getMode() == self::MODE_USER_FOLDER) { 385 // All accessible users 386 include_once './Services/User/classes/class.ilLocalUser.php'; 387 $user_filter = ilLocalUser::_getFolderIds(true); 388 } else { 389 if ($this->filter['time_limit_owner']) { 390 $user_filter = array($this->filter['time_limit_owner']); 391 } else { 392 // All accessible users 393 include_once './Services/User/classes/class.ilLocalUser.php'; 394 $user_filter = ilLocalUser::_getFolderIds(); 395 } 396 } 397 398 if (!isset($this->filter['user_ids'])) { 399 $this->filter['user_ids'] = array(); 400 $this->filter['user_ids'] = null; 401 } 402 403 include_once("./Services/User/classes/class.ilUserQuery.php"); 404 $query = new ilUserQuery(); 405 $query->setOffset($this->getOffset()); 406 $query->setLimit($this->getLimit()); 407 408 $query->setTextFilter($this->filter['query']); 409 $query->setActionFilter($this->filter['activation']); 410 $query->setAuthenticationFilter($this->filter['authentication']); 411 $query->setLastLogin($this->filter['last_login']); 412 $query->setLimitedAccessFilter($this->filter['limited_access']); 413 $query->setNoCourseFilter($this->filter['no_courses']); 414 $query->setNoGroupFilter($this->filter['no_groups']); 415 $query->setCourseGroupFilter($this->filter['course_group']); 416 $query->setRoleFilter($this->filter['global_role']); 417 $query->setUserFolder($user_filter); 418 $query->setUserFilter($this->filter['user_ids']); 419 $query->setFirstLetterLastname(ilUtil::stripSlashes($_GET['letter'])); 420 421 if ($this->getOrderField()) { 422 $query->setOrderField(ilUtil::stripSlashes($this->getOrderField())); 423 $query->setOrderDirection(ilUtil::stripSlashes($this->getOrderDirection())); 424 } 425 426 $usr_data = $query->query(); 427 $user_ids = array(); 428 429 foreach ($usr_data["set"] as $item) { 430 // #11632 431 if ($item["usr_id"] != SYSTEM_USER_ID) { 432 $user_ids[] = $item["usr_id"]; 433 } 434 } 435 return $user_ids; 436 } 437 438 439 /** 440 * Init filter 441 */ 442 public function initFilter() 443 { 444 global $DIC; 445 446 $lng = $DIC['lng']; 447 $rbacreview = $DIC['rbacreview']; 448 $ilUser = $DIC['ilUser']; 449 $ilCtrl = $DIC['ilCtrl']; 450 451 452 // Show context filter 453 if ($this->getMode() == self::MODE_LOCAL_USER) { 454 include_once './Services/User/classes/class.ilLocalUser.php'; 455 $parent_ids = ilLocalUser::_getFolderIds(); 456 457 if (count($parent_ids) > 1) { 458 include_once("./Services/Form/classes/class.ilSelectInputGUI.php"); 459 $co = new ilSelectInputGUI($lng->txt('context'), 'time_limit_owner'); 460 461 $ref_id = $this->getUserFolderId(); 462 463 $opt[0] = $this->lng->txt('all_users'); 464 $opt[$this->getUserFolderId()] = $lng->txt('users') . ' (' . ilObject::_lookupTitle(ilObject::_lookupObjId($this->getUserFolderId())) . ')'; 465 466 foreach ($parent_ids as $parent_id) { 467 if ($parent_id == $this->getUserFolderId()) { 468 continue; 469 } 470 switch ($parent_id) { 471 case USER_FOLDER_ID: 472 $opt[USER_FOLDER_ID] = $lng->txt('global_user'); 473 break; 474 475 default: 476 $opt[$parent_id] = $lng->txt('users') . ' (' . ilObject::_lookupTitle(ilObject::_lookupObjId($parent_id)) . ')'; 477 break; 478 } 479 } 480 $co->setOptions($opt); 481 $this->addFilterItem($co); 482 $co->readFromSession(); 483 $this->filter['time_limit_owner'] = $co->getValue(); 484 } 485 } 486 487 // User name, login, email filter 488 include_once("./Services/Form/classes/class.ilTextInputGUI.php"); 489 $ul = new ilTextInputGUI($lng->txt("login") . "/" . $lng->txt("email") . "/" . 490 $lng->txt("name"), "query"); 491 $ul->setDataSource($ilCtrl->getLinkTarget( 492 $this->getParentObject(), 493 "addUserAutoComplete", 494 "", 495 true 496 )); 497 $ul->setSize(20); 498 $ul->setSubmitFormOnEnter(true); 499 $this->addFilterItem($ul); 500 $ul->readFromSession(); 501 $this->filter["query"] = $ul->getValue(); 502 503 /* 504 include_once("./Services/Form/classes/class.ilTextInputGUI.php"); 505 $ti = new ilTextInputGUI($lng->txt("login")."/".$lng->txt("email")."/".$lng->txt("name"), "query"); 506 $ti->setMaxLength(64); 507 $ti->setSize(20); 508 $ti->setSubmitFormOnEnter(true); 509 $this->addFilterItem($ti); 510 $ti->readFromSession(); 511 $this->filter["query"] = $ti->getValue(); 512 */ 513 514 // activation 515 include_once("./Services/Form/classes/class.ilSelectInputGUI.php"); 516 $options = array( 517 "" => $lng->txt("user_all"), 518 "active" => $lng->txt("active"), 519 "inactive" => $lng->txt("inactive"), 520 ); 521 $si = new ilSelectInputGUI($this->lng->txt("user_activation"), "activation"); 522 $si->setOptions($options); 523 $this->addFilterItem($si); 524 $si->readFromSession(); 525 $this->filter["activation"] = $si->getValue(); 526 527 // limited access 528 include_once("./Services/Form/classes/class.ilCheckboxInputGUI.php"); 529 $cb = new ilCheckboxInputGUI($this->lng->txt("user_limited_access"), "limited_access"); 530 $this->addFilterItem($cb); 531 $cb->readFromSession(); 532 $this->filter["limited_access"] = $cb->getChecked(); 533 534 // last login 535 include_once("./Services/Form/classes/class.ilDateTimeInputGUI.php"); 536 $di = new ilDateTimeInputGUI($this->lng->txt("user_last_login_before"), "last_login"); 537 $default_date = new ilDateTime(time(), IL_CAL_UNIX); 538 $default_date->increment(IL_CAL_DAY, 1); 539 $di->setDate($default_date); 540 $this->addFilterItem($di); 541 $di->readFromSession(); 542 $this->filter["last_login"] = $di->getDate(); 543 544 if ($this->getMode() == self::MODE_USER_FOLDER) { 545 // no assigned courses 546 include_once("./Services/Form/classes/class.ilCheckboxInputGUI.php"); 547 $cb = new ilCheckboxInputGUI($this->lng->txt("user_no_courses"), "no_courses"); 548 $this->addFilterItem($cb); 549 $cb->readFromSession(); 550 $this->filter["no_courses"] = $cb->getChecked(); 551 552 // no assigned groups 553 include_once("./Services/Form/classes/class.ilCheckboxInputGUI.php"); 554 $ng = new ilCheckboxInputGUI($this->lng->txt("user_no_groups"), "no_groups"); 555 $this->addFilterItem($ng); 556 $ng->readFromSession(); 557 $this->filter['no_groups'] = $ng->getChecked(); 558 559 // course/group members 560 include_once("./Services/Form/classes/class.ilRepositorySelectorInputGUI.php"); 561 $rs = new ilRepositorySelectorInputGUI($lng->txt("user_member_of_course_group"), "course_group"); 562 $rs->setSelectText($lng->txt("user_select_course_group")); 563 $rs->setHeaderMessage($lng->txt("user_please_select_course_group")); 564 $rs->setClickableTypes(array("crs", "grp")); 565 $this->addFilterItem($rs); 566 $rs->readFromSession(); 567 $this->filter["course_group"] = $rs->getValue(); 568 } 569 570 // global roles 571 $options = array( 572 "" => $lng->txt("user_any"), 573 ); 574 $roles = $rbacreview->getRolesByFilter(2, $ilUser->getId()); 575 foreach ($roles as $role) { 576 $options[$role["rol_id"]] = $role["title"]; 577 } 578 $si = new ilSelectInputGUI($this->lng->txt("user_global_role"), "global_role"); 579 $si->setOptions($options); 580 $this->addFilterItem($si); 581 $si->readFromSession(); 582 $this->filter["global_role"] = $si->getValue(); 583 584 // authentication mode 585 $auth_methods = ilAuthUtils::_getActiveAuthModes(); 586 $options = array( 587 "" => $lng->txt("user_any"), 588 ); 589 foreach ($auth_methods as $method => $value) { 590 if ($method == 'default') { 591 $options[$method] = $this->lng->txt('auth_' . $method) . " (" . $this->lng->txt('auth_' . ilAuthUtils::_getAuthModeName($value)) . ")"; 592 } else { 593 $options[$method] = ilAuthUtils::getAuthModeTranslation($value); 594 } 595 } 596 $si = new ilSelectInputGUI($this->lng->txt("auth_mode"), "authentication_method"); 597 $si->setOptions($options); 598 $this->addFilterItem($si); 599 $si->readFromSession(); 600 $this->filter["authentication"] = $si->getValue(); 601 602 // udf fields 603 foreach ($this->udf_fields as $id => $f) { 604 $this->addFilterItemByUdfType($id, $f["type"], true, $f["txt"], $f["options"]); 605 } 606 } 607 608 /** 609 * Add filter by standard type 610 * 611 * @param string $id 612 * @param int $type 613 * @param bool $a_optional 614 * @param string $caption 615 * @return object 616 */ 617 public function addFilterItemByUdfType($id, $type, $a_optional = false, $caption = null, $a_options = array()) 618 { 619 global $DIC; 620 621 $lng = $DIC['lng']; 622 623 if (!$caption) { 624 $caption = $lng->txt($id); 625 } 626 627 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php"); 628 629 switch ($type) { 630 case UDF_TYPE_SELECT: 631 include_once("./Services/Form/classes/class.ilSelectInputGUI.php"); 632 $item = new ilSelectInputGUI($caption, $id); 633 $sel_options = array("" => $this->lng->txt("user_all")); 634 foreach ($a_options as $o) { 635 $sel_options[$o] = $o; 636 } 637 $item->setOptions($sel_options); 638 break; 639 640 case UDF_TYPE_TEXT: 641 include_once("./Services/Form/classes/class.ilTextInputGUI.php"); 642 $item = new ilTextInputGUI($caption, $id); 643 $item->setMaxLength(64); 644 $item->setSize(20); 645 // $item->setSubmitFormOnEnter(true); 646 break; 647 648 default: 649 return null; 650 } 651 652 if ($item) { 653 $this->addFilterItem($item, $a_optional); 654 $item->readFromSession(); 655 $this->filter[$id] = $item->getValue(); 656 } 657 return $item; 658 } 659 660 /** 661 * Fill table row 662 */ 663 protected function fillRow($user) 664 { 665 global $DIC; 666 667 $ilCtrl = $DIC['ilCtrl']; 668 $lng = $DIC['lng']; 669 670 $ilCtrl->setParameterByClass("ilobjusergui", "letter", $_GET["letter"]); 671 672 foreach ($this->getSelectedColumns() as $c) { 673 if ($c == "access_until") { 674 $this->tpl->setCurrentBlock("access_until"); 675 $this->tpl->setVariable("VAL_ACCESS_UNTIL", $user["access_until"]); 676 $this->tpl->setVariable("CLASS_ACCESS_UNTIL", $user["access_class"]); 677 } elseif ($c == "last_login") { 678 $this->tpl->setCurrentBlock("last_login"); 679 $this->tpl->setVariable( 680 "VAL_LAST_LOGIN", 681 ilDatePresentation::formatDate(new ilDateTime($user['last_login'], IL_CAL_DATETIME)) 682 ); 683 } elseif (in_array($c, array("firstname", "lastname"))) { 684 $this->tpl->setCurrentBlock($c); 685 $this->tpl->setVariable("VAL_" . strtoupper($c), (string) $user[$c]); 686 } elseif ($c == 'auth_mode') { 687 $this->tpl->setCurrentBlock('user_field'); 688 $this->tpl->setVariable('VAL_UF', ilAuthUtils::getAuthModeTranslation(ilAuthUtils::_getAuthMode($user['auth_mode']))); 689 $this->tpl->parseCurrentBlock(); 690 } else { // all other fields 691 $this->tpl->setCurrentBlock("user_field"); 692 $val = (trim($user[$c]) == "") 693 ? " " 694 : $user[$c]; 695 if ($user[$c] != "") { 696 switch ($c) { 697 case "birthday": 698 $val = ilDatePresentation::formatDate(new ilDate($val, IL_CAL_DATE)); 699 break; 700 701 case "gender": 702 $val = $lng->txt("gender_" . $user[$c]); 703 break; 704 705 case "create_date": 706 case "agree_date": 707 case "approve_date": 708 // $val = ilDatePresentation::formatDate(new ilDateTime($val,IL_CAL_DATETIME)); 709 $val = ilDatePresentation::formatDate(new ilDate($val, IL_CAL_DATE)); 710 break; 711 } 712 } 713 $this->tpl->setVariable("VAL_UF", $val); 714 } 715 716 $this->tpl->parseCurrentBlock(); 717 } 718 719 if ($user["usr_id"] != 6) { 720 if ($this->getMode() == self::MODE_USER_FOLDER or $user['time_limit_owner'] == $this->getUserFolderId()) { 721 $this->tpl->setCurrentBlock("checkb"); 722 $this->tpl->setVariable("ID", $user["usr_id"]); 723 $this->tpl->parseCurrentBlock(); 724 } 725 } 726 727 if ($this->getMode() == self::MODE_USER_FOLDER or $user['time_limit_owner'] == $this->getUserFolderId()) { 728 $this->tpl->setVariable("VAL_LOGIN", $user["login"]); 729 $ilCtrl->setParameterByClass("ilobjusergui", "obj_id", $user["usr_id"]); 730 $this->tpl->setVariable( 731 "HREF_LOGIN", 732 $ilCtrl->getLinkTargetByClass("ilobjusergui", "view") 733 ); 734 $ilCtrl->setParameterByClass("ilobjusergui", "obj_id", ""); 735 } else { 736 $this->tpl->setVariable('VAL_LOGIN_PLAIN', $user['login']); 737 } 738 739 if ($this->getMode() == self::MODE_LOCAL_USER) { 740 $this->tpl->setCurrentBlock('context'); 741 $this->tpl->setVariable('VAL_CONTEXT', (string) ilObject::_lookupTitle(ilObject::_lookupObjId($user['time_limit_owner']))); 742 $this->tpl->parseCurrentBlock(); 743 744 $this->tpl->setCurrentBlock('roles'); 745 $ilCtrl->setParameter($this->getParentObject(), 'obj_id', $user['usr_id']); 746 $this->tpl->setVariable('ROLE_LINK', $ilCtrl->getLinkTarget($this->getParentObject(), 'assignRoles')); 747 $this->tpl->setVariable('TXT_ROLES', $this->lng->txt('edit')); 748 $ilCtrl->clearParameters($this->getParentObject()); 749 $this->tpl->parseCurrentBlock(); 750 } 751 } 752} 753