Group improvements + message improvements see #5611

skala
Julio Montoya 16 years ago
parent f2ae954bf4
commit 3c84987966
  1. 8
      main/css/blue_lagoon/default.css
  2. BIN
      main/img/moderator_star.png
  3. 104
      main/inc/lib/group_portal_manager.lib.php
  4. 82
      main/inc/lib/message.lib.php
  5. 41
      main/inc/lib/social.lib.php
  6. 1
      main/inc/lib/usermanager.lib.php
  7. 3
      main/messages/inbox.php
  8. 17
      main/messages/index.php
  9. 24
      main/messages/messages.css
  10. 3
      main/messages/new_message.php
  11. 33
      main/messages/send_message_to_userfriend.inc.php
  12. 63
      main/messages/view_message.php
  13. 6
      main/social/contacts.inc.php
  14. 8
      main/social/data_personal.inc.php
  15. 10
      main/social/friends.php
  16. 8
      main/social/group_add.php
  17. 7
      main/social/group_contact.inc.php
  18. 15
      main/social/group_edit.php
  19. 244
      main/social/group_invitation.php
  20. 54
      main/social/group_members.php
  21. 34
      main/social/groups.php
  22. 11
      main/social/home.php
  23. 8
      main/social/index.php
  24. 57
      main/social/invitations.php
  25. 108
      main/social/profile.php
  26. 8
      main/social/qualify_contact.inc.php
  27. 6
      main/social/register_friend.php
  28. 10
      main/social/search.php
  29. 8
      main/social/select_friend_response.php
  30. 7
      main/social/select_options.php
  31. 55
      main/social/show_search_image.inc.php

@ -2664,4 +2664,12 @@ input[type="text"]:focus, input[type="password"]:focus, textarea:focus {
#maincontent .courseslist li {
margin-bottom:8px;
}
a.read {
font-weight:normal;
}
a.unread {
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

@ -15,9 +15,11 @@ define('GROUP_PERMISSION_CLOSED', '2');
// Group user permissions
define('GROUP_USER_PERMISSION_ADMIN' ,'1'); // the admin of a group
define('GROUP_USER_PERMISSION_READER' ,'2'); // a normal user
define('GROUP_USER_PERMISSION_PENDING_INVITATION' ,'3'); // user pending invitation to a group
define('GROUP_USER_PERMISSION_MODERATOR' ,'4'); // a moderator
define('GROUP_USER_PERMISSION_ANONYMOUS' ,'5'); // an anonymous user
define('GROUP_USER_PERMISSION_PENDING_INVITATION' ,'3'); // When an admin invite a user
define('GROUP_USER_PERMISSION_PENDING_INVITATION_SENT_BY_USER' ,'4'); // When a user whats to join to a group
define('GROUP_USER_PERMISSION_MODERATOR' ,'5'); // a moderator
define('GROUP_USER_PERMISSION_ANONYMOUS' ,'6'); // an anonymous user
class GroupPortalManager
{
@ -32,7 +34,7 @@ class GroupPortalManager
* @param int the user_id of the owner
* @return boolean if success
*/
function add($name, $description, $url, $visibility, $picture='')
public static function add($name, $description, $url, $visibility, $picture='')
{
$tms = time();
$table = Database :: get_main_table(TABLE_MAIN_GROUP);
@ -59,7 +61,7 @@ class GroupPortalManager
* @param int the user_id of the owner
* @return boolean if success
*/
function update($group_id, $name, $description, $url, $visibility, $picture_uri)
public static function update($group_id, $name, $description, $url, $visibility, $picture_uri)
{
$group_id = intval($group_id);
$table = Database::get_main_table(TABLE_MAIN_GROUP);
@ -83,7 +85,7 @@ class GroupPortalManager
* @param int id
* @return boolean true if success
* */
function delete($id)
public static function delete($id)
{
$id = intval($id);
$table = Database :: get_main_table(TABLE_MAIN_GROUP);
@ -99,7 +101,7 @@ class GroupPortalManager
/**
*
* */
function url_exist($url)
public static function url_exist($url)
{
$table_access_url= Database :: get_main_table(TABLE_MAIN_ACCESS_URL);
$sql = "SELECT id FROM $table_access_url WHERE url = '".Database::escape_string($url)."' ";
@ -111,7 +113,7 @@ class GroupPortalManager
/**
*
* */
function url_id_exist($url)
public static function url_id_exist($url)
{
$table_access_url= Database :: get_main_table(TABLE_MAIN_ACCESS_URL);
$sql = "SELECT id FROM $table_access_url WHERE id = '".Database::escape_string($url)."' ";
@ -125,7 +127,7 @@ class GroupPortalManager
* @author Julio Montoya
* @return int count of urls
* */
function url_count()
public static function url_count()
{
$table_access_url= Database :: get_main_table(TABLE_MAIN_ACCESS_URL);
$sql = "SELECT count(id) as count_result FROM $table_access_url";
@ -140,7 +142,7 @@ class GroupPortalManager
* @author Julio Montoya
* @return array
* */
function get_url_data()
public static function get_url_data()
{
$table_access_url= Database :: get_main_table(TABLE_MAIN_ACCESS_URL);
$sql = "SELECT id, url, description, active FROM $table_access_url";
@ -160,7 +162,7 @@ class GroupPortalManager
* @param int number of items
* @return array
* */
function get_all_group_data($visibility = GROUP_PERMISSION_OPEN, $from=0, $number_of_items=10)
public static function get_all_group_data($visibility = GROUP_PERMISSION_OPEN, $from=0, $number_of_items=10)
{
$table = Database :: get_main_table(TABLE_MAIN_GROUP);
$visibility = intval($visibility);
@ -179,7 +181,7 @@ class GroupPortalManager
*
*
*/
function get_group_data($group_id)
public static function get_group_data($group_id)
{
$table = Database :: get_main_table(TABLE_MAIN_GROUP);
$group_id = intval($group_id);
@ -199,7 +201,7 @@ class GroupPortalManager
* @param bool show group links or not
*
*/
function get_group_tags($group_id, $show_tag_links = true)
public static function get_group_tags($group_id, $show_tag_links = true)
{
$tag = Database :: get_main_table(TABLE_MAIN_TAG);
$table_group_rel_tag = Database :: get_main_table(TABLE_MAIN_GROUP_REL_TAG);
@ -237,7 +239,7 @@ class GroupPortalManager
* @author Julio Montoya
* @return array
* */
function get_url_data_from_id($url_id)
public static function get_url_data_from_id($url_id)
{
$table_access_url= Database :: get_main_table(TABLE_MAIN_ACCESS_URL);
$sql = "SELECT id, url, description, active FROM $table_access_url WHERE id = ".Database::escape_string($url_id);
@ -246,12 +248,12 @@ class GroupPortalManager
return $row;
}
/** Gets the inner join of users and group table
/** Gets the inner join from users and group table
* @author Julio Montoya
* @return int access url id
* @return array Database::store_result of the result
* */
function get_groups_by_user($user_id='', $relation_type = GROUP_USER_PERMISSION_READER, $with_image = false)
public static function get_groups_by_user($user_id='', $relation_type = GROUP_USER_PERMISSION_READER, $with_image = false)
{
$where = '';
$table_group_rel_user = Database::get_main_table(TABLE_MAIN_USER_REL_GROUP);
@ -288,7 +290,7 @@ class GroupPortalManager
* @return int access url id
* @return array Database::store_result of the result
* */
function get_groups_by_popularity($num = 10, $with_image = false)
public static function get_groups_by_popularity($num = 10, $with_image = false)
{
$where = '';
$table_group_rel_user = Database::get_main_table(TABLE_MAIN_USER_REL_GROUP);
@ -325,7 +327,7 @@ class GroupPortalManager
* @return int access url id
* @return array Database::store_result of the result
* */
function get_groups_by_age($num = 10, $with_image = false, $relation_type = GROUP_USER_PERMISSION_READER)
public static function get_groups_by_age($num = 10, $with_image = false, $relation_type = GROUP_USER_PERMISSION_READER)
{
$where = '';
$table_group_rel_user = Database::get_main_table(TABLE_MAIN_USER_REL_GROUP);
@ -359,8 +361,10 @@ class GroupPortalManager
return $array;
}
function get_users_by_group($group_id='', $with_image = false, $relation_type = 0, $limit = 100, $image_size = 'medium_')
/**
* Gets the members of a group
*/
public static function get_users_by_group($group_id='', $with_image = false, $relation_type = array(), $limit = 100, $image_conf = array('size'=>'medium_','height'=>80))
{
$where = '';
$table_group_rel_user = Database::get_main_table(TABLE_MAIN_USER_REL_GROUP);
@ -368,11 +372,16 @@ class GroupPortalManager
$group_id = intval($group_id);
$limit = intval($limit);
if ($relation_type == 0) {
if (count($relation_type) == 0) {
$where_relation_condition = '';
} else {
$relation_type = intval($relation_type);
$where_relation_condition = "AND gu.relation_type = $relation_type ";
$new_relation_type = array();
foreach($relation_type as $rel) {
$rel = intval($rel);
$new_relation_type[] ="'$rel'";
}
$relation_type = implode(',', $new_relation_type);
$where_relation_condition = "AND gu.relation_type IN ($relation_type) ";
}
$sql="SELECT picture_uri, u.user_id, u.firstname, u.lastname, relation_type FROM $tbl_user u
@ -382,12 +391,11 @@ class GroupPortalManager
$result=Database::query($sql,__FILE__,__LINE__);
$array = array();
while ($row = Database::fetch_array($result, 'ASSOC')) {
if ($with_image == true) {
$picture = UserManager::get_picture_user($row['user_id'], $row['picture_uri'],80,$image_size);
$img = '<img src="'.$picture['file'].'" />';
$row['picture_uri'] = $img;
}
$array[$row['user_id']] = $row;
if ($with_image == true) {
$picture = UserManager::get_picture_user($row['user_id'], $row['picture_uri'],$image_conf['height'],$image_conf['size']);
$row['image'] = '<img src="'.$picture['file'].'" '.$picture['style'].' />';
}
$array[$row['user_id']] = $row;
}
return $array;
}
@ -399,7 +407,7 @@ class GroupPortalManager
* @return int access url id
* @return array Database::store_result of the result
* */
function get_url_rel_course_data($access_url_id='')
public static function get_url_rel_course_data($access_url_id='')
{
$where ='';
$table_url_rel_course = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
@ -425,7 +433,7 @@ class GroupPortalManager
* @return int access url id
* @return array Database::store_result of the result
* */
function get_url_rel_session_data($access_url_id='')
public static function get_url_rel_session_data($access_url_id='')
{
$where ='';
$table_url_rel_session = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
@ -454,7 +462,7 @@ class GroupPortalManager
* @param string lock || unlock
* @param int url id
* */
function set_url_status($status, $url_id)
public static function set_url_status($status, $url_id)
{
$url_table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL);
if ($status=='lock') {
@ -477,7 +485,7 @@ class GroupPortalManager
* @return int 0 if there are not relationship otherwise return GROUP_USER_PERMISSION_ADMIN or GROUP_USER_PERMISSION_READER constants
* */
function get_user_group_role($user_id, $group_id)
public static function get_user_group_role($user_id, $group_id)
{
$table_group_rel_user= Database :: get_main_table(TABLE_MAIN_USER_REL_GROUP);
$return_value = 0;
@ -500,7 +508,7 @@ class GroupPortalManager
* @param int url id
* @return boolean true if success
* */
function relation_url_course_exist($course_id, $url_id)
public static function relation_url_course_exist($course_id, $url_id)
{
$table_url_rel_course= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
$sql= "SELECT course_code FROM $table_url_rel_course WHERE access_url_id = ".Database::escape_string($url_id)." AND course_code = '".Database::escape_string($course_id)."'";
@ -516,7 +524,7 @@ class GroupPortalManager
* @param url_id
* @return boolean true if success
* */
function add_user_to_group($user_id, $group_id, $relation_type = GROUP_USER_PERMISSION_READER)
public static function add_user_to_group($user_id, $group_id, $relation_type = GROUP_USER_PERMISSION_READER)
{
$table_url_rel_group = Database :: get_main_table(TABLE_MAIN_USER_REL_GROUP);
if (!empty($user_id) && !empty($group_id)) {
@ -537,7 +545,7 @@ class GroupPortalManager
* @param array of user_ids
* @param array of url_ids
* */
function add_users_to_groups($user_list, $group_list, $relation_type = GROUP_USER_PERMISSION_READER) {
public static function add_users_to_groups($user_list, $group_list, $relation_type = GROUP_USER_PERMISSION_READER) {
$table_url_rel_group = Database :: get_main_table(TABLE_MAIN_USER_REL_GROUP);
$result_array = array();
$relation_type = intval($relation_type);
@ -549,6 +557,7 @@ class GroupPortalManager
if ($role == 0) {
$sql = "INSERT INTO $table_url_rel_group
SET user_id = ".intval($user_id).", group_id = ".intval($group_id).", relation_type = ".intval($relation_type)."";
$result = Database::query($sql, __FILE__, __LINE__);
if ($result)
@ -564,6 +573,7 @@ class GroupPortalManager
/**
* Deletes a group and user relationship
* @author Julio Montoya
@ -571,7 +581,7 @@ class GroupPortalManager
* @param int url id
* @return boolean true if success
* */
function delete_users($group_id)
public static function delete_users($group_id)
{
$table_ = Database :: get_main_table(TABLE_MAIN_USER_REL_GROUP);
$sql = "DELETE FROM $table_ WHERE group_id = ".intval($group_id);
@ -586,7 +596,7 @@ class GroupPortalManager
* @param int url id
* @return boolean true if success
* */
function delete_url_rel_course($course_code, $url_id)
public static function delete_url_rel_course($course_code, $url_id)
{
$table_url_rel_course= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
$sql= "DELETE FROM $table_url_rel_course WHERE course_code = '".Database::escape_string($course_code)."' AND access_url_id=".Database::escape_string($url_id)." ";
@ -601,7 +611,7 @@ class GroupPortalManager
* @param int url id
* @return boolean true if success
* */
function delete_user_rel_group($user_id, $group_id)
public static function delete_user_rel_group($user_id, $group_id)
{
$table = Database :: get_main_table(TABLE_MAIN_USER_REL_GROUP);
$sql= "DELETE FROM $table WHERE user_id = ".intval($user_id)." AND group_id=".intval($group_id)." ";
@ -616,7 +626,7 @@ class GroupPortalManager
* @param array user list
* @param int access_url_id
* */
function update_urls_rel_user($user_list,$access_url_id)
public static function update_urls_rel_user($user_list,$access_url_id)
{
$table_access_url = Database :: get_main_table(TABLE_MAIN_ACCESS_URL);
$table_url_rel_user = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
@ -650,7 +660,7 @@ class GroupPortalManager
* @param int group id
* @param int relation type
* */
function update_user_permission($user_id, $group_id, $relation_type = GROUP_USER_PERMISSION_READER)
public static function update_user_role($user_id, $group_id, $relation_type = GROUP_USER_PERMISSION_READER)
{
$table_group_rel_user = Database :: get_main_table(TABLE_MAIN_USER_REL_GROUP);
$group_id = intval($group_id);
@ -662,14 +672,14 @@ class GroupPortalManager
}
function get_group_admin_list($user_id, $group_id)
public static function get_group_admin_list($user_id, $group_id)
{
$table_group_rel_user = Database :: get_main_table(TABLE_MAIN_USER_REL_GROUP);
$group_id = intval($group_id);
$user_id = intval($user_id);
$sql = "UPDATE $table_group_rel_user
SET relation_type = ".intval($relation_type)." WHERE user_id = $user_id AND group_id = $group_id" ;
echo $sql = "SELECT user_id FROM $table_group_rel_user WHERE
relation_type = ".GROUP_USER_PERMISSION_ADMIN." AND user_id = $user_id AND group_id = $group_id" ;
$result = Database::query($sql, __FILE__, __LINE__);
}
@ -682,7 +692,7 @@ class GroupPortalManager
* @param array user list
* @param int access_url_id
* */
function update_urls_rel_course($course_list,$access_url_id)
public static function update_urls_rel_course($course_list,$access_url_id)
{
$table_course = Database :: get_main_table(TABLE_MAIN_COURSE);
$table_url_rel_course = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
@ -712,7 +722,7 @@ class GroupPortalManager
function get_access_url_from_user($user_id) {
public static function get_access_url_from_user($user_id) {
$table_url_rel_user = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
$table_url = Database :: get_main_table(TABLE_MAIN_ACCESS_URL);
$sql = "SELECT url, access_url_id FROM $table_url_rel_user url_rel_user INNER JOIN $table_url u
@ -726,7 +736,7 @@ class GroupPortalManager
/**
*
* */
function get_url_id($url)
public static function get_url_id($url)
{
$table_access_url= Database :: get_main_table(TABLE_MAIN_ACCESS_URL);
$sql = "SELECT id FROM $table_access_url WHERE url = '".Database::escape_string($url)."'";

@ -139,6 +139,7 @@ class MessageManager
$i = 0;
$message_list = array ();
while ($result = Database::fetch_row($sql_result)) {
var_dump($result);
if ($request===true) {
$message[0] = '<input type="checkbox" value='.$result[0].' name="id[]">';
} else {
@ -146,12 +147,9 @@ class MessageManager
}
if ($request===true) {
if($result[4]==0)
{
if($result[4]==0) {
$message[1] = Display::return_icon('mail_open.png',get_lang('AlreadyReadMessage'));//Message already read
}
else
{
} else {
$message[1] = Display::return_icon('mail.png',get_lang('UnReadMessage'));//Message without reading
}
@ -160,8 +158,13 @@ class MessageManager
$message[5] = '<a onclick="reply_to_messages(\'show\','.$result[0].',\'\')" href="javascript:void(0)">'.Display::return_icon('message_reply.png',get_lang('ReplyToMessage')).'</a>'.
'&nbsp;&nbsp;<a onclick="delete_one_message('.$result[0].')" href="javascript:void(0)" >'.Display::return_icon('message_delete.png',get_lang('DeleteMessage')).'</a>';
} else {
$message[2] = '<a href="view_message.php?id='.$result[0].'">'.GetFullUserName(($result[1])).'</a>';;
$message[3] = '<a href="view_message.php?id='.$result[0].'">'.$result[2].'</a>';
if($result[4]==1) {
$class = 'class = "unread"';
} else {
$class = 'class = "read"';
}
$message[2] = '<a '.$class.' href="view_message.php?id='.$result[0].'">'.GetFullUserName(($result[1])).'</a>';;
$message[3] = '<a '.$class.' href="view_message.php?id='.$result[0].'">'.$result[2].'</a>';
$message[5] = '<a href="new_message.php?re_id='.$result[0].'">'.Display::return_icon('message_reply.png',get_lang('ReplyToMessage')).'</a>'.
'&nbsp;&nbsp;<a delete_one_message('.$result[0].') href="inbox.php?action=deleteone&id='.$result[0].'">'.Display::return_icon('message_delete.png',get_lang('DeleteMessage')).'</a>';
}
@ -466,7 +469,7 @@ class MessageManager
}
$message[4] = $result[3]; //date stays the same
foreach($message as $key => $value) {
$message[$key] = api_xml_http_response_encode($value);
$message[$key] = $value;
}
$message_list[] = $message;
$i++;
@ -489,29 +492,31 @@ class MessageManager
/**
* display message box in the inbox
* @return void
* @return string html with the message content
*/
public static function show_message_box() {
global $charset;
$table_message = Database::get_main_table(TABLE_MESSAGE);
$table_message = Database::get_main_table(TABLE_MESSAGE);
$tbl_message_attach = Database::get_main_table(TABLE_MESSAGE_ATTACHMENT);
$message_id = '';
$message_id = '';
if (isset($_GET['id_send']) && is_numeric($_GET['id_send'])) {
// when I get here ? by Julio Montoya
$query = "SELECT * FROM $table_message WHERE user_sender_id=".api_get_user_id()." AND id=".intval(Database::escape_string($_GET['id_send']))." AND msg_status=4;";
$result = Database::query($query,__FILE__,__LINE__);
$path='outbox.php';
$message_id = intval($_GET['id_send']);
} else {
if (is_numeric($_GET['id'])) {
$query = "UPDATE $table_message SET msg_status = '0' WHERE user_receiver_id=".api_get_user_id()." AND id='".intval(Database::escape_string($_GET['id']))."';";
} else {
if (is_numeric($_GET['id'])) {
$message_id = intval($_GET['id']);
$query = "UPDATE $table_message SET msg_status = '".MESSAGE_STATUS_NEW."' WHERE user_receiver_id=".api_get_user_id()." AND id='".$message_id."';";
$result = Database::query($query,__FILE__,__LINE__);
$query = "SELECT * FROM $table_message WHERE msg_status<>4 AND user_receiver_id=".api_get_user_id()." AND id='".intval(Database::escape_string($_GET['id']))."';";
$result = Database::query($query,__FILE__,__LINE__);
}
$path='inbox.php';
$message_id = intval($_GET['id']);
$query = "SELECT * FROM $table_message WHERE msg_status<>4 AND user_receiver_id=".api_get_user_id()." AND id='".$message_id."';";
$result = Database::query($query,__FILE__,__LINE__);
}
$path='inbox.php';
}
$row = Database::fetch_array($result);
@ -540,17 +545,8 @@ class MessageManager
for ($i=0;$i<count($user_con);$i++)
if ($row[1]==$user_con[$i])
$band=1;
if ($band==1 && !isset($_GET['id_send'])) {
if (is_numeric($_GET['id'])) {
$reply = '<a onclick="reply_to_messages(\'show\','.Security::remove_XSS($_GET['id']).',\'\')" href="javascript:void(0)">'.Display::return_icon('message_reply.png',api_xml_http_response_encode(get_lang('ReplyToMessage'))).api_xml_http_response_encode(get_lang('ReplyToMessage')).'</a>';
}
}
echo '<div class=actions>';
echo '<a onclick="close_div_show(\'div_content_messages\')" href="javascript:void(0)">'.Display::return_icon('folder_up.gif',api_xml_http_response_encode(get_lang('BackToInbox'))).api_xml_http_response_encode(get_lang('BackToInbox')).'</a>';
echo $reply;
echo '<a onclick="delete_one_message('.$row[0].')" href="javascript:void(0)" >'.Display::return_icon('message_delete.png',api_xml_http_response_encode(get_lang('DeleteMessage'))).''.api_xml_http_response_encode(get_lang('DeleteMessage')).'</a>';
echo '</div><br />';
echo '
$message_content = '
<table class="message_view_table" >
<TR>
<TD width=10>&nbsp; </TD>
@ -558,13 +554,25 @@ class MessageManager
<TABLE>
<TR>
<TD width="100%">
<TR> <h1>'.str_replace("\\","",api_xml_http_response_encode($row[5])).'</h1></TR>
<TR> <h1>'.str_replace("\\","",$row[5]).'</h1></TR>
</TD>
<TR>';
if (api_get_setting('allow_social_tool') == 'true') {
$user_image = '';
/* @todo add user image
$user_image = UserManager::get_user_picture_path_by_id($row[1],'web', true,false);
$user_image = UserManager::get_picture_user($row[1], $user_image['file'],'40');
$user_image = '<img src="'.$user_image['file'].'" style="'.$user_image['style'].'" >';
*/
$message_content .='<TD>'.get_lang('From').' '.$user_image.'<a href="'.api_get_path(WEB_PATH).'main/social/profile.php?u='.$row[1].'">'.GetFullUserName($row[1]).'</a> '.api_strtolower(get_lang('To')).'&nbsp;<b>'.get_lang('Me').'</b> </TD>';
} else {
$message_content .='<TD>'.get_lang('From').'&nbsp;'.GetFullUserName($row[1]).'</b> '.api_strtolower(get_lang('To')).' <b>'.get_lang('Me').'</b> </TD>';
}
$message_content .='</TR>
<TR>
<TD>'.api_xml_http_response_encode(get_lang('From').'&nbsp;<b>'.GetFullUserName($row[1]).'</b> '.api_strtolower(get_lang('To')).'&nbsp; <b>'.GetFullUserName($row[2])).'</b> </TD>
</TR>
<TR>
<TD >'.api_xml_http_response_encode(get_lang('Date').'&nbsp; '.$row[4]).'</TD>
<TD >'.get_lang('Date').'&nbsp; '.$row[4].'</TD>
</TR>
</TR>
</TABLE>
@ -572,7 +580,7 @@ class MessageManager
<TABLE height=209 width="100%" bgColor=#ffffff>
<TBODY>
<TR>
<TD vAlign=top>'.str_replace("\\","",api_xml_http_response_encode($row[6])).'</TD>
<TD vAlign=top>'.str_replace("\\","",$row[6]).'</TD>
</TR>
</TBODY>
</TABLE>
@ -581,6 +589,7 @@ class MessageManager
<TD width=10>&nbsp;</TD>
</TR>
</TABLE>';
return $message_content;
}
@ -818,6 +827,7 @@ function inbox_display() {
$table->set_header(3,$title,false);
$table->set_header(4,api_xml_http_response_encode(get_lang('Date')),false,array('style' => 'width:150px;'));
$table->set_header(5,$action,false,array ('style' => 'width:100px;'));
echo '<div id="div_content_table_data">';
if ($request===true) {
echo '<form name="form_send" id="form_send" action="" method="post">';

@ -1,5 +1,5 @@
<?php //$id: $
/* For licensing terms, see /dokeos_license.txt */
/* For licensing terms, see /chamilo_license.txt */
/**
==============================================================================
@ -165,14 +165,16 @@ class SocialManager extends UserManager {
}
}
/**
* get contacts id list
* @author isaac flores paz <florespaz@bidsoftperu.com>
* Gets friends id list
* @param int user id
* @param int group id
* @param string name to search
* @param bool true will load firstname, lastname, and image name
* @return array
* @author Julio Montoya <gugli100@gmail.com> Cleaning code, function renamed, $load_extra_info option added
* @author isaac flores paz <florespaz@bidsoftperu.com>
*/
public static function get_list_id_friends_by_user_id ($user_id,$id_group=null,$search_name=null) {
public static function get_friends($user_id, $id_group=null, $search_name=null, $load_extra_info = true) {
$list_ids_friends=array();
$tbl_my_friend = Database :: get_main_table(TABLE_MAIN_USER_FRIEND);
$tbl_my_user = Database :: get_main_table(TABLE_MAIN_USER);
@ -182,10 +184,16 @@ class SocialManager extends UserManager {
}
if (isset($search_name) && is_string($search_name)===true) {
$sql.=' AND friend_user_id IN (SELECT user_id FROM '.$tbl_my_user.' WHERE '.(api_is_western_name_order() ? 'concat(firstName, lastName)' : 'concat(lastName, firstName)').' like concat("%","'.Database::escape_string($search_name).'","%"));';
}
}
$res=Database::query($sql,__FILE__,__LINE__);
while ($row=Database::fetch_array($res,'ASSOC')) {
$list_ids_friends[]=$row;
if ($load_extra_info == true) {
$path = UserManager::get_user_picture_path_by_id($row['friend_user_id'],'web',false,true);
$my_user_info=api_get_user_info($row['friend_user_id']);
$list_ids_friends[]=array('friend_user_id'=>$row['friend_user_id'],'firstName'=>$my_user_info['firstName'] , 'lastName'=>$my_user_info['lastName'], 'username'=>$my_user_info['username'], 'image'=>$path['file']);
} else {
$list_ids_friends[]=$row;
}
}
return $list_ids_friends;
}
@ -204,7 +212,7 @@ class SocialManager extends UserManager {
$list_path_friend=array();
$array_path_user=array();
$combine_friend = array();
$list_ids = self::get_list_id_friends_by_user_id ($user_id,$id_group,$search_name);
$list_ids = self::get_friends($user_id,$id_group,$search_name);
if (is_array($list_ids)) {
foreach ($list_ids as $values_ids) {
$list_path_image_friend[] = UserManager::get_user_picture_path_by_id($values_ids['friend_user_id'],'web',false,true);
@ -234,7 +242,7 @@ class SocialManager extends UserManager {
/**
* Sends an invitation to contacts
* @author isaac flores paz <florespaz@bidsoftperu.com>
* @author Julio Montya <gugli100@gmail.com> Cleaning code
* @author Julio Montoya <gugli100@gmail.com> Cleaning code
* @param int user id
* @param int user friend id
* @param string title of the message
@ -424,17 +432,20 @@ class SocialManager extends UserManager {
if (count($feeds)==0) { return ''; }
foreach ($feeds as $url) {
if (empty($url)) { continue; }
$rss = fetch_rss($url);
$res .= '<h2>'.$rss->channel['title'].'</h2>';
$res .= '<div class="social-rss-channel-items">';
$i = 1;
foreach ($rss->items as $item) {
if ($limit>=0 and $i>$limit) {break;}
$res .= '<h3><a href="'.$item['link'].'">'.$item['title'].'</a></h3>';
$res .= '<div class="social-rss-item-date">'.api_get_datetime($item['date_timestamp']).'</div>';
$res .= '<div class="social-rss-item-content">'.$item['description'].'</div><br />';
$i++;
}
if (is_array($rss->items)) {
foreach ($rss->items as $item) {
if ($limit>=0 and $i>$limit) {break;}
$res .= '<h3><a href="'.$item['link'].'">'.$item['title'].'</a></h3>';
$res .= '<div class="social-rss-item-date">'.api_get_datetime($item['date_timestamp']).'</div>';
$res .= '<div class="social-rss-item-content">'.$item['description'].'</div><br />';
$i++;
}
}
$res .= '</div>';
}
return $res;

@ -2191,6 +2191,7 @@ class UserManager
* @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 = '') {
$patch_profile = 'upload/users/';
$picture = array();
$picture['style'] = $style;

@ -2,7 +2,7 @@
/* For licensing terms, see /chamilo_license.txt */
// name of the language file that needs to be included
$language_file = array('registration','messages','userInfo','admin','index');
$language_file = array('registration','messages','userInfo');
$cidReset=true;
require_once '../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'message.lib.php';
@ -111,7 +111,6 @@ if (isset($_GET['form_reply']) || isset($_GET['form_delete'])) {
$link_ref="new_message.php";
$table_message = Database::get_main_table(TABLE_MESSAGE);

@ -9,16 +9,21 @@ if (api_get_setting('allow_message_tool')!='true'){
api_not_allowed();
}
/* This page should be deleted */
if(api_get_user_id()!=0) {
echo '<script language="javascript" type="text/javascript" src="'.api_get_path(WEB_CODE_PATH).'messages/cookies.js"> </script> ';
echo '<script language="javascript" type="text/javascript">set_url("'.api_get_path(WEB_CODE_PATH).'messages/notify.php") ; notificar()</script> ';
//echo '<script language="javascript" type="text/javascript" src="'.api_get_path(WEB_CODE_PATH).'messages/cookies.js"> </script> ';
//echo '<script language="javascript" type="text/javascript">set_url("'.api_get_path(WEB_CODE_PATH).'messages/notify.php") ; notificar()</script> ';
$number_of_new_messages = MessageManager::get_new_messages();
if(is_null($number_of_new_messages)) {
$number_of_new_messages = 0;
}
echo "<a href=inbox.php>".get_lang('Inbox')."(<span id=\"nuevos\" style=\"none\">".$number_of_new_messages."</span>)</a>";
/*echo "<a href=inbox.php>".get_lang('Inbox')."(<span id=\"nuevos\" style=\"none\">".$number_of_new_messages."</span>)</a>";
echo " - ";
echo "<a href=new_message.php>".get_lang('ComposeMessage')."</a>";
echo "<a href=new_message.php>".get_lang('ComposeMessage')."</a>";*/
$number_of_new_messages = -1;
if($number_of_new_messages > 0)
{
?>
@ -36,7 +41,7 @@ if(api_get_user_id()!=0) {
<?php
}
} else {
echo '<script language="javascript" type="text/javascript" src="'.api_get_path(WEB_CODE_PATH).'messages/cookies.js"> </script>';
echo '<script language="javascript" type="text/javascript">Set_Cookie( "nuevos", 0, 0, "/","","")</script> ';
//echo '<script language="javascript" type="text/javascript" src="'.api_get_path(WEB_CODE_PATH).'messages/cookies.js"> </script>';
//echo '<script language="javascript" type="text/javascript">Set_Cookie( "nuevos", 0, 0, "/","","")</script> ';
}
?>

@ -1,24 +0,0 @@
#box.aviso
{
position:absolute;
width:200px;
height:60px;
z-index:3;
visibility:hidden;
top:85px;
left:10px;
margin: 0px;
padding: 0px;
}
#table.content
{
border: 1px solid #4171B5;
height:60px;
background-color:#DBEAF5;
filter:alpha(opacity=90);
opacity: 0.90;
}
#ref.content
{
text-align:center;
}

@ -229,8 +229,9 @@ if (isset($_GET['rs'])) {
'url' => '#',
'name' => get_lang('ComposeMessage')
);
$this_section = SECTION_MYPROFILE;
Display::display_header('');
Display::display_header('');
$group_id = intval($_REQUEST['group_id']);
echo '<div class=actions>';

@ -45,19 +45,25 @@ if ( isset($_REQUEST['user_friend']) ) {
if (api_get_setting('allow_message_tool')=='true') {
if ($panel == 1) {
//normal message
$user_info=api_get_user_info($userfriend_id);
echo api_xml_http_response_encode(get_lang('To')); ?> :&nbsp;&nbsp;&nbsp;&nbsp;<?php echo api_xml_http_response_encode(api_get_person_name($user_info['firstName'], $user_info['lastName'])); ?>
<br />
<br /><?php echo api_xml_http_response_encode(get_lang('Subject')); ?> :<br /><input id="txt_subject_id" type="text" style="width:300px;"><br/>
<br /><?php echo api_xml_http_response_encode(get_lang('Message')); ?> :<br /><textarea id="txt_area_invite" rows="4" cols="41"></textarea>
<br /><br />
<button class="save" type="button" value="<?php echo api_xml_http_response_encode(get_lang('SendMessage')); ?>" onclick="action_database_panel('5','<?php echo $userfriend_id;?>')"><?php echo api_xml_http_response_encode(get_lang('SendMessage')) ?></button>
$user_info=api_get_user_info($userfriend_id); ?>
<div id="display_response_id" style="height:200px;">
<?php echo api_xml_http_response_encode(get_lang('To')); ?> :&nbsp;&nbsp;&nbsp;&nbsp;<?php echo api_xml_http_response_encode(api_get_person_name($user_info['firstName'], $user_info['lastName'])); ?>
<br />
<br /><?php echo api_xml_http_response_encode(get_lang('Subject')); ?> :<br /><input id="txt_subject_id" type="text" style="width:300px;"><br/>
<br /><?php echo api_xml_http_response_encode(get_lang('Message')); ?> :<br /><textarea id="txt_area_invite" rows="4" cols="40"></textarea>
<br />
<button class="save" type="button" value="<?php echo api_xml_http_response_encode(get_lang('SendMessage')); ?>" onclick="action_database_panel('5','<?php echo $userfriend_id;?>')"><?php echo api_xml_http_response_encode(get_lang('SendMessage')) ?></button>
</div>
<?php
} else {
// friend invitation message
echo api_xml_http_response_encode(get_lang('AddPersonalMessage')); ?> :<br /><br />
<textarea id="txt_area_invite" rows="5" cols="41"></textarea><br /><br />
<button class="save" type="button" value="<?php echo api_xml_http_response_encode(get_lang('SocialAddToFriends')); ?>" onclick="action_database_panel('4','<?php echo $userfriend_id;?>')" ><?php echo api_xml_http_response_encode(get_lang('SocialAddToFriends')) ?></button>
?>
<div id="display_response_id" style="height:200px;">
<?= api_xml_http_response_encode(get_lang('AddPersonalMessage')); ?> :<br /><br />
<textarea id="txt_area_invite" rows="5" cols="40"></textarea><br /><br />
<button class="save" type="button" value="<?php echo api_xml_http_response_encode(get_lang('SocialAddToFriends')); ?>" onclick="action_database_panel('4','<?php echo $userfriend_id;?>')" >
<?php echo api_xml_http_response_encode(get_lang('SocialAddToFriends')) ?></button>
</div>
<?php
}
}
@ -67,9 +73,4 @@ if ( isset($_REQUEST['user_friend']) ) {
</td>
</tr>
</div>
<tr>
<td>
<div id="display_response_id" style="position:relative"></div>
</td>
</tr>
</table>
</table>

@ -10,61 +10,36 @@ if (api_get_setting('allow_message_tool')!='true'){
api_not_allowed();
}
require_once api_get_path(LIBRARY_PATH).'message.lib.php';
$interbreadcrumb[]= array ('url' => 'inbox.php','name' => get_lang('Message'));
$interbreadcrumb[]= array ('url' => '#','name' => get_lang('View'));
if (isset($_GET['id_send']) || isset($_GET['id'])) {
if (isset($_GET['rs'])) {
$interbreadcrumb[]= array (
'url' => '#',
'name' => get_lang('Messages')
);
$interbreadcrumb[]= array (
'url' => '../social/'.$_SESSION['social_dest'].'?#remote-tab-2',
'name' => get_lang('SocialNetwork')
);
$interbreadcrumb[]= array (
'url' => 'inbox.php',
'name' => get_lang('Inbox')
);
$interbreadcrumb[]= array (
'url' => 'outbox.php',
'name' => get_lang('Outbox')
);
} else {
$interbreadcrumb[]= array (
'url' => '#',
'name' => get_lang('Messages')
);
$interbreadcrumb[]= array (
'url' => 'inbox.php',
'name' => get_lang('Inbox')
);
$interbreadcrumb[]= array (
'url' => 'outbox.php',
'name' => get_lang('Outbox')
);
}
}
/*
==============================================================================
HEADER
==============================================================================
*/
$request=api_is_xml_http_request();
if ($request===false) {
Display::display_header('');
}
//api_display_tool_title(api_xml_http_response_encode(get_lang('ReadMessage')));
if (isset($_GET['id_send'])) {
MessageManager::show_message_box_sent();
$this_section = SECTION_MYPROFILE;
Display::display_header('');
echo '<div class=actions>';
echo '<a href="inbox.php">'.Display::return_icon('folder_up.gif',get_lang('BackToInbox')).get_lang('BackToInbox').'</a>';
echo '<a href="new_message.php?re_id"'.intval($_GET['id']).'">'.Display::return_icon('message_reply.png',get_lang('ReplyToMessage')).get_lang('ReplyToMessage').'</a>';
echo '<a href="inbox.php?action=deleteone&id="'.intval($_GET['id']).'" >'.Display::return_icon('message_delete.png',get_lang('DeleteMessage')).''.get_lang('DeleteMessage').'</a>';
echo '</div><br />';
$message = MessageManager::show_message_box();
if (!empty($message)) {
echo $message;
} else {
MessageManager::show_message_box();
api_not_allowed();
}
/*
==============================================================================
FOOTER
==============================================================================
*/
if ($request===false) {
Display::display_footer();
}
Display::display_footer();
?>

@ -1,6 +1,10 @@
<?php
/* For licensing terms, see /chamilo_license.txt */
/**
* @package dokeos.social
* @author Julio Montoya <gugli100@gmail.com>
*/
$language_file = array('registration','messages','userInfo','admin');
require '../inc/global.inc.php';
require_once api_get_path(CONFIGURATION_PATH).'profile.conf.php';

@ -1,6 +1,10 @@
<?php
/* For licensing terms, see /dokeos_license.txt */
/* For licensing terms, see /chamilo_license.txt */
/**
* @package dokeos.social
* @author Julio Montoya <gugli100@gmail.com>
*/
$language_file = array('registration','messages','userInfo','admin','forum','blog');
require_once '../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php';

@ -1,7 +1,11 @@
<?php
/* For licensing terms, see /dokeos_license.txt */
/* For licensing terms, see /chamilo_license.txt */
/**
* @package dokeos.social
* @author Julio Montoya <gugli100@gmail.com>
*/
$language_file = array('admin');
$language_file = array('userInfo');
require '../inc/global.inc.php';
require_once api_get_path(CONFIGURATION_PATH).'profile.conf.php';
require_once api_get_path(LIBRARY_PATH).'fileManage.lib.php';
@ -10,6 +14,8 @@ require_once api_get_path(LIBRARY_PATH).'image.lib.php';
require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php';
require_once api_get_path(LIBRARY_PATH).'social.lib.php';
api_block_anonymous_users();
$this_section = SECTION_SOCIAL;
$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.js" type="text/javascript" language="javascript"></script>'; //jQuery

@ -1,5 +1,11 @@
<?php
$language_file= 'admin';
/* For licensing terms, see /chamilo_license.txt */
/**
* @package dokeos.social
* @author Julio Montoya <gugli100@gmail.com>
*/
$language_file= 'userInfo';
$cidReset=true;
require_once '../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'/formvalidator/FormValidator.class.php';

@ -1,5 +1,10 @@
<?php
/* For licensing terms, see /dokeos_license.txt */
/* For licensing terms, see /chamilo_license.txt */
/**
* @package dokeos.social
* @author Julio Montoya <gugli100@gmail.com>
*/
$language_file = array('registration','messages','userInfo','admin');
require '../inc/global.inc.php';

@ -1,12 +1,13 @@
<?php // $Id: user_edit.php 22233 2009-07-20 09:54:05Z ivantcholakov $
/* For licensing terms, see /dokeos_license.txt */
<?php
/* For licensing terms, see /chamilo_license.txt */
/**
==============================================================================
* @package dokeos.admin
==============================================================================
*/
* @package dokeos.social
* @author Julio Montoya <gugli100@gmail.com>
*/
// Language files that should be included
$language_file = array('admin');
$language_file = array('userInfo');
$cidReset = true;
include '../inc/global.inc.php';
$this_section = SECTION_SOCIAL;

@ -1,16 +1,21 @@
<?php //$id: $
/* For licensing terms, see /dokeos_license.txt */
/* For licensing terms, see /chamilo_license.txt */
/**
* @package dokeos.social
* @author Julio Montoya <gugli100@gmail.com>
*/
// name of the language file that needs to be included
$language_file=array('registration');
$language_file=array('userInfo');
// resetting the course id
$cidReset=true;
// including some necessary dokeos files
require('../inc/global.inc.php');
require_once ('../inc/lib/xajax/xajax.inc.php');
api_block_anonymous_users();
$xajax = new xajax();
//$xajax->debugOn();
$xajax -> registerFunction ('search_users');
@ -19,8 +24,9 @@ $xajax -> registerFunction ('search_users');
$this_section = SECTION_PLATFORM_ADMIN;
// setting breadcrumbs
$interbreadcrumb[]=array('url' => 'index.php','name' => get_lang('PlatformAdmin'));
$interbreadcrumb[]=array('url' => 'group_list.php','name' => get_lang('GroupList'));
$this_section = SECTION_SOCIAL;
$interbreadcrumb[]= array ('url' =>'home.php','name' => get_lang('Social'));
// Database Table Definitions
$tbl_group = Database::get_main_table(TABLE_MAIN_GROUP);
@ -29,7 +35,7 @@ $tbl_group_rel_user = Database::get_main_table(TABLE_MAIN_USER_REL_GROUP);
// setting the name of the tool
$tool_name = get_lang('SubscribeUsersToGroup');
$group_id = intval($_GET['id']);
$group_id = intval($_REQUEST['id']);
$add_type = 'multiple';
if(isset($_REQUEST['add_type']) && $_REQUEST['add_type']!=''){
@ -37,12 +43,26 @@ if(isset($_REQUEST['add_type']) && $_REQUEST['add_type']!=''){
}
//checking for extra field with filter on
require_once (api_get_path(LIBRARY_PATH).'usermanager.lib.php');
require_once (api_get_path(LIBRARY_PATH).'group_portal_manager.lib.php');
require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php';
require_once api_get_path(LIBRARY_PATH).'group_portal_manager.lib.php';
require_once api_get_path(LIBRARY_PATH).'social.lib.php';
function search_users($needle,$type)
{
//todo @this validation could be in a function in group_portal_manager
if (empty($group_id)) {
api_not_allowed();
} else {
$group_info = GroupPortalManager::get_group_data($group_id);
if (empty($group_info)) {
api_not_allowed();
}
//only admin or moderator can do that
$user_role = GroupPortalManager::get_user_group_role(api_get_user_id(), $group_id);
if (!in_array($user_role, array(GROUP_USER_PERMISSION_ADMIN, GROUP_USER_PERMISSION_MODERATOR))) {
api_not_allowed();
}
}
function search_users($needle,$type) {
global $tbl_user,$tbl_group_rel_user,$group_id;
$xajax_response = new XajaxResponse();
$return = '';
@ -185,43 +205,44 @@ $form_sent=0;
$errorMsg=$firstLetterUser=$firstLetterSession='';
$UserList=$SessionList=array();
$users=$sessions=array();
$noPHP_SELF=true;
$group_info = GroupPortalManager::get_group_data($group_id);
api_block_anonymous_users();
Display :: display_header($tool_name, 'Groups');
SocialManager::show_social_menu();
echo '<div class="actions-title">';
echo get_lang('Invitations');
echo '</div>';
//api_display_tool_title($tool_name.' ('.$session_info['name'].')');
if($_POST['form_sent']) {
$form_sent = $_POST['form_sent'];
$firstLetterUser = $_POST['firstLetterUser'];
$firstLetterSession = $_POST['firstLetterSession'];
$UserList = $_POST['sessionUsersList'];
$ClassList = $_POST['sessionClassesList'];
$user_list = $_POST['sessionUsersList'];
$group_id = intval($_POST['id']);
/*if(!is_array($UserList)) {
$UserList=array();
if(!is_array($user_list)) {
$user_list=array();
}
if ($form_sent == 1) {
GroupPortalManager::delete_users($group_id);
$result = GroupPortalManager::add_users_to_groups($UserList, array($group_id));
Display :: display_confirmation_message(get_lang('UsersEdited'));
if ($form_sent == 1) {
//invite this users
$result = GroupPortalManager::add_users_to_groups($user_list, array($group_id), GROUP_USER_PERMISSION_PENDING_INVITATION_SENT_BY_USER);
$title = 'YouAreInvitedToGroup'.$group_id;
$content = 'YouAreInvitedToGroupContent'.$group_id;
//send invitation message
foreach($user_list as $user_id ){
MessageManager::send_message($user_id, $title, $content);
}
}
*/
}
$nosessionUsersList = $sessionUsersList = array();
/*$sql = 'SELECT COUNT(1) FROM '.$tbl_user;
$rs = Database::query($sql, __FILE__, __LINE__);
$count_courses = Database::result($rs, 0, 0);*/
$ajax_search = $add_type == 'unique' ? true : false;
global $_configuration;
@ -254,152 +275,44 @@ if ($ajax_search) {
$sessionUsersList[$user['user_id']] = $user ;
}
} else {
/*
//Filter by Extra Fields
$use_extra_fields = false;
if (is_array($extra_field_list)) {
if (is_array($new_field_list) && count($new_field_list)>0 ) {
$result_list=array();
foreach ($new_field_list as $new_field) {
$varname = 'field_'.$new_field['variable'];
if (Usermanager::is_extra_field_available($new_field['variable'])) {
if (isset($_POST[$varname]) && $_POST[$varname]!='0') {
$use_extra_fields = true;
$extra_field_result[]= Usermanager::get_extra_user_data_by_value($new_field['variable'], $_POST[$varname]);
}
}
}
}
}
*/
$use_extra_fields =false;
if ($use_extra_fields) {
$final_result = array();
if (count($extra_field_result)>1) {
for($i=0;$i<count($extra_field_result)-1;$i++) {
if (is_array($extra_field_result[$i+1])) {
$final_result = array_intersect($extra_field_result[$i],$extra_field_result[$i+1]);
}
}
} else {
$final_result = $extra_field_result[0];
}
$where_filter ='';
if ($_configuration['multiple_access_urls']==true) {
if (is_array($final_result) && count($final_result)>0) {
$where_filter = " AND u.user_id IN ('".implode("','",$final_result)."') ";
} else {
//no results
$where_filter = " AND u.user_id = -1";
}
} else {
if (is_array($final_result) && count($final_result)>0) {
$where_filter = " WHERE u.user_id IN ('".implode("','",$final_result)."') ";
} else {
//no results
$where_filter = " WHERE u.user_id = -1";
}
}
}
if ($use_extra_fields) {
$sql="SELECT user_id, lastname, firstname, username, group_id
FROM $tbl_user u
LEFT JOIN $tbl_session_rel_user
ON $tbl_session_rel_user.id_user = u.user_id AND id_session = '$id_session'
$where_filter
$order_clause";
} else {
$friends = SocialManager::get_friends(api_get_user_id());
$sql="SELECT u.user_id, lastname, firstname, username, group_id
FROM $tbl_user u
LEFT JOIN $tbl_group_rel_user gu
ON (gu.user_id = u.user_id) AND gu.group_id = $group_id
$order_clause";
}
if ($_configuration['multiple_access_urls']==true) {
$tbl_user_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
$access_url_id = api_get_current_access_url_id();
if ($access_url_id != -1){
$sql="SELECT u.user_id, lastname, firstname, username, id_session
FROM $tbl_user u
LEFT JOIN $tbl_session_rel_user
ON $tbl_session_rel_user.id_user = u.user_id AND id_session = '$id_session'
INNER JOIN $tbl_user_rel_access_url url_user ON (url_user.user_id=u.user_id)
WHERE access_url_id = $access_url_id $where_filter
$order_clause";
}
}
$suggest_friends = false;
$friends = SocialManager::get_list_id_friends_by_user_id(api_get_user_id());
foreach($friends as $friend) {
$user_info=api_get_user_info($friend['friend_user_id']);
$group_friend_list = GroupPortalManager::get_groups_by_user($friend['friend_user_id']);
$friend_group_id = '';
if (isset($group_friend_list[$group_id]) && $group_friend_list[$group_id]['id'] == $group_id) {
$friend_group_id = $group_id;
}
$Users[]=array('user_id' => $friend['friend_user_id'], 'firstname' =>$user_info['firstName'], 'lasttname' => $user_info['lastName'], 'username' =>$user_info['username'],'group_id'=>$friend_group_id );
if (!$friends) {
$suggest_friends = true;
} else {
foreach($friends as $friend) {
$group_friend_list = GroupPortalManager::get_groups_by_user($friend['friend_user_id'], 0);
$friend_group_id = '';
if (isset($group_friend_list[$group_id]) && $group_friend_list[$group_id]['id'] == $group_id) {
$friend_group_id = $group_id;
}
//var_dump ($group_friend_list[$group_id]['relation_type']);
if ($group_friend_list[$group_id]['relation_type'] == '' ) {
$Users[$friend['friend_user_id']]=array('user_id' => $friend['friend_user_id'], 'firstname' =>$friend['firstName'], 'lasttname' => $friend['lastName'], 'username' =>$friend['username'],'group_id'=>$friend_group_id );
}
}
}
// echo $sql;
//$result = Database::query($sql,__FILE__,__LINE__);
//$Users = Database::store_result($result,'ASSOC');
foreach ($Users as $user) {
if($user['group_id'] != $group_id)
$nosessionUsersList[$user['user_id']] = $user ;
}
$user_anonymous=api_get_anonymous_id();
//deleting anonymous users
$user_anonymous = api_get_anonymous_id();
foreach($nosessionUsersList as $key_user_list =>$value_user_list) {
if ($nosessionUsersList[$key_user_list]['user_id']==$user_anonymous) {
unset($nosessionUsersList[$key_user_list]);
}
}
//filling the correct users in list
$sql="SELECT u.user_id, lastname, firstname, username, group_id
FROM $tbl_user u
LEFT JOIN $tbl_group_rel_user
ON $tbl_group_rel_user.user_id = u.user_id AND group_id = '$group_id'
$order_clause";
if ($_configuration['multiple_access_urls']==true) {
$tbl_user_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
$access_url_id = api_get_current_access_url_id();
if ($access_url_id != -1){
$sql="SELECT u.user_id, lastname, firstname, username, id_session
FROM $tbl_user u
LEFT JOIN $tbl_session_rel_user
ON $tbl_session_rel_user.id_user = u.user_id AND id_session = '$id_session'
INNER JOIN $tbl_user_rel_access_url url_user ON (url_user.user_id=u.user_id)
WHERE access_url_id = $access_url_id
$order_clause";
}
}
$result=Database::query($sql,__FILE__,__LINE__);
$Users=Database::store_result($result);
foreach($Users as $key_user_list =>$value_user_list) {
if ($Users[$key_user_list]['user_id']==$user_anonymous) {
unset($Users[$key_user_list]);
}
}
foreach ($Users as $user) {
if($user['group_id'] == $group_id) {
$sessionUsersList[$user['user_id']] = $user;
if (array_key_exists($user['user_id'],$nosessionUsersList))
unset($nosessionUsersList[$user['user_id']]);
}
}
}
if ($add_type == 'multiple') {
$link_add_type_unique = '<a href="'.api_get_self().'?id='.$group_id.'&add='.Security::remove_XSS($_GET['add']).'&add_type=unique">'.Display::return_icon('single.gif').get_lang('SessionAddTypeUnique').'</a>';
$link_add_type_multiple = Display::return_icon('multiple.gif').get_lang('SessionAddTypeMultiple');
@ -459,10 +372,10 @@ if(!empty($errorMsg)) {
<table border="0" cellpadding="5" cellspacing="0" width="100%">
<!-- Users -->
<tr>
<td align="center"><b><?php echo get_lang('UserListInPlatform') ?> :</b>
<td align="center"><b><?php echo get_lang('Friends') ?> :</b>
</td>
<td></td>
<td align="center"><b><?php echo get_lang('UserListInGroup') ?> :</b></td>
<td align="center"><b><?php echo get_lang('SendInvitationTo') ?> :</b></td>
</tr>
<?php if ($add_type=='no') { ?>
@ -519,8 +432,6 @@ if(!empty($errorMsg)) {
} else {
?>
<button class="arrowr" type="button" onclick="moveItem(document.getElementById('origin_users'), document.getElementById('destination_users'))" onclick="moveItem(document.getElementById('origin_users'), document.getElementById('destination_users'))"></button>
<br /><br />
<button class="arrowl" type="button" onclick="moveItem(document.getElementById('destination_users'), document.getElementById('origin_users'))" onclick="moveItem(document.getElementById('destination_users'), document.getElementById('origin_users'))"></button>
<?php
}
?>
@ -546,7 +457,7 @@ unset($sessionUsersList);
<td colspan="3" align="center">
<br />
<?php
echo '<button class="save" type="button" value="" onclick="valide()" >'.get_lang('SubscribeUsersToGroup').'</button>';
echo '<button class="save" type="button" value="" onclick="valide()" >'.get_lang('InviteUsersToGroup').'</button>';
?>
</td>
</tr>
@ -645,6 +556,13 @@ function makepost(select){
</script>
<?php
//current group members
$members = GroupPortalManager::get_users_by_group($group_id,true,array(GROUP_USER_PERMISSION_PENDING_INVITATION_SENT_BY_USER));
echo get_lang('UsersAlreadyInvited');
Display::display_sortable_grid('search_users', array(), $members, array('hide_navigation'=>true, 'per_page' => 100), $query_vars, false, array(true, false, true));
/*
==============================================================================
FOOTER

@ -1,18 +1,40 @@
<?php
/* For licensing terms, see /dokeos_license.txt */
$language_file = array('admin');
/* For licensing terms, see /chamilo_license.txt */
/**
* @package dokeos.social
* @author Julio Montoya <gugli100@gmail.com>
*/
$language_file = array('userInfo');
require '../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'group_portal_manager.lib.php';
require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php';
require_once api_get_path(LIBRARY_PATH).'social.lib.php';
$this_section = SECTION_SOCIAL;
$interbreadcrumb[]= array ('url' =>'home.php','name' => get_lang('Social'));
api_block_anonymous_users();
$group_id = intval($_GET['id']);
//todo @this validation could be in a function in group_portal_manager
if (empty($group_id)) {
api_not_allowed();
} else {
$group_info = GroupPortalManager::get_group_data($group_id);
if (empty($group_info)) {
api_not_allowed();
}
//only admin or moderator can do that
$user_role = GroupPortalManager::get_user_group_role(api_get_user_id(), $group_id);
if (!in_array($user_role, array(GROUP_USER_PERMISSION_ADMIN, GROUP_USER_PERMISSION_MODERATOR))) {
api_not_allowed();
}
}
Display :: display_header($tool_name, 'Groups');
SocialManager::show_social_menu();
echo '<div class="actions-title">';
@ -20,8 +42,7 @@ echo get_lang('GroupMembers');
echo '</div>';
// Group information
$group_id = intval($_GET['id']);
$admins = GroupPortalManager::get_users_by_group($group_id, true,GROUP_USER_PERMISSION_ADMIN);
$admins = GroupPortalManager::get_users_by_group($group_id, true,array(GROUP_USER_PERMISSION_ADMIN));
$show_message = '';
if (isset($_GET['action']) && $_GET['action']=='add') {
@ -29,7 +50,7 @@ if (isset($_GET['action']) && $_GET['action']=='add') {
$user_join = intval($_GET['u']);
//if i'm the admin
if (isset($admins[api_get_user_id()]) && $admins[api_get_user_id()]['relation_type'] == GROUP_USER_PERMISSION_ADMIN) {
GroupPortalManager::update_user_permission($user_join, $group_id);
GroupPortalManager::update_user_role($user_join, $group_id);
$show_message = get_lang('UserAdded');
}
}
@ -44,12 +65,22 @@ if (isset($_GET['action']) && $_GET['action']=='delete') {
}
}
$users = GroupPortalManager::get_users_by_group($group_id, true);
if (isset($_GET['action']) && $_GET['action']=='set_moderator') {
// we add a user only if is a open group
$user_moderator= intval($_GET['u']);
//if i'm the admin
if (isset($admins[api_get_user_id()]) && $admins[api_get_user_id()]['relation_type'] == GROUP_USER_PERMISSION_ADMIN) {
GroupPortalManager::update_user_role($user_moderator, $group_id, GROUP_USER_PERMISSION_MODERATOR);
$show_message = get_lang('UserChangeToModerator');
}
}
if (! empty($show_message)){
Display :: display_normal_message($show_message);
}
$users = GroupPortalManager::get_users_by_group($group_id, true, array(GROUP_USER_PERMISSION_ADMIN, GROUP_USER_PERMISSION_READER, GROUP_USER_PERMISSION_MODERATOR));
$new_member_list = array();
foreach($users as $user) {
@ -58,11 +89,14 @@ foreach($users as $user) {
$user['link'] = Display::return_icon('admin_star.png', get_lang('Admin'));
break;
case GROUP_USER_PERMISSION_READER:
$user['link'] = '<a href="group_members.php?id='.$group_id.'&u='.$user['user_id'].'&action=delete">'.Display::return_icon('delete.png', get_lang('DeleteFromGroup')).'</a><br />'.
'<a href="group_members.php?id='.$group_id.'&u='.$user['user_id'].'&action=set_admin">'.Display::return_icon('delete.png', get_lang('LikeModerator')).'</a>';
$user['link'] = '<a href="group_members.php?id='.$group_id.'&u='.$user['user_id'].'&action=delete">'.Display::return_icon('del_user_big.gif', get_lang('DeleteFromGroup')).'</a><br />'.
'<a href="group_members.php?id='.$group_id.'&u='.$user['user_id'].'&action=set_moderator">'.Display::return_icon('admins.gif', get_lang('AddModerator')).'</a>';
break;
case GROUP_USER_PERMISSION_PENDING_INVITATION:
$user['link'] = '<a href="group_members.php?id='.$group_id.'&u='.$user['user_id'].'&action=add">'.Display::return_icon('pending_invitation.png', get_lang('PendingInvitation')).'</a>';
break;
case GROUP_USER_PERMISSION_MODERATOR:
$user['link'] = Display::return_icon('moderator_star.png', get_lang('Moderator'));
break;
}
$new_member_list[] = $user;

@ -1,13 +1,19 @@
<?php
/* For licensing terms, see /dokeos_license.txt */
$language_file = array('admin');
/* For licensing terms, see /chamilo_license.txt */
/**
* @package dokeos.social
* @author Julio Montoya <gugli100@gmail.com>
*/
$language_file = array('userInfo');
require_once '../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php';
require_once api_get_path(LIBRARY_PATH).'group_portal_manager.lib.php';
require_once api_get_path(LIBRARY_PATH).'social.lib.php';
require_once api_get_path(LIBRARY_PATH).'message.lib.php';
api_block_anonymous_users();
$this_section = SECTION_SOCIAL;
$interbreadcrumb[]= array ('url' =>'home.php','name' => get_lang('Social'));
@ -24,8 +30,7 @@ $group_id = intval($_GET['id']);
$group_info = GroupPortalManager::get_group_data($group_id);
if ($group_id != 0 ) {
if ($group_id != 0 ) {
//Loading group information
if (isset($_GET['status']) && $_GET['status']=='sent') {
Display::display_confirmation_message(get_lang('MessageHasBeenSent'), false);
@ -56,6 +61,7 @@ if ($group_id != 0 ) {
$picture = GroupPortalManager::get_picture_group($group_id, $group_info['picture_uri'],160,'medium_');
$tags = GroupPortalManager::get_group_tags($group_id, true);
$users = GroupPortalManager::get_users_by_group($group_id, true);
//my relation with the group is set here
if (is_array($users[api_get_user_id()]) && count($users[api_get_user_id()]) > 0) {
@ -70,12 +76,15 @@ if ($group_id != 0 ) {
$my_group_role = GROUP_USER_PERMISSION_ANONYMOUS;
}
//@todo this must be move to default.css for dev use only
echo '<style>
#group_members { width:233px; height:300px; overflow-x:none; overflow-y: auto;}
.group_member_item { width:98px; height:86px; float:left; margin:5px 5px 15px 5px; }
.group_member_picture { height:65px; };
.group_member_picture { display:block;
height:92px;
margin:0;
overflow:hidden; };
</style>';
echo '<div id="layout-left" style="float: left; width: 280px; height: 100%;">';
@ -122,7 +131,13 @@ if ($group_id != 0 ) {
if ($user['relation_type'] == GROUP_USER_PERMISSION_ADMIN) {
$user['lastname'].= Display::return_icon('admin_star.png', get_lang('Admin'));
}
echo '<div class="group_member_item"><a href="profile.php?u='.$user['user_id'].'"><div class="group_member_picture">'.$user['picture_uri'].'</div>'.$user['firstname'].$user['lastname'].'</a></div>';
if ($user['relation_type'] == GROUP_USER_PERMISSION_MODERATOR) {
$user['lastname'].= Display::return_icon('moderator_star.png', get_lang('Moderator'));
}
echo '<div class="group_member_item"><a href="profile.php?u='.$user['user_id'].'">';
echo '<div class="group_member_picture">'.$user['image'].'</div>';
echo api_get_person_name($user['firstname'], $user['lastname']).'</a></div>';
}
}
echo '</div>';
@ -144,6 +159,9 @@ if ($group_id != 0 ) {
case GROUP_USER_PERMISSION_PENDING_INVITATION:
echo get_lang('PendingApproval');
break;
case GROUP_USER_PERMISSION_PENDING_INVITATION_SENT_BY_USER:
echo get_lang('PendingApproval');
break;
case GROUP_USER_PERMISSION_MODERATOR:
echo '<a href="group_members.php?id='.$group_id.'">'.get_lang('MemberList').'</a>';
echo '<a href="group_invitation.php?id='.$group_id.'">'.get_lang('InviteFriends').'</a>';

@ -1,11 +1,10 @@
<?php //$id: $
/* For licensing terms, see /dokeos_license.txt */
/* For licensing terms, see /chamilo_license.txt */
/**
* This is the home of a social network user, here we should show the latest info/status of our friends
* @author Julio Montoya <gugli100@gmail.com>
* @package dokeos.social
*/
* @package dokeos.social
* @author Julio Montoya <gugli100@gmail.com>
*/
$language_file = array('registration','messages','userInfo','admin','forum','blog');
$cidReset = true;
require '../inc/global.inc.php';

@ -1,6 +1,10 @@
<?php
/* For licensing terms, see /dokeos_license.txt */
/* For licensing terms, see /chamilo_license.txt */
/**
* @package dokeos.social
* @author Julio Montoya <gugli100@gmail.com>
*/
$cidReset = true;
$language_file = array('registration','messages','userInfo','admin');
require '../inc/global.inc.php';

@ -1,12 +1,16 @@
<?php
/* For licensing terms, see /dokeos_license.txt */
$language_file = array('messages','userInfo','admin');
/* For licensing terms, see /chamilo_license.txt */
/**
* @package dokeos.social
* @author Julio Montoya <gugli100@gmail.com>
*/
$language_file = array('messages','userInfo');
require '../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'image.lib.php';
require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php';
require_once api_get_path(LIBRARY_PATH).'social.lib.php';
require_once api_get_path(LIBRARY_PATH).'group_portal_manager.lib.php';
$this_section = SECTION_SOCIAL;
$interbreadcrumb[]= array ('url' =>'home.php','name' => get_lang('Social'));
@ -61,9 +65,33 @@ SocialManager::show_social_menu();
echo '<div class="actions-title">';
echo get_lang('Invitations');
echo '</div>';
// easy links
if (is_array($_GET) && count($_GET)>0) {
foreach($_GET as $key => $value) {
switch ($key) {
case 'accept':
$user_role = GroupPortalManager::get_user_group_role(api_get_user_id(), $value);
if ($user_role == GROUP_USER_PERMISSION_PENDING_INVITATION_SENT_BY_USER) {
GroupPortalManager::update_user_role(api_get_user_id(), $value, GROUP_USER_PERMISSION_READER);
$show_message = get_lang('UserIsSubscribeToThisGroup');
} else {
$show_message = get_lang('UserIsSubscribeToThisGroup');
}
break 2;
case 'deny':
// delete invitation
GroupPortalManager::delete_user_rel_group(api_get_user_id(), $value);
$show_message = get_lang('GroupInvitationWasDeny');
break 2;
}
}
}
if (! empty($show_message)){
Display :: display_normal_message($show_message);
}
$request = api_is_xml_http_request();
$language_variable = get_lang('PendingInvitations');
$language_comment = get_lang('SocialInvitesComment');
//api_display_tool_title($language_variable);
@ -75,8 +103,7 @@ $user_id = api_get_user_id();
$list_get_invitation = SocialManager::get_list_invitation_of_friends_by_user_id($user_id);
$list_get_invitation_sent = SocialManager::get_list_invitation_sent_by_user_id($user_id);
$pending_invitations = GroupPortalManager::get_groups_by_user($user_id, GROUP_USER_PERMISSION_PENDING_INVITATION,true);
$pending_invitations = GroupPortalManager::get_groups_by_user($user_id, GROUP_USER_PERMISSION_PENDING_INVITATION_SENT_BY_USER,true);
$number_loop=count($list_get_invitation);
@ -89,9 +116,7 @@ echo '<style>
width:110px;
}
</style>';
if ($number_loop==0) {
Display::display_normal_message(get_lang('NoPendingInvitations'));
} else {
if ($number_loop != 0) {
echo '<h2>'.get_lang('InvitationReceived').'</h2>';
foreach ($list_get_invitation as $invitation) {
@ -176,8 +201,18 @@ if (count($list_get_invitation_sent) > 0 ){
}
if (count($pending_invitations) > 0) {
echo '<h2>'.get_lang('GroupsWaitingApproval').'</h2>';
Display::display_sortable_grid('search_users', array(), $pending_invitations, array('hide_navigation'=>true, 'per_page' => 100), $query_vars, false, array(true, true, true,false));
$new_invitation = array();
foreach ($pending_invitations as $invitation) {
$invitation['picture_uri'] = '<a href="groups.php?id='.$invitation['id'].'">'.$invitation['picture_uri'].'</a>';
$invitation['name'] = '<a href="groups.php?id='.$invitation['id'].'">'.$invitation['name'].'</a>';
$invitation['join'] = '<a href="invitations.php?accept='.$invitation['id'].'">'.get_lang('AcceptInvitation').'</a>';
$invitation['deny'] = '<a href="invitations.php?deny='.$invitation['id'].'">'.get_lang('DenyInvitation').'</a>';
$new_invitation[]=$invitation;
}
Display::display_sortable_grid('search_users', array(), $new_invitation, array('hide_navigation'=>true, 'per_page' => 100), $query_vars, false, array(true, true, true,false,false,true,true));
}
Display::display_footer();

@ -272,58 +272,50 @@ echo '<div id="social-profile-wrapper">';
if ($show_full_profile) {
$list_path_friends= $list_path_normal_friends = $list_path_parents = array();
$list_path_good_friends = SocialManager::get_list_path_web_by_user_id($user_id, SOCIALGOODFRIEND);
$list_path_normal_friends = SocialManager::get_list_path_web_by_user_id($user_id, SOCIALFRIEND);
$list_path_parents = SocialManager::get_list_path_web_by_user_id($user_id, SOCIALPARENT);
$list_path_friends = array_merge_recursive($list_path_good_friends, $list_path_normal_friends, $list_path_parents);
$friend_html='';
$number_of_images=3;
$number_friends=0;
$list_friends_id=array();
$list_friends_dir=array();
$list_friends_file=array();
if (count($list_path_friends)!=0) {
$friends_count = count($list_path_friends['id_friend']);
for ($z=0;$z< $friends_count ;$z++) {
$list_friends_id[] = $list_path_friends['id_friend'][$z]['friend_user_id'];
$list_friends_dir[] = $list_path_friends['path_friend'][$z]['dir'];
$list_friends_file[]= $list_path_friends['path_friend'][$z]['file'];
}
$number_friends= count($list_friends_dir);
$number_loop = ($number_friends/$number_of_images);
$loop_friends = ceil($number_loop);
//SOCIALGOODFRIEND , SOCIALFRIEND, SOCIALPARENT
$friends = SocialManager::get_friends($user_id, SOCIALFRIEND);
$friend_html = '';
$number_of_images = 3;
$number_friends = 0;
$list_friends_id = array();
$number_friends = count($friends);
$number_of_images = $number_friends;
if ($number_friends != 0) {
$number_loop = ($number_friends/$number_of_images);
$loop_friends = ceil($number_loop);
$j=0;
$friend_html .= '<div class="sectiontitle">'.get_lang('SocialFriend').'</div>';
$friend_html.= '<div id="friend-container" class="social-friend-container">';
$friend_html .= '<div class="sectiontitle">'.get_lang('SocialFriend').'</div>';
$friend_html .= '<div id="friend-container" class="social-friend-container">';
$friend_html.= '<div id="friend-header">';
//$friend_html.= $friends_count.' '.get_lang('Friends');
if ($friends_count == 1)
$friend_html.= '<div style="float:left;">'.$friends_count.' '.get_lang('Friend').'</div>';
if ($number_friends == 1)
$friend_html.= '<div style="float:left;">'.$number_friends.' '.get_lang('Friend').'</div>';
else
$friend_html.= '<div style="float:left;">'.$friends_count.' '.get_lang('Friends').'</div>';
if (api_get_user_id() == $user_id)
$friend_html.= '<div style="float:right;"><a href="friends.php">'.get_lang('SeeAll').'</a></div>';
$friend_html.= '<div style="float:left;">'.$number_friends.' '.get_lang('Friends').'</div>';
if (api_get_user_id() == $user_id) {
$friend_html.= '<div style="float:right;"><a href="friends.php">'.get_lang('SeeAll').'</a></div>';
}
$friend_html.= '</div>'; // close div friend-header
for ($k=0;$k<$loop_friends;$k++) {
if ($j==$number_of_images) {
$number_of_images=$number_of_images*2;
}
while ($j<$number_of_images) {
if ($list_friends_file[$j]<>"") {
$my_user_info=api_get_user_info($list_friends_id[$j]);
$name_user=api_get_person_name($my_user_info['firstName'], $my_user_info['lastName']);
$friend_html.='<div id=div_'.$list_friends_id[$j].' class="image_friend_network" ><span><center>';
if (isset($friends[$j])) {
$friend = $friends[$j];
$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>';
// the height = 92 must be the sqme in the image_friend_network span style in default.css
$friends_profile = SocialManager::get_picture_user($list_friends_id[$j], $list_friends_file[$j], 92, 'medium_', 'width="85" height="90" ');
$friend_html.='<a href="profile.php?u='.$list_friends_id[$j].'&amp;'.$link_shared.'">';
$friend_html.='<img src="'.$friends_profile['file'].'" '.$friends_profile['style'].' id="imgfriend_'.$list_friends_id[$j].'" title="'.$name_user.'" />';
$friends_profile = SocialManager::get_picture_user($friend['friend_user_id'], $friend['image'], 92, 'medium_', 'width="85" height="90" ');
$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.= '</center></span>';
$friend_html.= '<center class="friend">'.api_get_person_name($my_user_info['firstName'], $my_user_info['lastName']).'</a></center>';
$friend_html.= '<center class="friend">'.$name_user.'</a></center>';
$friend_html.= '</div>';
}
$j++;
@ -339,6 +331,7 @@ echo '<div id="social-profile-wrapper">';
}
$friend_html.= '</div>';
echo $friend_html;
//Pending invitations
if (!isset($_GET['u']) || (isset($_GET['u']) && $_GET['u']==api_get_user_id())) {
$pending_invitations = SocialManager::get_list_invitation_of_friends_by_user_id(api_get_user_id());
@ -465,24 +458,23 @@ echo '<div id="social-profile-container">';
echo '<img src='.$img_array['dir'].$img_array['file'].' /> <br /><br />';
echo '</div>';
echo '</div>';
echo '<br/>';
echo '<div class="actions" style="margin-right:5px;">';
echo '&nbsp;<a href="/main/messages/send_message_to_userfriend.inc.php?height=365&width=610&user_friend='.$user_id.'&view=profile&view_panel=1" class="thickbox" title="'.get_lang('SendMessage').'">'.Display::return_icon('message_new.png').'&nbsp;&nbsp;'.get_lang('SendMessage').'</a><br />';
//check if I already sent an invitation message
$invitation_sent_list = SocialManager::get_list_invitation_sent_by_user_id(api_get_user_id());
if (is_array($invitation_sent_list) && is_array($invitation_sent_list[$user_id]) && count($invitation_sent_list[$user_id]) >0 ) {
echo '<a href="'.api_get_path(WEB_PATH).'main/social/invitations.php">'.get_lang('YouAlreadySentAnInvitation').'</a>';
} else {
if (!$show_full_profile) {
echo '&nbsp;<a href="/main/messages/send_message_to_userfriend.inc.php?view_panel=2&height=300&width=610&user_friend='.$user_id.'" class="thickbox" title="'.get_lang('SendInvitation').'">'.Display :: return_icon('add_multiple_users.gif', get_lang('SocialInvitationToFriends')).'&nbsp;'.get_lang('SendInvitation').'</a>';
}
}
echo '<br/>';
echo '<div class="actions" style="margin-right:5px;">';
echo '&nbsp;<a href="/main/messages/send_message_to_userfriend.inc.php?height=300&width=610&user_friend='.$user_id.'&view=profile&view_panel=1" class="thickbox" title="'.get_lang('SendMessage').'">';
echo Display::return_icon('message_new.png').'&nbsp;&nbsp;'.get_lang('SendMessage').'</a><br />';
//check if I already sent an invitation message
$invitation_sent_list = SocialManager::get_list_invitation_sent_by_user_id(api_get_user_id());
if (is_array($invitation_sent_list) && is_array($invitation_sent_list[$user_id]) && count($invitation_sent_list[$user_id]) >0 ) {
echo '<a href="'.api_get_path(WEB_PATH).'main/social/invitations.php">'.get_lang('YouAlreadySentAnInvitation').'</a>';
} else {
if (!$show_full_profile) {
echo '&nbsp;<a href="/main/messages/send_message_to_userfriend.inc.php?view_panel=2&height=240&width=610&user_friend='.$user_id.'" class="thickbox" title="'.get_lang('SendInvitation').'">'.Display :: return_icon('add_multiple_users.gif', get_lang('SocialInvitationToFriends')).'&nbsp;'.get_lang('SendInvitation').'</a>';
}
}
echo '</div>';
echo '<br />';
@ -693,7 +685,7 @@ echo '<div id="social-profile-container">';
echo '</ul><br />';
$user_feeds = SocialManager::get_user_feeds($user_id);
if (!empty($user_feeds )) {
if (is_array($user_feeds )) {
echo '<div class="sectiontitle">'.get_lang('RSSFeeds').'</div>';
echo '<div class="social-content-training">';
echo $user_feeds;

@ -1,6 +1,10 @@
<?php //$id: $
/* For licensing terms, see /dokeos_license.txt */
/* For licensing terms, see /chamilo_license.txt */
/**
* @package dokeos.social
* @author Julio Montoya <gugli100@gmail.com>
*/
$language_file=array('registration','messages','userInfo','admin');
require_once '../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php';

@ -1,8 +1,10 @@
<?php //$id: $
/* For licensing terms, see /dokeos_license.txt */
/* For licensing terms, see /chamilo_license.txt */
/**
* Provides a short controller for friends registration
* @package dokeos.social
* @author Julio Montoya <gugli100@gmail.com>
*/
// names of the language files that needs to be included
$language_file = array('registration','messages','userInfo','admin');
require '../inc/global.inc.php';

@ -1,8 +1,12 @@
<?php
/* For licensing terms, see /dokeos_license.txt */
/* For licensing terms, see /chamilo_license.txt */
/**
* @package dokeos.social
* @author Julio Montoya <gugli100@gmail.com>
*/
// name of the language file that needs to be included
$language_file = array('registration','admin');
$language_file = array('registration','admin','userInfo');
require_once '../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php';
require_once api_get_path(LIBRARY_PATH).'social.lib.php';

@ -1,6 +1,10 @@
<?php
/* For licensing terms, see /dokeos_license.txt */
/* For licensing terms, see /chamilo_license.txt */
/**
* @package dokeos.social
* @author Julio Montoya <gugli100@gmail.com>
*/
$language_file = array('registration','messages','userInfo','admin');
require '../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'image.lib.php';

@ -1,5 +1,10 @@
<?php
/* For licensing terms, see /dokeos_license.txt */
/* For licensing terms, see /chamilo_license.txt */
/**
* @package dokeos.social
* @author Julio Montoya <gugli100@gmail.com>
*/
$language_file = array('registration','messages','userInfo','admin');
$cidReset = true;
require '../inc/global.inc.php';

@ -1,6 +1,10 @@
<?php
/* For licensing terms, see /dokeos_license.txt */
/* For licensing terms, see /chamilo_license.txt */
/**
* @package dokeos.social
* @author Julio Montoya <gugli100@gmail.com>
*/
$cidReset = true;
require '../inc/global.inc.php';
$language_file = array('registration','messages','userInfo','admin');
@ -10,28 +14,22 @@ require_once api_get_path(LIBRARY_PATH).'fileUpload.lib.php';
require_once api_get_path(LIBRARY_PATH).'image.lib.php';
require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php';
require_once '../inc/lib/social.lib.php';
$list_path_friends=array();
$user_id=api_get_user_id();
$name_search=Security::remove_XSS($_POST['search_name_q']);
$list_path_friends = array();
$user_id = api_get_user_id();
$name_search= Security::remove_XSS($_POST['search_name_q']);
$number_friends = 0;
if (isset($name_search) && $name_search!='undefined') {
$list_path_friends=SocialManager::get_list_path_web_by_user_id($user_id,null,$name_search);
$friends = SocialManager::get_friends($user_id,null,$name_search);
} else {
$list_path_friends=SocialManager::get_list_path_web_by_user_id($user_id);
$friends = SocialManager::get_friends($user_id);
}
$friend_html='';
$number_of_images=8;
$number_friends=0;
$list_friends_id=array();
$list_friends_dir=array();
$list_friends_file=array();
$friend_html = '';
$number_of_images = 8;
if (count($list_path_friends)!=0) {
for ($z=0;$z<count($list_path_friends['id_friend']);$z++) {
$list_friends_id[] = $list_path_friends['id_friend'][$z]['friend_user_id'];
$list_friends_dir[] = $list_path_friends['path_friend'][$z]['dir'];
$list_friends_file[]= $list_path_friends['path_friend'][$z]['file'];
}
$number_friends= count($list_friends_dir);
$number_friends = count($friends);
if ($number_friends != 0) {
$number_loop = ($number_friends/$number_of_images);
$loop_friends = ceil($number_loop);
$j=0;
@ -42,18 +40,13 @@ if (count($list_path_friends)!=0) {
$number_of_images=$number_of_images*2;
}
while ($j<$number_of_images) {
if ($list_friends_file[$j]<>"") {
$user_info=api_get_user_info($list_friends_id[$j]);
$user_name=api_xml_http_response_encode(api_get_person_name($user_info['firstName'], $user_info['lastName']));
$friends_profile = SocialManager::get_picture_user($list_friends_id[$j], $list_friends_file[$j], 92);
if (isset($friends[$j])) {
$friend = $friends[$j];
$user_name = api_xml_http_response_encode($friend['firstName'], $friend['lastName']);
$friends_profile = SocialManager::get_picture_user($friend['friend_user_id'], $friend['image'], 92);
$friend_html.='<div onMouseover="show_icon_delete(this)" onMouseout="hide_icon_delete(this)" class="image-social-content" id=div_'.$list_friends_id[$j].'>';
$friend_html.='<span><a href="profile.php?u='.$list_friends_id[$j].'"><center><img src="'.$friends_profile['file'].'" '.$friends_profile['style'].' id="imgfriend_'.$list_friends_id[$j].'" title="'.$user_name.'" /></center></a></span>';
$friend_html.='<img onclick="delete_friend (this)" id=img_'.$list_friends_id[$j].' src="../img/blank.gif" alt="" title="" class="image-delete" /> <center class="friend">'.$user_name.'</center></div>';
/*
* $friend_html.='&nbsp;<div onMouseover="show_icon_delete(this)" onMouseout="hide_icon_delete(this)" class="image-social-content" id=div_'.$list_friends_id[$j].' style="float:left" >
* <img src="'.$list_friends_dir[$j]."/".$list_friends_file[$j].'" width="90" height="110" style="margin-left:3px ;margin-rigth:3px;margin-top:10px;margin-bottom:3px;" id="imgfriend_'.$list_friends_id[$j].'" title="'.$user_name.'" onclick="qualify_friend(this)"/>
* <img onclick="delete_friend (this)" id=img_'.$list_friends_id[$j].' src="../img/blank.gif" alt="" title="" class="image-delete" /></div>&nbsp;';
*/
$friend_html.='<span><a href="profile.php?u='.$friend['friend_user_id'].'"><center><img src="'.$friends_profile['file'].'" '.$friends_profile['style'].' id="imgfriend_'.$friend['friend_user_id'].'" title="'.$user_name.'" /></center></a></span>';
$friend_html.='<img onclick="delete_friend (this)" id=img_'.$friend['friend_user_id'].' src="../img/blank.gif" alt="" title="" class="image-delete" /> <center class="friend">'.$user_name.'</center></div>';
}
$j++;
}

Loading…
Cancel
Save