Minor - Deleting unuseles functions and files see #190

skala
Julio Montoya 15 years ago
parent 8e8d453613
commit 0dbe793c87
  1. 108
      main/inc/ajax/social.ajax.php
  2. 41
      main/inc/lib/message.lib.php
  3. 6
      main/inc/lib/social.lib.php
  4. 1
      main/messages/inbox.php
  5. 6
      main/messages/index.html
  6. 44
      main/messages/index.php
  7. 4
      main/messages/view_message.php
  8. 73
      main/social/contacts.inc.php
  9. 151
      main/social/data_personal.inc.php
  10. 97
      main/social/group_contact.inc.php
  11. 148
      main/social/personal_data.php
  12. 4
      main/social/profile.php
  13. 64
      main/social/qualify_contact.inc.php
  14. 121
      main/social/select_friend_response.php

@ -92,7 +92,7 @@ switch ($action) {
break;
case 'show_my_friends':
if (api_is_anonymous()){
if (api_is_anonymous()) {
echo '';
break;
}
@ -137,7 +137,111 @@ switch ($action) {
$friend_html.='<br/></table>';
}
echo $friend_html;
break;
break;
case 'delete_friend':
if (api_is_anonymous()){
echo '';
break;
}
$my_current_friend = Security::remove_XSS($_POST['friend_id']);
$my_denied_current_friend= Security::remove_XSS($_POST['denied_friend_id']);
$my_delete_friend = Security::remove_XSS($_POST['delete_friend_id']);
$friend_id_qualify = Security::remove_XSS($_POST['user_id_friend_q']);
$type_friend_qualify = Security::remove_XSS($_POST['type_friend_q']); //filtered?
$is_my_friend = Security::remove_XSS($_POST['is_my_friend']); //filtered?
if (isset($_POST['delete_friend_id'])) {
SocialManager::removed_friend($my_delete_friend);
}
/*
if(isset($_POST['user_id_friend_q']) && isset($_POST['type_friend_q'])) {
SocialManager::qualify_friend($friend_id_qualify,$type_friend_qualify);
echo api_xml_http_response_encode(get_lang('AttachContactsToGroupSuccesfuly'));
}*/
break;
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
$forum_result = get_all_post_from_user($user_id, $course_db);
$all_result_data = 0;
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
$result = get_blog_post_from_user($course_db, $user_id);
if (!empty($result)) {
api_display_tool_title(api_xml_http_response_encode(get_lang('Blog')));
echo '<div class="social-background-content" style="background:#FAF9F6; padding:0px;">';
echo api_xml_http_response_encode($result);
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:
echo '';
}

@ -684,11 +684,11 @@ class MessageManager
<td width=10>&nbsp; </td>
<td vAlign=top width="100%">
<table>
<TR>
<TD width="100%">
<tr>
<td width="100%">
<h1>'.str_replace("\\","",$row[5]).'</h1>
</TD>
<TR>';
</td>
<tr>';
if (api_get_setting('allow_social_tool') == 'true') {
$user_image = '';
/* @todo add user image
@ -697,33 +697,33 @@ class MessageManager
$user_image = '<img src="'.$user_image['file'].'" style="'.$user_image['style'].'" >';
*/
if ($source == 'outbox') {
$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>'.GetFullUserName($row[2]).'</b> </TD>';
$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>'.GetFullUserName($row[2]).'</b> </TD>';
} else {
$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>';
$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 {
if ($source == 'outbox') {
$message_content .='<TD>'.get_lang('From').'&nbsp;'.GetFullUserName($row[1]).'</b> '.api_strtolower(get_lang('To')).' <b>'.GetFullUserName($row[2]).'</b> </TD>';
$message_content .='<td>'.get_lang('From').'&nbsp;'.GetFullUserName($row[1]).'</b> '.api_strtolower(get_lang('To')).' <b>'.GetFullUserName($row[2]).'</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 .='<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 >'.get_lang('Date').'&nbsp; '.$row[4].'</TD>
</TR>
</TR>
</TABLE>
$message_content .='</tr>
<tr>
<td>'.get_lang('Date').'&nbsp; '.$row[4].'</TD>
</tr>
</tr>
</table>
<br />
<TABLE height=209 width="100%" bgColor=#ffffff>
<table height=209 width="100%" bgColor=#ffffff>
<TBODY>
<TR>
<TD vAlign=top class="view-message-content">'.str_replace("\\","",$row[6]).'</TD>
</TR>
</TBODY>
</TABLE>
</table>
<div id="message-attach">'.(!empty($files_attachments)?implode('&nbsp;|&nbsp;',$files_attachments):'').'</div>
<DIV class=HT style="PADDING-BOTTOM: 5px">';
$social_link = '';
@ -735,16 +735,13 @@ class MessageManager
} else {
$message_content .= '<a href="inbox.php?'.$social_link.'">'.Display::return_icon('back.png',get_lang('ReturnToInbox')).get_lang('ReturnToInbox').'</a> &nbsp';
$message_content .= '<a href="new_message.php?re_id='.$message_id.'&'.$social_link.'">'.Display::return_icon('message_reply.png',get_lang('ReplyToMessage')).get_lang('ReplyToMessage').'</a> &nbsp';
}
}
$message_content .= '<a href="inbox.php?action=deleteone&id='.$message_id.'&'.$social_link.'" >'.Display::return_icon('message_delete.png',get_lang('DeleteMessage')).''.get_lang('DeleteMessage').'</a>&nbsp';
$message_content .='</DIV></TD>
$message_content .='</DIV></TD>
<TD width=10></TD>
</TR>
</TABLE>';
</table>';
return $message_content;
}

@ -529,13 +529,13 @@ class SocialManager extends UserManager {
//display course entry
$result .= '<div id="div_'.$count.'">';
//$result .= '<a id="btn_'.$count.'" href="#" onclick="toogle_function(this,\''.$course_database.'\')">';
$result .= '<h2><img src="../img/nolines_plus.gif" id="btn_'.$count.'" onclick="toogle_function(this,\''.$course_database.'\' )">';
//$result .= '<a id="btn_'.$count.'" href="#" onclick="toogle_course(this,\''.$course_database.'\')">';
$result .= '<h2><img src="../img/nolines_plus.gif" id="btn_'.$count.'" onclick="toogle_course(this,\''.$course_database.'\' )">';
$result .= $s_htlm_status_icon;
//show a hyperlink to the course, unless the course is closed and user is not course admin
if ($course_visibility != COURSE_VISIBILITY_CLOSED || $user_in_course_status == COURSEMANAGER) {
$result .= '<a href="javascript:void(0)" id="ln_'.$count.'" onclick=toogle_function(this,\''.$course_database.'\');>&nbsp;'.$course_title.'</a></h2>';
$result .= '<a href="javascript:void(0)" id="ln_'.$count.'" onclick=toogle_course(this,\''.$course_database.'\');>&nbsp;'.$course_title.'</a></h2>';
/*
if(api_get_setting('use_session_mode')=='true' && !$nosession) {
if(empty($my_course['id_session'])) {

@ -4,7 +4,6 @@
* @package dokeos.messages
*/
// name of the language file that needs to be included
$language_file = array('registration','messages','userInfo');
$cidReset=true;

@ -1,6 +0,0 @@
<html>
<head>
</head>
<body>
</body>
</html>

@ -1,45 +1,9 @@
<?php
/* For licensing terms, see /chamilo_license.txt */
$language_file= 'messages';
require_once '../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'message.lib.php';
api_block_anonymous_users();
if (api_get_setting('allow_message_tool')!='true'){
api_not_allowed();
}
/* This page should be deleted */
if(api_get_user_id()!=0) {
$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 " - ";
echo "<a href=new_message.php>".get_lang('ComposeMessage')."</a>";*/
$number_of_new_messages = -1;
if($number_of_new_messages > 0)
{
?>
<div id="box" class="message-content-table">
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="2" id="table" class="content">
<tr>
<td width="28%" height="16" class="content" id="ref"><a style="color:red;font-size:10px" href="javascript:;" onclick="ocultar_aviso()"><?php echo get_lang('Close');?></a></td>
<td width="72%" rowspan="2" class="content" id="ref"><?php echo '<a href="'.$e.'" style="color:#000000" onclick="ocultar_aviso()">'.get_lang('YouHaveNewMessage').'</a>'; ?></td>
</tr>
<tr>
<td class="content" id="ref"><?php Display::return_icon('message_new.gif',get_lang('NewMessage'));?> </td>
</tr>
</table>
</div>
<?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> ';
if (api_get_setting('allow_social_tool')=='true' && api_get_setting('allow_message_tool')=='true') {
header('Location:inbox.php?f=social');
} elseif ( api_get_setting('allow_message_tool')=='true') {
header('Location:inbox.php');
}
?>

@ -4,7 +4,6 @@
* @package dokeos.messages
*/
$language_file = array('registration','messages','userInfo');
$cidReset= true;
require_once '../inc/global.inc.php';
@ -77,8 +76,7 @@ echo '<div id="inbox-wrapper">';
} else {
$id_message = $_GET['id'];
$source = 'inbox';
}
}
$message = MessageManager::show_message_box($id_message,$source);
if (!empty($message)) {
echo $message;

@ -1,73 +0,0 @@
<?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';
require_once api_get_path(LIBRARY_PATH).'fileManage.lib.php';
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';
$this_section = SECTION_MYPROFILE;
$_SESSION['this_section']=$this_section;
//$list_path_friends=array();
$request=api_is_xml_http_request();
$language_variable=api_xml_http_response_encode(get_lang('Contacts'));
//api_display_tool_title($language_variable);
$user_id=api_get_user_id();
$image_path = UserManager::get_user_picture_path_by_id ($user_id,'web',false,true);
?>
<div align="center" >
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="social-content-table">
<tr>
<td width="100%" height="20" valign="top">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="100%" height="20" valign="top"><?php
echo '&nbsp;&nbsp;Dokeos&nbsp;&nbsp;-&nbsp;&nbsp;';
$user_id=api_get_user_id();
$user_info=api_get_user_info($user_id);
echo $name_user=api_xml_http_response_encode(api_get_person_name($user_info['firstName'], $user_info['lastName']));
?></td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="25" valign="top">
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="social-subtitle-search">
<tr>
<td width="100%" height="25" valign="top" class="social-align-box">&nbsp;&nbsp;<?php echo api_xml_http_response_encode(get_lang('Search')) .'&nbsp;&nbsp; : &nbsp;&nbsp;'; ?><input class="social-search-image" type="text" class="search-image" id="id_search_image" name="id_search_image" value="" onkeyup="search_image_social(this)" /></td>
</tr>
</table></td>
</tr>
<tr>
<td height="175" valign="top">
<table width="100%" border="0" cellpadding="0" cellspacing="0" >
<tr>
<td width="100%" height="22" valign="top">
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="social-align-box">
<tr>
<td width="100%" height="22" valign="top">&nbsp;&nbsp;<?php echo api_xml_http_response_encode(get_lang('ContactsList')); ?></td>
</tr>
</table></td>
</tr>
<tr>
<td height="153" valign="top">
<?php
echo '<div id="div_content_table">';
require_once 'show_search_image.inc.php';
echo '</div>';
?>
</td>
</tr>
</table></td>
</tr>
</table>
</div>

@ -1,151 +0,0 @@
<?php
/* 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';
require_once api_get_path(LIBRARY_PATH).'social.lib.php';
require_once api_get_path(LIBRARY_PATH).'course.lib.php';
// @todo here we must show the user information as read only
//User picture size is calculated from SYSTEM path
$user_info= UserManager::get_user_info_by_id(api_get_user_id());
$img_array= UserManager::get_user_picture_path_by_id(api_get_user_id(),'web',true,true);
if (isset($_POST['load_ajax'])) {
require_once api_get_path(LIBRARY_PATH).'blog.lib.php';
require_once api_get_path(SYS_CODE_PATH).'forum/forumfunction.inc.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
$forum_result = get_all_post_from_user($user_id, $course_db);
$all_result_data = 0;
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
$result = get_blog_post_from_user($course_db, $user_id);
if (!empty($result)) {
api_display_tool_title(api_xml_http_response_encode(get_lang('Blog')));
echo '<div class="social-background-content" style="background:#FAF9F6; padding:0px;">';
echo api_xml_http_response_encode($result);
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:
}
} else {
// normal behavior
$request=api_is_xml_http_request();
$language_variable=api_xml_http_response_encode(get_lang('PersonalData'));
//api_display_tool_title($language_variable);
echo '<div class="actions">';
echo '<a href="../auth/profile.php?show=1"">'.Display::return_icon('edit.gif',api_xml_http_response_encode(get_lang('EditInformation'))).'&nbsp;'.api_xml_http_response_encode(get_lang('EditInformation')).'</a>&nbsp;&nbsp;';
if (api_get_setting('allow_social_tool')=='true' && api_get_setting('allow_message_tool')=='true' && api_get_user_id()<>2 && api_get_user_id()<>0) {
echo '<a href="../social/profile.php?shared=true">'.Display::return_icon('shared_profile.png',api_xml_http_response_encode(get_lang('ViewSharedProfile'))).'&nbsp;'.api_xml_http_response_encode(get_lang('ViewSharedProfile')).'</a>';
}
echo '</div>';
echo '<div id="profile_container">';
echo '<div class="social-profile-info" style="float:left;position:relative">';
echo '<dl><dt>'.api_xml_http_response_encode(get_lang('UserName')).'</dt>
<dd>'. api_xml_http_response_encode($user_info['username']).' </dd></dl>';
if (api_is_western_name_order()) {
echo '<dl><dt>'.api_xml_http_response_encode(get_lang('FirstName')).'</dt>
<dd>'. api_xml_http_response_encode($user_info['firstname']).'</dd></dl>';
echo '<dl><dt>'.api_xml_http_response_encode(get_lang('LastName')).'</dt>
<dd>'. api_xml_http_response_encode($user_info['lastname']).'</dd></dl>';
} else {
echo '<dl><dt>'.api_xml_http_response_encode(get_lang('LastName')).'</dt><dd>'. api_xml_http_response_encode($user_info['lastname']).'</dd></dl>';
echo '<dl><dt>'.api_xml_http_response_encode(get_lang('FirstName')).'</dt><dd>'. api_xml_http_response_encode($user_info['firstname']).'</dd></dl>';
}
echo '<dl><dt>'.api_xml_http_response_encode(get_lang('OfficialCode')).'</dt>
<dd>'. api_xml_http_response_encode($user_info['official_code']).'</dd></dl>';
echo '<dl><dt>'.api_xml_http_response_encode(get_lang('Email')).'</dt>
<dd>'. api_xml_http_response_encode($user_info['email']).'</dd></dl>';
echo '<dl><dt>'.api_xml_http_response_encode(get_lang('Phone')).'</dt>
<dd>'. api_xml_http_response_encode($user_info['phone']).'</dd></dl>';
echo '</div>';
echo '<div style="float:left;position:relative">';
echo '<div id="picture" style="width:200px;float:left;position:relative;margin-top:10px;">';
echo '<img src='.$img_array['dir'].$img_array['file'].' />';
echo '</div>';
/*if (api_get_setting('allow_message_tool')=='true') {
require_once api_get_path(LIBRARY_PATH).'message.lib.php';
$number_of_new_messages = MessageManager::get_new_messages();
$number_of_outbox_message=MessageManager::get_number_of_messages_sent();
$cant_out_box=' ('.$number_of_outbox_message.')';
$cant_msg = ' ('.$number_of_new_messages.')';
$number_of_new_messages_of_friend=SocialManager::get_message_number_invitation_by_user_id(api_get_user_id());
//echo '<div class="message-view" style="display:none;">'.get_lang('ViewMessages').'</div>';
echo '<div class="message-content" style="float:right" >
<h2 class="message-title" style="margin-top:0">'.get_lang('Messages').'</h2>
<p>
<a href="../social/index.php#remote-tab-2" class="message-body">'.get_lang('Inbox').$cant_msg.' </a><br />
<a href="../social/index.php#remote-tab-3" class="message-body">'.get_lang('Outbox').$cant_out_box.'</a><br />
</p>';
echo '<img src="../img/delete.gif" alt="'.get_lang('Close').'" title="'.get_lang('Close').'" class="message-delete" onclick="delete_message_js()" />';
if ($number_of_new_messages_of_friend>0) {
echo '<br/>';
}
echo '</div>';
}*/
echo '</div>';
}
?>

@ -1,97 +0,0 @@
<?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';
require_once api_get_path(LIBRARY_PATH).'fileManage.lib.php';
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';
$this_section = SECTION_MYPROFILE;
$_SESSION['this_section']=$this_section;
$list_path_friends=array();
$list_groups=array();
$request=api_is_xml_http_request();
$language_variable=api_xml_http_response_encode(get_lang('ContactsGroups'));
//api_display_tool_title($language_variable);
$user_id=api_get_user_id();
$list_groups=SocialManager::show_list_type_friends();
for ($p=0;$p<count($list_groups);$p++) {
$list_path_friends=SocialManager::get_list_path_web_by_user_id ($user_id,$list_groups[$p]['id']);
?>
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="data_table">
<tr>
<th align="left" id="<?php echo 'td_'.$list_groups[$p]['id']; ?>" style="cursor:pointer" valign="top" onclick="toogle_function(this)">
<?php echo api_xml_http_response_encode(get_lang($list_groups[$p]['title'])); ?>
</th>
<th width="30" align="center">
<?php Display::display_icon('visible.gif',api_xml_http_response_encode(get_lang('ChangeVisibility')), array('id'=>'btn_'.$list_groups[$p]['id'])); ?>
<input type="hidden" class="hidden" id="id_hd_dame" name="hd_dame" value="0" />
</th>
</tr>
<tr>
<td colspan="2">
<div align="center" id="<?php echo 'div_group_'.$list_groups[$p]['id']; ?>" >
<?php
$friend_html='';
$number_of_images=10;
$number_friends=0;
$list_friends_id=array();
$list_friends_dir=array();
$list_friends_file=array();
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_loop = ($number_friends/$number_of_images);
$loop_friends = ceil($number_loop);
$j=0;//<div id="div_groupid_"'.$list_groups[$p]['id'].'">
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]<>"") {
$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']));
if($list_friends_file[$j]==='unknown.jpg') {
$big='';
} else {
$big='big_';
}
$friends_profile = SocialManager::get_picture_user($list_friends_id[$j], $list_friends_file[$j], 92);
$friend_html.='<div id="div_'.$list_friends_id[$j].'" class="image_friend_network">' .
'<a href="javascript:void(0)" onclick=load_thick("'.$list_friends_dir[$j].$big.$list_friends_file[$j].'","") title="" class="thickbox">' .
'<span><center><img src="'.$friends_profile['file'].'" '.$friends_profile['style'].' id="imgfriend_'.$list_friends_id[$j].'" title="'.api_xml_http_response_encode($user_name).'" /></center></span>'.
'<center class="friend">'.api_xml_http_response_encode($user_name).'</center>'.
'</a></div>';
}
$j++;
}
}
echo $friend_html;
}
else {
echo api_xml_http_response_encode(get_lang('YouDontHaveContactsInThisGroup'));
}
?>
</div>
</td>
</tr>
</table>
<?php
}
?>

@ -1,148 +0,0 @@
<?php
/* For licensing terms, see /dokeos_license.txt */
$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';
require_once api_get_path(LIBRARY_PATH).'social.lib.php';
require_once api_get_path(LIBRARY_PATH).'course.lib.php';
Display :: display_header('');
// @todo here we must show the user information as read only
//User picture size is calculated from SYSTEM path
$user_info= UserManager::get_user_info_by_id(api_get_user_id());
$img_array= UserManager::get_user_picture_path_by_id(api_get_user_id(),'web',true,true);
if (isset($_POST['load_ajax'])) {
require_once api_get_path(LIBRARY_PATH).'blog.lib.php';
require_once api_get_path(SYS_CODE_PATH).'forum/forumfunction.inc.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
$forum_result = get_all_post_from_user($user_id, $course_db);
$all_result_data = 0;
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
$result = get_blog_post_from_user($course_db, $user_id);
if (!empty($result)) {
echo '<div class="clear"></div><br />';
api_display_tool_title(api_xml_http_response_encode(get_lang('BlogPosts')));
echo '<div class="social-background-content" style="background:#FAF9F6; padding:0px;">';
echo api_xml_http_response_encode($result);
echo '</div>';
echo '<br />';
$all_result_data++;
}
//------Blog comments
$result = get_blog_comment_from_user($course_db, $user_id);
if (!empty($result)) {
api_display_tool_title(api_xml_http_response_encode(get_lang('BlogComments')));
echo '<div class="social-background-content" style="background:#FAF9F6; padding:0px;">';
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:
}
} else {
// normal behavior
$request=api_is_xml_http_request();
$language_variable=api_xml_http_response_encode(get_lang('PersonalData'));
//api_display_tool_title($language_variable);
echo '<div class="actions">';
echo '<a href="../auth/profile.php?show=1"">'.Display::return_icon('edit.gif',api_xml_http_response_encode(get_lang('EditInformation'))).'&nbsp;'.api_xml_http_response_encode(get_lang('EditInformation')).'</a>&nbsp;&nbsp;';
if (api_get_setting('allow_social_tool')=='true' && api_get_setting('allow_message_tool')=='true' && api_get_user_id()<>2 && api_get_user_id()<>0) {
echo '<a href="../social/profile.php?shared=true">'.Display::return_icon('shared_profile.png',api_xml_http_response_encode(get_lang('ViewSharedProfile'))).'&nbsp;'.api_xml_http_response_encode(get_lang('ViewSharedProfile')).'</a>';
}
echo '</div>';
echo '<div id="profile_container">';
echo '<div class="social-profile-info" style="float:left;position:relative">';
echo '<dl><dt>'.api_xml_http_response_encode(get_lang('UserName')).'</dt>
<dd>'. api_xml_http_response_encode($user_info['username']).' </dd></dl>';
if (api_is_western_name_order()) {
echo '<dl><dt>'.api_xml_http_response_encode(get_lang('FirstName')).'</dt>
<dd>'. api_xml_http_response_encode($user_info['firstname']).'</dd></dl>';
echo '<dl><dt>'.api_xml_http_response_encode(get_lang('LastName')).'</dt>
<dd>'. api_xml_http_response_encode($user_info['lastname']).'</dd></dl>';
} else {
echo '<dl><dt>'.api_xml_http_response_encode(get_lang('LastName')).'</dt><dd>'. api_xml_http_response_encode($user_info['lastname']).'</dd></dl>';
echo '<dl><dt>'.api_xml_http_response_encode(get_lang('FirstName')).'</dt><dd>'. api_xml_http_response_encode($user_info['firstname']).'</dd></dl>';
}
echo '<dl><dt>'.api_xml_http_response_encode(get_lang('OfficialCode')).'</dt>
<dd>'. api_xml_http_response_encode($user_info['official_code']).'</dd></dl>';
echo '<dl><dt>'.api_xml_http_response_encode(get_lang('Email')).'</dt>
<dd>'. api_xml_http_response_encode($user_info['email']).'</dd></dl>';
echo '<dl><dt>'.api_xml_http_response_encode(get_lang('Phone')).'</dt>
<dd>'. api_xml_http_response_encode($user_info['phone']).'</dd></dl>';
echo '</div>';
echo '<div style="float:left;position:relative">';
echo '<div id="picture" style="width:200px;float:left;position:relative;margin-top:10px;">';
echo '<img src='.$img_array['dir'].$img_array['file'].' />';
echo '</div>';
/*if (api_get_setting('allow_message_tool')=='true') {
require_once api_get_path(LIBRARY_PATH).'message.lib.php';
$number_of_new_messages = MessageManager::get_new_messages();
$number_of_outbox_message=MessageManager::get_number_of_messages_sent();
$cant_out_box=' ('.$number_of_outbox_message.')';
$cant_msg = ' ('.$number_of_new_messages.')';
$number_of_new_messages_of_friend=SocialManager::get_message_number_invitation_by_user_id(api_get_user_id());
//echo '<div class="message-view" style="display:none;">'.get_lang('ViewMessages').'</div>';
echo '<div class="message-content" style="float:right" >
<h2 class="message-title" style="margin-top:0">'.get_lang('Messages').'</h2>
<p>
<a href="../social/index.php#remote-tab-2" class="message-body">'.get_lang('Inbox').$cant_msg.' </a><br />
<a href="../social/index.php#remote-tab-3" class="message-body">'.get_lang('Outbox').$cant_out_box.'</a><br />
</p>';
echo '<img src="../img/delete.gif" alt="'.get_lang('Close').'" title="'.get_lang('Close').'" class="message-delete" onclick="delete_message_js()" />';
if ($number_of_new_messages_of_friend>0) {
echo '<br/>';
}
echo '</div>';
}*/
echo '</div>';
}
?>

@ -67,7 +67,7 @@ $htmlHeadXtra[] = '<script type="text/javascript" src="'.api_get_path(WEB_LIBRAR
$htmlHeadXtra[] = '<link rel="stylesheet" href="'.api_get_path(WEB_LIBRARY_PATH).'javascript/thickbox.css" type="text/css" media="projection, screen">';
$htmlHeadXtra[] = '
<script type="text/javascript">
function toogle_function (element_html, course_code){
function toogle_course (element_html, course_code){
elem_id=$(element_html).attr("id");
id_elem=elem_id.split("_");
ident="div#div_group_"+id_elem[1];
@ -91,7 +91,7 @@ function toogle_function (element_html, course_code){
beforeSend: function(objeto) {
$("div#"+content).html("<img src=\'../inc/lib/javascript/indicator.gif\' />"); },
type: "POST",
url: "../social/data_personal.inc.php",
url: "'.api_get_path(WEB_AJAX_PATH).'social.ajax.php?a=toogle_course",
data: "load_ajax="+id_elem+"&action="+action+"&course_code="+course_code,
success: function(datos) {
//$("div#"+name_div_id).hide("slow");

@ -1,64 +0,0 @@
<?php //$id: $
/* 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';
require_once '../inc/lib/social.lib.php';
$user_friend=(int)$_POST['user_friend'];
$list_of_options=array();
$img_user=array();
$img_info_user=array();
$list_of_options=SocialManager::show_list_type_friends();
$path_user=str_replace(array('\\','../','\\0'),array('','',''),$_GET['path_user']);
$img_user =explode('"',$path_user);
$number_list=count($list_of_options);
$user_friend = $user_id = (int)str_replace(array('\\','"'),array('',''),$_GET['id_user']);
$user_info=api_get_user_info($user_friend);
$user_friend_relation=SocialManager::get_relation_between_contacts(api_get_user_id(),$user_friend);
?>
<input type="hidden" name="user_cod_qualify" id="user_cod_qualify" value="<?php echo $user_friend; ?>"/>
<table width="600" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<table width="600" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="600" align="left">
<td width="50%"><br/>
<img src="<?php echo Security::remove_XSS($img_user[1]); ?>" />
<?php
echo '<br /><br />'.$name_user=api_xml_http_response_encode(api_get_person_name($user_info['firstName'], $user_info['lastName']));
?>
</td>
<td width="50%"><div align="left">
<?php
for ($k=0;$k<$number_list;$k++) {
echo '<br />';
if ($list_of_options[$k]['id']==$user_friend_relation) {
$check='checked="checked"';
} else {
$check='';
}
?>
<input <?php echo $check; ?> style="margin-left:50px" type="radio" class="radio" name="list_type_friend" value="<?php echo api_xml_http_response_encode($list_of_options[$k]['id']); ?>" />
<?php
echo api_xml_http_response_encode(get_lang($list_of_options[$k]['title']));
echo '<br />';
?>
<?php
}
echo '<br />';
?>
<button style="margin-left:50px" type="button" class="save" value="<?php echo api_xml_http_response_encode(get_lang('AttachToGroup')); ?>" onclick="set_qualify_friend()"><?php echo api_xml_http_response_encode(get_lang('AttachToGroup')) ?></button>
</div></td>
</td>
</tr>
</table>
</td>
</tr>
</table>

@ -1,121 +0,0 @@
<?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(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';
$this_section = SECTION_MYPROFILE;
$_SESSION['this_section']=$this_section;
api_block_anonymous_users();
$request=api_is_xml_http_request();
$language_variable=api_xml_http_response_encode(get_lang('PendingInvitations'));
$language_comment=api_xml_http_response_encode(get_lang('SocialInvitesComment'));
//api_display_tool_title($language_variable);
?>
<div id="id_response" align="center"></div>
<?php
$list_get_invitation=array();
$list_get_path_web=array();
$user_id=api_get_user_id();
$list_get_invitation=SocialManager::get_list_invitation_of_friends_by_user_id($user_id);
$list_get_path_web=SocialManager::get_list_web_path_user_invitation_by_user_id($user_id);
$number_loop=count($list_get_invitation);
if ($number_loop==0) {
Display::display_normal_message(api_xml_http_response_encode(get_lang('YouDontHaveInvites')));
}
for ($i=0;$i<$number_loop;$i++) {
?>
<div id="<?php echo 'id_'.$list_get_invitation[$i]['user_sender_id'] ?>" align="center">
<table width="600" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="600" height="20" valign="top"><table width="100%" border="0"
cellpadding="0" cellspacing="0" bgcolor="#9DACBF">
<tr>
<td width="600" height="20" valign="top" style="padding:4px;"><div align="left"><b><?php echo api_xml_http_response_encode(get_lang('RequestContact')); ?></b></div></td>
</tr>
</table></td>
</tr>
<tr>
<td height="135" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="600" height="135" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="600" height="110" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="100" height="110" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#C8D5E4">
<tr>
<td width="100" height="110" style="padding:4px;" >
<?php $friends_profile = SocialManager::get_picture_user($list_get_invitation[$i]['user_sender_id'], $list_get_path_web[$i]['file'], 92); ?>
<center><img src="<?php echo $friends_profile['file']; ?>" <?php echo $friends_profile['style']; ?> /></center></td>
</tr>
</table></td>
<td width="500" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td width="500" height="22" valign="top">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="500" height="22" valign="top" style="padding:2px;">
<?php
$user_id=$list_get_invitation[$i]['user_sender_id'];
$user_info=api_get_user_info($user_id);
echo api_xml_http_response_encode(api_get_person_name($user_info['firstName'], $user_info['lastName']));
?></td>
</tr>
</table></td>
</tr>
<tr>
<td height="5" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="500" height="5"></td>
</tr>
</table></td>
</tr>
<tr>
<td height="22" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="500" height="22" valign="top" style="padding:2px;"><?php
$title=get_lang($list_get_invitation[$i]['title']);
$content=get_lang($list_get_invitation[$i]['content']);
echo api_xml_http_response_encode($title.' : '.$content);
?> </td>
</tr>
</table></td>
</tr>
<tr>
<td height="61" valign="top" style="padding:2px;"><?php
$date=$list_get_invitation[$i]['send_date'];
echo api_xml_http_response_encode(get_lang('DateSend').' : '.$date);
?></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<tr>
<td height="25" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#9DACBF">
<tr>
<td width="600" height="25" valign="top" style="padding:4px;"><div align="right">
<button class="save" name="btn_accepted" type="submit" id="<?php echo "btn_accepted_".$user_id ?>" value="<?php echo api_xml_http_response_encode(get_lang('Accept'));?>"onclick="javascript:register_friend(this)"><?php echo api_xml_http_response_encode(get_lang('Accept')) ?></button>
<button class="cancel" name="btn_denied" type="submit" id="<?php echo "btn_deniedst_".$user_id ?>" value="<?php echo api_xml_http_response_encode(get_lang('Deny')); ?>" onclick="javascript:denied_friend(this)" ><?php echo api_xml_http_response_encode(get_lang('Deny'))?></button>
</div></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table>
</div>
<br/>
<?php
}
Loading…
Cancel
Save