本文整理汇总了PHP中UserManager::get_user_picture_path_by_id方法的典型用法代码示例。如果您正苦于以下问题:PHP UserManager::get_user_picture_path_by_id方法的具体用法?PHP UserManager::get_user_picture_path_by_id怎么用?PHP UserManager::get_user_picture_path_by_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserManager
的用法示例。
在下文中一共展示了UserManager::get_user_picture_path_by_id方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUserImageBlock
/**
* Returns an HTML block with the user picture (as a link in a <div>)
* @param int User ID (if not provided, will use the user ID from session)
* @return string HTML div with a link to the user's profile
* @uses UserManager::get_user_pictur_path_by_id() to get the image path
* @uses UserManager::get_picture_user() to get the details of the image in a specific format
* @uses PageController::show_right_block() to include the image in a larger user block
* @assert (-1) === false
*/
public function setUserImageBlock($user_id = null)
{
if (empty($user_id)) {
$user_id = api_get_user_id();
}
//Always show the user image
$img_array = UserManager::get_user_picture_path_by_id($user_id, 'web', true, true);
$no_image = false;
if ($img_array['file'] == 'unknown.jpg') {
$no_image = true;
}
$img_array = UserManager::get_picture_user($user_id, $img_array['file'], 100, USER_IMAGE_SIZE_ORIGINAL);
$profile_content = null;
if (api_get_setting('allow_social_tool') == 'true') {
if (!$no_image) {
$profile_content .= '<a style="text-align:center" href="' . api_get_path(WEB_CODE_PATH) . 'social/home.php">
<img src="' . $img_array['file'] . '"></a>';
} else {
$profile_content .= '<a style="text-align:center" href="' . api_get_path(WEB_CODE_PATH) . 'auth/profile.php">
<img title="' . get_lang('EditProfile') . '" src="' . $img_array['file'] . '"></a>';
}
}
if (!empty($profile_content)) {
$this->show_right_block(null, null, 'user_image_block', array('content' => $profile_content));
}
}
示例2: get_link_user_picture
public function get_link_user_picture($username, $password, $id)
{
if ($this->verifyUserPass($username, $password) == "valid") {
$userPic = UserManager::get_user_picture_path_by_id($id, "web");
if (empty($userPic['file'])) {
return "0";
}
return $userPic['dir'] . $userPic['file'];
}
return "0";
}
示例3: getConfiguration
/**
* {@inheritdoc}
*/
public function getConfiguration()
{
if ($this->connector->security->isGranted('IS_AUTHENTICATED_FULLY')) {
$userId = $this->connector->user->getUserId();
if (!empty($userId)) {
// Adding user personal files
$dir = \UserManager::get_user_picture_path_by_id($userId, 'system');
$dirWeb = \UserManager::get_user_picture_path_by_id($userId, 'web');
$driver = array('driver' => 'PersonalDriver', 'alias' => $this->connector->translator->trans('MyFiles'), 'path' => $dir['dir'] . 'my_files', 'URL' => $dirWeb['dir'] . 'my_files', 'accessControl' => array($this, 'access'));
return $driver;
}
}
}
示例4: check_certificate_path
/**
* Checks if the certificate user path directory is created
*/
public function check_certificate_path()
{
$this->certification_user_path = null;
//Setting certification path
$path_info = UserManager::get_user_picture_path_by_id($this->user_id, 'system');
$web_path_info = UserManager::get_user_picture_path_by_id($this->user_id, 'web');
if (!empty($path_info) && isset($path_info['dir'])) {
$this->certification_user_path = $path_info['dir'] . 'certificate/';
$this->certification_web_user_path = $web_path_info['dir'] . 'certificate/';
if (!is_dir($path_info['dir'])) {
mkdir($path_info['dir'], 0777, true);
}
if (!is_dir($this->certification_user_path)) {
mkdir($this->certification_user_path, 0777);
}
}
}
示例5: display_message_for_group
/**
* Displays messages of a group with nested view
* @param $group_id
* @param $topic_id
* @param $is_member
* @param $message_id
* @return string
*/
public static function display_message_for_group($group_id, $topic_id, $is_member, $message_id)
{
global $my_group_role;
$main_message = self::get_message_by_id($topic_id);
if (empty($main_message)) {
return false;
}
$rows = self::get_messages_by_group_by_message($group_id, $topic_id);
$rows = self::calculate_children($rows, $topic_id);
$current_user_id = api_get_user_id();
$items_per_page = 50;
$query_vars = array('id' => $group_id, 'topic_id' => $topic_id, 'topics_page_nr' => 0);
// Main message
$user_link = '';
$links = '';
$main_content = '';
$items_page_nr = null;
$html = '';
$delete_button = '';
if (api_is_platform_admin()) {
$delete_button = Display::url(Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL), 'group_topics.php?action=delete&id=' . $group_id . '&topic_id=' . $topic_id);
}
$html .= Display::page_subheader(Security::remove_XSS($main_message['title'] . $delete_button, STUDENT, true));
$user_sender_info = UserManager::get_user_info_by_id($main_message['user_sender_id']);
$files_attachments = self::get_links_message_attachment_files($main_message['id']);
$name = api_get_person_name($user_sender_info['firstname'], $user_sender_info['lastname']);
$topic_page_nr = isset($_GET['topics_page_nr']) ? intval($_GET['topics_page_nr']) : null;
$links .= '<div id="message-reply-link">';
if ($my_group_role == GROUP_USER_PERMISSION_ADMIN || $my_group_role == GROUP_USER_PERMISSION_MODERATOR || $main_message['user_sender_id'] == $current_user_id) {
$links .= '<a href="' . api_get_path(WEB_CODE_PATH) . 'social/message_for_group_form.inc.php?view_panel=1&height=390&width=610&&user_friend=' . $current_user_id . '&group_id=' . $group_id . '&message_id=' . $main_message['id'] . '&action=edit_message_group&anchor_topic=topic_' . $main_message['id'] . '&topics_page_nr=' . $topic_page_nr . '&items_page_nr=' . $items_page_nr . '&topic_id=' . $main_message['id'] . '" class="group_message_popup" title="' . get_lang('Edit') . '">';
$links .= Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL) . '</a>';
}
$links .= ' <a href="' . api_get_path(WEB_CODE_PATH) . 'social/message_for_group_form.inc.php?view_panel=1&height=390&width=610&&user_friend=' . api_get_user_id() . '&group_id=' . $group_id . '&message_id=' . $main_message['id'] . '&action=reply_message_group&anchor_topic=topic_' . $main_message['id'] . '&topics_page_nr=' . $topic_page_nr . '&items_page_nr=' . $items_page_nr . '&topic_id=' . $main_message['id'] . '" class="group_message_popup" title="' . get_lang('Reply') . '">';
$links .= Display::return_icon('talk.png', get_lang('Reply')) . '</a>';
$links .= '</div>';
$image_path = UserManager::get_user_picture_path_by_id($main_message['user_sender_id'], 'web', false, true);
$image_repository = $image_path['dir'];
$existing_image = $image_path['file'];
$main_content .= '<div class="message-group-author"><img src="' . $image_repository . $existing_image . '" alt="' . $name . '" width="32" height="32" title="' . $name . '" /></div>';
$user_link = '<a href="' . api_get_path(WEB_PATH) . 'main/social/profile.php?u=' . $main_message['user_sender_id'] . '">' . $name . ' </a>';
$date = '';
if ($main_message['send_date'] != $main_message['update_date']) {
if (!empty($main_message['update_date']) && $main_message['update_date'] != '0000-00-00 00:00:00') {
$date = '<div class="message-group-date"> ' . get_lang('LastUpdate') . ' ' . date_to_str_ago($main_message['update_date']) . '</div>';
}
} else {
$date = '<div class="message-group-date"> ' . get_lang('Created') . ' ' . date_to_str_ago($main_message['send_date']) . '</div>';
}
$attachment = '<div class="message-attach">' . (!empty($files_attachments) ? implode('<br />', $files_attachments) : '') . '</div>';
$main_content .= '<div class="message-group-content">' . $links . $user_link . ' ' . $date . $main_message['content'] . $attachment . '</div>';
$main_content = Security::remove_XSS($main_content, STUDENT, true);
$html .= Display::div(Display::div(Display::div($main_content, array('class' => 'group_social_sub_item', 'style' => 'background-color:#fff;')), array('class' => 'group_social_item')), array('class' => 'group_social_grid'));
$topic_id = $main_message['id'];
if (is_array($rows) && count($rows) > 0) {
$topics = $rows;
$array_html_items = array();
foreach ($topics as $index => $topic) {
if (empty($topic['id'])) {
continue;
}
$items_page_nr = isset($_GET['items_' . $topic['id'] . '_page_nr']) ? intval($_GET['items_' . $topic['id'] . '_page_nr']) : null;
$user_link = '';
$links = '';
$html_items = '';
$user_sender_info = UserManager::get_user_info_by_id($topic['user_sender_id']);
$files_attachments = self::get_links_message_attachment_files($topic['id']);
$name = api_get_person_name($user_sender_info['firstname'], $user_sender_info['lastname']);
$links .= '<div id="message-reply-link">';
if ($my_group_role == GROUP_USER_PERMISSION_ADMIN || $my_group_role == GROUP_USER_PERMISSION_MODERATOR || $topic['user_sender_id'] == $current_user_id) {
$links .= '<a href="' . api_get_path(WEB_CODE_PATH) . 'social/message_for_group_form.inc.php?view_panel=1&height=390&width=610&&user_friend=' . $current_user_id . '&group_id=' . $group_id . '&message_id=' . $topic['id'] . '&action=edit_message_group&anchor_topic=topic_' . $topic_id . '&topics_page_nr=' . $topic_page_nr . '&items_page_nr=' . $items_page_nr . '&topic_id=' . $topic_id . '" class="group_message_popup" title="' . get_lang('Edit') . '">' . Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL) . '</a>';
}
$links .= ' <a href="' . api_get_path(WEB_CODE_PATH) . 'social/message_for_group_form.inc.php?view_panel=1&height=390&width=610&&user_friend=' . api_get_user_id() . '&group_id=' . $group_id . '&message_id=' . $topic['id'] . '&action=reply_message_group&anchor_topic=topic_' . $topic_id . '&topics_page_nr=' . $topic_page_nr . '&items_page_nr=' . $items_page_nr . '&topic_id=' . $topic_id . '" class="group_message_popup" title="' . get_lang('Reply') . '">';
$links .= Display::return_icon('talk.png', get_lang('Reply')) . '</a>';
$links .= '</div>';
$image_path = UserManager::get_user_picture_path_by_id($topic['user_sender_id'], 'web', false, true);
$image_repository = $image_path['dir'];
$existing_image = $image_path['file'];
$html_items .= '<div class="message-group-author"><img src="' . $image_repository . $existing_image . '" alt="' . $name . '" width="32" height="32" title="' . $name . '" /></div>';
$user_link = '<a href="' . api_get_path(WEB_PATH) . 'main/social/profile.php?u=' . $topic['user_sender_id'] . '">' . $name . ' </a>';
$date = '';
if ($topic['send_date'] != $topic['update_date']) {
if (!empty($topic['update_date']) && $topic['update_date'] != '0000-00-00 00:00:00') {
$date = '<div class="message-group-date"> ' . get_lang('LastUpdate') . ' ' . date_to_str_ago($topic['update_date']) . '</div>';
}
} else {
$date = '<div class="message-group-date"> ' . get_lang('Created') . ' ' . date_to_str_ago($topic['send_date']) . '</div>';
}
$attachment = '<div class="message-attach">' . (!empty($files_attachments) ? implode('<br />', $files_attachments) : '') . '</div>';
$html_items .= '<div class="message-group-content">' . $links . $user_link . ' ' . $date . Security::remove_XSS($topic['content'], STUDENT, true) . $attachment . '</div>';
$base_padding = 20;
if ($topic['indent_cnt'] == 0) {
$indent = $base_padding;
//.........这里部分代码省略.........
示例6: basename
/* DISPLAY */
if ($to_group_id != 0) {
// Add group name after for group documents
$add_group_to_title = ' (' . $group_properties['name'] . ')';
}
/* Introduction section (editable by course admins) */
if (!empty($_SESSION['_gid'])) {
Display::display_introduction_section(TOOL_DOCUMENT . $_SESSION['_gid']);
} else {
Display::display_introduction_section(TOOL_DOCUMENT);
}
// ACTION MENU
// Copy a file to general my files user's
if (isset($_GET['action']) && $_GET['action'] == 'copytomyfiles' && api_get_setting('users_copy_files') == 'true' && api_get_user_id() != 0) {
$clean_get_id = Security::remove_XSS($_GET['id']);
$my_path = UserManager::get_user_picture_path_by_id(api_get_user_id(), 'system');
$user_folder = $my_path['dir'] . 'my_files/';
$my_path = null;
if (!file_exists($user_folder)) {
$perm = api_get_permissions_for_new_directories();
@mkdir($user_folder, $perm, true);
}
$file = $sys_course_path . $_course['path'] . '/document' . $clean_get_id;
$copyfile = $user_folder . basename($clean_get_id);
if (file_exists($copyfile)) {
$message = get_lang('CopyAlreadyDone') . '</p><p>' . '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&curdirpath=' . $curdirpath . '">' . get_lang("No") . '</a> | <a href="' . api_get_self() . '?' . api_get_cidreq() . '&curdirpath=' . $curdirpath . '&action=copytomyfiles&id=' . $clean_get_id . '&copy=yes">' . get_lang('Yes') . '</a></p>';
if (!isset($_GET['copy'])) {
Display::display_warning_message($message, false);
}
if (Security::remove_XSS($_GET['copy']) == 'yes') {
if (!copy($file, $copyfile)) {
示例7: array
// cvs informations
$csv_content[] = array(get_lang('Informations'));
$csv_content[] = array(get_lang('Name'), get_lang('Email'), get_lang('Tel'));
$csv_content[] = array($a_infosUser['name'], $a_infosUser['email'], $a_infosUser['phone']);
$csv_content[] = array();
// csv tracking
$csv_content[] = array(get_lang('Tracking'));
$csv_content[] = array(get_lang('FirstLogin'), get_lang('LatestLogin'), get_lang('TimeSpentInTheCourse'), get_lang('Progress'), get_lang('Score'));
$csv_content[] = array(strip_tags($first_connection_date), strip_tags($last_connection_date), $time_spent_on_the_course, $avg_student_progress . ' %', $avg_student_score . ' %');
?>
<a name="infosStudent"></a>
<table width="100%" border="0" >
<tr>
<?php
$image_array = UserManager::get_user_picture_path_by_id($a_infosUser['user_id'], 'web', false, true);
echo '<td class="borderRight" width="10%" valign="top">';
// get the path,width and height from original picture
$image_file = $image_array['dir'] . $image_array['file'];
$big_image = $image_array['dir'] . 'big_' . $image_array['file'];
$big_image_size = @getimagesize(api_url_to_local_path($big_image));
$big_image_width = $big_image_size[0];
$big_image_height = $big_image_size[1];
$url_big_image = $big_image . '?rnd=' . time();
$img_attributes = 'src="' . $image_file . '?rand=' . time() . '" ' . 'alt="' . $a_infosUser['lastname'] . ' ' . $a_infosUser['firstname'] . '" ' . 'style="float:' . ($text_dir == 'rtl' ? 'left' : 'right') . '; padding:5px;" ';
if ($image_array['file'] == 'unknown.jpg') {
echo '<img ' . $img_attributes . ' />';
} else {
echo '<input type="image" ' . $img_attributes . ' onclick="return show_image(\'' . $url_big_image . '\',\'' . $big_image_width . '\',\'' . $big_image_height . '\');"/>';
}
echo '</td>';
示例8: get_lang
'social_group_moderator.png',
get_lang('Moderator')
);
//only group admin can manage moderators
if ($user_role == GROUP_USER_PERMISSION_ADMIN) {
$user['link'] .= '<a href="group_members.php?id=' . $group_id . '&u=' . $user['user_id'] . '&action=delete_moderator">' . Display::return_icon(
'social_moderator_delete.png',
get_lang('DeleteModerator')
) . '</a>';
}
break;
}
$image_path = UserManager::get_user_picture_path_by_id(
$user['user_id'],
'web',
false,
true
);
$picture = UserManager::get_picture_user(
$user['user_id'],
$image_path['file'],
80
);
$user['image'] = '<img src="' . $picture['file'] . '" width="50px" height="50px" />';
$new_member_list[] = $user;
}
if (count($new_member_list) > 0) {
$social_right_content .= Display::return_sortable_grid(
'list_members',
array(),
示例9: headerMessagePost
/**
* Returns the formatted header message post
* @param int $authorId Author's id
* @param int $receiverId Receiver's id
* @param array $users Author's and receiver's data
* @param array $message Message data
* @param boolean $isOwnWall Determines if the author is in its own social wall or not
* @return string $html The formatted header message post
*/
private static function headerMessagePost($authorId, $receiverId, $users, $message, $isOwnWall = false)
{
$date = api_get_local_time($message['send_date']);
$avatarAuthor = $users[$authorId]['avatar'];
$urlAuthor = api_get_path(WEB_CODE_PATH).'social/profile.php?u='.$authorId;
$nameCompleteAuthor = api_get_person_name(
$users[$authorId]['firstname'],
$users[$authorId]['lastname']
);
// Deprecated since 2014-10-29
//$avatarReceiver = $users[$receiverId]['avatar'];
$urlReceiver = api_get_path(WEB_CODE_PATH).'social/profile.php?u='.$receiverId;
$nameCompleteReceiver = api_get_person_name(
$users[$receiverId]['firstname'],
$users[$receiverId]['lastname']
);
$htmlReceiver = '';
if ($authorId != $receiverId) {
$htmlReceiver = ' > <a href="'.$urlReceiver.'">' . $nameCompleteReceiver . '</a> ';
}
$wallImage = '';
if (!empty($message['path'])) {
$pathUserInfo = UserManager::get_user_picture_path_by_id($authorId, 'web', true);
$pathImg = $pathUserInfo['dir'] . 'message_attachments';
$imageBig = $pathImg .self::getImagePath($message['path'], IMAGE_WALL_BIG);
$imageSmall = $pathImg. self::getImagePath($message['path'], IMAGE_WALL_SMALL);
$wallImage = '<a class="thumbnail thickbox" href="'.$imageBig.'"><img src="'.$imageSmall.'"></a>';
}
$htmlDelete = '';
if ($isOwnWall) {
$htmlDelete .= '<a href="'.api_get_path(WEB_CODE_PATH).'social/profile.php?messageId='.
$message['id'].'">'.get_lang('SocialMessageDelete').'</a>';
}
$html = '';
$html .= '<div class="mediaPost" style="width: 100%; display:inline-block; margin-bottom:5px;">';
$html .= '<div class="media-body" style="width: 100%; height: 40px; margin-bottom:5px;">';
$html .= '<div class="pull-left" style="width: 40px; height: 100%;">';
$html .= '<a href="'.$urlAuthor.'">'.'<img class="" src="'.$avatarAuthor.
'" alt="'.$nameCompleteAuthor.'" style="width: 40px; height: 40px;"></a>';
$html .= '</div>';
$html .= '<div class="pull-left" style="padding-left:4px; width: calc(100% - 44px);height: 100%;">';
$html .= '<div style="width: 100%; height: 50%;">';
$html .= '<h4 class="media-heading" style="width: inherit;">';
$html .= '<a href="'.$urlAuthor.'">'.$nameCompleteAuthor.'</a>'.$htmlReceiver.'</h4>';
$html .= '</div>';
$html .= '<div style="width: 100%; height: 50%;">';
$html .= '<div class="pull-left" style="height: 100%;">';
$html .= '<small><span class="time timeago" title="'.$date.'">'.$date.'</span></small>';
$html .= '</div>';
$html .= '</div>';
$html .= '</div>';
$html .= '</div>';
if ($isOwnWall) {
$html .= '<div style="width: 100%;height:20px">';
$html .= $htmlDelete;
$html .= '</div>';
}
$html .= '<div style="width: 100%;">';
$html .= $wallImage;
$html .= '</div>';
$html .= '<div style="width:100%;text-align:justify;">';
$html .= '<span class="content">'.
Security::remove_XSS(self::readContentWithOpenGraph($message['content'])).'</span>';
$html .= '</div>';
$html .= '</div>'; // end mediaPost
return $html;
}
示例10: get_users_rel_course
/**
* Get registered users inside current course
* @param int attendance id for showing attendance result field (optional)
* @return array users data
*/
public function get_users_rel_course($attendance_id = 0)
{
$current_course_id = $this->get_course_id();
$courseInfo = api_get_course_info($current_course_id);
$courseId = $courseInfo['real_id'];
$current_session_id = $this->get_session_id();
if (!empty($current_session_id)) {
$a_course_users = CourseManager::get_user_list_from_course_code($current_course_id, $current_session_id, '', 'lastname');
} else {
$a_course_users = CourseManager::get_user_list_from_course_code($current_course_id, 0, '', 'lastname');
}
// get registered users inside current course
$a_users = array();
foreach ($a_course_users as $key => $user_data) {
$value = array();
$uid = $user_data['user_id'];
$status = $user_data['status'];
$user_status_in_session = null;
$user_status_in_course = null;
if ($current_session_id) {
$user_status_in_session = SessionManager::get_user_status_in_course_session($uid, $courseId, $current_session_id);
} else {
$user_status_in_course = CourseManager::get_user_in_course_status($uid, $courseId);
}
//Not taking into account DRH or COURSEMANAGER
if ($uid <= 1 || $status == DRH || $user_status_in_course == COURSEMANAGER || $user_status_in_session == 2) {
continue;
}
if (!empty($attendance_id)) {
$user_faults = $this->get_faults_of_user($uid, $attendance_id);
$value['attendance_result'] = $user_faults['faults'] . '/' . $user_faults['total'] . ' (' . $user_faults['faults_porcent'] . '%)';
$value['result_color_bar'] = $user_faults['color_bar'];
}
// user's picture
$image_path = UserManager::get_user_picture_path_by_id($uid, 'web', false);
$user_profile = UserManager::get_picture_user($uid, $image_path['file'], 22, USER_IMAGE_SIZE_SMALL, ' width="22" height="22" ');
if (!empty($image_path['file'])) {
$photo = '<center><a class="thickbox" href="' . $image_path['dir'] . $image_path['file'] . '" ><img src="' . $user_profile['file'] . '" ' . $user_profile['style'] . ' alt="' . api_get_person_name($user_data['firstname'], $user_data['lastname']) . '" title="' . api_get_person_name($user_data['firstname'], $user_data['lastname']) . '" /></a></center>';
} else {
$photo = '<center><img src="' . $user_profile['file'] . '" ' . $user_profile['style'] . ' alt="' . api_get_person_name($user_data['firstname'], $user_data['lastname']) . '" title="' . api_get_person_name($user_data['firstname'], $user_data['lastname']) . '" /></center>';
}
$value['photo'] = $photo;
$value['firstname'] = $user_data['firstname'];
$value['lastname'] = $user_data['lastname'];
$value['username'] = $user_data['username'];
$value['user_id'] = $uid;
//Sending only 5 items in the array instead of 60
$a_users[$key] = $value;
}
return $a_users;
}
示例11: return_user_image_block
function return_user_image_block() {
$img_array = UserManager::get_user_picture_path_by_id(api_get_user_id(), 'web', true, true);
$img_array = UserManager::get_picture_user(api_get_user_id(), $img_array['file'], 50, USER_IMAGE_SIZE_MEDIUM, ' width="90" height="90" ');
$profile_content = null;
if (api_get_setting('allow_social_tool') == 'true') {
$profile_content .='<a style="text-align:center" href="'.api_get_path(WEB_PATH).'main/social/home.php"><img src="'.$img_array['file'].'" '.$img_array['style'].' ></a>';
} else {
$profile_content .='<a style="text-align:center" href="'.api_get_path(WEB_PATH).'main/auth/profile.php"><img title="'.get_lang('EditProfile').'" src="'.$img_array['file'].'" '.$img_array['style'].'></a>';
}
$html = self::show_right_block(null, $profile_content, 'user_image_block', array('style' => 'text-align:center;'));
return $html;
}
示例12: get_user_data
/**
* Get the users to display on the current page.
*/
function get_user_data($from, $number_of_items, $column, $direction)
{
global $origin;
global $course_info;
global $is_western_name_order;
global $session_id;
global $extraFields;
$a_users = array();
// limit
if (!isset($_GET['keyword']) || empty($_GET['keyword'])) {
$limit = 'LIMIT '.intval($from).','.intval($number_of_items);
}
if (!in_array($direction, array('ASC', 'DESC'))) {
$direction = 'ASC';
}
switch ($column) {
case 2: //official code
$order_by = 'ORDER BY user.official_code '.$direction;
break;
case 3:
if ($is_western_name_order) {
$order_by = 'ORDER BY user.firstname '.$direction.', user.lastname '.$direction;
} else {
$order_by = 'ORDER BY user.lastname '.$direction.', user.firstname '.$direction;
}
break;
case 4:
if ($is_western_name_order) {
$order_by = 'ORDER BY user.lastname '.$direction.', user.firstname '.$direction;
} else {
$order_by = 'ORDER BY user.firstname '.$direction.', user.lastname '.$direction;
}
break;
case 5: //username
$order_by = 'ORDER BY user.username '.$direction;
break;
default:
if ($is_western_name_order) {
$order_by = 'ORDER BY user.lastname '.$direction.', user.firstname '.$direction;
} else {
$order_by = 'ORDER BY user.firstname '.$direction.', user.lastname '.$direction;
}
break;
}
$session_id = api_get_session_id();
$course_code = api_get_course_id();
$active = isset($_GET['active']) ? $_GET['active'] : null;
$a_course_users = CourseManager :: get_user_list_from_course_code(
$course_code,
$session_id,
$limit,
$order_by,
null,
null,
false,
false,
null,
array(),
array(),
$active
);
foreach ($a_course_users as $user_id => $o_course_user) {
if ((
isset($_GET['keyword']) &&
searchUserKeyword(
$o_course_user['firstname'],
$o_course_user['lastname'],
$o_course_user['username'],
$o_course_user['official_code'],
$_GET['keyword'])
) || !isset($_GET['keyword']) || empty($_GET['keyword'])
) {
$groupsNameList = GroupManager::getAllGroupPerUserSubscription($user_id);
$temp = array();
if (api_is_allowed_to_edit(null, true)) {
$temp[] = $user_id;
$image_path = UserManager::get_user_picture_path_by_id(
$user_id,
'web',
false,
true
);
$user_profile = UserManager::get_picture_user(
$user_id,
$image_path['file'],
22,
USER_IMAGE_SIZE_SMALL,
' width="22" height="22" '
);
if (!api_is_anonymous()) {
//.........这里部分代码省略.........
示例13: build_document_icon_tag
/**
* Builds an img html tag for the filetype
*
* @param string $type (file/folder)
* @param string $path
* @return string img html tag
*/
function build_document_icon_tag($type, $path)
{
$basename = basename($path);
$current_session_id = api_get_session_id();
$is_allowed_to_edit = api_is_allowed_to_edit(null, true);
if ($type == 'file') {
$icon = FileManager::choose_image($basename);
if (preg_match('/_chnano_.wav$/i', $basename)) {
$icon = "jplayer_play.png";
$basename = 'wav' . ' ' . '(Nanogong)';
} else {
$basename = substr(strrchr($basename, '.'), 1);
}
} else {
if ($path == '/shared_folder') {
$icon = 'folder_users.gif';
if ($is_allowed_to_edit) {
$basename = get_lang('HelpUsersFolder');
} else {
$basename = get_lang('UserFolders');
}
} elseif (strstr($basename, 'sf_user_')) {
$userinfo = api_get_user_info(substr($basename, 8));
$image_path = UserManager::get_user_picture_path_by_id(substr($basename, 8), 'web', false, true);
if ($image_path['file'] == 'unknown.jpg') {
$icon = $image_path['file'];
} else {
$icon = '../upload/users/' . substr($basename, 8) . '/' . $image_path['file'];
}
$basename = get_lang('UserFolder') . ' ' . $userinfo['complete_name'];
} elseif (strstr($path, 'shared_folder_session_')) {
if ($is_allowed_to_edit) {
$basename = '***(' . api_get_session_name($current_session_id) . ')*** ' . get_lang('HelpUsersFolder');
} else {
$basename = get_lang('UserFolders') . ' (' . api_get_session_name($current_session_id) . ')';
}
$icon = 'folder_users.gif';
} else {
$icon = 'folder_document.gif';
if ($path == '/audio') {
$icon = 'folder_audio.gif';
if (api_is_allowed_to_edit()) {
$basename = get_lang('HelpDefaultDirDocuments');
} else {
$basename = get_lang('Audio');
}
} elseif ($path == '/flash') {
$icon = 'folder_flash.gif';
if (api_is_allowed_to_edit()) {
$basename = get_lang('HelpDefaultDirDocuments');
} else {
$basename = get_lang('Flash');
}
} elseif ($path == '/images') {
$icon = 'folder_images.gif';
if (api_is_allowed_to_edit()) {
$basename = get_lang('HelpDefaultDirDocuments');
} else {
$basename = get_lang('Images');
}
} elseif ($path == '/video') {
$icon = 'folder_video.gif';
if (api_is_allowed_to_edit()) {
$basename = get_lang('HelpDefaultDirDocuments');
} else {
$basename = get_lang('Video');
}
} elseif ($path == '/images/gallery') {
$icon = 'folder_gallery.gif';
if (api_is_allowed_to_edit()) {
$basename = get_lang('HelpDefaultDirDocuments');
} else {
$basename = get_lang('Gallery');
}
} elseif ($path == '/chat_files') {
$icon = 'folder_chat.gif';
if (api_is_allowed_to_edit()) {
$basename = get_lang('HelpFolderChat');
} else {
$basename = get_lang('ChatFiles');
}
} elseif ($path == '/learning_path') {
$icon = 'folder_learningpath.gif';
if (api_is_allowed_to_edit()) {
$basename = get_lang('HelpFolderLearningPaths');
} else {
$basename = get_lang('LearningPaths');
}
}
}
}
return Display::return_icon($icon, $basename, array());
}
示例14: upload_user_production
/**
* Upload a submitted user production.
*
* @param $user_id User id
* @return The filename of the new production or FALSE if the upload has failed
*/
function upload_user_production($user_id)
{
$image_path = UserManager::get_user_picture_path_by_id($user_id, 'system');
$production_repository = $image_path['dir'];
if (!file_exists($production_repository)) {
@mkdir($production_repository, api_get_permissions_for_new_directories(), true);
}
$filename = replace_dangerous_char($_FILES['production']['name']);
$filename = disable_dangerous_file($filename);
if (filter_extension($filename)) {
if (@move_uploaded_file($_FILES['production']['tmp_name'], $production_repository . $filename)) {
return $filename;
}
}
return false;
// this should be returned if anything went wrong with the upload
}
示例15: get_users_by_group
/**
* Gets the group's members
* @param int group id
* @param bool show image or not of the group
* @param array list of relation type use constants
* @param int from value
* @param int limit
* @param array image configuration, i.e array('height'=>'20px', 'size'=> '20px')
* @return array list of users in a group
*/
public static function get_users_by_group($group_id, $with_image = false, $relation_type = array(), $from = null, $limit = null, $image_conf = array('size' => USER_IMAGE_SIZE_MEDIUM, 'height' => 80))
{
$where = '';
$table_group_rel_user = Database::get_main_table(TABLE_MAIN_USER_REL_GROUP);
$tbl_user = Database::get_main_table(TABLE_MAIN_USER);
$group_id = intval($group_id);
if (empty($group_id)) {
return array();
}
$limit_text = '';
if (isset($from) && isset($limit)) {
$from = intval($from);
$limit = intval($limit);
$limit_text = "LIMIT {$from}, {$limit}";
}
if (count($relation_type) == 0) {
$where_relation_condition = '';
} else {
$new_relation_type = array();
foreach ($relation_type as $rel) {
$rel = intval($rel);
$new_relation_type[] = "'{$rel}'";
}
$relation_type = implode(',', $new_relation_type);
if (!empty($relation_type)) {
$where_relation_condition = "AND gu.relation_type IN ({$relation_type}) ";
}
}
$sql = "SELECT picture_uri as image, u.user_id, u.firstname, u.lastname, relation_type\n \t\t FROM {$tbl_user} u INNER JOIN {$table_group_rel_user} gu\n \t\t\tON (gu.user_id = u.user_id)\n \t\t\tWHERE gu.group_id= {$group_id} {$where_relation_condition}\n \t\t\tORDER BY relation_type, firstname {$limit_text}";
$result = Database::query($sql);
$array = array();
while ($row = Database::fetch_array($result, 'ASSOC')) {
if ($with_image) {
$image_path = UserManager::get_user_picture_path_by_id($row['user_id'], 'web', false, true);
$picture = UserManager::get_picture_user($row['user_id'], $image_path['file'], $image_conf['height'], $image_conf['size']);
$row['image'] = '<img src="' . $picture['file'] . '" ' . $picture['style'] . ' />';
}
$array[$row['user_id']] = $row;
}
return $array;
}