Changing _medium, _small , big_ to constants in user_manager class

skala
Julio Montoya 15 years ago
parent fe932f5723
commit b1f7e58919
  1. 4
      main/admin/user_list.php
  2. 2
      main/forum/forumfunction.inc.php
  3. 154
      main/inc/ajax/social.ajax.php
  4. 4
      main/inc/lib/group_portal_manager.lib.php
  5. 17
      main/inc/lib/message.lib.php
  6. 2
      main/inc/lib/social.lib.php
  7. 28
      main/inc/lib/usermanager.lib.php
  8. 52
      main/social/home.php
  9. 5
      main/social/profile.php
  10. 2
      main/user/user.php

@ -406,7 +406,7 @@ function get_user_data($from, $number_of_items, $column, $direction)
while ($user = Database::fetch_row($res)) { while ($user = Database::fetch_row($res)) {
$image_path = UserManager::get_user_picture_path_by_id($user[0], 'web', false, true); $image_path = UserManager::get_user_picture_path_by_id($user[0], 'web', false, true);
$user_profile = UserManager::get_picture_user($user[0], $image_path['file'], 22, 'small_', ' width="22" height="22" '); $user_profile = UserManager::get_picture_user($user[0], $image_path['file'], 22, USER_IMAGE_SIZE_SMALL, ' width="22" height="22" ');
if (!api_is_anonymous()) { if (!api_is_anonymous()) {
$photo = '<center><a href="'.api_get_path(WEB_PATH).'whoisonline.php?origin=user_list&id='.$user[0].'" title="'.get_lang('Info').'" ><img src="'.$user_profile['file'].'" '.$user_profile['style'].' alt="'.api_get_person_name($user[2],$user[3]).'" title="'.api_get_person_name($user[2], $user[3]).'" /></a></center>'; $photo = '<center><a href="'.api_get_path(WEB_PATH).'whoisonline.php?origin=user_list&id='.$user[0].'" title="'.get_lang('Info').'" ><img src="'.$user_profile['file'].'" '.$user_profile['style'].' alt="'.api_get_person_name($user[2],$user[3]).'" title="'.api_get_person_name($user[2], $user[3]).'" /></a></center>';
} else { } else {
@ -757,7 +757,7 @@ else
} }
$image_path = UserManager::get_user_picture_path_by_id($user_id, 'web', false, true); $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, 'small_', ' width="22" height="22" '); $user_profile = UserManager::get_picture_user($user_id, $image_path['file'], 22, USER_IMAGE_SIZE_SMALL, ' width="22" height="22" ');
if (!api_is_anonymous()) { if (!api_is_anonymous()) {
$photo = '<center><a href="userInfo.php?'.api_get_cidreq().'&origin='.$origin.'&amp;uInfo='.$user_id.'" title="'.get_lang('Info').'" ><img src="'.$user_profile['file'].'" '.$user_profile['style'].' alt="'.api_get_person_name($o_course_user['firstname'], $o_course_user['lastname']).'" title="'.api_get_person_name($o_course_user['firstname'], $o_course_user['lastname']).'" /></a></center>'; $photo = '<center><a href="userInfo.php?'.api_get_cidreq().'&origin='.$origin.'&amp;uInfo='.$user_id.'" title="'.get_lang('Info').'" ><img src="'.$user_profile['file'].'" '.$user_profile['style'].' alt="'.api_get_person_name($o_course_user['firstname'], $o_course_user['lastname']).'" title="'.api_get_person_name($o_course_user['firstname'], $o_course_user['lastname']).'" /></a></center>';
} else { } else {

@ -2566,7 +2566,7 @@ function display_user_image($user_id,$name, $origin='') {
$image_path = UserManager::get_user_picture_path_by_id($user_id,'web',false, true); $image_path = UserManager::get_user_picture_path_by_id($user_id,'web',false, true);
$image_repository = $image_path['dir']; $image_repository = $image_path['dir'];
$existing_image = $image_path['file']; $existing_image = $image_path['file'];
$friends_profile = UserManager::get_picture_user($user_id, $image_path['file'], 0, 'medium_' , 'width="96" height="96" '); $friends_profile = UserManager::get_picture_user($user_id, $image_path['file'], 0, USER_IMAGE_SIZE_MEDIUM , 'width="96" height="96" ');
return $link.'<img src="'.$friends_profile['file'].'" '.$friends_profile['style'].' alt="'.$name.'" title="'.$name.'" /></a>'; return $link.'<img src="'.$friends_profile['file'].'" '.$friends_profile['style'].' alt="'.$name.'" title="'.$name.'" /></a>';
} else { } else {
return $link.'<img src="'.api_get_path(WEB_CODE_PATH)."img/unknown.jpg".'" alt="'.$name.'" title="'.$name.'" /></a>'; return $link.'<img src="'.api_get_path(WEB_CODE_PATH)."img/unknown.jpg".'" alt="'.$name.'" title="'.$name.'" /></a>';

@ -138,7 +138,7 @@ switch ($action) {
} }
echo $friend_html; echo $friend_html;
break; break;
case 'delete_friend': case 'delete_friend':
if (api_is_anonymous()){ if (api_is_anonymous()){
echo ''; echo '';
@ -162,86 +162,86 @@ switch ($action) {
}*/ }*/
break; break;
case 'toogle_course': case 'toogle_course':
require_once api_get_path(LIBRARY_PATH).'blog.lib.php';
require_once api_get_path(SYS_CODE_PATH).'forum/forumfunction.inc.php';
require_once api_get_path(LIBRARY_PATH).'course.lib.php';
$user_id = intval($_SESSION['social_user_id']);
if ($_POST['action']) {$action = $_POST['action'];}
switch($action) {
case 'load_course' :
$course_db = $_POST['course_code'];
// @todo goto the course link
//echo '<a href="'.api_get_path(WEB_COURSE_PATH).$course_directory.'/?id_session='.$my_course['id_session'].'">'.get_lang('GotoCourse').'</a>';
$course_id=CourseManager::get_course_id_by_database_name($course_db);
if (api_is_user_of_course($course_id,api_get_user_id())) {
$table_forums = Database :: get_course_table(TABLE_FORUM,$course_db);
$table_threads = Database :: get_course_table(TABLE_FORUM_THREAD,$course_db);
$table_posts = Database :: get_course_table(TABLE_FORUM_POST,$course_db);
$table_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY,$course_db);
$table_users = Database :: get_main_table(TABLE_MAIN_USER);
//------Forum messages require_once api_get_path(LIBRARY_PATH).'blog.lib.php';
require_once api_get_path(SYS_CODE_PATH).'forum/forumfunction.inc.php';
require_once api_get_path(LIBRARY_PATH).'course.lib.php';
$forum_result = get_all_post_from_user($user_id, $course_db); $user_id = intval($_SESSION['social_user_id']);
$all_result_data = 0; if ($_POST['action']) {$action = $_POST['action'];}
if ($forum_result !='') {
api_display_tool_title(get_lang('Forum'));
echo '<div class="social-background-content" style="background:#FAF9F6; padding:0px;" >';
echo api_xml_http_response_encode($forum_result);
echo '</div>';
echo '<br />';
$all_result_data++;
}
//------Blog posts switch($action) {
$result = get_blog_post_from_user($course_db, $user_id);
if (!empty($result)) { case 'load_course' :
api_display_tool_title(api_xml_http_response_encode(get_lang('Blog'))); $course_db = $_POST['course_code'];
echo '<div class="social-background-content" style="background:#FAF9F6; padding:0px;">'; // @todo goto the course link
echo api_xml_http_response_encode($result); //echo '<a href="'.api_get_path(WEB_COURSE_PATH).$course_directory.'/?id_session='.$my_course['id_session'].'">'.get_lang('GotoCourse').'</a>';
echo '</div>'; $course_id=CourseManager::get_course_id_by_database_name($course_db);
echo '<br />';
$all_result_data++; if (api_is_user_of_course($course_id,api_get_user_id())) {
}
$table_forums = Database :: get_course_table(TABLE_FORUM,$course_db);
//------Blog comments $table_threads = Database :: get_course_table(TABLE_FORUM_THREAD,$course_db);
$result = get_blog_comment_from_user($course_db, $user_id); $table_posts = Database :: get_course_table(TABLE_FORUM_POST,$course_db);
if (!empty($result)) { $table_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY,$course_db);
echo '<div class="social-background-content" style="background:#FAF9F6; padding-left:10px;">'; $table_users = Database :: get_main_table(TABLE_MAIN_USER);
api_display_tool_title(api_xml_http_response_encode(get_lang('BlogComments')));
echo api_xml_http_response_encode($result); //------Forum messages
echo '</div>';
echo '<br />'; $forum_result = get_all_post_from_user($user_id, $course_db);
$all_result_data++; $all_result_data = 0;
} if ($forum_result !='') {
if ($all_result_data == 0) { api_display_tool_title(get_lang('Forum'));
echo api_xml_http_response_encode(get_lang('NoDataAvailable')); echo '<div class="social-background-content" style="background:#FAF9F6; padding:0px;" >';
} echo api_xml_http_response_encode($forum_result);
echo '</div>';
} else { echo '<br />';
echo '<div class="clear"></div><br />'; $all_result_data++;
api_display_tool_title(api_xml_http_response_encode(get_lang('Details')));
echo '<div class="social-background-content" style="background:#FAF9F6; padding:0px;">';
echo api_xml_http_response_encode(get_lang('UserNonRegisteredAtTheCourse'));
echo '<div class="clear"></div><br />';
echo '</div>';
echo '<div class="clear"></div><br />';
} }
break;
case 'unload_course' : //------Blog posts
//echo 'load2'; $result = get_blog_post_from_user($course_db, $user_id);
break; if (!empty($result)) {
default: api_display_tool_title(api_xml_http_response_encode(get_lang('Blog')));
break; echo '<div class="social-background-content" style="background:#FAF9F6; padding:0px;">';
} echo api_xml_http_response_encode($result);
break; echo '</div>';
echo '<br />';
$all_result_data++;
}
//------Blog comments
$result = get_blog_comment_from_user($course_db, $user_id);
if (!empty($result)) {
echo '<div class="social-background-content" style="background:#FAF9F6; padding-left:10px;">';
api_display_tool_title(api_xml_http_response_encode(get_lang('BlogComments')));
echo api_xml_http_response_encode($result);
echo '</div>';
echo '<br />';
$all_result_data++;
}
if ($all_result_data == 0) {
echo api_xml_http_response_encode(get_lang('NoDataAvailable'));
}
} else {
echo '<div class="clear"></div><br />';
api_display_tool_title(api_xml_http_response_encode(get_lang('Details')));
echo '<div class="social-background-content" style="background:#FAF9F6; padding:0px;">';
echo api_xml_http_response_encode(get_lang('UserNonRegisteredAtTheCourse'));
echo '<div class="clear"></div><br />';
echo '</div>';
echo '<div class="clear"></div><br />';
}
break;
case 'unload_course' :
//echo 'load2';
break;
default:
break;
}
break;
default: default:
echo ''; echo '';
} }

@ -289,7 +289,7 @@ class GroupPortalManager
/** /**
* Gets the group's members * Gets the group's members
*/ */
public static function get_users_by_group($group_id, $with_image = false, $relation_type = array(), $from = 0, $limit = 15, $image_conf = array('size'=>'medium_','height'=>80)) public static function get_users_by_group($group_id, $with_image = false, $relation_type = array(), $from = 0, $limit = 15, $image_conf = array('size'=>USER_IMAGE_SIZE_MEDIUM,'height'=>80))
{ {
$where = ''; $where = '';
$table_group_rel_user = Database::get_main_table(TABLE_MAIN_USER_REL_GROUP); $table_group_rel_user = Database::get_main_table(TABLE_MAIN_USER_REL_GROUP);
@ -329,7 +329,7 @@ class GroupPortalManager
$array = array(); $array = array();
while ($row = Database::fetch_array($result, 'ASSOC')) { while ($row = Database::fetch_array($result, 'ASSOC')) {
$image_path = UserManager::get_user_picture_path_by_id($row['user_id'], 'web', false, true); $image_path = UserManager::get_user_picture_path_by_id($row['user_id'], 'web', false, true);
$user_profile = UserManager::get_picture_user($row['user_id'], $image_path['file'], 60, 'medium_'); $user_profile = UserManager::get_picture_user($row['user_id'], $image_path['file'], 60, USER_IMAGE_SIZE_MEDIUM);
if ($with_image == true) { if ($with_image == true) {
$picture = UserManager::get_picture_user($row['user_id'], $row['picture_uri'],$image_conf['height'],$image_conf['size']); $picture = UserManager::get_picture_user($row['user_id'], $row['picture_uri'],$image_conf['height'],$image_conf['size']);
$row['image'] = '<img src="'.$user_profile['file'].'" '.$picture['style'].' />'; $row['image'] = '<img src="'.$user_profile['file'].'" '.$picture['style'].' />';

@ -22,9 +22,9 @@ require_once api_get_path(LIBRARY_PATH).'group_portal_manager.lib.php';
*/ */
define('MESSAGE_STATUS_NEW', '0'); define('MESSAGE_STATUS_NEW', '0');
define('MESSAGE_STATUS_UNREAD', '1'); define('MESSAGE_STATUS_UNREAD', '1');
//2 ??
define('MESSAGE_STATUS_DELETED', '3'); define('MESSAGE_STATUS_DELETED', '3');
define('MESSAGE_STATUS_OUTBOX', '4'); define('MESSAGE_STATUS_OUTBOX', '4');
define('MESSAGE_STATUS_INVITATION_PENDING', '5'); define('MESSAGE_STATUS_INVITATION_PENDING', '5');
define('MESSAGE_STATUS_INVITATION_ACCEPTED','6'); define('MESSAGE_STATUS_INVITATION_ACCEPTED','6');
define('MESSAGE_STATUS_INVITATION_DENIED', '7'); define('MESSAGE_STATUS_INVITATION_DENIED', '7');
@ -85,7 +85,7 @@ class MessageManager
return false; return false;
} }
$i=0; $i=0;
$query = "SELECT * FROM $table_message WHERE user_receiver_id=".api_get_user_id()." AND msg_status=1"; $query = "SELECT * FROM $table_message WHERE user_receiver_id=".api_get_user_id()." AND msg_status=".MESSAGE_STATUS_UNREAD;
$result = Database::query($query,__FILE__,__LINE__); $result = Database::query($query,__FILE__,__LINE__);
$i = Database::num_rows($result); $i = Database::num_rows($result);
return $i; return $i;
@ -314,6 +314,7 @@ class MessageManager
public static function delete_message_by_user_receiver ($user_receiver_id,$id) { public static function delete_message_by_user_receiver ($user_receiver_id,$id) {
$table_message = Database::get_main_table(TABLE_MESSAGE); $table_message = Database::get_main_table(TABLE_MESSAGE);
if ($id != strval(intval($id))) return false; if ($id != strval(intval($id))) return false;
$user_receiver_id = intval($user_receiver_id);
$id = Database::escape_string($id); $id = Database::escape_string($id);
$sql="SELECT * FROM $table_message WHERE id=".$id." AND msg_status<>4;"; $sql="SELECT * FROM $table_message WHERE id=".$id." AND msg_status<>4;";
$rs=Database::query($sql,__FILE__,__LINE__); $rs=Database::query($sql,__FILE__,__LINE__);
@ -323,7 +324,7 @@ class MessageManager
// delete attachment file // delete attachment file
$res = self::delete_message_attachment_file($id,$user_receiver_id); $res = self::delete_message_attachment_file($id,$user_receiver_id);
// delete message // delete message
$query = "UPDATE $table_message SET msg_status=3 WHERE user_receiver_id=".Database::escape_string($user_receiver_id)." AND id=".$id; $query = "UPDATE $table_message SET msg_status=3 WHERE user_receiver_id=".$user_receiver_id." AND id=".$id;
//$query = "DELETE FROM $table_message WHERE user_receiver_id=".Database::escape_string($user_receiver_id)." AND id=".$id; //$query = "DELETE FROM $table_message WHERE user_receiver_id=".Database::escape_string($user_receiver_id)." AND id=".$id;
$result = Database::query($query,__FILE__,__LINE__); $result = Database::query($query,__FILE__,__LINE__);
return $result; return $result;
@ -362,7 +363,7 @@ class MessageManager
} }
/** /**
* save message attachment files * Saves a message attachment files
* @param array $_FILES['name'] * @param array $_FILES['name']
* @param string a comment about the uploaded file * @param string a comment about the uploaded file
* @param int message id * @param int message id
@ -496,7 +497,7 @@ class MessageManager
$table_message = Database::get_main_table(TABLE_MESSAGE); $table_message = Database::get_main_table(TABLE_MESSAGE);
$current_uid = api_get_user_id(); $current_uid = api_get_user_id();
$group_id = intval($group_id); $group_id = intval($group_id);
$query = "SELECT * FROM $table_message WHERE group_id='$group_id' AND msg_status <> 4 ORDER BY id"; $query = "SELECT * FROM $table_message WHERE group_id=$group_id AND msg_status <> ".MESSAGE_STATUS_OUTBOX." ORDER BY id";
$rs = Database::query($query,__FILE__,__LINE__); $rs = Database::query($query,__FILE__,__LINE__);
$data = array(); $data = array();
if (Database::num_rows($rs) > 0) { if (Database::num_rows($rs) > 0) {
@ -533,7 +534,7 @@ class MessageManager
$condition_limit = " LIMIT $offset,$limit "; $condition_limit = " LIMIT $offset,$limit ";
} }
$query = "SELECT * FROM $table_message WHERE parent_id='$parent_id' AND msg_status <> 4 $condition_group_id ORDER BY send_date DESC $condition_limit "; $query = "SELECT * FROM $table_message WHERE parent_id='$parent_id' AND msg_status <> ".MESSAGE_STATUS_OUTBOX." $condition_group_id ORDER BY send_date DESC $condition_limit ";
$rs = Database::query($query,__FILE__,__LINE__); $rs = Database::query($query,__FILE__,__LINE__);
$data = array(); $data = array();
if (Database::num_rows($rs) > 0) { if (Database::num_rows($rs) > 0) {
@ -582,7 +583,7 @@ class MessageManager
$table_message = Database::get_main_table(TABLE_MESSAGE); $table_message = Database::get_main_table(TABLE_MESSAGE);
$request=api_is_xml_http_request(); $request=api_is_xml_http_request();
$sql_query = "SELECT id as col0, user_sender_id as col1, title as col2, send_date as col3, user_receiver_id as col4, msg_status as col5 FROM $table_message " . $sql_query = "SELECT id as col0, user_sender_id as col1, title as col2, send_date as col3, user_receiver_id as col4, msg_status as col5 FROM $table_message " .
"WHERE user_sender_id=".api_get_user_id()." AND msg_status=4 " . "WHERE user_sender_id=".api_get_user_id()." AND msg_status=".MESSAGE_STATUS_OUTBOX." " .
"ORDER BY col$column $direction LIMIT $from,$number_of_items"; "ORDER BY col$column $direction LIMIT $from,$number_of_items";
$sql_result = Database::query($sql_query,__FILE__,__LINE__); $sql_result = Database::query($sql_query,__FILE__,__LINE__);
@ -632,7 +633,7 @@ class MessageManager
*/ */
public static function get_number_of_messages_sent () { public static function get_number_of_messages_sent () {
$table_message = Database::get_main_table(TABLE_MESSAGE); $table_message = Database::get_main_table(TABLE_MESSAGE);
$sql_query = "SELECT COUNT(*) as number_messages FROM $table_message WHERE msg_status=4 AND user_sender_id=".api_get_user_id(); $sql_query = "SELECT COUNT(*) as number_messages FROM $table_message WHERE msg_status=".MESSAGE_STATUS_OUTBOX." AND user_sender_id=".api_get_user_id();
$sql_result = Database::query($sql_query,__FILE__,__LINE__); $sql_result = Database::query($sql_query,__FILE__,__LINE__);
$result = Database::fetch_array($sql_result); $result = Database::fetch_array($sql_result);
return $result['number_messages']; return $result['number_messages'];

@ -718,7 +718,7 @@ class SocialManager extends UserManager {
} }
$image_array = UserManager::get_user_picture_path_by_id($uid, 'system', false, true); $image_array = UserManager::get_user_picture_path_by_id($uid, 'system', false, true);
$friends_profile = SocialManager::get_picture_user($uid, $image_array['file'], 92, 'medium_', ' width="90" height="90" '); $friends_profile = SocialManager::get_picture_user($uid, $image_array['file'], 92, USER_IMAGE_SIZE_MEDIUM , ' width="90" height="90" ');
// reduce image // reduce image
$name = api_get_person_name($user_info['firstName'], $user_info['lastName']); $name = api_get_person_name($user_info['firstName'], $user_info['lastName']);
$table_row[] = '<a href="'.$url.'"><img title = "'.$name.'" alt="'.$name.'" src="'.$friends_profile['file'].'" '.$friends_profile['style'].' border="1"></a>'; $table_row[] = '<a href="'.$url.'"><img title = "'.$name.'" alt="'.$name.'" src="'.$friends_profile['file'].'" '.$friends_profile['style'].' border="1"></a>';

@ -22,6 +22,14 @@ define('USER_FIELD_TYPE_DOUBLE_SELECT', 8);
define('USER_FIELD_TYPE_DIVIDER', 9); define('USER_FIELD_TYPE_DIVIDER', 9);
define('USER_FIELD_TYPE_TAG', 10); define('USER_FIELD_TYPE_TAG', 10);
//User image sizes
define('USER_IMAGE_SIZE_ORIGINAL', 1);
define('USER_IMAGE_SIZE_BIG', 2);
define('USER_IMAGE_SIZE_MEDIUM', 3);
define('USER_IMAGE_SIZE_SMALL', 4);
class UserManager class UserManager
{ {
private function __construct () { private function __construct () {
@ -2191,7 +2199,7 @@ class UserManager
* @param string style css * @param string style css
* @return array with the file and the style of an image i.e $array['file'] $array['style'] * @return array with the file and the style of an image i.e $array['file'] $array['style']
*/ */
public static function get_picture_user($user_id, $picture_file, $height, $size_picture = 'medium_', $style = '') { public static function get_picture_user($user_id, $picture_file, $height, $size_picture = USER_IMAGE_SIZE_MEDIUM , $style = '') {
$patch_profile = 'upload/users/'; $patch_profile = 'upload/users/';
$picture = array(); $picture = array();
@ -2200,6 +2208,24 @@ class UserManager
$picture['file'] = api_get_path(WEB_CODE_PATH).'img/'.$picture_file; $picture['file'] = api_get_path(WEB_CODE_PATH).'img/'.$picture_file;
return $picture; return $picture;
} }
switch ($size_picture) {
case USER_IMAGE_SIZE_ORIGINAL :
$size_picture = '';
break;
case USER_IMAGE_SIZE_BIG :
$size_picture = 'big_';
break;
case USER_IMAGE_SIZE_MEDIUM :
$size_picture = 'medium_';
break;
case USER_IMAGE_SIZE_SMALL :
$size_picture = 'small_';
break;
default:
$size_picture = 'medium_';
}
$image_array_sys = self::get_user_picture_path_by_id($user_id, 'system', false, true); $image_array_sys = self::get_user_picture_path_by_id($user_id, 'system', false, true);
$image_array = self::get_user_picture_path_by_id($user_id, 'web', false, true); $image_array = self::get_user_picture_path_by_id($user_id, 'web', false, true);
$file = $image_array_sys['dir'].$size_picture.$picture_file; $file = $image_array_sys['dir'].$size_picture.$picture_file;

@ -25,8 +25,8 @@ $htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jqu
if (api_get_setting('profile', 'picture') == 'true') { if (api_get_setting('profile', 'picture') == 'true') {
require_once api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php'; require_once api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php';
$form = new FormValidator('profile', 'post', 'home.php', null, array()); $form = new FormValidator('profile', 'post', 'home.php', null, array());
// PICTURE
// PICTURE
$form->addElement('file', 'picture', get_lang('AddImage')); $form->addElement('file', 'picture', get_lang('AddImage'));
$form->add_progress_bar(); $form->add_progress_bar();
if (!empty($user_data['picture_uri'])) { if (!empty($user_data['picture_uri'])) {
@ -36,10 +36,8 @@ if (api_get_setting('profile', 'picture') == 'true') {
$form->addRule('picture', get_lang('OnlyImagesAllowed').' ('.implode(',', $allowed_picture_types).')', 'filetype', $allowed_picture_types); $form->addRule('picture', get_lang('OnlyImagesAllowed').' ('.implode(',', $allowed_picture_types).')', 'filetype', $allowed_picture_types);
$form->addElement('style_submit_button', 'apply_change', get_lang('SaveSettings'), 'class="save"'); $form->addElement('style_submit_button', 'apply_change', get_lang('SaveSettings'), 'class="save"');
if ($form->validate()) { if ($form->validate()) {
$user_data = $form->getSubmitValues(); $user_data = $form->getSubmitValues();
var_dump($_FILES);
// upload picture if a new one is provided // upload picture if a new one is provided
if ($_FILES['picture']['size']) { if ($_FILES['picture']['size']) {
if ($new_picture = UserManager::update_user_picture(api_get_user_id(), $_FILES['picture']['name'], $_FILES['picture']['tmp_name'])) { if ($new_picture = UserManager::update_user_picture(api_get_user_id(), $_FILES['picture']['name'], $_FILES['picture']['tmp_name'])) {
@ -53,64 +51,34 @@ if (api_get_setting('profile', 'picture') == 'true') {
Display :: display_header(null); Display :: display_header(null);
$user_info = api_get_user_info(api_get_user_id());
echo '<div id="social_wrapper">'; echo '<div id="social_wrapper">';
//this include the social menu div //this include the social menu div
SocialManager::show_social_menu(array('messages')); SocialManager::show_social_menu();
echo '<div id="social_main">'; echo '<div id="social_main">';
echo '<div id="social_main_sub">'; echo '<div id="social_main_sub">';
echo '<div id="social_top">'; echo '<div id="social_top">';
echo get_lang('User Online').'120'; echo get_lang('FriendsOnline').'120';
echo '</div>'; echo '</div>';
echo '<div id="social_left">'; echo '<div id="social_left">';
//@todo fix this aswell as in main/auth/profile.php //@todo fix this code aswell as in main/auth/profile.php
//User picture size is calculated from SYSTEM path
$image_syspath = UserManager::get_user_picture_path_by_id(api_get_user_id(), 'system', false, true);
$image_syspath['dir'].$image_syspath['file'];
$image_size = @getimagesize($image_syspath['dir'].$image_syspath['file']);
//Web path
$image_path = UserManager::get_user_picture_path_by_id(api_get_user_id(), 'web', false, true);
$image_dir = $image_path['dir'];
$image = $image_path['file'];
$image_file = $image_dir.$image;
$img_attributes = 'src="'.$image_file.'?rand='.time().'" '
.'alt="'.api_get_person_name($user_data['firstname'], $user_data['lastname']).'" '
.'style="float:'.($text_dir == 'rtl' ? 'left' : 'right').'; margin-top:0px;padding:5px;" ';
if ($image_size[0] > 300) {
//limit display width to 300px
$img_attributes .= 'width="300" ';
}
// get the path,width and height from original picture $user_image_array = UserManager::get_picture_user(api_get_user_id(), $user_info['picture_uri'], 200, USER_IMAGE_SIZE_MEDIUM);
$big_image = $image_dir.'big_'.$image;
$big_image_size = api_getimagesize($big_image);
$big_image_width = $big_image_size[0];
$big_image_height = $big_image_size[1];
$url_big_image = $big_image.'?rnd='.time();
// Style position:absolute has been removed for Opera-compatibility. if ($user_image_array['file'] != 'unknown.jpg') {
//echo '<div id="image-message-container" style="float:right;display:inline;position:absolute;padding:3px;width:250px;" >'; echo '<img src='.$user_image_array['dir'].$user_image_array['file'].' /> <br /><br />';
//echo '<div id="image-message-container" style="float:right;display:inline;padding:3px;width:250px;" >';
if ($image == 'unknown.jpg') {
echo '<img '.$img_attributes.' />';
if (api_get_setting('profile', 'picture') == 'true') {
$form->display();
}
} else { } else {
echo '<input type="image" '.$img_attributes.' onclick="javascript: return show_image(\''.$url_big_image.'\',\''.$big_image_width.'\',\''.$big_image_height.'\');"/>'; echo '<img src='.$user_image_array['dir'].$user_image_array['file'].' /><br /><br />';
} }
echo '<div id="social_center">'; echo '<div id="social_center">';
echo '</div>'; echo '</div>';

@ -213,7 +213,8 @@ Display :: display_header(null);
//User picture size is calculated from SYSTEM path //User picture size is calculated from SYSTEM path
$img_array= UserManager::get_user_picture_path_by_id($user_id,'web',true,true); $img_array= UserManager::get_user_picture_path_by_id($user_id,'web',true,true);
$big_image = UserManager::get_picture_user($user_id, $img_array['file'],'','big_'); $big_image = UserManager::get_picture_user($user_id, $img_array['file'],'',USER_IMAGE_SIZE_BIG);
$big_image = $big_image['file'].$big_image['dir']; $big_image = $big_image['file'].$big_image['dir'];
//print_r($user_info); //print_r($user_info);
// Added by Ivan Tcholakov, 03-APR-2009. // Added by Ivan Tcholakov, 03-APR-2009.
@ -302,7 +303,7 @@ echo '<div id="social-profile-wrapper">';
$name_user = api_get_person_name($friend['firstName'], $friend['lastName']); $name_user = api_get_person_name($friend['firstName'], $friend['lastName']);
$friend_html.='<div id=div_'.$friend['friend_user_id'].' class="image_friend_network" ><span><center>'; $friend_html.='<div id=div_'.$friend['friend_user_id'].' class="image_friend_network" ><span><center>';
// the height = 92 must be the sqme in the image_friend_network span style in default.css // the height = 92 must be the sqme in the image_friend_network span style in default.css
$friends_profile = SocialManager::get_picture_user($friend['friend_user_id'], $friend['image'], 92, 'medium_', 'width="85" height="90" '); $friends_profile = SocialManager::get_picture_user($friend['friend_user_id'], $friend['image'], 92, USER_IMAGE_SIZE_MEDIUM , 'width="85" height="90" ');
$friend_html.='<a href="profile.php?u='.$friend['friend_user_id'].'&amp;'.$link_shared.'">'; $friend_html.='<a href="profile.php?u='.$friend['friend_user_id'].'&amp;'.$link_shared.'">';
$friend_html.='<img src="'.$friends_profile['file'].'" '.$friends_profile['style'].' id="imgfriend_'.$friend['friend_user_id'].'" title="'.$name_user.'" />'; $friend_html.='<img src="'.$friends_profile['file'].'" '.$friends_profile['style'].' id="imgfriend_'.$friend['friend_user_id'].'" title="'.$name_user.'" />';

@ -451,7 +451,7 @@ function get_user_data($from, $number_of_items, $column, $direction) {
$temp[] = $user_id; $temp[] = $user_id;
$image_path = UserManager::get_user_picture_path_by_id($user_id, 'web', false, true); $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, 'small_', ' width="22" height="22" '); $user_profile = UserManager::get_picture_user($user_id, $image_path['file'], 22, USER_IMAGE_SIZE_SMALL, ' width="22" height="22" ');
if (!api_is_anonymous()) { if (!api_is_anonymous()) {
$photo = '<center><a href="userInfo.php?'.api_get_cidreq().'&origin='.$origin.'&amp;uInfo='.$user_id.'" title="'.get_lang('Info').'" ><img src="'.$user_profile['file'].'" '.$user_profile['style'].' alt="'.api_get_person_name($o_course_user['firstname'], $o_course_user['lastname']).'" title="'.api_get_person_name($o_course_user['firstname'], $o_course_user['lastname']).'" /></a></center>'; $photo = '<center><a href="userInfo.php?'.api_get_cidreq().'&origin='.$origin.'&amp;uInfo='.$user_id.'" title="'.get_lang('Info').'" ><img src="'.$user_profile['file'].'" '.$user_profile['style'].' alt="'.api_get_person_name($o_course_user['firstname'], $o_course_user['lastname']).'" title="'.api_get_person_name($o_course_user['firstname'], $o_course_user['lastname']).'" /></a></center>';
} else { } else {

Loading…
Cancel
Save