/** * Get user items */ function getItems() { global $lng, $rbacreview; $this->determineOffsetAndOrder(); include_once "./Services/User/classes/class.ilUserQuery.php"; $usr_data = ilUserQuery::getUserListData(ilUtil::stripSlashes($this->getOrderField()), ilUtil::stripSlashes($this->getOrderDirection()), ilUtil::stripSlashes($this->getOffset()), ilUtil::stripSlashes($this->getLimit()), '', '', null, false, false, 0, $this->getRoleId()); if ($rbacreview->isAssigned(SYSTEM_USER_ID, $this->getRoleId())) { $this->setMaxCount($usr_data["cnt"] - 1); } else { $this->setMaxCount($usr_data["cnt"]); } $this->setData($usr_data["set"]); }
function getItems() { $this->determineOffsetAndOrder(); include_once "./Services/User/classes/class.ilUserQuery.php"; $usr_data = ilUserQuery::getUserListData(ilUtil::stripSlashes($this->getOrderField()), ilUtil::stripSlashes($this->getOrderDirection()), ilUtil::stripSlashes($this->getOffset()), ilUtil::stripSlashes($this->getLimit()), null, null, null, null, null, null, null, null, array("online_time"), null, null); if (count($usr_data["set"]) == 0 && $this->getOffset() > 0) { $this->resetOffset(); $usr_data = ilUserQuery::getUserListData(ilUtil::stripSlashes($this->getOrderField()), ilUtil::stripSlashes($this->getOrderDirection()), ilUtil::stripSlashes($this->getOffset()), ilUtil::stripSlashes($this->getLimit()), null, null, null, null, null, null, null, null, array("online_time"), null, null); } $this->setMaxCount($usr_data["cnt"]); $this->setData($usr_data["set"]); include_once 'Services/Tracking/classes/class.ilObjUserTracking.php'; $this->lp_active = ilObjUserTracking::_enabledLearningProgress(); }
/** * Parse data * @return * * @global ilRbacReview $rbacreview */ public function parse() { global $rbacreview; $this->determineOffsetAndOrder(); include_once './Services/User/classes/class.ilUserQuery.php'; $additional_fields = $this->getSelectedColumns(); unset($additional_fields["firstname"]); unset($additional_fields["lastname"]); unset($additional_fields["last_login"]); unset($additional_fields["access_until"]); unset($additional_fields['consultation_hour']); unset($additional_fields['prtf']); $udf_ids = $usr_data_fields = $odf_ids = array(); foreach ($additional_fields as $field) { if (substr($field, 0, 3) == 'udf') { $udf_ids[] = substr($field, 4); continue; } if (substr($field, 0, 3) == 'odf') { $odf_ids[] = substr($field, 4); continue; } $usr_data_fields[] = $field; } $usr_data = ilUserQuery::getUserListData($this->getOrderField(), $this->getOrderDirection(), $this->getOffset(), $this->getLimit(), '', '', null, false, false, 0, $this->getRoleId(), null, $usr_data_fields, $part); foreach ((array) $usr_data['set'] as $user) { $usr_ids[] = $user['usr_id']; } // merge course data $course_user_data = $this->getParentObject()->readMemberData($usr_ids, $this->type == 'admin', $this->getSelectedColumns()); $a_user_data = array(); foreach ((array) $usr_data['set'] as $ud) { $a_user_data[$ud['usr_id']] = array_merge($ud, $course_user_data[$ud['usr_id']]); if ($this->show_lp_status_sync) { // #9912 / #13208 $passed_info = ""; if ($a_user_data[$ud['usr_id']]["passed_info"]) { $pinfo = $a_user_data[$ud['usr_id']]["passed_info"]; if ($pinfo["user_id"]) { if ($pinfo["user_id"] < 0) { $passed_info = $this->lng->txt("crs_passed_status_system"); } else { if ($pinfo["user_id"] > 0) { $name = ilObjUser::_lookupName($pinfo["user_id"]); $passed_info = $this->lng->txt("crs_passed_status_manual_by") . ": " . $name["login"]; } } } if ($pinfo["timestamp"]) { $passed_info .= "<br />" . ilDatePresentation::formatDate($pinfo["timestamp"]); } } $a_user_data[$ud['usr_id']]["passed_info"] = $passed_info; } } // Custom user data fields if ($udf_ids) { include_once './Services/User/classes/class.ilUserDefinedData.php'; $data = ilUserDefinedData::lookupData($usr_ids, $udf_ids); foreach ($data as $usr_id => $fields) { if (!$this->checkAcceptance($usr_id)) { continue; } foreach ($fields as $field_id => $value) { $a_user_data[$usr_id]['udf_' . $field_id] = $value; } } } // Object specific user data fields if ($odf_ids) { include_once './Modules/Course/classes/Export/class.ilCourseUserData.php'; $data = ilCourseUserData::_getValuesByObjId($this->getParentObject()->object->getId()); foreach ($data as $usr_id => $fields) { // #7264: as we get data for all course members filter against user data if (!$this->checkAcceptance($usr_id) || !in_array($usr_id, $usr_ids)) { continue; } foreach ($fields as $field_id => $value) { $a_user_data[$usr_id]['odf_' . $field_id] = $value; } } // add last edit date include_once './Services/Membership/classes/class.ilObjectCustomUserFieldHistory.php'; foreach (ilObjectCustomUserFieldHistory::lookupEntriesByObjectId($this->getParentObject()->object->getId()) as $usr_id => $edit_info) { if (!isset($a_user_data[$usr_id])) { continue; } include_once './Services/PrivacySecurity/classes/class.ilPrivacySettings.php'; if ($usr_id == $edit_info['update_user']) { $a_user_data[$usr_id]['odf_last_update'] = ''; $a_user_data[$usr_id]['odf_info_txt'] = $GLOBALS['lng']->txt('cdf_edited_by_self'); if (ilPrivacySettings::_getInstance()->enabledAccessTimesByType($this->getParentObject()->object->getType())) { $a_user_data[$usr_id]['odf_last_update'] .= '_' . $edit_info['editing_time']->get(IL_CAL_UNIX); $a_user_data[$usr_id]['odf_info_txt'] .= ', ' . ilDatePresentation::formatDate($edit_info['editing_time']); } } else { $a_user_data[$usr_id]['odf_last_update'] = $edit_info['update_user']; $a_user_data[$usr_id]['odf_last_update'] .= '_' . $edit_info['editing_time']->get(IL_CAL_UNIX); $name = ilObjUser::_lookupName($edit_info['update_user']); $a_user_data[$usr_id]['odf_info_txt'] = $name['firstname'] . ' ' . $name['lastname'] . ', ' . ilDatePresentation::formatDate($edit_info['editing_time']); } } } foreach ($usr_data['set'] as $user) { // Check acceptance if (!$this->checkAcceptance($user['usr_id'])) { continue; } // DONE: accepted foreach ($usr_data_fields as $field) { $a_user_data[$user['usr_id']][$field] = $user[$field] ? $user[$field] : ''; } } // consultation hours if ($this->isColumnSelected('consultation_hour')) { include_once './Services/Booking/classes/class.ilBookingEntry.php'; foreach (ilBookingEntry::lookupManagedBookingsForObject($this->getParentObject()->object->getId(), $GLOBALS['ilUser']->getId()) as $buser => $booking) { if (isset($a_user_data[$buser])) { $a_user_data[$buser]['consultation_hour'] = $booking[0]['dt']; $a_user_data[$buser]['consultation_hour_end'] = $booking[0]['dtend']; $a_user_data[$buser]['consultation_hours'] = $booking; } } } $this->setMaxCount($usr_data['cnt'] ? $usr_data['cnt'] : 0); return $this->setData($a_user_data); }
/** * Parse data * @return * * @global ilRbacReview $rbacreview */ public function parse() { global $rbacreview; $this->determineOffsetAndOrder(); include_once './Services/User/classes/class.ilUserQuery.php'; $additional_fields = $this->getSelectedColumns(); unset($additional_fields["firstname"]); unset($additional_fields["lastname"]); unset($additional_fields["last_login"]); unset($additional_fields["access_until"]); $udf_ids = $usr_data_fields = $odf_ids = array(); foreach ($additional_fields as $field) { if (substr($field, 0, 3) == 'udf') { $udf_ids[] = substr($field, 4); continue; } if (substr($field, 0, 3) == 'odf') { $odf_ids[] = substr($field, 4); continue; } $usr_data_fields[] = $field; } $usr_data = ilUserQuery::getUserListData($this->getOrderField(), $this->getOrderDirection(), $this->getOffset(), $this->getLimit(), '', '', null, false, false, 0, $this->getRoleId(), null, $usr_data_fields, $part); foreach ((array) $usr_data['set'] as $user) { $usr_ids[] = $user['usr_id']; } // merge course data $course_user_data = $this->getParentObject()->readMemberData($usr_ids, $this->type == 'admin'); $a_user_data = array(); foreach ((array) $usr_data['set'] as $ud) { $a_user_data[$ud['usr_id']] = array_merge($ud, $course_user_data[$ud['usr_id']]); if ($this->show_lp_status_sync) { // #9912 $passed_info = ""; if ($a_user_data[$ud['usr_id']]["passed_info"]["user_id"]) { $pinfo = $a_user_data[$ud['usr_id']]["passed_info"]; if ($pinfo["user_id"] < 0) { $passed_info = "LP"; } else { $name = ilObjUser::_lookupName($pinfo["user_id"]); $passed_info = $name["login"]; $passed_info .= "<br />" . ilDatePresentation::formatDate($pinfo["timestamp"]); } } $a_user_data[$ud['usr_id']]["passed_info"] = $passed_info; } } // Custom user data fields if ($udf_ids) { include_once './Services/User/classes/class.ilUserDefinedData.php'; $data = ilUserDefinedData::lookupData($usr_ids, $udf_ids); foreach ($data as $usr_id => $fields) { if (!$this->checkAcceptance($usr_id)) { continue; } foreach ($fields as $field_id => $value) { $a_user_data[$usr_id]['udf_' . $field_id] = $value; } } } // Object specific user data fields if ($odf_ids) { include_once './Modules/Course/classes/Export/class.ilCourseUserData.php'; $data = ilCourseUserData::_getValuesByObjId($this->getParentObject()->object->getId()); foreach ($data as $usr_id => $fields) { // #7264: as we get data for all course members filter against user data if (!$this->checkAcceptance($usr_id) || !in_array($usr_id, $usr_ids)) { continue; } foreach ($fields as $field_id => $value) { $a_user_data[$usr_id]['odf_' . $field_id] = $value; } } } foreach ($usr_data['set'] as $user) { // Check acceptance if (!$this->checkAcceptance($user['usr_id'])) { continue; } // DONE: accepted foreach ($usr_data_fields as $field) { $a_user_data[$user['usr_id']][$field] = $user[$field] ? $user[$field] : ''; } } $this->setMaxCount($usr_data['cnt'] ? $usr_data['cnt'] : 0); return $this->setData($a_user_data); }
/** * read data * * @access protected * @param * @return */ public function readSubscriberData() { include_once './Services/Membership/classes/class.ilParticipants.php'; $sub_data = ilParticipants::lookupSubscribersData($this->getParentObject()->object->getId()); $sub_ids = array(); foreach ($sub_data as $usr_id => $usr_data) { $sub_ids[] = $usr_id; } $this->determineOffsetAndOrder(); include_once './Services/User/classes/class.ilUserQuery.php'; $additional_fields = $this->getSelectedColumns(); unset($additional_fields["firstname"]); unset($additional_fields["lastname"]); unset($additional_fields["last_login"]); unset($additional_fields["access_until"]); $udf_ids = $usr_data_fields = $odf_ids = array(); foreach ($additional_fields as $field) { if (substr($field, 0, 3) == 'udf') { $udf_ids[] = substr($field, 4); continue; } if (substr($field, 0, 3) == 'odf') { $odf_ids[] = substr($field, 4); continue; } $usr_data_fields[] = $field; } $usr_data = ilUserQuery::getUserListData($this->getOrderField(), $this->getOrderDirection(), $this->getOffset(), $this->getLimit(), '', '', null, false, false, 0, 0, null, $usr_data_fields, $sub_ids); foreach ((array) $usr_data['set'] as $user) { $usr_ids[] = $user['usr_id']; } // merge course data $course_user_data = $this->getParentObject()->readMemberData($usr_ids, $this->type == 'admin'); $a_user_data = array(); foreach ((array) $usr_data['set'] as $ud) { $a_user_data[$ud['usr_id']] = array_merge($ud, (array) $course_user_data[$ud['usr_id']]); } // Custom user data fields if ($udf_ids) { include_once './Services/User/classes/class.ilUserDefinedData.php'; $data = ilUserDefinedData::lookupData($usr_ids, $udf_ids); foreach ($data as $usr_id => $fields) { if (!$this->checkAcceptance($usr_id)) { continue; } foreach ($fields as $field_id => $value) { $a_user_data[$usr_id]['udf_' . $field_id] = $value; } } } // Object specific user data fields if ($odf_ids) { include_once './Modules/Course/classes/Export/class.ilCourseUserData.php'; $data = ilCourseUserData::_getValuesByObjId($this->getParentObject()->object->getId()); foreach ($data as $usr_id => $fields) { // #7264: as we get data for all course members filter against user data if (!$this->checkAcceptance($usr_id) || !in_array($usr_id, $usr_ids)) { continue; } foreach ($fields as $field_id => $value) { $a_user_data[$usr_id]['odf_' . $field_id] = $value; } } // add last edit date include_once './Services/Membership/classes/class.ilObjectCustomUserFieldHistory.php'; foreach (ilObjectCustomUserFieldHistory::lookupEntriesByObjectId($this->getParentObject()->object->getId()) as $usr_id => $edit_info) { if (!isset($a_user_data[$usr_id])) { continue; } include_once './Services/PrivacySecurity/classes/class.ilPrivacySettings.php'; if ($usr_id == $edit_info['update_user']) { $a_user_data[$usr_id]['odf_last_update'] = ''; $a_user_data[$usr_id]['odf_info_txt'] = $GLOBALS['lng']->txt('cdf_edited_by_self'); if (ilPrivacySettings::_getInstance()->enabledAccessTimesByType($this->getParentObject()->object->getType())) { $a_user_data[$usr_id]['odf_last_update'] .= '_' . $edit_info['editing_time']->get(IL_CAL_UNIX); $a_user_data[$usr_id]['odf_info_txt'] .= ', ' . ilDatePresentation::formatDate($edit_info['editing_time']); } } else { $a_user_data[$usr_id]['odf_last_update'] = $edit_info['update_user']; $a_user_data[$usr_id]['odf_last_update'] .= '_' . $edit_info['editing_time']->get(IL_CAL_UNIX); $name = ilObjUser::_lookupName($edit_info['update_user']); $a_user_data[$usr_id]['odf_info_txt'] = $name['firstname'] . ' ' . $name['lastname'] . ', ' . ilDatePresentation::formatDate($edit_info['editing_time']); } } } foreach ($usr_data['set'] as $user) { // Check acceptance if (!$this->checkAcceptance($user['usr_id'])) { continue; } // DONE: accepted foreach ($usr_data_fields as $field) { $a_user_data[$user['usr_id']][$field] = $user[$field] ? $user[$field] : ''; } } // Waiting list subscription foreach ($sub_data as $usr_id => $usr_data) { if (!in_array($usr_id, $usr_ids)) { continue; } $a_user_data[$usr_id]['sub_time'] = $usr_data['time']; $a_user_data[$usr_id]['subject'] = $usr_data['subject']; } $this->setMaxCount(count($sub_ids)); return $this->setData($a_user_data); }
/** * Get data for user administration list. * @deprecated */ public static function getUserListData($a_order_field, $a_order_dir, $a_offset, $a_limit, $a_string_filter = "", $a_activation_filter = "", $a_last_login_filter = null, $a_limited_access_filter = false, $a_no_courses_filter = false, $a_course_group_filter = 0, $a_role_filter = 0, $a_user_folder_filter = null, $a_additional_fields = '', $a_user_filter = null, $a_first_letter = "") { $query = new ilUserQuery(); $query->setOrderField($a_order_field); $query->setOrderDirection($a_order_dir); $query->setOffset($a_offset); $query->setLimit($a_limit); $query->setTextFilter($a_string_filter); $query->setActionFilter($a_activation_filter); $query->setLastLogin($a_last_login_filter); $query->setLimitedAccessFilter($a_limited_access_filter); $query->setNoCourseFilter($a_no_courses_filter); $query->setCourseGroupFilter($a_course_group_filter); $query->setRoleFilter($a_role_filter); $query->setUserFolder($a_user_folder_filter); $query->setAdditionalFields($a_additional_fields); $query->setUserFilter($a_user_filter); $query->setFirstLetterLastname($a_first_letter); return $query->query(); }
/** * Parse user data * @param array $a_user_data * @return */ public function parse($a_user_data) { include_once './Services/User/classes/class.ilUserQuery.php'; $additional_fields = $this->getSelectedColumns(); unset($additional_fields["firstname"]); unset($additional_fields["lastname"]); unset($additional_fields["last_login"]); unset($additional_fields["access_until"]); switch ($this->type) { case 'admin': $part = ilGroupParticipants::_getInstanceByObjId($this->getParentObject()->object->getId())->getAdmins(); break; case 'member': $part = ilGroupParticipants::_getInstanceByObjId($this->getParentObject()->object->getId())->getMembers(); break; } $udf_ids = $usr_data_fields = $odf_ids = array(); foreach ($additional_fields as $field) { if (substr($field, 0, 3) == 'udf') { $udf_ids[] = substr($field, 4); continue; } if (substr($field, 0, 3) == 'odf') { $odf_ids[] = substr($field, 4); continue; } $usr_data_fields[] = $field; } $usr_data = ilUserQuery::getUserListData('login', 'ASC', 0, 9999, '', '', null, false, false, 0, 0, null, $usr_data_fields, $part); // Custom user data fields if ($udf_ids) { include_once './Services/User/classes/class.ilUserDefinedData.php'; $data = ilUserDefinedData::lookupData($part, $udf_ids); foreach ($data as $usr_id => $fields) { if (!$this->checkAcceptance($usr_id)) { continue; } foreach ($fields as $field_id => $value) { $a_user_data[$usr_id]['udf_' . $field_id] = $value; } } } // Object specific user data fields if ($odf_ids) { include_once './Modules/Course/classes/Export/class.ilCourseUserData.php'; $data = ilCourseUserData::_getValuesByObjId($this->getParentObject()->object->getId()); foreach ($data as $usr_id => $fields) { if (!$this->checkAcceptance($usr_id)) { continue; } foreach ($fields as $field_id => $value) { if ($a_user_data[$usr_id]) { $a_user_data[$usr_id]['odf_' . $field_id] = $value; } } } } foreach ($usr_data['set'] as $user) { // Check acceptance if (!$this->checkAcceptance($user['usr_id'])) { continue; } // DONE: accepted foreach ($usr_data_fields as $field) { $a_user_data[$user['usr_id']][$field] = $user[$field] ? $user[$field] : ''; } } return $this->setData($a_user_data); }
/** * Parse user data * @param array $a_user_data * @return */ public function parse($part) { include_once './Services/User/classes/class.ilUserQuery.php'; $usr_data = ilUserQuery::getUserListData('login', 'ASC', 0, 9999, '', '', null, false, false, 0, 0, null, array(), $part); $locked = ilViteroLockedUser::getLockedAccounts($this->getVGroupId()); $users = array(); foreach ((array) $usr_data['set'] as $key => $usr) { if (in_array($usr['usr_id'], (array) $locked)) { $usr['locked'] = 1; } else { $usr['locked'] = 0; } $users[] = $usr; } return $this->setData((array) $users); }
public function getUserIdsForFilter() { if ($this->getMode() == self::MODE_USER_FOLDER) { // All accessible users include_once './Services/User/classes/class.ilLocalUser.php'; $user_filter = ilLocalUser::_getFolderIds(); } else { if ($this->filter['time_limit_owner']) { $user_filter = array($this->filter['time_limit_owner']); } else { // All accessible users include_once './Services/User/classes/class.ilLocalUser.php'; $user_filter = ilLocalUser::_getFolderIds(); } } include_once "./Services/User/classes/class.ilUserQuery.php"; $query = new ilUserQuery(); $query->setOffset(0); $query->setLimit(self::getAllCommandLimit()); $query->setTextFilter($this->filter['query']); $query->setActionFilter($this->filter['activation']); $query->setLastLogin($this->filter['last_login']); $query->setLimitedAccessFilter($this->filter['limited_access']); $query->setNoCourseFilter($this->filter['no_courses']); $query->setNoGroupFilter($this->filter['no_groups']); $query->setCourseGroupFilter($this->filter['course_group']); $query->setRoleFilter($this->filter['global_role']); $query->setUserFolder($user_filter); $query->setFirstLetterLastname(ilUtil::stripSlashes($_GET['letter'])); if ($this->getOrderField()) { $query->setOrderField(ilUtil::stripSlashes($this->getOrderField())); $query->setOrderDirection(ilUtil::stripSlashes($this->getOrderDirection())); } $usr_data = $query->query(); $user_ids = array(); foreach ($usr_data["set"] as $item) { // #11632 if ($item["usr_id"] != SYSTEM_USER_ID) { $user_ids[] = $item["usr_id"]; } } return $user_ids; }
/** * Parse user data * @param array $a_user_data * @return */ public function parse($a_user_data) { include_once './Services/User/classes/class.ilUserQuery.php'; $additional_fields = $this->getSelectedColumns(); unset($additional_fields["firstname"]); unset($additional_fields["lastname"]); unset($additional_fields["last_login"]); unset($additional_fields["access_until"]); unset($additional_fields['consultation_hour']); unset($additional_fields['prtf']); switch ($this->type) { case 'admin': $part = ilGroupParticipants::_getInstanceByObjId($this->getParentObject()->object->getId())->getAdmins(); break; case 'member': $part = $GLOBALS['rbacreview']->assignedUsers($this->getRole()); break; case 'role': $part = $GLOBALS['rbacreview']->assignedUsers($this->getRole()); break; } $udf_ids = $usr_data_fields = $odf_ids = array(); foreach ($additional_fields as $field) { if (substr($field, 0, 3) == 'udf') { $udf_ids[] = substr($field, 4); continue; } if (substr($field, 0, 3) == 'odf') { $odf_ids[] = substr($field, 4); continue; } $usr_data_fields[] = $field; } $usr_data = ilUserQuery::getUserListData('login', 'ASC', 0, 9999, '', '', null, false, false, 0, 0, null, $usr_data_fields, $part); // Custom user data fields if ($udf_ids) { include_once './Services/User/classes/class.ilUserDefinedData.php'; $data = ilUserDefinedData::lookupData($part, $udf_ids); foreach ($data as $usr_id => $fields) { if (!$this->checkAcceptance($usr_id)) { continue; } foreach ($fields as $field_id => $value) { $a_user_data[$usr_id]['udf_' . $field_id] = $value; } } } // Object specific user data fields if ($odf_ids) { include_once './Modules/Course/classes/Export/class.ilCourseUserData.php'; $data = ilCourseUserData::_getValuesByObjId($this->getParentObject()->object->getId()); foreach ($data as $usr_id => $fields) { if (!$this->checkAcceptance($usr_id)) { continue; } foreach ($fields as $field_id => $value) { if ($a_user_data[$usr_id]) { $a_user_data[$usr_id]['odf_' . $field_id] = $value; } } } } foreach ($usr_data['set'] as $user) { // Check acceptance if (!$this->checkAcceptance($user['usr_id'])) { continue; } // DONE: accepted foreach ($usr_data_fields as $field) { $a_user_data[$user['usr_id']][$field] = $user[$field] ? $user[$field] : ''; } } // consultation hours if ($this->isColumnSelected('consultation_hour')) { include_once './Services/Booking/classes/class.ilBookingEntry.php'; foreach (ilBookingEntry::lookupManagedBookingsForObject($this->getParentObject()->object->getId(), $GLOBALS['ilUser']->getId()) as $buser => $booking) { if (isset($a_user_data[$buser])) { $a_user_data[$buser]['consultation_hour'] = $booking[0]['dt']; $a_user_data[$buser]['consultation_hour_end'] = $booking[0]['dtend']; $a_user_data[$buser]['consultation_hours'] = $booking; } } } return $this->setData($a_user_data); }
/** * Parse user data * @return * @param array $a_user_ids */ public function parseUserIds($a_user_ids) { if (!$a_user_ids) { $this->setData(array()); return true; } $additional_fields = $this->getSelectedColumns(); $parse_access = false; if (isset($additional_fields['access_until'])) { $parse_access = true; unset($additional_fields['access_until']); } $udf_ids = $usr_data_fields = $odf_ids = array(); foreach ($additional_fields as $field) { if (substr($field, 0, 3) == 'udf') { $udf_ids[] = substr($field, 4); continue; } $usr_data_fields[] = $field; } include_once './Services/User/classes/class.ilUserQuery.php'; $usr_data = ilUserQuery::getUserListData('login', 'ASC', 0, 999999, '', '', null, false, false, 0, 0, null, $usr_data_fields, $a_user_ids); if ($this->admin_mode && $parse_access) { // see ilUserTableGUI $current_time = time(); foreach ($usr_data['set'] as $k => $user) { if ($user['active']) { if ($user["time_limit_unlimited"]) { $txt_access = $this->lng->txt("access_unlimited"); $usr_data["set"][$k]["access_class"] = "smallgreen"; } elseif ($user["time_limit_until"] < $current_time) { $txt_access = $this->lng->txt("access_expired"); $usr_data["set"][$k]["access_class"] = "smallred"; } else { $txt_access = ilDatePresentation::formatDate(new ilDateTime($user["time_limit_until"], IL_CAL_UNIX)); $usr_data["set"][$k]["access_class"] = "small"; } } else { $txt_access = $this->lng->txt("inactive"); $usr_data["set"][$k]["access_class"] = "smallred"; } $usr_data["set"][$k]["access_until"] = $txt_access; } } // Custom user data fields if ($udf_ids) { include_once './Services/User/classes/class.ilUserDefinedData.php'; $data = ilUserDefinedData::lookupData($a_user_ids, $udf_ids); $users = array(); $counter = 0; foreach ($usr_data['set'] as $set) { $users[$counter] = $set; foreach ($udf_ids as $udf_field) { $users[$counter]['udf_' . $udf_field] = $data[$set['usr_id']][$udf_field]; } ++$counter; } } else { $users = $usr_data['set']; } if ($this->getType() == self::TYPE_GLOBAL_SEARCH) { if ($this->getLuceneResult() instanceof ilLuceneSearchResult) { foreach ($users as $counter => $ud) { $users[$counter]['relevance'] = $this->getLuceneResult()->getRelevance($ud['usr_id']); } } } $this->setData($users); }
/** * Parse user data * @param array $a_user_data * @return */ public function parse($a_user_data) { include_once './Services/User/classes/class.ilUserQuery.php'; $additional_fields = $this->getSelectedColumns(); unset($additional_fields["firstname"]); unset($additional_fields["lastname"]); unset($additional_fields["last_login"]); unset($additional_fields["access_until"]); unset($additional_fields['consultation_hour']); unset($additional_fields['prtf']); switch ($this->type) { case 'admin': $part = ilGroupParticipants::_getInstanceByObjId($this->getParentObject()->object->getId())->getAdmins(); break; case 'member': $part = $GLOBALS['rbacreview']->assignedUsers($this->getRole()); break; case 'role': $part = $GLOBALS['rbacreview']->assignedUsers($this->getRole()); break; } $udf_ids = $usr_data_fields = $odf_ids = array(); foreach ($additional_fields as $field) { if (substr($field, 0, 3) == 'udf') { $udf_ids[] = substr($field, 4); continue; } if (substr($field, 0, 3) == 'odf') { $odf_ids[] = substr($field, 4); continue; } $usr_data_fields[] = $field; } $usr_data = ilUserQuery::getUserListData('login', 'ASC', 0, 9999, '', '', null, false, false, 0, 0, null, $usr_data_fields, $part); // Custom user data fields if ($udf_ids) { include_once './Services/User/classes/class.ilUserDefinedData.php'; $data = ilUserDefinedData::lookupData($part, $udf_ids); foreach ($data as $usr_id => $fields) { if (!$this->checkAcceptance($usr_id)) { continue; } foreach ($fields as $field_id => $value) { $a_user_data[$usr_id]['udf_' . $field_id] = $value; } } } // Object specific user data fields if ($odf_ids) { include_once './Modules/Course/classes/Export/class.ilCourseUserData.php'; $data = ilCourseUserData::_getValuesByObjId($this->getParentObject()->object->getId()); foreach ($data as $usr_id => $fields) { if (!$this->checkAcceptance($usr_id)) { continue; } foreach ($fields as $field_id => $value) { if ($a_user_data[$usr_id]) { $a_user_data[$usr_id]['odf_' . $field_id] = $value; } } } // add last edit date include_once './Services/Membership/classes/class.ilObjectCustomUserFieldHistory.php'; foreach (ilObjectCustomUserFieldHistory::lookupEntriesByObjectId($this->getParentObject()->object->getId()) as $usr_id => $edit_info) { if (!isset($a_user_data[$usr_id])) { continue; } include_once './Services/PrivacySecurity/classes/class.ilPrivacySettings.php'; if ($usr_id == $edit_info['update_user']) { $a_user_data[$usr_id]['odf_last_update'] = ''; $a_user_data[$usr_id]['odf_info_txt'] = $GLOBALS['lng']->txt('cdf_edited_by_self'); if (ilPrivacySettings::_getInstance()->enabledAccessTimesByType($this->getParentObject()->object->getType())) { $a_user_data[$usr_id]['odf_last_update'] .= '_' . $edit_info['editing_time']->get(IL_CAL_UNIX); $a_user_data[$usr_id]['odf_info_txt'] .= ', ' . ilDatePresentation::formatDate($edit_info['editing_time']); } } else { $a_user_data[$usr_id]['odf_last_update'] = $edit_info['edit_user']; $a_user_data[$usr_id]['odf_last_update'] .= '_' . $edit_info['editing_time']->get(IL_CAL_UNIX); $name = ilObjUser::_lookupName($edit_info['update_user']); $a_user_data[$usr_id]['odf_info_txt'] = $name['firstname'] . ' ' . $name['lastname'] . ', ' . ilDatePresentation::formatDate($edit_info['editing_time']); } } } foreach ($usr_data['set'] as $user) { // Check acceptance if (!$this->checkAcceptance($user['usr_id'])) { continue; } // DONE: accepted foreach ($usr_data_fields as $field) { $a_user_data[$user['usr_id']][$field] = $user[$field] ? $user[$field] : ''; } } // consultation hours if ($this->isColumnSelected('consultation_hour')) { include_once './Services/Booking/classes/class.ilBookingEntry.php'; foreach (ilBookingEntry::lookupManagedBookingsForObject($this->getParentObject()->object->getId(), $GLOBALS['ilUser']->getId()) as $buser => $booking) { if (isset($a_user_data[$buser])) { $a_user_data[$buser]['consultation_hour'] = $booking[0]['dt']; $a_user_data[$buser]['consultation_hour_end'] = $booking[0]['dtend']; $a_user_data[$buser]['consultation_hours'] = $booking; } } } return $this->setData($a_user_data); }
public function getUserIdsForFilter() { if ($this->getMode() == self::MODE_USER_FOLDER) { // All accessible users include_once './Services/User/classes/class.ilLocalUser.php'; $user_filter = ilLocalUser::_getFolderIds(); } else { if ($this->filter['time_limit_owner']) { $user_filter = array($this->filter['time_limit_owner']); } else { // All accessible users include_once './Services/User/classes/class.ilLocalUser.php'; $user_filter = ilLocalUser::_getFolderIds(); } } include_once "./Services/User/classes/class.ilUserQuery.php"; $usr_data = ilUserQuery::getUserListData(ilUtil::stripSlashes($this->getOrderField()), ilUtil::stripSlashes($this->getOrderDirection()), 0, self::getAllCommandLimit(), $this->filter["query"], $this->filter["activation"], $this->filter["last_login"], $this->filter["limited_access"], $this->filter["no_courses"], $this->filter["course_group"], $this->filter["global_role"], $user_filter, null, null, ilUtil::stripSlashes($_GET["letter"])); $user_ids = array(); foreach ($usr_data["set"] as $item) { $user_ids[] = $item["usr_id"]; } return $user_ids; }