$conditions = array('username' => $keyword); $user_list = UserManager::get_user_list($conditions, array(), false, ' OR '); if (!empty($user_list)) { $extra_search_options = Display::page_subheader(get_lang('UsersFoundInOtherPortals')); $table = new HTML_Table(array('class' => 'data_table')); $column = 0; $row = 0; $headers = array(get_lang('User'), 'URL', get_lang('Actions')); foreach ($headers as $header) { $table->setHeaderContents($row, $column, $header); $column++; } $row++; foreach ($user_list as $user) { $column = 0; $access_info = UrlManager::get_access_url_from_user($user['id']); $access_info_to_string = ''; $add_user = true; if (!empty($access_info)) { foreach ($access_info as $url_info) { if ($current_access_url_id == $url_info['access_url_id']) { $add_user = false; } $access_info_to_string .= $url_info['url'] . '<br />'; } } if ($add_user) { $row_table = array(); $row_table[] = api_get_person_name($user['firstname'], $user['lastname']) . ' (' . $user['username'] . ') '; $row_table[] = $access_info_to_string; $url = api_get_self() . '?action=add_user_to_my_url&user_id=' . $user['id'] . '&sec_token=' . $_SESSION['sec_token'];
$result = TrackingUserLogCSV::getToolInformation($user['user_id'], $courseInfo, 0); $courseToolInformationTotal .= $result['html']; $csvContent = array_merge($csvContent, $result['array']); } $courseInformation = Display::page_subheader(get_lang('Courses')); $courseInformation .= Display::return_sortable_table($header, $data, array(), array(), array('user_id' => intval($_GET['user_id']))); $courseInformation .= $courseToolInformationTotal; } else { $courseInformation = '<p>' . get_lang('NoCoursesForThisUser') . '</p>'; } /** * Show the URL in which this user is subscribed */ $urlInformation = null; if (api_is_multiple_url_enabled()) { $urlList = UrlManager::get_access_url_from_user($user['user_id']); if (count($urlList) > 0) { $header = array(); $header[] = array('URL', true); $data = array(); $csvContent[] = array(); $csvContent[] = array('Url'); foreach ($urlList as $url) { $row = array(); $row[] = Display::url($url['url'], $url['url']); $csvContent[] = array_map('strip_tags', $row); $data[] = $row; } $urlInformation = Display::page_subheader(get_lang('URLList')); $urlInformation .= Display::return_sortable_table($header, $data, array(), array(), array('user_id' => intval($_GET['user_id']))); } else {
function WSGetPortalListFromUser($params) { if (!WSHelperVerifyKey($params['secret_key'])) { return return_error(WS_ERROR_SECRET_KEY); } $userId = $params['user_id']; $result = UrlManager::get_access_url_from_user($userId); if (!empty($result)) { foreach ($result as &$data) { $data['id'] = $data['access_url_id']; } } return $result; }