Social network improvements see #5508

skala
Julio Montoya 15 years ago
parent e8790bfb9a
commit dcf6c5f4a3
  1. 673
      main/admin/add_users_to_group.php
  2. 148
      main/admin/group_add.php
  3. 143
      main/admin/group_edit.php
  4. 439
      main/admin/group_list.php
  5. 27
      main/admin/index.php
  6. 27
      main/auth/profile.php
  7. 17
      main/inc/banner.inc.php
  8. 2
      main/inc/header.inc.php
  9. 17
      main/inc/lib/database.lib.php
  10. 50
      main/inc/lib/display.lib.php
  11. 1054
      main/inc/lib/group_portal_manager.lib.php
  12. 1
      main/inc/lib/main_api.lib.php
  13. 109
      main/inc/lib/message.lib.php
  14. 247
      main/inc/lib/social.lib.php
  15. 102
      main/inc/lib/sortabletable.class.php
  16. 257
      main/inc/lib/usermanager.lib.php
  17. 33
      main/install/dokeos_main.sql
  18. 2
      main/install/migrate-db-1.8.6.1-1.8.6.2-pre.sql
  19. 60
      main/messages/inbox.php
  20. 26
      main/messages/index.php
  21. 23
      main/messages/message.class.php
  22. 10
      main/messages/new_message.php
  23. 26
      main/messages/notify.php
  24. 11
      main/messages/outbox.php
  25. 4
      main/messages/send_message.php
  26. 2
      main/social/data_personal.inc.php
  27. 150
      main/social/friends.php
  28. 78
      main/social/group_add.php
  29. 8
      main/social/group_contact.inc.php
  30. 17
      main/social/group_invitation.php
  31. 120
      main/social/groups.php
  32. 611
      main/social/home.php
  33. 431
      main/social/index.php
  34. 128
      main/social/invitations.php
  35. 148
      main/social/personal_data.php
  36. 290
      main/social/profile.php
  37. 4
      main/social/qualify_contact.inc.php
  38. 12
      main/social/register_friend.php
  39. 330
      main/social/search.php
  40. 6
      main/social/select_friend_response.php
  41. 6
      main/social/show_search_image.inc.php
  42. 14
      whoisonline.php

@ -0,0 +1,673 @@
<?php //$id: $
/* For licensing terms, see /dokeos_license.txt */
/**
==============================================================================
* @package dokeos.admin
==============================================================================
*/
// name of the language file that needs to be included
$language_file=array('admin','registration');
// resetting the course id
$cidReset=true;
// including some necessary dokeos files
require('../inc/global.inc.php');
require_once ('../inc/lib/xajax/xajax.inc.php');
$xajax = new xajax();
//$xajax->debugOn();
$xajax -> registerFunction ('search_users');
// setting the section (for the tabs)
$this_section = SECTION_PLATFORM_ADMIN;
// Access restrictions
api_protect_admin_script(true);
// setting breadcrumbs
$interbreadcrumb[]=array('url' => 'index.php','name' => get_lang('PlatformAdmin'));
$interbreadcrumb[]=array('url' => 'group_list.php','name' => get_lang('GroupList'));
// Database Table Definitions
$tbl_group = Database::get_main_table(TABLE_MAIN_GROUP);
$tbl_user = Database::get_main_table(TABLE_MAIN_USER);
$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']);
$add_type = 'single';
if(isset($_REQUEST['add_type']) && $_REQUEST['add_type']!=''){
$add_type = Security::remove_XSS($_REQUEST['add_type']);
}
/*
if (!api_is_platform_admin()) {
$sql = 'SELECT session_admin_id FROM '.Database :: get_main_table(TABLE_MAIN_SESSION).' WHERE id='.$id_session;
$rs = Database::query($sql,__FILE__,__LINE__);
if(Database::result($rs,0,0)!=$_user['user_id']) {
api_not_allowed(true);
}
}*/
//checking for extra field with filter on
include_once (api_get_path(LIBRARY_PATH).'usermanager.lib.php');
include_once (api_get_path(LIBRARY_PATH).'group_portal_manager.lib.php');
function search_users($needle,$type)
{
global $tbl_user,$tbl_group_rel_user,$group_id;
$xajax_response = new XajaxResponse();
$return = '';
if (!empty($needle) && !empty($type)) {
// xajax send utf8 datas... datas in db can be non-utf8 datas
$charset = api_get_setting('platform_charset');
$needle = Database::escape_string($needle);
$needle = api_convert_encoding($needle, $charset, 'utf-8');
$user_anonymous=api_get_anonymous_id();
$order_clause = api_sort_by_first_name() ? ' ORDER BY firstname, lastname, username' : ' ORDER BY lastname, firstname, username';
$cond_user_id = '';
if (!empty($id_session)) {
$group_id = Database::escape_string($group_id);
// check id_user from session_rel_user table
$sql = 'SELECT id_user FROM '.$tbl_group_rel_user.' WHERE group_id ="'.(int)$group_id.'"';
$res = Database::query($sql,__FILE__,__LINE__);
$user_ids = array();
if (Database::num_rows($res) > 0) {
while ($row = Database::fetch_row($res)) {
$user_ids[] = (int)$row[0];
}
}
if (count($user_ids) > 0){
$cond_user_id = ' AND user_id NOT IN('.implode(",",$user_ids).')';
}
}
if ($type == 'single') {
// search users where username or firstname or lastname begins likes $needle
$sql = 'SELECT user_id, username, lastname, firstname FROM '.$tbl_user.' user
WHERE (username LIKE "'.$needle.'%"
OR firstname LIKE "'.$needle.'%"
OR lastname LIKE "'.$needle.'%") AND user_id<>"'.$user_anonymous.'"'.
$order_clause.
' LIMIT 11';
} else {
$sql = 'SELECT user_id, username, lastname, firstname FROM '.$tbl_user.' user
WHERE '.(api_sort_by_first_name() ? 'firstname' : 'lastname').' LIKE "'.$needle.'%" AND user_id<>"'.$user_anonymous.'"'.$cond_user_id.
$order_clause;
}
global $_configuration;
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){
if ($type == 'single') {
$sql = 'SELECT user.user_id, username, lastname, firstname FROM '.$tbl_user.' user
INNER JOIN '.$tbl_user_rel_access_url.' url_user ON (url_user.user_id=user.user_id)
WHERE access_url_id = '.$access_url_id.' AND (username LIKE "'.$needle.'%"
OR firstname LIKE "'.$needle.'%"
OR lastname LIKE "'.$needle.'%") AND user.user_id<>"'.$user_anonymous.'"'.
$order_clause.
' LIMIT 11';
} else {
$sql = 'SELECT user.user_id, username, lastname, firstname FROM '.$tbl_user.' user
INNER JOIN '.$tbl_user_rel_access_url.' url_user ON (url_user.user_id=user.user_id)
WHERE access_url_id = '.$access_url_id.'
AND '.(api_sort_by_first_name() ? 'firstname' : 'lastname').' LIKE "'.$needle.'%" AND user.user_id<>"'.$user_anonymous.'"'.$cond_user_id.
$order_clause;
}
}
}
$rs = Database::query($sql, __FILE__, __LINE__);
$i=0;
if ($type=='single') {
while ($user = Database :: fetch_array($rs)) {
$i++;
if ($i<=10) {
$person_name = api_get_person_name($user['firstname'], $user['lastname']);
$return .= '<a href="javascript: void(0);" onclick="javascript: add_user(\''.$user['user_id'].'\',\''.$person_name.' ('.$user['username'].')'.'\')">'.$person_name.' ('.$user['username'].')</a><br />';
} else {
$return .= '...<br />';
}
}
$xajax_response -> addAssign('ajax_list_users_single','innerHTML',api_utf8_encode($return));
} else {
global $nosessionUsersList;
$return .= '<select id="origin_users" name="nosessionUsersList[]" multiple="multiple" size="15" style="width:360px;">';
while ($user = Database :: fetch_array($rs)) {
$person_name = api_get_person_name($user['firstname'], $user['lastname']);
$return .= '<option value="'.$user['user_id'].'">'.$person_name.' ('.$user['username'].')</option>';
}
$return .= '</select>';
$xajax_response -> addAssign('ajax_list_users_multiple','innerHTML',api_utf8_encode($return));
}
}
return $xajax_response;
}
$xajax -> processRequests();
$htmlHeadXtra[] = $xajax->getJavascript('../inc/lib/xajax/');
$htmlHeadXtra[] = '
<script type="text/javascript">
function add_user (code, content) {
// document.getElementById("user_to_add").value = "";
//document.getElementById("ajax_list_users_single").innerHTML = "";
destination = document.getElementById("destination_users");
for (i=0;i<destination.length;i++) {
if(destination.options[i].text == content) {
return false;
}
}
destination.options[destination.length] = new Option(content,code);
destination.selectedIndex = -1;
sortOptions(destination.options);
}
function remove_item(origin)
{
for(var i = 0 ; i<origin.options.length ; i++) {
if(origin.options[i].selected) {
origin.options[i]=null;
i = i-1;
}
}
}
function validate_filter() {
document.formulaire.add_type.value = \''.$add_type.'\';
document.formulaire.form_sent.value=0;
document.formulaire.submit();
}
</script>';
$form_sent=0;
$errorMsg=$firstLetterUser=$firstLetterSession='';
$UserList=$SessionList=array();
$users=$sessions=array();
$noPHP_SELF=true;
if($_POST['form_sent']) {
$form_sent = $_POST['form_sent'];
$firstLetterUser = $_POST['firstLetterUser'];
$firstLetterSession = $_POST['firstLetterSession'];
$UserList = $_POST['sessionUsersList'];
$ClassList = $_POST['sessionClassesList'];
if(!is_array($UserList)) {
$UserList=array();
}
if ($form_sent == 1) {
//added a parameter to send emails when registering a user
// SessionManager::suscribe_users_to_session($id_session,$UserList,true,true);
//adding the session to the access_url_rel_session table
/*global $_configuration;
require_once (api_get_path(LIBRARY_PATH).'urlmanager.lib.php');
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();
UrlManager::add_session_to_url($id_session,$access_url_id);
} else {
// we are filling by default the access_url_rel_session table
UrlManager::add_session_to_url($id_session,1);
}*/
//if(empty($_GET['add']))
//header('Location: '.Security::remove_XSS($_GET['page']).'?id_session='.$id_session);
//else
header('Location: group_list.php');
}
}
$group_info = GroupPortalManager::get_group_data($group_id);
Display::display_header($tool_name);
//api_display_tool_title($tool_name.' ('.$session_info['name'].')');
$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;
$order_clause = api_sort_by_first_name() ? ' ORDER BY firstname, lastname, username' : ' ORDER BY lastname, firstname, username';
if ($ajax_search) {
$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) WHERE 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
INNER JOIN $tbl_session_rel_user
ON $tbl_session_rel_user.id_user = u.user_id
AND $tbl_session_rel_user.id_session = ".intval($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 $user) {
$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 {
$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) WHERE 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";
}
}
$result = Database::query($sql,__FILE__,__LINE__);
$Users = Database::store_result($result);
foreach ($Users as $user) {
if($user['group_id'] != $group_id)
$nosessionUsersList[$user['user_id']] = $user ;
}
var_dump($nosessionUsersList);
$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_session='.$id_session.'&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');
} else {
//$link_add_type_unique = Display::return_icon('single.gif').get_lang('SessionAddTypeUnique');
//$link_add_type_multiple = '<a href="'.api_get_self().'?id_session='.$id_session.'&add='.Security::remove_XSS($_GET['add']).'&add_type=multiple">'.Display::return_icon('multiple.gif').get_lang('SessionAddTypeMultiple').'</a>';
/*
* <div class="actions">
<?php echo $link_add_type_unique ?>&nbsp;|&nbsp;<?php echo $link_add_type_multiple ?>
</div>
*/
}
?>
<?php echo '<div class="row"><div class="form_header">'.$tool_name.' ('.$session_info['name'].')</div></div><br/>'; ?>
<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?page=<?php echo Security::remove_XSS($_GET['page']); ?>&id_session=<?php echo $id_session; ?><?php if(!empty($_GET['add'])) echo '&add=true' ; ?>" style="margin:0px;" <?php if($ajax_search){echo ' onsubmit="valide();"';}?>>
<?php
if ($add_type=='multiple') {
if (is_array($extra_field_list)) {
if (is_array($new_field_list) && count($new_field_list)>0 ) {
echo '<h3>'.get_lang('FilterUsers').'</h3>';
foreach ($new_field_list as $new_field) {
echo $new_field['name'];
$varname = 'field_'.$new_field['variable'];
echo '&nbsp;<select name="'.$varname.'">';
echo '<option value="0">--'.get_lang('Select').'--</option>';
foreach ($new_field['data'] as $option) {
$checked='';
if (isset($_POST[$varname])) {
if ($_POST[$varname]==$option[1]) {
$checked = 'selected="true"';
}
}
echo '<option value="'.$option[1].'" '.$checked.'>'.$option[1].'</option>';
}
echo '</select>';
echo '&nbsp;&nbsp;';
}
echo '<input type="button" value="'.get_lang('Filter').'" onclick="validate_filter()" />';
echo '<br /><br />';
}
}
}
?>
<input type="hidden" name="form_sent" value="1" />
<input type="hidden" name="add_type" />
<?php
if(!empty($errorMsg)) {
Display::display_normal_message($errorMsg); //main API
}
?>
<table border="0" cellpadding="5" cellspacing="0" width="100%">
<!-- Users -->
<tr>
<td align="center"><b><?php echo get_lang('UserListInPlatform') ?> :</b>
</td>
<td></td>
<td align="center"><b><?php echo get_lang('UserListInSession') ?> :</b></td>
</tr>
<?php if ($add_type=='multiple') { ?>
<tr>
<td align="center">
<?php echo get_lang('FirstLetterUser'); ?> :
<select name="firstLetterUser" onchange = "xajax_search_users(this.value,'multiple')" >
<option value = "%">--</option>
<?php
echo Display :: get_alphabet_options();
?>
</select>
</td>
<td align="center">&nbsp;</td>
</tr>
<?php } ?>
<tr>
<td align="center">
<div id="content_source">
<?php
if (!($add_type=='multiple')) {
?>
<input type="text" id="user_to_add" onkeyup="xajax_search_users(this.value,'single')" />
<div id="ajax_list_users_single"></div>
<?php
} else {
?>
<div id="ajax_list_users_multiple">
<select id="origin_users" name="nosessionUsersList[]" multiple="multiple" size="15" style="width:360px;">
<?php
foreach($nosessionUsersList as $enreg) {
?>
<option value="<?php echo $enreg['user_id']; ?>" <?php if(in_array($enreg['user_id'],$UserList)) echo 'selected="selected"'; ?>><?php echo api_get_person_name($enreg['firstname'], $enreg['lastname']).' ('.$enreg['username'].')'; ?></option>
<?php
}
?>
</select>
</div>
<?php
}
unset($nosessionUsersList);
?>
</div>
</td>
<td width="10%" valign="middle" align="center">
<?php
if ($ajax_search) {
?>
<button class="arrowl" type="button" onclick="remove_item(document.getElementById('destination_users'))" ></button>
<?php
} 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
}
?>
<br /><br /><br /><br /><br /><br />
</td>
<td align="center">
<select id="destination_users" name="sessionUsersList[]" multiple="multiple" size="15" style="width:360px;">
<?php
foreach($sessionUsersList as $enreg) {
?>
<option value="<?php echo $enreg['user_id']; ?>"><?php echo $enreg['firstname'].' '.$enreg['lastname'].' ('.$enreg['username'].')'; ?></option>
<?php
}
unset($sessionUsersList);
?>
</select></td>
</tr>
<tr>
<td colspan="3" align="center">
<br />
<?php
if(isset($_GET['add'])) {
echo '<button class="save" type="button" value="" onclick="valide()" >'.get_lang('FinishSessionCreation').'</button>';
} else {
//@todo see that the call to "valide()" doesn't duplicate the onsubmit of the form (necessary to avoid delete on "enter" key pressed)
echo '<button class="save" type="button" value="" onclick="valide()" >'.get_lang('SubscribeUsersToGroup').'</button>';
}
?>
</td>
</tr>
</table>
</form>
<script type="text/javascript">
<!--
function moveItem(origin , destination){
for(var i = 0 ; i<origin.options.length ; i++) {
if(origin.options[i].selected) {
destination.options[destination.length] = new Option(origin.options[i].text,origin.options[i].value);
origin.options[i]=null;
i = i-1;
}
}
destination.selectedIndex = -1;
sortOptions(destination.options);
}
function sortOptions(options) {
newOptions = new Array();
for (i = 0 ; i<options.length ; i++)
newOptions[i] = options[i];
newOptions = newOptions.sort(mysort);
options.length = 0;
for(i = 0 ; i < newOptions.length ; i++)
options[i] = newOptions[i];
}
function mysort(a, b){
if(a.text.toLowerCase() > b.text.toLowerCase()){
return 1;
}
if(a.text.toLowerCase() < b.text.toLowerCase()){
return -1;
}
return 0;
}
function valide(){
var options = document.getElementById('destination_users').options;
for (i = 0 ; i<options.length ; i++)
options[i].selected = true;
document.forms.formulaire.submit();
}
function loadUsersInSelect(select){
var xhr_object = null;
if(window.XMLHttpRequest) // Firefox
xhr_object = new XMLHttpRequest();
else if(window.ActiveXObject) // Internet Explorer
xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
else // XMLHttpRequest non supporté par le navigateur
alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest...");
//xhr_object.open("GET", "loadUsersInSelect.ajax.php?id_session=<?php echo $id_session ?>&letter="+select.options[select.selectedIndex].text, false);
xhr_object.open("POST", "loadUsersInSelect.ajax.php");
xhr_object.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
nosessionUsers = makepost(document.getElementById('origin_users'));
sessionUsers = makepost(document.getElementById('destination_users'));
nosessionClasses = makepost(document.getElementById('origin_classes'));
sessionClasses = makepost(document.getElementById('destination_classes'));
xhr_object.send("nosessionusers="+nosessionUsers+"&sessionusers="+sessionUsers+"&nosessionclasses="+nosessionClasses+"&sessionclasses="+sessionClasses);
xhr_object.onreadystatechange = function() {
if(xhr_object.readyState == 4) {
document.getElementById('content_source').innerHTML = result = xhr_object.responseText;
//alert(xhr_object.responseText);
}
}
}
function makepost(select){
var options = select.options;
var ret = "";
for (i = 0 ; i<options.length ; i++)
ret = ret + options[i].value +'::'+options[i].text+";;";
return ret;
}
-->
</script>
<?php
/*
==============================================================================
FOOTER
==============================================================================
*/
Display::display_footer();
?>

@ -0,0 +1,148 @@
<?php
/* For licensing terms, see /dokeos_license.txt */
/**
==============================================================================
* @package dokeos.admin
==============================================================================
*/
// Language files that should be included
$language_file = array('admin', 'registration');
$cidReset = true;
// Including necessary libraries.
require '../inc/global.inc.php';
$libpath = api_get_path(LIBRARY_PATH);
require_once $libpath.'fileManage.lib.php';
require_once $libpath.'fileUpload.lib.php';
require_once $libpath.'group_portal_manager.lib.php';
require_once $libpath.'formvalidator/FormValidator.class.php';
require_once $libpath.'image.lib.php';
// Section for the tabs
$this_section = SECTION_PLATFORM_ADMIN;
// User permissions
api_protect_admin_script();
// Database table definitions
$table_admin = Database :: get_main_table(TABLE_MAIN_ADMIN);
$table_user = Database :: get_main_table(TABLE_MAIN_USER);
$database = Database::get_main_database();
if (!empty($_GET['message'])) {
$message = urldecode($_GET['message']);
}
$interbreadcrumb[] = array ('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
$tool_name = get_lang('AddGroup');
// Create the form
$form = new FormValidator('group_add');
$form->addElement('header', '', $tool_name);
// name
$form->addElement('text', 'name', get_lang('Name'));
$form->applyFilter('name', 'html_filter');
$form->applyFilter('name', 'trim');
$form->addRule('name', get_lang('ThisFieldIsRequired'), 'required');
// Description
$form->addElement('text', 'description', get_lang('Description'));
$form->applyFilter('description', 'html_filter');
$form->applyFilter('description', 'trim');
// url
$form->addElement('text', 'url', get_lang('URL'));
$form->applyFilter('url', 'html_filter');
$form->applyFilter('url', 'trim');
// Picture
$form->addElement('file', 'picture', get_lang('AddPicture'));
$allowed_picture_types = array ('jpg', 'jpeg', 'png', 'gif');
$form->addRule('picture', get_lang('OnlyImagesAllowed').' ('.implode(',', $allowed_picture_types).')', 'filetype', $allowed_picture_types);
// Status
$status = array();
$status[GROUP_PERMISSION_OPEN] = get_lang('Open');
$status[GROUP_PERMISSION_CLOSED] = get_lang('Closed');
$form->addElement('select', 'visibility', get_lang('GroupPermissions'), $status);
// Set default values
$defaults['status'] = GROUP_PERMISSION_OPEN;
$form->setDefaults($defaults);
// Submit button
$form->addElement('style_submit_button', 'submit', get_lang('Add'), 'class="add"');
// Validate form
if( $form->validate()) {
$check = Security::check_token('post');
if ($check) {
$values = $form->exportValues();
$picture_element = & $form->getElement('picture');
$picture = $picture_element->getValue();
$picture_uri = '';
$name = $values['name'];
$description = $values['description'];
$url = $values['url'];
$status = intval($values['visibility']);
$picture = $_FILES['picture'];
$group_id = GroupPortalManager::add($name, $description, $url, $status);
if (!empty($picture['name'])) {
$picture_uri = GroupPortalManager::update_group_picture($group_id, $_FILES['picture']['name'], $_FILES['picture']['tmp_name']);
GroupPortalManager::update($group_id, $name, $description, $url,$status, $picture_uri);
}
//@todo send emails
/* if (!empty($email) && $send_mail) {
$recipient_name = api_get_person_name($firstname, $lastname, null, PERSON_NAME_EMAIL_ADDRESS);
$emailsubject = '['.api_get_setting('siteName').'] '.get_lang('YourReg').' '.api_get_setting('siteName');
$sender_name = api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'), null, PERSON_NAME_EMAIL_ADDRESS);
$email_admin = api_get_setting('emailAdministrator');
if ($_configuration['multiple_access_urls'] == true) {
$access_url_id = api_get_current_access_url_id();
if ($access_url_id != -1) {
$url = api_get_access_url($access_url_id);
$emailbody = get_lang('Dear')." ".stripslashes(api_get_person_name($firstname, $lastname)).",\n\n".get_lang('YouAreReg')." ".api_get_setting('siteName') ." ".get_lang('WithTheFollowingSettings')."\n\n".get_lang('Username')." : ". $username ."\n". get_lang('Pass')." : ".stripslashes($password)."\n\n" .get_lang('Address') ." ". api_get_setting('siteName') ." ". get_lang('Is') ." : ". $url['url'] ."\n\n". get_lang('Problem'). "\n\n". get_lang('Formula').",\n\n".api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'))."\n". get_lang('Manager'). " ".api_get_setting('siteName')."\nT. ".api_get_setting('administratorTelephone')."\n" .get_lang('Email') ." : ".api_get_setting('emailAdministrator');
}
}
else {
$emailbody = get_lang('Dear')." ".stripslashes(api_get_person_name($firstname, $lastname)).",\n\n".get_lang('YouAreReg')." ".api_get_setting('siteName') ." ".get_lang('WithTheFollowingSettings')."\n\n".get_lang('Username')." : ". $username ."\n". get_lang('Pass')." : ".stripslashes($password)."\n\n" .get_lang('Address') ." ". api_get_setting('siteName') ." ". get_lang('Is') ." : ". $_configuration['root_web'] ."\n\n". get_lang('Problem'). "\n\n". get_lang('Formula').",\n\n".api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'))."\n". get_lang('Manager'). " ".api_get_setting('siteName')."\nT. ".api_get_setting('administratorTelephone')."\n" .get_lang('Email') ." : ".api_get_setting('emailAdministrator');
}
@api_mail($recipient_name, $email, $emailsubject, $emailbody, $sender_name, $email_admin);
}*/
Security::clear_token();
$tok = Security::get_token();
header('Location: group_list.php?action=show_message&message='.urlencode(get_lang('GroupAdded')).'&sec_token='.$tok);
exit ();
}
} else {
if (isset($_POST['submit'])) {
Security::clear_token();
}
$token = Security::get_token();
$form->addElement('hidden', 'sec_token');
$form->setConstants(array('sec_token' => $token));
}
// Display form
Display::display_header($tool_name);
//api_display_tool_title($tool_name);
if(!empty($message)){
Display::display_normal_message(stripslashes($message));
}
$form->display();
// Footer
Display::display_footer();

@ -0,0 +1,143 @@
<?php // $Id: user_edit.php 22233 2009-07-20 09:54:05Z ivantcholakov $
/* For licensing terms, see /dokeos_license.txt */
/**
==============================================================================
* @package dokeos.admin
==============================================================================
*/
// Language files that should be included
$language_file = array('admin');
$cidReset = true;
include '../inc/global.inc.php';
$this_section = SECTION_PLATFORM_ADMIN;
api_protect_admin_script();
$libpath = api_get_path(LIBRARY_PATH);
require_once $libpath.'fileManage.lib.php';
require_once $libpath.'fileUpload.lib.php';
require_once $libpath.'group_portal_manager.lib.php';
require_once $libpath.'formvalidator/FormValidator.class.php';
require_once $libpath.'image.lib.php';
require_once $libpath.'mail.lib.inc.php';
$group_id = isset($_GET['id']) ? intval($_GET['id']) : intval($_POST['id']);
$tool_name = get_lang('GroupEdit');
$interbreadcrumb[] = array('url' => 'index.php','name' => get_lang('PlatformAdmin'));
$interbreadcrumb[] = array('url' => 'group_list.php','name' => get_lang('GroupList'));
$table_group = Database::get_main_table(TABLE_MAIN_GROUP);
$sql = "SELECT * FROM $table_group WHERE id = '".$group_id."'";
$res = Database::query($sql, __FILE__, __LINE__);
if (Database::num_rows($res) != 1) {
header('Location: group_list.php');
exit;
}
$group_data = Database::fetch_array($res, 'ASSOC');
// Create the form
$form = new FormValidator('group_edit', 'post', '', '', array('style' => 'width: 60%; float: '.($text_dir == 'rtl' ? 'right;' : 'left;')));
$form->addElement('header', '', $tool_name);
$form->addElement('hidden', 'id', $group_id);
// name
$form->addElement('text', 'name', get_lang('Name'));
$form->applyFilter('name', 'html_filter');
$form->applyFilter('name', 'trim');
$form->addRule('name', get_lang('ThisFieldIsRequired'), 'required');
// Description
$form->addElement('text', 'description', get_lang('Description'));
$form->applyFilter('description', 'html_filter');
$form->applyFilter('description', 'trim');
// url
$form->addElement('text', 'url', get_lang('URL'));
$form->applyFilter('url', 'html_filter');
$form->applyFilter('url', 'trim');
// Picture
$form->addElement('file', 'picture', get_lang('AddPicture'));
$allowed_picture_types = array ('jpg', 'jpeg', 'png', 'gif');
$form->addRule('picture', get_lang('OnlyImagesAllowed').' ('.implode(',', $allowed_picture_types).')', 'filetype', $allowed_picture_types);
if (strlen($group_data['picture_uri']) > 0) {
$form->addElement('checkbox', 'delete_picture', '', get_lang('DelImage'));
}
// Status
$status = array();
$status[GROUP_PERMISSION_OPEN] = get_lang('Open');
$status[GROUP_PERMISSION_CLOSED] = get_lang('Closed');
$form->addElement('select', 'visibility', get_lang('GroupPermissions'), $status, array());
// Submit button
$form->addElement('style_submit_button', 'submit', get_lang('ModifyInformation'), 'class="save"');
// Set default values
$form->setDefaults($group_data);
// Validate form
if ( $form->validate()) {
$group = $form->exportValues();
$picture_element = & $form->getElement('picture');
$picture = $picture_element->getValue();
$picture_uri = $group_data['picture_uri'];
if ($group['delete_picture']) {
$picture_uri = GroupPortalManager::delete_group_picture($group_id);
}
elseif (!empty($picture['name'])) {
$picture_uri = GroupPortalManager::update_group_picture($group_id, $_FILES['picture']['name'], $_FILES['picture']['tmp_name']);
}
$name = $group['name'];
$description = $group['description'];
$url = $group['url'];
$status = intval($group['visibility']);
GroupPortalManager::update($group_id, $name, $description, $url, $status, $picture_uri);
$tok = Security::get_token();
header('Location: group_list.php?action=show_message&message='.urlencode(get_lang('GroupUpdated')).'&sec_token='.$tok);
exit();
}
Display::display_header($tool_name);
// Group picture
$image_path = GroupPortalManager::get_group_picture_path_by_id($group_id,'web');
$image_dir = $image_path['dir'];
$image = $image_path['file'];
$image_file = ($image != '' ? $image_dir.$image : api_get_path(WEB_CODE_PATH).'img/unknown_group.jpg');
$image_size = api_getimagesize($image_file);
$img_attributes = 'src="'.$image_file.'?rand='.time().'" '
.'alt="'.api_get_person_name($user_data['firstname'], $user_data['lastname']).'" '
.'style="float:'.($text_dir == 'rtl' ? 'left' : 'right').'; padding:5px;" ';
if ($image_size[0] > 300) { //limit display width to 300px
$img_attributes .= 'width="300" ';
}
// get the path,width and height from original picture
$big_image = $image_dir.'big_'.$image;
$big_image_size = api_getimagesize($big_image);
$big_image_width = $big_image_size[0];
$big_image_height = $big_image_size[1];
$url_big_image = $big_image.'?rnd='.time();
if ($image == '') {
echo '<img '.$img_attributes.' />';
} else {
echo '<input type="image" '.$img_attributes.' onclick="javascript: return show_image(\''.$url_big_image.'\',\''.$big_image_width.'\',\''.$big_image_height.'\');"/>';
}
// Display form
$form->display();
// Footer
Display::display_footer();

@ -0,0 +1,439 @@
<?php // $Id: user_list.php 22292 2009-07-22 18:32:32Z herodoto $
/* For licensing terms, see /dokeos_license.txt */
/**
==============================================================================
@author Bart Mollet
* @package dokeos.admin
==============================================================================
*/
// name of the language file that needs to be included
$language_file = array ('registration','admin');
$cidReset = true;
require ('../inc/global.inc.php');
require_once (api_get_path(LIBRARY_PATH).'sortabletable.class.php');
require_once (api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php');
require_once (api_get_path(LIBRARY_PATH).'security.lib.php');
require_once(api_get_path(LIBRARY_PATH).'xajax/xajax.inc.php');
require_once (api_get_path(LIBRARY_PATH).'usermanager.lib.php');
require_once api_get_path(LIBRARY_PATH).'group_portal_manager.lib.php';
$this_section = SECTION_PLATFORM_ADMIN;
api_protect_admin_script(true);
/**
* Get the total number of users on the platform
* @see SortableTable#get_total_number_of_items()
*/
function get_number_of_groups()
{
$group_table = Database :: get_main_table(TABLE_MAIN_GROUP);
$sql = "SELECT COUNT(g.id) AS total_number_of_items FROM $group_table g";
// adding the filter to see the user's only of the current access_url
/*
global $_configuration;
if ((api_is_platform_admin() || api_is_session_admin()) && $_configuration['multiple_access_urls']==true && api_get_current_access_url_id()!=-1) {
$access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
$sql.= " INNER JOIN $access_url_rel_user_table url_rel_user ON (u.user_id=url_rel_user.user_id)";
}
*/
if ( isset ($_GET['keyword'])) {
$keyword = Database::escape_string($_GET['keyword']);
$sql .= " WHERE (g.name LIKE '%".$keyword."%' OR g.description LIKE '%".$keyword."%' OR g.url LIKE '%".$keyword."%' )";
}
// adding the filter to see the user's only of the current access_url
/*
if ((api_is_platform_admin() || api_is_session_admin()) && $_configuration['multiple_access_urls']==true && api_get_current_access_url_id()!=-1) {
$sql.= " AND url_rel_user.access_url_id=".api_get_current_access_url_id();
}*/
$res = Database::query($sql, __FILE__, __LINE__);
$obj = Database::fetch_object($res);
return $obj->total_number_of_items;
}
/**
* Get the users to display on the current page (fill the sortable-table)
* @param int offset of first user to recover
* @param int Number of users to get
* @param int Column to sort on
* @param string Order (ASC,DESC)
* @see SortableTable#get_table_data($from)
*/
function get_group_data($from, $number_of_items, $column, $direction)
{
$group_table = Database :: get_main_table(TABLE_MAIN_GROUP);
$sql = "SELECT
g.id AS col0,
g.name AS col1,
g.description AS col2,
g.visibility AS col3,
g.id AS col4
FROM $group_table g ";
// adding the filter to see the user's only of the current access_url
/*global $_configuration;
if ((api_is_platform_admin() || api_is_session_admin()) && $_configuration['multiple_access_urls']==true && api_get_current_access_url_id()!=-1) {
$access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
$sql.= " INNER JOIN $access_url_rel_user_table url_rel_user ON (u.user_id=url_rel_user.user_id)";
}*/
if (isset ($_GET['keyword'])) {
$keyword = Database::escape_string($_GET['keyword']);
$sql .= " WHERE (g.name LIKE '%".$keyword."%' OR g.description LIKE '%".$keyword."%' OR g.url LIKE '%".$keyword."%' )";
}
/*
// adding the filter to see the user's only of the current access_url
if ((api_is_platform_admin() || api_is_session_admin()) && $_configuration['multiple_access_urls']==true && api_get_current_access_url_id()!=-1) {
$sql.= " AND url_rel_user.access_url_id=".api_get_current_access_url_id();
}*/
if (!in_array($direction, array('ASC','DESC'))) {
$direction = 'ASC';
}
$column = intval($column);
$from = intval($from);
$number_of_items = intval($number_of_items);
$sql .= " ORDER BY col$column $direction ";
$sql .= " LIMIT $from,$number_of_items";
$res = Database::query($sql, __FILE__, __LINE__);
$users = array ();
$t = time();
while ($group = Database::fetch_row($res)) {
// forget about the expiration date field
$groups[] = $group;
}
return $groups;
}
function get_recent_group_data($from =0 , $number_of_items = 5, $column, $direction)
{
$group_table = Database :: get_main_table(TABLE_MAIN_GROUP);
$sql = "SELECT
g.id AS col0,
g.name AS col1,
g.description AS col2,
g.visibility AS col3,
g.id AS col4
FROM $group_table g ";
// adding the filter to see the user's only of the current access_url
/*global $_configuration;
if ((api_is_platform_admin() || api_is_session_admin()) && $_configuration['multiple_access_urls']==true && api_get_current_access_url_id()!=-1) {
$access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
$sql.= " INNER JOIN $access_url_rel_user_table url_rel_user ON (u.user_id=url_rel_user.user_id)";
}*/
if (isset ($_GET['keyword'])) {
$keyword = Database::escape_string($_GET['keyword']);
$sql .= " WHERE (g.name LIKE '%".$keyword."%' OR g.description LIKE '%".$keyword."%' OR g.url LIKE '%".$keyword."%' )";
}
/*
// adding the filter to see the user's only of the current access_url
if ((api_is_platform_admin() || api_is_session_admin()) && $_configuration['multiple_access_urls']==true && api_get_current_access_url_id()!=-1) {
$sql.= " AND url_rel_user.access_url_id=".api_get_current_access_url_id();
}*/
if (!in_array($direction, array('ASC','DESC'))) {
$direction = 'ASC';
}
$column = intval($column);
$from = intval($from);
$number_of_items = intval($number_of_items);
$sql .= " ORDER BY col$column $direction ";
$sql .= " LIMIT $from,$number_of_items";
$res = Database::query($sql, __FILE__, __LINE__);
$users = array ();
$t = time();
while ($group = Database::fetch_row($res)) {
// forget about the expiration date field
$groups[] = $group;
}
return $groups;
}
/**
* Build the modify-column of the table
* @param int The user id
* @param string URL params to add to table links
* @param array Row of elements to alter
* @return string Some HTML-code with modify-buttons
*/
function modify_filter($group_id,$url_params,$row)
{
global $charset;
global $_user;
global $_admins_list;
if (api_is_platform_admin()) {
$result .= '<a href="'.api_get_path(WEB_CODE_PATH).'admin/add_users_to_group.php?id='.$group_id.'">'.Display::return_icon('add_user_big.gif',get_lang('AddUsersToGroup')).'</a>';
$result .= '<a href="group_edit.php?id='.$group_id.'">'.Display::return_icon('edit.gif', get_lang('Edit')).'</a>&nbsp;&nbsp;';
$result .= '<a href="group_list.php?action=delete_group&amp;group_id='.$group_id.'&amp;'.$url_params.'&amp;sec_token='.$_SESSION['sec_token'].'" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES,$charset))."'".')) return false;">'.Display::return_icon('delete.gif', get_lang('Delete')).'</a>';
}
return $result;
}
/**
* Build the active-column of the table to lock or unlock a certain user
* lock = the user can no longer use this account
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
* @param int $active the current state of the account
* @param int $user_id The user id
* @param string $url_params
* @return string Some HTML-code with the lock/unlock button
*/
function active_filter($active, $url_params, $row) {
global $_user;
if ($active=='1') {
$action='lock';
$image='right';
} elseif ($active=='-1') {
$action='edit';
$image='expired';
} elseif ($active=='0') {
$action='unlock';
$image='wrong';
}
if ($action=='edit') {
$result = Display::return_icon($image.'.gif', get_lang('AccountExpired'));
}elseif ($row['0']<>$_user['user_id']) { // you cannot lock yourself out otherwise you could disable all the accounts including your own => everybody is locked out and nobody can change it anymore.
$result = '<a href="user_list.php?action='.$action.'&amp;user_id='.$row['0'].'&amp;'.$url_params.'&amp;sec_token='.$_SESSION['sec_token'].'">'.Display::return_icon($image.'.gif', get_lang(ucfirst($action))).'</a>';
}
return $result;
}
/**
* Lock or unlock a user
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
* @param int $status, do we want to lock the user ($status=lock) or unlock it ($status=unlock)
* @param int $user_id The user id
* @return language variable
*/
function lock_unlock_user($status,$user_id)
{
$user_table = Database :: get_main_table(TABLE_MAIN_USER);
if ($status=='lock')
{
$status_db='0';
$return_message=get_lang('UserLocked');
}
if ($status=='unlock')
{
$status_db='1';
$return_message=get_lang('UserUnlocked');
}
if(($status_db=='1' OR $status_db=='0') AND is_numeric($user_id))
{
$sql="UPDATE $user_table SET active='".Database::escape_string($status_db)."' WHERE user_id='".Database::escape_string($user_id)."'";
$result = Database::query($sql, __FILE__, __LINE__);
}
if ($result)
{
return $return_message;
}
}
/**
* Instead of displaying the integer of the status, we give a translation for the status
*
* @param integer $status
* @return string translation
*
* @version march 2008
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University, Belgium
*/
function status_filter($status)
{
$statusname = api_get_status_langvars();
return $statusname[$status];
}
/**
==============================================================================
INIT SECTION
==============================================================================
*/
$action = $_GET["action"];
if (isset ($_GET['search']) && $_GET['search'] == 'advanced') {
$interbreadcrumb[] = array ("url" => 'index.php', "name" => get_lang('PlatformAdmin'));
$interbreadcrumb[] = array ("url" => 'user_list.php', "name" => get_lang('UserList'));
$tool_name = get_lang('SearchAUser');
Display :: display_header($tool_name);
//api_display_tool_title($tool_name);
$form = new FormValidator('advanced_search','get');
$form->addElement('header', '', $tool_name);
$form->add_textfield('keyword_firstname',get_lang('FirstName'),false);
$form->add_textfield('keyword_lastname',get_lang('LastName'),false);
$form->add_textfield('keyword_username',get_lang('LoginName'),false);
$form->add_textfield('keyword_email',get_lang('Email'),false);
$form->add_textfield('keyword_officialcode',get_lang('OfficialCode'),false);
$status_options = array();
$status_options['%'] = get_lang('All');
$status_options[STUDENT] = get_lang('Student');
$status_options[COURSEMANAGER] = get_lang('Teacher');
$status_options[SESSIONADMIN] = get_lang('Administrator');//
$form->addElement('select','keyword_status',get_lang('Status'),$status_options);
$active_group = array();
$active_group[] = $form->createElement('checkbox','keyword_active','',get_lang('Active'));
$active_group[] = $form->createElement('checkbox','keyword_inactive','',get_lang('Inactive'));
$form->addGroup($active_group,'',get_lang('ActiveAccount'),'<br/>',false);
$form->addElement('style_submit_button', 'submit',get_lang('SearchUsers'),'class="search"');
$defaults['keyword_active'] = 1;
$defaults['keyword_inactive'] = 1;
$form->setDefaults($defaults);
$form->display();
}
else
{
$interbreadcrumb[] = array ("url" => 'index.php', "name" => get_lang('PlatformAdmin'));
$tool_name = get_lang('UserList');
Display :: display_header($tool_name, "");
//api_display_tool_title($tool_name);
if (isset ($_GET['action'])) {
$check = Security::check_token('get');
if($check) {
switch ($_GET['action']) {
case 'show_message' :
if (!empty($_GET['warn'])) {
// to prevent too long messages
if ($_GET['warn'] == 'session_message'){
$_GET['warn'] = $_SESSION['session_message_import_users'];
}
Display::display_warning_message(urldecode($_GET['warn']),false);
}
if (!empty($_GET['message'])) {
Display :: display_confirmation_message(stripslashes($_GET['message']));
}
break;
case 'delete_group' :
if (api_is_platform_admin()) {
if (GroupPortalManager :: delete($_GET['group_id'])) {
Display :: display_confirmation_message(get_lang('GroupDeleted'));
} else {
Display :: display_error_message(get_lang('CannotDeleteGroup'));
}
}
break;
case 'lock' :
$message=lock_unlock_user('lock',$_GET['user_id']);
Display :: display_normal_message($message);
break;
case 'unlock';
$message=lock_unlock_user('unlock',$_GET['user_id']);
Display :: display_normal_message($message);
break;
}
Security::clear_token();
}
}
if (isset ($_POST['action']))
{
$check = Security::check_token('get');
if($check)
{
switch ($_POST['action'])
{
case 'delete' :
if (api_is_platform_admin()) {
$number_of_selected_users = count($_POST['id']);
$number_of_deleted_users = 0;
if (is_array($_POST['id'])) {
foreach ($_POST['id'] as $index => $user_id)
{
if($user_id != $_user['user_id'])
{
if(UserManager :: delete_user($user_id))
{
$number_of_deleted_users++;
}
}
}
}
if($number_of_selected_users == $number_of_deleted_users)
{
Display :: display_confirmation_message(get_lang('SelectedUsersDeleted'));
}
else
{
Display :: display_error_message(get_lang('SomeUsersNotDeleted'));
}
}
break;
}
Security::clear_token();
}
}
// Create a search-box
$form = new FormValidator('search_simple','get','','',null,false);
$renderer =& $form->defaultRenderer();
$renderer->setElementTemplate('<span>{element}</span> ');
$form->addElement('text','keyword',get_lang('keyword'));
$form->addElement('style_submit_button', 'submit',get_lang('Search'),'class="search"');
//$form->addElement('static','search_advanced_link',null,'<a href="user_list.php?search=advanced">'.get_lang('AdvancedSearch').'</a>');
echo '<div class="actions" style="width:100%;">';
if (api_is_platform_admin()) {
echo '<span style="float:right; padding-top:7px;">'.
'<a href="'.api_get_path(WEB_CODE_PATH).'admin/group_add.php">'.Display::return_icon('add_user_big.gif',get_lang('AddUsers')).get_lang('AddGroup').'</a>'.
'</span>';
}
$form->display();
echo '</div>';
if (isset ($_GET['keyword'])) {
$parameters = array ('keyword' => Security::remove_XSS($_GET['keyword']));
}
// Create a sortable table with user-data
$parameters['sec_token'] = Security::get_token();
// get the list of all admins to mark them in the users list
$admin_table = Database::get_main_table(TABLE_MAIN_ADMIN);
$sql_admin = "SELECT user_id FROM $admin_table";
$res_admin = Database::query($sql_admin);
$_admins_list = array();
while ($row_admin = Database::fetch_row($res_admin)) {
$_admins_list[] = $row_admin[0];
}
$table = new SortableTable('users', 'get_number_of_groups', 'get_group_data', 2);
$table->set_additional_parameters($parameters);
$table->set_header(0, '', false);
$table->set_header(1, get_lang('Name'));
$table->set_header(2, get_lang('Description'));
$table->set_header(3, get_lang('Visibility'));
$table->set_header(4, '', false);
$table->set_column_filter(4, 'modify_filter');
//$table->set_column_filter(6, 'status_filter');
//$table->set_column_filter(7, 'active_filter');
//$table->set_column_filter(8, 'modify_filter');
if (api_is_platform_admin())
$table->set_form_actions(array ('delete' => get_lang('DeleteFromPlatform')));
$table->display();
}
/*
==============================================================================
FOOTER
==============================================================================
*/
Display :: display_footer();
?>

@ -1,26 +1,5 @@
<?php // $Id: index.php 22269 2009-07-21 15:06:15Z juliomontoya $
/*
==============================================================================
Dokeos - elearning and course management software
Copyright (c) 2004-2009 Dokeos SPRL
Copyright (c) 2003 Ghent University (UGent)
Copyright (c) 2001 Universite catholique de Louvain (UCL)
Copyright (c) Olivier Brouckaert
For a full list of contributors, see "credits.txt".
The full license can be read in "license.txt".
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
See the GNU General Public License for more details.
Contact: Dokeos, rue du Corbeau, 108, B-1030 Brussels, Belgium, info@dokeos.com
==============================================================================
*/
/* For licensing terms, see /dokeos_license.txt */
/**
==============================================================================
* Index of the admin tools
@ -96,7 +75,11 @@ if (api_is_platform_admin()) {
<li><a href="user_add.php"> <?php echo get_lang('AddUsers') ?></a></li>
<li><a href="user_export.php"> <?php echo get_lang('ExportUserListXMLCSV') ?></a></li>
<li><a href="user_import.php"> <?php echo get_lang('ImportUserListXMLCSV') ?></a></li>
<?php if (api_get_setting('allow_social_tool')=='true') { ?>
<li><a href="group_add.php"> <?php echo get_lang('AddGroups') ?></a></li>
<li><a href="group_list.php"> <?php echo get_lang('GroupList') ?></a></li>
<?php
}
if(isset($extAuthSource) && isset($extAuthSource['ldap']) && count($extAuthSource['ldap'])>0){
?>
<!-- dynamic ldap code -->

@ -17,18 +17,8 @@
// Language files that should be included.
$language_file = array('registration', 'messages', 'userInfo');
$cidReset = true;
require_once '../inc/global.inc.php';
if (!isset($_GET['show'])) {
if (api_get_setting('allow_social_tool') == 'true' || api_get_setting('allow_message_tool') == 'true') {
header('Location:../social/index.php');
exit;
}
}
require_once api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php';
$this_section = SECTION_MYPROFILE;
@ -39,7 +29,6 @@ if (!(isset($_user['user_id']) && $_user['user_id']) || api_is_anonymous($_user[
}
$htmlHeadXtra[] = '<script src="../inc/lib/javascript/jquery.js" type="text/javascript" language="javascript"></script>'; //jQuery
$htmlHeadXtra[] = '<script src="../inc/lib/javascript/tag/jquery.fcbkcomplete.js" type="text/javascript" language="javascript"></script>'; //jQuery
$htmlHeadXtra[] = '<link href="'.api_get_path(WEB_LIBRARY_PATH).'javascript/tag/style.css" rel="stylesheet" type="text/css" />';
@ -714,15 +703,23 @@ Display :: display_header('');
if (api_get_setting('extended_profile') == 'true') {
echo '<div class="actions">';
if (api_get_setting('allow_social_tool') == 'true' && api_get_setting('allow_message_tool') == 'true') {
echo '<a href="/main/social/profile.php">'.Display::return_icon('shared_profile.png', get_lang('ViewSharedProfile')).'&nbsp;'.get_lang('ViewSharedProfile').'</a>';
}
if (api_get_setting('allow_message_tool') == 'true') {
echo '<a href="/main/messages/inbox.php">'.Display::return_icon('inbox.png').' '.get_lang('Messages').'</a>';
}
$show = isset($_GET['show']) ? '&amp;show='.Security::remove_XSS($_GET['show']) : '';
echo '<span style="float:right; padding-top:7px;">';
if (isset($_GET['type']) && $_GET['type'] == 'extended') {
echo '<a href="profile.php?type=reduced'.$show.'">'.Display::return_icon('edit.gif', get_lang('EditNormalProfile')).'&nbsp;'.get_lang('EditNormalProfile').'</a>';
} else {
echo '<a href="profile.php?type=extended'.$show.'">'.Display::return_icon('edit.gif', get_lang('EditExtendProfile')).'&nbsp;'.get_lang('EditExtendProfile').'</a>';
}
if (api_get_setting('allow_social_tool') == 'true' && api_get_setting('allow_message_tool') == 'true') {
echo '<a href="../social/profile.php">'.Display::return_icon('shared_profile.png', get_lang('ViewSharedProfile')).'&nbsp;'.get_lang('ViewSharedProfile').'</a>';
}
echo '</span>';
echo '</div>';
}
@ -797,7 +794,7 @@ if (api_get_setting('allow_message_tool') == 'true') {
$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 = UserFriend::get_message_number_invitation_by_user_id(api_get_user_id());
$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">
<h2 class="message-title">'.get_lang('Messages').'</h2>

@ -233,6 +233,16 @@ if ($_user['user_id'] && !api_is_anonymous()) {
$menu_navigation['session_my_space'] = $possible_tabs['session_my_progress'];
}
}
// Social Networking
//if (api_get_setting('show_tabs', 'social') == 'true') {
if (1) {
$navigation['social'] = $possible_tabs['social'];
} else{
$menu_navigation['social'] = $possible_tabs['social'];
}
if(api_is_platform_admin(true)) {
@ -520,6 +530,13 @@ function get_tabs() {
$navigation['session_my_progress']['url'] = api_get_path(WEB_CODE_PATH).'auth/my_progress.php';
$navigation['session_my_progress']['title'] = get_lang('MyProgress');
}
// Social
if (api_get_setting('allow_social_tool')=='true') {
$navigation['social']['url'] = api_get_path(WEB_CODE_PATH).'social/profile.php';
$navigation['social']['title'] = get_lang('SocialNetwork');
}
// Platform administration
if (api_is_platform_admin(true)) {

@ -219,4 +219,4 @@ include(api_get_path(LIBRARY_PATH).'/javascript/email_links.lib.js.php');
<?php
// Banner
include(api_get_path(INCLUDE_PATH)."banner.inc.php");
include api_get_path(INCLUDE_PATH).'banner.inc.php';

@ -63,12 +63,15 @@ define('TABLE_MAIN_USER_FIELD_OPTIONS', 'user_field_options');
define('TABLE_MAIN_USER_FIELD_VALUES', 'user_field_values');
//User tags
define('TABLE_MAIN_USER_TAG', 'user_tag');
define('TABLE_MAIN_TAG', 'tag');
define('TABLE_MAIN_USER_REL_TAG', 'user_rel_tag');
//User group
define('TABLE_MAIN_USER_GROUP', 'user_group');
define('TABLE_MAIN_USER_GROUP_VALUES', 'user_group_values');
//User groups
define('TABLE_MAIN_GROUP', 'group');
define('TABLE_MAIN_USER_REL_GROUP', 'group_rel_user');
define('TABLE_MAIN_GROUP_REL_TAG', 'group_rel_tag');
// Search engine
define('TABLE_MAIN_SPECIFIC_FIELD', 'specific_field');
@ -791,12 +794,14 @@ class Database {
*
* @author Olivier Brouckaert
* @param resource $result - the return value of the query
* @param option BOTH, ASSOC, or NUM
* @return array - the value returned by the query
*
*/
public static function store_result($result) {
public static function store_result($result, $option = 'BOTH') {
$array = array();
if ($result !== false) { // For isolation from database engine's behaviour.
while ($row = self::fetch_array($result)) {
while ($row = self::fetch_array($result, $option)) {
$array[] = $row;
}
}

@ -270,7 +270,7 @@ class Display {
* 'per_page' = number of items to show per page
* 'page_nr' = The page to display
* @param array $query_vars Additional variables to add in the query-string
* @param string The style that the table will show. You can set 'table' or 'grid' string
* @param string The style that the table will show. You can set 'table' or 'grid'
* @author bart.mollet@hogent.be
*/
public static function display_sortable_table ($header, $content, $sorting_options = array (), $paging_options = array (), $query_vars = null, $form_actions=array(), $style='table') {
@ -283,16 +283,46 @@ class Display {
if (is_array($query_vars)) {
$table->set_additional_parameters($query_vars);
}
foreach ($header as $index => $header_item)
{
$table->set_header($index, $header_item[0], $header_item[1], $header_item[2], $header_item[3]);
}
$table->set_form_actions($form_actions);
if ($style=='table')
$table->display();
else
$table->display_grid();
if ($style=='table') {
if (is_array($header) && count($header)>0 ) {
foreach ($header as $index => $header_item) {
$table->set_header($index, $header_item[0], $header_item[1], $header_item[2], $header_item[3]);
}
}
$table->set_form_actions($form_actions);
$table->display();
} else {
$table->display_grid();
}
}
/**
* Shows a nice grid
* @param string grid name (important to create css)
* @param array header content
* @param array array with the information to show
* @param array $paging_options Keys are:
* 'per_page_default' = items per page when switching from
* full- list to per-page-view
* 'per_page' = number of items to show per page
* 'page_nr' = The page to display
* 'hide_navigation' = true to hide the navigation
* @param array $query_vars Additional variables to add in the query-string
* @param array $form actions Additional variables to add in the query-string
* @param mixed An array with bool values to know which columns show. i.e: $vibility_options= array(true, false) we will only show the first column
* Can be also only a bool value. TRUE: show all columns, FALSE: show nothing
*/
public static function display_sortable_grid ($name, $header, $content, $paging_options = array (), $query_vars = null, $form_actions=array(), $vibility_options = true) {
global $origin;
$column = 0;
$default_items_per_page = isset ($paging_options['per_page']) ? $paging_options['per_page'] : 20;
$table = new SortableTableFromArray($content, $column, $default_items_per_page, $name);
if (is_array($query_vars)) {
$table->set_additional_parameters($query_vars);
}
$table->display_simple_grid($vibility_options, $paging_options['hide_navigation']);
}
/**

File diff suppressed because it is too large Load Diff

@ -142,6 +142,7 @@ define('SECTION_MYAGENDA', 'myagenda');
define('SECTION_COURSE_ADMIN', 'course_admin');
define('SECTION_PLATFORM_ADMIN', 'platform_admin');
define('SECTION_MYGRADEBOOK', 'mygradebook');
define('SECTION_SOCIAL', 'social');
// CONSTANT name for local authentication source
define('PLATFORM_AUTH_SOURCE', 'platform');

@ -25,70 +25,63 @@
require_once api_get_path(LIBRARY_PATH).'online.inc.php';
require_once api_get_path(SYS_CODE_PATH).'messages/message.class.php';
function inbox_display() {
global $charset;
echo '<div id="div_content_messages">&nbsp;&nbsp;';
//api_display_tool_title(api_xml_http_response_encode(get_lang('Inbox')));
echo '<div class=actions>';
echo '<a onclick="compose_and_show_message(\'show\',\'1\')" href="javascript:void(0)">'.Display::return_icon('message_new.png',api_xml_http_response_encode(get_lang('ComposeMessage'))).api_xml_http_response_encode(get_lang('ComposeMessage')).'</a>';
echo '<a class="refresh" href="javascript:window.location.reload()">'.api_convert_encoding(get_lang('Refresh'),'UTF-8',$charset).'</a>';
echo '</div>';
echo '</div>';
$charset = api_get_setting('platform_charset');
$table_message = Database::get_main_table(TABLE_MESSAGE);
$request=api_is_xml_http_request();
if ($_SESSION['social_exist']===true) {
$redirect="#remote-tab-2";
if (api_get_setting('allow_social_tool')=='true' && api_get_setting('allow_message_tool')=='true') {
$success= get_lang('SelectedMessagesDeleted');
} else {
$success= get_lang('SelectedMessagesDeleted');
}
global $charset;
// $charset = api_get_setting('platform_charset');
$table_message = Database::get_main_table(TABLE_MESSAGE);
$request=api_is_xml_http_request();
if ($_SESSION['social_exist']===true) {
$redirect="#remote-tab-2";
if (api_get_setting('allow_social_tool')=='true' && api_get_setting('allow_message_tool')=='true') {
$success= get_lang('SelectedMessagesDeleted');
} else {
$success= get_lang('SelectedMessagesDeleted');
}
if (isset ($_REQUEST['action'])) {
switch ($_REQUEST['action']) {
case 'delete' :
$number_of_selected_messages = count($_POST['id']);
foreach ($_POST['id'] as $index => $message_id) {
MessageManager::delete_message_by_user_receiver(api_get_user_id(), $message_id);
}
Display::display_normal_message(api_xml_http_response_encode($success),false);
break;
case 'deleteone' :
MessageManager::delete_message_by_user_receiver(api_get_user_id(), $_GET['id']);
Display::display_confirmation_message(api_xml_http_response_encode($success),false);
echo '<br />';
break;
}
} else {
$success= get_lang('SelectedMessagesDeleted');
}
if (isset ($_REQUEST['action'])) {
switch ($_REQUEST['action']) {
case 'delete' :
$number_of_selected_messages = count($_POST['id']);
foreach ($_POST['id'] as $index => $message_id) {
MessageManager::delete_message_by_user_receiver(api_get_user_id(), $message_id);
}
Display::display_normal_message(api_xml_http_response_encode($success),false);
break;
case 'deleteone' :
MessageManager::delete_message_by_user_receiver(api_get_user_id(), $_GET['id']);
Display::display_confirmation_message(api_xml_http_response_encode($success),false);
echo '<br />';
break;
}
// display sortable table with messages of the current user
$table = new SortableTable('messages', 'get_number_of_messages_mask', 'get_message_data_mask', 3, get_number_of_messages_mask(),'DESC');
$table->set_header(0, '', false,array ('style' => 'width:20px;'));
$title=api_xml_http_response_encode(get_lang('Title'));
$action=api_xml_http_response_encode(get_lang('Actions'));
$table->set_header(1,api_xml_http_response_encode(get_lang('Status')),false,array('style' => 'width:30px;'));
$table->set_header(2,api_xml_http_response_encode(get_lang('From')),false);
$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">';
echo '<input type="hidden" name="action" value="delete" />';
$table->display();
echo '</form>';
if (get_number_of_messages_mask() > 0) {
echo '<a href="javascript:void(0)" onclick="selectall_cheks()">'.api_xml_http_response_encode(get_lang('SelectAll')).'</a>&nbsp;&nbsp;&nbsp;';
echo '<a href="javascript:void(0)" onclick="unselectall_cheks()">'.api_xml_http_response_encode(get_lang('UnSelectAll')).'</a>&nbsp;&nbsp;&nbsp;';
echo '<button class="save" name="delete" type="button" value="'.api_xml_http_response_encode(get_lang('DeleteSelectedMessages')).'" onclick="submit_form(\'inbox\')">'.api_xml_http_response_encode(get_lang('DeleteSelectedMessages')).'</button>';
}
// display sortable table with messages of the current user
$table = new SortableTable('messages', 'get_number_of_messages_mask', 'get_message_data_mask', 3, get_number_of_messages_mask(),'DESC');
$table->set_header(0, '', false,array ('style' => 'width:20px;'));
$title=api_xml_http_response_encode(get_lang('Title'));
$action=api_xml_http_response_encode(get_lang('Actions'));
$table->set_header(1,api_xml_http_response_encode(get_lang('Status')),false,array('style' => 'width:30px;'));
$table->set_header(2,api_xml_http_response_encode(get_lang('From')),false);
$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">';
echo '<input type="hidden" name="action" value="delete" />';
$table->display();
echo '</form>';
if (get_number_of_messages_mask() > 0) {
echo '<a href="javascript:void(0)" onclick="selectall_cheks()">'.api_xml_http_response_encode(get_lang('SelectAll')).'</a>&nbsp;&nbsp;&nbsp;';
echo '<a href="javascript:void(0)" onclick="unselectall_cheks()">'.api_xml_http_response_encode(get_lang('UnSelectAll')).'</a>&nbsp;&nbsp;&nbsp;';
echo '<button class="save" name="delete" type="button" value="'.api_xml_http_response_encode(get_lang('DeleteSelectedMessages')).'" onclick="submit_form(\'inbox\')">'.api_xml_http_response_encode(get_lang('DeleteSelectedMessages')).'</button>';
}
} else {
$table->set_form_actions(array ('delete' => get_lang('DeleteSelectedMessages')));
$table->display();
}
echo '</div>';
} else {
$table->set_form_actions(array ('delete' => get_lang('DeleteSelectedMessages')));
$table->display();
}
echo '</div>';
}
function get_number_of_messages_mask() {
return MessageManager::get_number_of_messages();

@ -7,8 +7,9 @@ define(SOCIALFRIEND,3);
define(SOCIALGOODFRIEND,4);
define(SOCIALENEMY,5);
define(SOCIALDELETED,6);
require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php';
class UserFriend extends UserManager {
class SocialManager extends UserManager {
private function __construct() {
@ -332,4 +333,248 @@ class UserFriend extends UserManager {
}
}
}
/**
* Get user's feeds
* @param int User ID
* @param int Limit of posts per feed
* @return string HTML section with all feeds included
* @author Yannick Warnier
* @since Dokeos 1.8.6.1
*/
function get_user_feeds($user,$limit=5) {
if (!function_exists('fetch_rss')) { return '';}
$fields = UserManager::get_extra_fields();
$feed_fields = array();
$feeds = array();
$res = '<div class="sectiontitle">'.get_lang('RSSFeeds').'</div>';
$res .= '<div class="social-content-training">';
$feed = UserManager::get_extra_user_data_by_field($user,'rssfeeds');
if(empty($feed)) { return ''; }
$feeds = split(';',$feed['rssfeeds']);
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++;
}
$res .= '</div>';
}
$res .= '</div>';
$res .= '<div class="clear"></div><br />';
return $res;
}
/**
* Helper functions definition
*/
function get_logged_user_course_html($my_course, $count) {
global $nosession;
if (api_get_setting('use_session_mode')=='true' && !$nosession) {
global $now, $date_start, $date_end;
}
//initialise
$result = '';
// Table definitions
$main_user_table = Database :: get_main_table(TABLE_MAIN_USER);
$tbl_session = Database :: get_main_table(TABLE_MAIN_SESSION);
$course_database = $my_course['db'];
$course_tool_table = Database :: get_course_table(TABLE_TOOL_LIST, $course_database);
$tool_edit_table = Database :: get_course_table(TABLE_ITEM_PROPERTY, $course_database);
$course_group_user_table = Database :: get_course_table(TOOL_USER, $course_database);
$user_id = api_get_user_id();
$course_system_code = $my_course['k'];
$course_visual_code = $my_course['c'];
$course_title = $my_course['i'];
$course_directory = $my_course['d'];
$course_teacher = $my_course['t'];
$course_teacher_email = isset($my_course['email'])?$my_course['email']:'';
$course_info = Database :: get_course_info($course_system_code);
//error_log(print_r($course_info,true));
$course_access_settings = CourseManager :: get_access_settings($course_system_code);
$course_visibility = $course_access_settings['visibility'];
$user_in_course_status = CourseManager :: get_user_in_course_status(api_get_user_id(), $course_system_code);
//function logic - act on the data
$is_virtual_course = CourseManager :: is_virtual_course_from_system_code($my_course['k']);
if ($is_virtual_course) {
// If the current user is also subscribed in the real course to which this
// virtual course is linked, we don't need to display the virtual course entry in
// the course list - it is combined with the real course entry.
$target_course_code = CourseManager :: get_target_of_linked_course($course_system_code);
$is_subscribed_in_target_course = CourseManager :: is_user_subscribed_in_course(api_get_user_id(), $target_course_code);
if ($is_subscribed_in_target_course) {
return; //do not display this course entry
}
}
$has_virtual_courses = CourseManager :: has_virtual_courses_from_code($course_system_code, api_get_user_id());
if ($has_virtual_courses) {
$return_result = CourseManager :: determine_course_title_from_course_info(api_get_user_id(), $course_info);
$course_display_title = $return_result['title'];
$course_display_code = $return_result['code'];
} else {
$course_display_title = $course_title;
$course_display_code = $course_visual_code;
}
$s_course_status=$my_course['s'];
$s_htlm_status_icon="";
if ($s_course_status==1) {
$s_htlm_status_icon=Display::return_icon('teachers.gif', get_lang('Teacher'));
}
if ($s_course_status==2) {
$s_htlm_status_icon=Display::return_icon('coachs.gif', get_lang('GeneralCoach'));
}
if ($s_course_status==5) {
$s_htlm_status_icon=Display::return_icon('students.gif', get_lang('Student'));
}
//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 .= $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>';
/*
if(api_get_setting('use_session_mode')=='true' && !$nosession) {
if(empty($my_course['id_session'])) {
$my_course['id_session'] = 0;
}
if($user_in_course_status == COURSEMANAGER || ($date_start <= $now && $date_end >= $now) || $date_start=='0000-00-00') {
//$result .= '<a href="'.api_get_path(WEB_COURSE_PATH).$course_directory.'/?id_session='.$my_course['id_session'].'">'.$course_display_title.'</a>';
$result .= '<a href="#">'.$course_display_title.'</a>';
}
} else {
//$result .= '<a href="'.api_get_path(WEB_COURSE_PATH).$course_directory.'/">'.$course_display_title.'</a>';
$result .= '<a href="'.api_get_path(WEB_COURSE_PATH).$course_directory.'/">'.$course_display_title.'</a>';
}*/
} else {
$result .= $course_display_title." "." ".get_lang('CourseClosed')."";
}
// show the course_code and teacher if chosen to display this
// we dont need this!
/*
if (api_get_setting('display_coursecode_in_courselist') == 'true' OR api_get_setting('display_teacher_in_courselist') == 'true') {
$result .= '<br />';
}
if (api_get_setting('display_coursecode_in_courselist') == 'true') {
$result .= $course_display_code;
}
if (api_get_setting('display_coursecode_in_courselist') == 'true' AND api_get_setting('display_teacher_in_courselist') == 'true') {
$result .= ' &ndash; ';
}
if (api_get_setting('display_teacher_in_courselist') == 'true') {
$result .= $course_teacher;
if(!empty($course_teacher_email)) {
$result .= ' ('.$course_teacher_email.')';
}
}
*/
$current_course_settings = CourseManager :: get_access_settings($my_course['k']);
// display the what's new icons
// $result .= show_notification($my_course);
if ((CONFVAL_showExtractInfo == SCRIPTVAL_InCourseList || CONFVAL_showExtractInfo == SCRIPTVAL_Both) && $nbDigestEntries > 0) {
reset($digest);
$result .= '<ul>';
while (list ($key2) = each($digest[$thisCourseSysCode])) {
$result .= '<li>';
if ($orderKey[1] == 'keyTools') {
$result .= "<a href=\"$toolsList[$key2] [\"path\"] $thisCourseSysCode \">";
$result .= "$toolsList[$key2][\"name\"]</a>";
} else {
$result .= format_locale_date(CONFVAL_dateFormatForInfosFromCourses, strtotime($key2));
}
$result .= '</li>';
$result .= '<ul>';
reset($digest[$thisCourseSysCode][$key2]);
while (list ($key3, $dataFromCourse) = each($digest[$thisCourseSysCode][$key2])) {
$result .= '<li>';
if ($orderKey[2] == 'keyTools') {
$result .= "<a href=\"$toolsList[$key3] [\"path\"] $thisCourseSysCode \">";
$result .= "$toolsList[$key3][\"name\"]</a>";
} else {
$result .= format_locale_date(CONFVAL_dateFormatForInfosFromCourses, strtotime($key3));
}
$result .= '<ul compact="compact">';
reset($digest[$thisCourseSysCode][$key2][$key3]);
while (list ($key4, $dataFromCourse) = each($digest[$thisCourseSysCode][$key2][$key3])) {
$result .= '<li>';
$result .= htmlspecialchars(substr(strip_tags($dataFromCourse), 0, CONFVAL_NB_CHAR_FROM_CONTENT));
$result .= '</li>';
}
$result .= '</ul>';
$result .= '</li>';
}
$result .= '</ul>';
$result .= '</li>';
}
$result .= '</ul>';
}
$result .= '</li>';
$result .= '</div>';
if (api_get_setting('use_session_mode')=='true' && !$nosession) {
$session = '';
$active = false;
if (!empty($my_course['session_name'])) {
// Request for the name of the general coach
$sql = 'SELECT lastname, firstname
FROM '.$tbl_session.' ts LEFT JOIN '.$main_user_table .' tu
ON ts.id_coach = tu.user_id
WHERE ts.id='.(int) $my_course['id_session']. ' LIMIT 1';
$rs = Database::query($sql, __FILE__, __LINE__);
$sessioncoach = Database::store_result($rs);
$sessioncoach = $sessioncoach[0];
$session = array();
$session['title'] = $my_course['session_name'];
if ( $my_course['date_start']=='0000-00-00' ) {
$session['dates'] = get_lang('WithoutTimeLimits');
if ( api_get_setting('show_session_coach') === 'true' ) {
$session['coach'] = get_lang('GeneralCoach').': '.api_get_person_name($sessioncoach['firstname'], $sessioncoach['lastname']);
}
$active = true;
} else {
$session ['dates'] = ' - '.get_lang('From').' '.$my_course['date_start'].' '.get_lang('To').' '.$my_course['date_end'];
if ( api_get_setting('show_session_coach') === 'true' ) {
$session['coach'] = get_lang('GeneralCoach').': '.api_get_person_name($sessioncoach['firstname'], $sessioncoach['lastname']);
}
$active = ($date_start <= $now && $date_end >= $now)?true:false;
}
}
$output = array ($my_course['user_course_cat'], $result, $my_course['id_session'], $session, 'active'=>$active);
} else {
$output = array ($my_course['user_course_cat'], $result);
}
//$my_course['creation_date'];
return $output;
}
public static function show_social_menu() {
echo '<div class="actions">';
echo '<a href="/main/social/profile.php">'.Display::return_icon('shared_profile.png').' '.get_lang('MySharedProfile').'</a>';
echo '<a href="/main/messages/inbox.php?f=social">'.Display::return_icon('inbox.png').' '.get_lang('Messages').'</a>';
echo '<a href="/main/social/friends.php">'.Display::return_icon('lp_users.png').' '.get_lang('Friends').'</a>';
echo '<a href="/main/social/invitations.php">'.Display::return_icon('lp_users.png').' '.get_lang('Invitations').'</a>';
echo '<a href="/main/social/groups.php">'.Display::return_icon('group.gif').' '.get_lang('MyGroups').'</a>';
echo '<a href="/main/social/search.php">'.Display::return_icon('search.gif').' '.get_lang('Search').'</a>';
echo '<span style="float:right; padding-top:7px;">'.
'<a href="/main/auth/profile.php?show=1">'.Display::return_icon('edit.gif').' '.get_lang('Configuration').'</a>';
'</span>';
echo '</div>';
}
}

@ -378,10 +378,7 @@ class SortableTable extends HTML_Table {
$html .= '<form method="post" action="'.api_get_self().'?'.$params.'" name="form_'.$this->table_name.'">';
}
}
$items = $this->get_clean_html(); // getting the items of the table
$items = $this->get_clean_html(); // getting the items of the table
// the generating of style classes must be improved. Maybe we need a a table name to create style on the fly:
// i.e: .whoisonline_table_grid_container instead of .grid_container
// where whoisonline is the table's name like drupal's template engine
@ -432,6 +429,103 @@ class SortableTable extends HTML_Table {
echo $html;
}
public function display_simple_grid($vibility_options, $hide_navigation) {
global $charset;
$empty_table = false;
$html = '';
if ($this->get_total_number_of_items() == 0) {
$cols = $this->getColCount();
//$this->setCellAttributes(1, 0, 'style="font-style: italic;text-align:center;" colspan='.$cols);
if (api_is_xml_http_request()===true) {
$message_empty=api_utf8_encode(get_lang('TheListIsEmpty'));
} else {
$message_empty=get_lang('TheListIsEmpty');
}
$this->setCellContents(1, 0,$message_empty);
$empty_table = true;
}
$html='';
if (!$empty_table) {
//if we show the pagination
if ($hide_navigation == false ) {
$form = $this->get_page_select_form();
$nav = $this->get_navigation_html();
//this also must be moved
$html = '<div class="sub-header">';
$html .= '<div class="grid_selectbox">'.$form.'</div>';
$html .= '<div class="grid_title">'.$this->get_table_title().'</div>';
$html .= '<div class="grid_nav">'.$nav.'</div>';
$html .= '</div>';
}
$html .= '<div class="clear"></div>';
if (count($this->form_actions) > 0) {
$script= '<script language="javaScript" type="text/javascript">
/*<![CDATA[*/
function setCheckbox(value) {
d = document.form_'.$this->table_name.';
for (i = 0; i < d.elements.length; i++) {
if (d.elements[i].type == "checkbox") {
d.elements[i].checked = value;
}
}
}
/*]]>*/
</script>';
$params = $this->get_sortable_table_param_string().'&amp;'.$this->get_additional_url_paramstring();
$html .= '<form method="post" action="'.api_get_self().'?'.$params.'" name="form_'.$this->table_name.'">';
}
}
// @todo This style css must be moved to default.css only for dev
echo '<style>
.search_users_grid_container { width:100%;}
.search_users_grid_item { width:400px; height: 90px; border:1px dotted #ccc; float:left; padding:5px; margin:8px;}
.search_users_grid_element_0 { width:100px; float:left; text-align:center; margin-bottom:5px;}
.search_users_grid_element_1 { width:100px; float:left; text-align:center;margin-bottom:5px;}
.search_users_grid_element_2 { width:150px; float:left;}
.search_users_grid_selectbox { width:50%; float:left;}
.search_users_grid_title { width:30%; float:left;}
.search_users_grid_nav { float:right;}
</style>';
$items = $this->get_clean_html(); // getting the items of the table
// the generating of style classes must be improved. Maybe we need a a table name to create style on the fly:
// i.e: .whoisonline_table_grid_container instead of .grid_container
// where whoisonline is the table's name like drupal's template engine
if (is_array($vibility_options)) {
$filter = false; // the 2nd condition of the if will be loaded
} else {
if ($vibility_options === false) {
$filter = false;
} else {
$filter = true;
}
}
$html .= '<div class="'.$this->table_name.'_grid_container">';
if (is_array($items) && count($items)>0 ) {
foreach($items as $row) {
$html.= '<div class="'.$this->table_name.'_grid_item">';
$i=0;
foreach($row as $element) {
if ( $filter === true || $vibility_options[$i] == true) {
$html.='<div class="'.$this->table_name.'_grid_element_'.$i.'">'.$element.'</div>';
}
$i++;
}
$html.='</div>';
}
}
$html.='</div>';
$html .= '<div class="clear"></div>';
echo $html;
}
/**
* Get the HTML-code with the navigational buttons to browse through the
* data-pages.

@ -639,13 +639,15 @@ class UserManager
} else {
$dir = $base.'upload/users/'.$user_id.'/';
}
if (empty($picture_filename) && $anonymous) {
return array('dir' => $base.'img/', 'file' => 'unknown.jpg');
}
return array('dir' => $dir, 'file' => $picture_filename);
}
/**
* Creates new user pfotos in various sizes of a user, or deletes user pfotos.
@ -2195,6 +2197,7 @@ class UserManager
$image_array_sys = self::get_user_picture_path_by_id($user_id, 'system', false, true);
$image_array = self::get_user_picture_path_by_id($user_id, 'web', false, true);
$file = $image_array_sys['dir'].$size_picture.$picture_file;
if (file_exists($file)) {
$picture['file'] = $image_array['dir'].$size_picture.$picture_file;
$picture['style'] = '';
@ -2206,10 +2209,10 @@ class UserManager
}
} else {
//$file = api_get_path(SYS_CODE_PATH).$patch_profile.$user_id.'/'.$picture_file;
$file = $image_array_sys['dir'].$picture_file;
if (file_exists($file)) {
$file = $image_array_sys['dir'].$picture_file;
if (file_exists($file) && !is_dir($file)) {
$picture['file'] = $image_array['dir'].$picture_file;
} else {
} else {
$picture['file'] = api_get_path(WEB_CODE_PATH).'img/unknown.jpg';
}
}
@ -2272,7 +2275,7 @@ class UserManager
*/
public static function get_tags($tag, $field_id, $return_format='json',$limit=10) {
// database table definition
$table_user_tag = Database::get_main_table(TABLE_MAIN_USER_TAG);
$table_user_tag = Database::get_main_table(TABLE_MAIN_TAG);
$table_user_tag_values = Database::get_main_table(TABLE_MAIN_USER_REL_TAG);
$field_id = intval($field_id); //like '%$tag%'
$limit = intval($limit);
@ -2295,10 +2298,10 @@ class UserManager
public static function get_top_tags($field_id, $limit=100) {
// database table definition
$table_user_tag = Database::get_main_table(TABLE_MAIN_USER_TAG);
$table_user_tag = Database::get_main_table(TABLE_MAIN_TAG);
$table_user_tag_values = Database::get_main_table(TABLE_MAIN_USER_REL_TAG);
$field_id = intval($field_id);
$limit = intval($limit);
$field_id = intval($field_id);
$limit = intval($limit);
// all the information of the field
$sql = "SELECT count(*) count, tag FROM $table_user_tag_values uv INNER JOIN $table_user_tag ut ON(ut.id = uv.tag_id)
WHERE field_id = $field_id GROUP BY tag_id ORDER BY count DESC LIMIT $limit";
@ -2320,7 +2323,7 @@ class UserManager
*/
public static function get_user_tags($user_id,$field_id) {
// database table definition
$table_user_tag = Database::get_main_table(TABLE_MAIN_USER_TAG);
$table_user_tag = Database::get_main_table(TABLE_MAIN_TAG);
$table_user_tag_values = Database::get_main_table(TABLE_MAIN_USER_REL_TAG);
$field_id = intval($field_id);
$user_id = intval($user_id);
@ -2338,34 +2341,38 @@ class UserManager
return $return;
}
/**
* Searchs user with a specific tag
* @param string the tag
* @param int field id of the tag
/**
* Get user's tags
* @param int field_id
* @param int user_id
* @return array
*/
public static function get_all_user_tags($tag, $field_id, $from, $number_of_items) {
public static function get_user_tags_to_string($user_id,$field_id) {
// database table definition
$table_user_tag = Database::get_main_table(TABLE_MAIN_USER_TAG);
$table_user_tag = Database::get_main_table(TABLE_MAIN_TAG);
$table_user_tag_values = Database::get_main_table(TABLE_MAIN_USER_REL_TAG);
$field_id = intval($field_id);
$tag = Database::escape_string($tag);
$from = intval($from);
$number_of_items = intval($number_of_items);
$user_id = intval($user_id);
// all the information of the field
$sql = "SELECT u.user_id,u.username,firstname, lastname, tag FROM $table_user_tag ut INNER JOIN $table_user_tag_values uv ON (uv.tag_id=ut.ID)
INNER JOIN user u ON(uv.user_id =u.user_id)
WHERE field_id = $field_id AND tag LIKE '$tag%' ORDER BY tag";
$sql .= " LIMIT $from,$number_of_items";
$sql = "SELECT ut.id, tag,count FROM $table_user_tag ut INNER JOIN $table_user_tag_values uv ON (uv.tag_id=ut.ID)
WHERE field_id = $field_id AND user_id = $user_id ORDER BY tag";
$result = Database::query($sql, __FILE__, __LINE__);
$return = array();
if (Database::num_rows($result)> 0) {
while ($row = Database::fetch_array($result,'ASSOC')) {
$return[$row['user_id']] = $row;
$return[$row['id']] = array('tag'=>$row['tag'],'count'=>$row['count']);
}
}
$user_tags = $return;
$tag_tmp = array();
foreach ($user_tags as $tag) {
$tag_tmp[] = '<a href="/main/search/?q='.$tag['tag'].'">'.$tag['tag'].'</a>';
}
if (is_array($user_tags) && count($user_tags)>0) {
$return = implode(', ',$tag_tmp);
}
return $return;
}
@ -2377,7 +2384,7 @@ class UserManager
* @return int 0 if fails otherwise the tag id
*/
public function get_tag_id($tag, $field_id) {
$table_user_tag = Database::get_main_table(TABLE_MAIN_USER_TAG);
$table_user_tag = Database::get_main_table(TABLE_MAIN_TAG);
$tag = Database::escape_string($tag);
$field_id = intval($field_id);
//with COLLATE latin1_bin to select query in a case sensitive mode
@ -2398,7 +2405,7 @@ class UserManager
* @return int 0 if fails otherwise the tag id
*/
public function get_tag_id_from_id($tag_id, $field_id) {
$table_user_tag = Database::get_main_table(TABLE_MAIN_USER_TAG);
$table_user_tag = Database::get_main_table(TABLE_MAIN_TAG);
$tag_id = intval($tag_id);
$field_id = intval($field_id);
$sql = "SELECT id FROM $table_user_tag WHERE id = '$tag_id' AND field_id = $field_id";
@ -2421,7 +2428,7 @@ class UserManager
*/
public function add_tag($tag, $user_id, $field_id) {
// database table definition
$table_user_tag = Database::get_main_table(TABLE_MAIN_USER_TAG);
$table_user_tag = Database::get_main_table(TABLE_MAIN_TAG);
$table_user_tag_values = Database::get_main_table(TABLE_MAIN_USER_REL_TAG);
$tag = Database::escape_string($tag);
$user_id = intval($user_id);
@ -2483,7 +2490,7 @@ class UserManager
*/
public function delete_user_tags($user_id, $field_id) {
// database table definition
$table_user_tag = Database::get_main_table(TABLE_MAIN_USER_TAG);
$table_user_tag = Database::get_main_table(TABLE_MAIN_TAG);
$table_user_tag_values = Database::get_main_table(TABLE_MAIN_USER_REL_TAG);
$tags = UserManager::get_user_tags($user_id, $field_id);
//echo '<pre>';var_dump($tags);
@ -2518,5 +2525,193 @@ class UserManager
UserManager::add_tag($tags,$user_id, $field_id);
}
return true;
}
}
/**
* Searchs an user (tags, firstname, lastname and email )
* @param string the tag
* @param int field id of the tag
* @return array
*/
public static function get_all_user_tags($tag, $field_id = 0, $from=0, $number_of_items=10) {
// database table definition
$user_table = Database::get_main_table(TABLE_MAIN_USER);
$table_user_tag = Database::get_main_table(TABLE_MAIN_TAG);
$table_user_tag_values = Database::get_main_table(TABLE_MAIN_USER_REL_TAG);
$field_id = intval($field_id);
$tag = Database::escape_string($tag);
$from = intval($from);
$number_of_items = intval($number_of_items);
$where_field = "";
if ($field_id != 0) {
$where_field = " field_id = $field_id AND ";
}
// all the information of the field
$sql = "SELECT u.user_id,u.username,firstname, lastname, email, tag, picture_uri FROM $table_user_tag ut INNER JOIN $table_user_tag_values uv ON (uv.tag_id=ut.id)
INNER JOIN $user_table u ON(uv.user_id =u.user_id)
WHERE $where_field tag LIKE '$tag%' ORDER BY tag";
$sql .= " LIMIT $from,$number_of_items";
$result = Database::query($sql, __FILE__, __LINE__);
$return = array();
if (Database::num_rows($result)> 0) {
while ($row = Database::fetch_array($result,'ASSOC')) {
$return[$row['user_id']] = $row;
}
}
$keyword = $tag;
$sql = "SELECT u.user_id, u.username, firstname, lastname, email, picture_uri FROM $user_table u";
global $_configuration;
if ($_configuration['multiple_access_urls']==true && api_get_current_access_url_id()!=-1) {
$access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
$sql.= " INNER JOIN $access_url_rel_user_table url_rel_user ON (u.user_id=url_rel_user.user_id)";
}
if (isset ($keyword)) {
$keyword = Database::escape_string($keyword);
//OR u.official_code LIKE '%".$keyword."%'
// OR u.email LIKE '%".$keyword."%'
$sql .= " WHERE (u.firstname LIKE '%".$keyword."%' OR u.lastname LIKE '%".$keyword."%' OR u.username LIKE '%".$keyword."%' )";
}
$keyword_active = true;
//only active users
if ($keyword_active) {
$sql .= " AND u.active='1'";
}
// adding the filter to see the user's only of the current access_url
if ($_configuration['multiple_access_urls']==true && api_get_current_access_url_id()!=-1) {
$sql.= " AND url_rel_user.access_url_id=".api_get_current_access_url_id();
}
$direction = 'ASC';
if (!in_array($direction, array('ASC','DESC'))) {
$direction = 'ASC';
}
$column = intval($column);
$from = intval($from);
$number_of_items = intval($number_of_items);
//$sql .= " ORDER BY col$column $direction ";
$sql .= " LIMIT $from,$number_of_items";
$res = Database::query($sql, __FILE__, __LINE__);
if (Database::num_rows($res)> 0) {
while ($row = Database::fetch_array($res,'ASSOC')) {
if (!in_array($row['user_id'], $return)) {
$return[$row['user_id']] = $row;
}
}
}
return $return;
}
/**
* Show the search form
* @param string the value of the search box
*
*/
public function get_search_form($query) {
echo'<form method="get" action="/main/social/search.php">
<table cellspacing="0" cellpadding="0" id="SearchTable">
<tbody><tr>
<td>
<div id="SearchQueryChunk">
<div id="SearchQueryNav">
<b>Search</b > (Users, Groups)
</div>
<div>
<input type="text" size="30" value="'.Security::remove_XSS($query).'" tabindex="1" id="standard_q" name="q"/>
<input type="submit" value="search"/>
</div>
</td>
</tr>
</tbody></table></form>';
}
//deprecated
public function get_public_users($keyword, $from = 0, $number_of_items= 20, $column=2, $direction='ASC') {
$admin_table = Database :: get_main_table(TABLE_MAIN_ADMIN);
$sql = "SELECT
u.user_id AS col0,
u.official_code AS col1,
".(api_is_western_name_order()
? "u.firstname AS col2,
u.lastname AS col3,"
: "u.lastname AS col2,
u.firstname AS col3,")."
u.username AS col4,
u.email AS col5,
u.status AS col6,
u.active AS col7,
u.user_id AS col8 ".
", u.expiration_date AS exp ".
" FROM $user_table u ";
// adding the filter to see the user's only of the current access_url
global $_configuration;
if ((api_is_platform_admin() || api_is_session_admin()) && $_configuration['multiple_access_urls']==true && api_get_current_access_url_id()!=-1) {
$access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
$sql.= " INNER JOIN $access_url_rel_user_table url_rel_user ON (u.user_id=url_rel_user.user_id)";
}
if (isset ($keyword)) {
$keyword = Database::escape_string($keyword);
//OR u.official_code LIKE '%".$keyword."%'
$sql .= " WHERE (u.firstname LIKE '%".$keyword."%' OR u.lastname LIKE '%".$keyword."%' OR u.username LIKE '%".$keyword."%' OR u.email LIKE '%".$keyword."%' )";
}
$keyword_active = true;
//only active users
if ($keyword_active) {
$sql .= " AND u.active='1'";
}
// adding the filter to see the user's only of the current access_url
if ($_configuration['multiple_access_urls']==true && api_get_current_access_url_id()!=-1) {
$sql.= " AND url_rel_user.access_url_id=".api_get_current_access_url_id();
}
if (!in_array($direction, array('ASC','DESC'))) {
$direction = 'ASC';
}
$column = intval($column);
$from = intval($from);
$number_of_items = intval($number_of_items);
$sql .= " ORDER BY col$column $direction ";
$sql .= " LIMIT $from,$number_of_items";
$res = Database::query($sql, __FILE__, __LINE__);
$users = array ();
$t = time();
while ($user = Database::fetch_row($res)) {
if ($user[7] == 1 && $user[9] != '0000-00-00 00:00:00') {
// check expiration date
$expiration_time = convert_mysql_date($user[9]);
// if expiration date is passed, store a special value for active field
if ($expiration_time < $t) {
$user[7] = '-1';
}
}
// forget about the expiration date field
$users[] = array($user[0],$user[1],$user[2],$user[3],$user[4],$user[5],$user[6],$user[7],$user[8]);
}
return $users;
}
function show_menu(){
echo '<div class="actions">';
echo '<a href="/main/auth/profile.php">'.Display::return_icon('profile.png').' '.get_lang('PersonalData').'</a>';
echo '<a href="/main/messages/inbox.php">'.Display::return_icon('inbox.png').' '. get_lang('Inbox').'</a>';
echo '<a href="/main/messages/outbox.php">'.Display::return_icon('outbox.png').' '. get_lang('Outbox').'</a>';
echo '<span style="float:right; padding-top:7px;">'.
'<a href="/main/auth/profile.php?show=1">'.Display::return_icon('edit.gif').' '.get_lang('Configuration').'</a>';
'</span>';
echo '</div>';
}
}

@ -2265,7 +2265,7 @@ CREATE TABLE session_category (
--
CREATE TABLE user_tag (
CREATE TABLE tag (
id int NOT NULL auto_increment,
tag varchar(255) NOT NULL,
field_id int NOT NULL,
@ -2281,3 +2281,34 @@ CREATE TABLE user_rel_tag (
PRIMARY KEY (id)
);
--
-- Table structure for user platform groups
--
CREATE TABLE `group` (
id int NOT NULL AUTO_INCREMENT,
name varchar(255) NOT NULL,
description varchar(255) NOT NULL,
picture_uri varchar(255) NOT NULL,
url varchar(255) NOT NULL,
visibility int NOT NULL,
updated_on varchar(255) NOT NULL,
created_on varchar(255) NOT NULL,
PRIMARY KEY (id)
);
CREATE TABLE group_rel_tag (
id int NOT NULL AUTO_INCREMENT,
tag_id int NOT NULL,
group_id int NOT NULL,
PRIMARY KEY (id)
);
CREATE TABLE group_rel_user (
id int NOT NULL AUTO_INCREMENT,
group_id int NOT NULL,
user_id int NOT NULL,
relation_type int NOT NULL,
PRIMARY KEY (id)
);

@ -34,7 +34,7 @@ INSERT INTO settings_options (variable, value, display_text) VALUES ('allow_coac
INSERT INTO settings_options (variable, value, display_text) VALUES ('show_glossary_in_extra_tools', 'true', 'Yes');
INSERT INTO settings_options (variable, value, display_text) VALUES ('show_glossary_in_extra_tools', 'false', 'No');
CREATE TABLE user_tag (id int NOT NULL auto_increment, tag varchar(255) NOT NULL, field_id int NOT NULL, count int NOT NULL, PRIMARY KEY (id));
CREATE TABLE tag (id int NOT NULL auto_increment, tag varchar(255) NOT NULL, field_id int NOT NULL, count int NOT NULL, PRIMARY KEY (id));
CREATE TABLE user_rel_tag (id int NOT NULL auto_increment,user_id int NOT NULL,tag_id int NOT NULL, PRIMARY KEY (id));

@ -136,35 +136,45 @@ if (isset($_GET['form_reply']) || isset($_GET['form_delete'])) {
}
}
if ($request===false) {
$interbreadcrumb[]= array (
'url' => '#',
'name' => get_lang('Messages')
);
$interbreadcrumb[]= array (
'url' => 'outbox.php',
'name' => get_lang('Outbox')
);
$interbreadcrumb[]= array (
'url' => 'inbox.php',
'name' => get_lang('Inbox')
);
Display::display_header('');
$link_ref="new_message.php";
} else {
$link_ref="../messages/new_message.php?rs=1";
}
$link_ref="new_message.php";
$table_message = Database::get_main_table(TABLE_MESSAGE);
/*echo '<div id="div_content_messages">&nbsp;&nbsp;';
//api_display_tool_title(api_xml_http_response_encode(get_lang('Inbox')));
echo '<div class=actions>';
echo '<a onclick="compose_and_show_message(\'show\',\'1\')" href="javascript:void(0)">'.Display::return_icon('message_new.png',api_xml_http_response_encode(get_lang('ComposeMessage'))).api_xml_http_response_encode(get_lang('ComposeMessage')).'</a>';
echo '</div>';
echo '</div>';*/
if (!isset($_GET['del_msg'])) {
if ($_GET['f']=='social') {
$this_section = SECTION_SOCIAL;
$interbreadcrumb[]= array ('url' => '#','name' => get_lang('Profile'));
$interbreadcrumb[]= array ('url' => 'outbox.php','name' => get_lang('Inbox'));
} else {
$this_section = SECTION_MYPROFILE;
$interbreadcrumb[]= array ('url' => '#','name' => get_lang('Profile'));
$interbreadcrumb[]= array ('url' => 'outbox.php','name' => get_lang('Inbox'));
}
Display::display_header('');
if ($_GET['f']=='social') {
require_once api_get_path(LIBRARY_PATH).'social.lib.php';
SocialManager::show_social_menu();
echo '<div class="actions-title">';
echo get_lang('Messages');
echo '</div>';
} else {
//comes from normal profile
echo '<div class=actions>';
echo '<a href="/main/messages/inbox.php">'.Display::return_icon('inbox.png',api_xml_http_response_encode(get_lang('Inbox'))).api_xml_http_response_encode(get_lang('Inbox')).'</a>';
echo '<a href="/main/messages/new_message.php">'.Display::return_icon('message_new.png',api_xml_http_response_encode(get_lang('ComposeMessage'))).api_xml_http_response_encode(get_lang('ComposeMessage')).'</a>';
echo '<a href="/main/messages/outbox.php">'.Display::return_icon('outbox.png',api_xml_http_response_encode(get_lang('Outbox'))).api_xml_http_response_encode(get_lang('Outbox')).'</a>';
echo '</div>';
}
if (!isset($_GET['del_msg'])) {
inbox_display();
} else {
$num_msg = $_POST['total'];
$num_msg = intval($_POST['total']);
for ($i=0;$i<$num_msg;$i++) {
if($_POST[$i]) {
//the user_id was necesarry to delete a message??

@ -1,27 +1,5 @@
<?php // $Id: index.php 20962 2009-05-25 03:15:53Z iflorespaz $
/*
==============================================================================
Dokeos - elearning and course management software
Copyright (c) 2009 Dokeos SPRL
Copyright (c) 2009 Julio Montoya Armas <gugli100@gmail.com>
Copyright (c) Facultad de Matematicas, UADY (México)
Copyright (c) Evie, Free University of Brussels (Belgium)
For a full list of contributors, see "credits.txt".
The full license can be read in "license.txt".
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
See the GNU General Public License for more details.
Contact address: Dokeos, rue du Corbeau, 108, B-1030 Brussels, Belgium
Mail: info@dokeos.com
==============================================================================
*/
/* For licensing terms, see /dokeos_license.txt */
$language_file= 'messages';
require_once '../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'message.lib.php';
@ -34,7 +12,7 @@ if (api_get_setting('allow_message_tool')!='true'){
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> ';
$number_of_new_messages = get_new_messages();
$number_of_new_messages = MessageManager::get_new_messages();
if(is_null($number_of_new_messages)) {
$number_of_new_messages = 0;
}

@ -1,26 +1,5 @@
<?php
/*
==============================================================================
Dokeos - elearning and course management software
Copyright (c) 2004-2009 Dokeos SPRL
Copyright (c) Julio Montoya <gugli100@gmail.com>
For a full list of contributors, see "credits.txt".
The full license can be read in "license.txt".
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
See the GNU General Public License for more details.
Contact address: Dokeos, rue du Corbeau, 108, B-1030 Brussels, Belgium
Mail: info@dokeos.com
==============================================================================
*/
/* For licensing terms, see /dokeos_license.txt */
require_once api_get_path(LIBRARY_PATH).'/main_api.lib.php';
require_once api_get_path(LIBRARY_PATH).'/online.inc.php';

@ -213,14 +213,14 @@ if (isset($_GET['rs'])) {
'name' => get_lang('ComposeMessage')
);
if ($request===false) {
Display::display_header('');
}
//api_display_tool_title($nameTools);
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 '</div>';
echo '<a href="/main/messages/inbox.php">'.Display::return_icon('inbox.png',api_xml_http_response_encode(get_lang('Inbox'))).api_xml_http_response_encode(get_lang('Inbox')).'</a>';
echo '<a href="/main/messages/new_message.php">'.Display::return_icon('message_new.png',api_xml_http_response_encode(get_lang('ComposeMessage'))).api_xml_http_response_encode(get_lang('ComposeMessage')).'</a>';
echo '<a href="/main/messages/outbox.php">'.Display::return_icon('outbox.png',api_xml_http_response_encode(get_lang('Outbox'))).api_xml_http_response_encode(get_lang('Outbox')).'</a>';
echo '</div>';
if (!isset($_POST['compose'])) {
if(isset($_GET['re_id'])) {
$message_id = $_GET['re_id'];

@ -1,29 +1,7 @@
<?php // $Id: notify.php 20962 2009-05-25 03:15:53Z iflorespaz $
/*
==============================================================================
Dokeos - elearning and course management software
Copyright (c) 2009 Dokeos SPRL
Copyright (c) 2009 Julio Montoya Armas <gugli100@gmail.com>
Copyright (c) Facultad de Matematicas, UADY (México)
Copyright (c) Evie, Free University of Brussels (Belgium)
For a full list of contributors, see "credits.txt".
The full license can be read in "license.txt".
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
See the GNU General Public License for more details.
Contact address: Dokeos, rue du Corbeau, 108, B-1030 Brussels, Belgium
Mail: info@dokeos.com
==============================================================================
*/
/* For licensing terms, see /dokeos_license.txt */
require_once '../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'message.lib.php';
header("Cache-Control: no-cache, must-revalidate");
echo get_new_messages();
echo MessageManager::get_new_messages();
?>

@ -93,6 +93,13 @@ if ($request===false) {
);
Display::display_header('');
}
echo '<div class=actions>';
echo '<a href="/main/messages/inbox.php">'.Display::return_icon('inbox.png',api_xml_http_response_encode(get_lang('Inbox'))).api_xml_http_response_encode(get_lang('Inbox')).'</a>';
echo '<a href="/main/messages/new_message.php">'.Display::return_icon('message_new.png',api_xml_http_response_encode(get_lang('ComposeMessage'))).api_xml_http_response_encode(get_lang('ComposeMessage')).'</a>';
echo '<a href="/main/messages/outbox.php">'.Display::return_icon('outbox.png',api_xml_http_response_encode(get_lang('Outbox'))).api_xml_http_response_encode(get_lang('Outbox')).'</a>';
echo '</div>';
/**************************************************************/
$info_delete_outbox=array();
$info_delete_outbox=explode(',',$_GET['form_delete_outbox']);
@ -112,9 +119,7 @@ if( trim($info_delete_outbox[0])=='delete' ) {
}
/**************************************************************/
$table_message = Database::get_main_table(TABLE_MESSAGE);
echo '<div id="div_content_messages_sent">&nbsp;&nbsp;';
//api_display_tool_title(api_xml_http_response_encode(get_lang('Outbox')));
echo '</div>';
$user_sender_id=api_get_user_id();
if ($_REQUEST['action']=='delete') {
$delete_list_id=array();

@ -71,8 +71,8 @@ if ($panel_id==4) {
if ($subject_message=='clear') {
$subject_message=null;
}
UserFriend::send_invitation_friend_user($user_id,$subject_message,$content_message);
SocialManager::send_invitation_friend_user($user_id,$subject_message,$content_message);
} elseif ($panel_id==5) {
UserFriend::send_invitation_friend_user($user_id,$subject_message,$content_message);
SocialManager::send_invitation_friend_user($user_id,$subject_message,$content_message);
}
?>

@ -129,7 +129,7 @@ $language_variable=api_xml_http_response_encode(get_lang('PersonalData'));
$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=UserFriend::get_message_number_invitation_by_user_id(api_get_user_id());
$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>

@ -0,0 +1,150 @@
<?php
/* For licensing terms, see /dokeos_license.txt */
$language_file = array('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 api_get_path(LIBRARY_PATH).'social.lib.php';
$this_section = SECTION_SOCIAL;
$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.js" type="text/javascript" language="javascript"></script>'; //jQuery
$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery-1.1.3.1.pack.js" type="text/javascript"></script>';
$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.history_remote.pack.js" type="text/javascript"></script>';
$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.tabs.pack.js" type="text/javascript"></script>';
$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/thickbox.js" type="text/javascript" language="javascript"></script>';
$htmlHeadXtra[] = '<script type="text/javascript">
function add_group (my_action,name_rs) {
if(my_action=="show") {
$("div#div_content_messages").html("");
$("div#div_content_table_data").html("");
$(".confirmation-message").remove();
$(".normal-message").remove();
$(".error-message").remove();
$.ajax({
contentType: "application/x-www-form-urlencoded",
type: "GET",
url: "group_add.php",
data:"rs="+name_rs,
success: function(datos) {
$("div#div_add_group").html(datos);
}
});
}
}
function delete_friend (element_div) {
id_image=$(element_div).attr("id");
user_id=id_image.split("_");
if (confirm("'.get_lang('Delete', '').'")) {
$.ajax({
contentType: "application/x-www-form-urlencoded",
type: "POST",
url: "../social/register_friend.php",
data: "delete_friend_id="+user_id[1],
success: function(datos) {
//alert(datos);
$("div#"+"div_"+user_id[1]).hide("slow");
$("div#"+"div_"+user_id[1]).html("");
clear_form ();
}
});
}
}
function search_image_social(element_html) {
name_search=$(element_html).attr("value");
$.ajax({
contentType: "application/x-www-form-urlencoded",
type: "POST",
url: "../social/show_search_image.inc.php",
data: "search_name_q="+name_search,
success: function(datos) {
$("div#div_content_table").html(datos);
}
});
}
function show_icon_delete(element_html) {
elem_id=$(element_html).attr("id");
id_elem=elem_id.split("_");
ident="#img_"+id_elem[1];
$(ident).attr("src","../img/delete.gif");
$(ident).attr("alt","'.get_lang('Delete', '').'");
$(ident).attr("title","'.get_lang('Delete', '').'");
}
function hide_icon_delete(element_html) {
elem_id=$(element_html).attr("id");
id_elem=elem_id.split("_");
ident="#img_"+id_elem[1];
$(ident).attr("src","../img/blank.gif");
$(ident).attr("alt","");
$(ident).attr("title","");
}
</script>';
$interbreadcrumb[]= array ('url' =>'home.php','name' => get_lang('Social'));
Display :: display_header($tool_name, 'Groups');
SocialManager::show_social_menu();
echo '<div class="actions-title">';
echo get_lang('MyFriends');
echo '</div>';
//$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 height="25" valign="top">
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="social-subtitle-search">
<tr>
<td width="100%" 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 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>
<?php
Display :: display_footer();
?>

@ -0,0 +1,78 @@
<?php
$language_file= 'admin';
$cidReset=true;
require_once '../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'/formvalidator/FormValidator.class.php';
$request=api_is_xml_http_request();
$nameTools = api_xml_http_response_encode(get_lang('AddGroup'));
global $charset;
$table_message = Database::get_main_table(TABLE_MESSAGE);
$request=api_is_xml_http_request();
if ($request===true) {
$form = new FormValidator('add_group','post','index.php?add_group=1#remote-tab-7');
} else {
$form = new FormValidator('add_group');
}
// name
$form->addElement('text', 'name', get_lang('Name'));
$form->applyFilter('name', 'html_filter');
$form->applyFilter('name', 'trim');
$form->addRule('name', get_lang('ThisFieldIsRequired'), 'required');
// Description
$form->addElement('text', 'description', get_lang('Description'));
$form->applyFilter('description', 'html_filter');
$form->applyFilter('description', 'trim');
// url
$form->addElement('text', 'url', get_lang('URL'));
$form->applyFilter('url', 'html_filter');
$form->applyFilter('url', 'trim');
// Picture
$form->addElement('file', 'picture', get_lang('AddPicture'));
$allowed_picture_types = array ('jpg', 'jpeg', 'png', 'gif');
$form->addRule('picture', get_lang('OnlyImagesAllowed').' ('.implode(',', $allowed_picture_types).')', 'filetype', $allowed_picture_types);
/*
$form->add_textfield('id_text_name', api_xml_http_response_encode(get_lang('SendMessageTo')),true,array('size' => 40,'id'=>'id_text_name','onkeyup'=>'send_request_and_search()','autocomplete'=>'off','style'=>'padding:0px'));
$form->addRule('id_text_name', api_xml_http_response_encode(get_lang('ThisFieldIsRequired')), 'required');
$form->addElement('html','<div id="id_div_search" style="padding:0px" class="message-select-box" >&nbsp;</div>');
$form->addElement('hidden','user_list',0,array('id'=>'user_list'));
$form->add_textfield('title', api_xml_http_response_encode(get_lang('Title')));
$form->add_html_editor('content', '', false, false, array('ToolbarSet' => 'Messages', 'Width' => '95%', 'Height' => '250'));
if (isset($_GET['re_id'])) {
$form->addElement('hidden','re_id',Security::remove_XSS($_GET['re_id']));
$form->addElement('hidden','save_form','save_form');
}
*/
$form->addElement('style_submit_button','add_group', api_xml_http_response_encode(get_lang('AddGroup')),'class="save"');
$form->setRequiredNote(api_xml_http_response_encode('<span class="form_required">*</span> <small>'.get_lang('ThisFieldIsRequired').'</small>'));
$form->setDefaults($default);
if ($form->validate()) {
$values = $form->exportValues();
var_dump($values);
$receiver_user_id = $values['user_list'];
$title = $values['title'];
$content = $values['content'];
//all is well, send the message
//MessageManager::send_message($receiver_user_id, $title, $content);
//MessageManager::display_success_message($receiver_user_id);
} else {
$form->display();
}
?>

@ -17,10 +17,12 @@ $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=UserFriend::show_list_type_friends();
$list_groups=SocialManager::show_list_type_friends();
for ($p=0;$p<count($list_groups);$p++) {
$list_path_friends=UserFriend::get_list_path_web_by_user_id ($user_id,$list_groups[$p]['id']);
$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>
@ -65,7 +67,7 @@ for ($p=0;$p<count($list_groups);$p++) {
} else {
$big='big_';
}
$friends_profile = UserFriend::get_picture_user($list_friends_id[$j], $list_friends_file[$j], 92);
$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>'.

@ -0,0 +1,17 @@
<?php
/* For licensing terms, see /dokeos_license.txt */
$language_file = array('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 api_get_path(LIBRARY_PATH).'group_portal_manager.lib.php';
Display :: display_header($tool_name, "User");
$group_id = intval($_GET['id']);
Display :: display_footer();
?>

@ -0,0 +1,120 @@
<?php
/* For licensing terms, see /dokeos_license.txt */
$language_file = array('admin');
require '../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';
$this_section = SECTION_SOCIAL;
$interbreadcrumb[]= array ('url' =>'home.php','name' => get_lang('Social'));
Display :: display_header($tool_name, 'Groups');
//show the action menu
SocialManager::show_social_menu();
echo '<div class="actions-title">';
echo get_lang('Groups');
echo '</div>';
$group_id = intval($_GET['id']);
if ($group_id != 0 ) {
$group_info = GroupPortalManager::get_group_data($group_id);
$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);
//var_dump($users);
//Group's title
echo '<h1>'.$group_info['name'].'</h1>';
//image
echo '<div id="group_image">';
echo $img = '<img src="'.$picture['file'].'" />';
echo '</div>';
//description
echo '<div id="group_description">';
echo $group_info['description'];
echo '</div>';
//Privacy
echo '<div id="group_privacy">';
echo get_lang('Privacy').' : ';
if ($group_info['visibility']== GROUP_PERMISSION_OPEN) {
echo get_lang('ThisIsAnOpenGroup');
} elseif ($group_info['visibility']== GROUP_PERMISSION_CLOSED) {
echo get_lang('ThisIsACloseGroup');
}
echo '</div>';
//group tags
if (!empty($tags)) {
echo '<div id="group_tags">';
echo get_lang('Tags').' : '.$tags;
echo '</div>';
}
echo '<div id="group_members">';
echo get_lang('Members').' : ';
foreach($users as $user) {
echo $user['picture_uri'].$user['firstname'].$user['lastname'].'<br />';
}
echo '</div>';
echo '<div id="group_permissions">';
if (in_array(api_get_user_id(), $users)) {
//im a member
if (isset($users[api_get_user_id()]) && $users[api_get_user_id()]['relation_info']!='') {
$my_group_role = $users[api_get_get_user_id()]['relation_info'];
// just a reader
if ($my_group_role == GROUP_USER_PERMISSION_READER) {
echo 'Im just a reader';
echo 'Invite others';
echo 'Leave group';
//the main admin
} elseif ($my_group_role == GROUP_USER_PERMISSION_ADMIN) {
echo 'Imm the admin';
echo 'Edit group';
echo 'Invite others';
}
} else {
//im not a member
echo 'I should register';
}
} else {
//im not a member
echo 'I should register';
}
echo '</div>';
} else {
echo '<h1>'.get_lang('Newest').'</h1>';
echo '<h1>'.get_lang('Popular').'</h1>';
echo '<h1>'.get_lang('MyGroups').'</h1>';
$results = GroupPortalManager::get_groups_by_user(api_get_user_id(), 0, true);
$groups = array();
foreach ($results as $result) {
$id = $result['id'];
$url_open = '<a href="groups.php?id='.$id.'">';
$url_close = '</a>';
$groups[]= array($url_open.$result['picture_uri'].$url_close, $url_open.$result['name'].$url_close);
}
Display::display_sortable_grid('search_users', array(), $groups, array('hide_navigation'=>true, 'per_page' => 100), $query_vars, false, array(true, true, true,false));
}
Display :: display_footer();
?>

@ -0,0 +1,611 @@
<?php //$id: $
/* For licensing terms, see /dokeos_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
*/
$language_file = array('registration','messages','userInfo','admin','forum','blog');
$cidReset = true;
require '../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).'array.lib.php';
$user_id = api_get_user_id();
$show_full_profile = true;
//social tab
$this_section = SECTION_SOCIAL;
//I'm your friend? I can see your profile?
if (isset($_GET['u'])) {
$user_id = (int) Database::escape_string($_GET['u']);
// It's me!
if (api_get_user_id() != $user_id) {
$user_info = UserManager::get_user_info_by_id($user_id);
$show_full_profile = false;
if ($user_info==false) {
// user does no exist !!
api_not_allowed();
} else {
//checking the relationship between me and my friend
$my_status= SocialManager::get_relation_between_contacts(api_get_user_id(), $user_id);
if (in_array($my_status, array(SOCIALPARENT, SOCIALFRIEND, SOCIALGOODFRIEND))) {
$show_full_profile = true;
}
//checking the relationship between my friend and me
$my_friend_status = SocialManager::get_relation_between_contacts($user_id, api_get_user_id());
if (in_array($my_friend_status, array(SOCIALPARENT, SOCIALFRIEND, SOCIALGOODFRIEND))) {
$show_full_profile = true;
} else {
// im probably not a good friend
$show_full_profile = false;
}
}
} else {
$user_info = UserManager::get_user_info_by_id($user_id);
}
} else {
$user_info = UserManager::get_user_info_by_id($user_id);
}
$libpath = api_get_path(LIBRARY_PATH);
require_once api_get_path(SYS_CODE_PATH).'calendar/myagenda.inc.php';
require_once api_get_path(SYS_CODE_PATH).'announcements/announcements.inc.php';
require_once $libpath.'course.lib.php';
require_once $libpath.'formvalidator/FormValidator.class.php';
require_once $libpath.'magpierss/rss_fetch.inc';
api_block_anonymous_users();
$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.js" type="text/javascript" language="javascript"></script>'; //jQuery
$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.corners.min.js" type="text/javascript" language="javascript"></script>'; //jQuery corner
$htmlHeadXtra[] = '<script type="text/javascript" src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/thickbox.js"></script>';
$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){
elem_id=$(element_html).attr("id");
id_elem=elem_id.split("_");
ident="div#div_group_"+id_elem[1];
id_button="#btn_"+id_elem[1];
elem_src=$(id_button).attr("src");
image_show=elem_src.split("/");
my_image=image_show[2];
var content = \'social_content\' + id_elem[1];
if (my_image=="nolines_plus.gif") {
$(id_button).attr("src","../img/nolines_minus.gif"); var action = "load_course";
$("div#"+content).show("slow");
} else {
$("div#"+content).hide("slow");
$(id_button).attr("src","../img/nolines_plus.gif"); var action = "unload";
return false;
}
$.ajax({
contentType: "application/x-www-form-urlencoded",
beforeSend: function(objeto) {
$("div#"+content).html("<img src=\'../inc/lib/javascript/indicator.gif\' />"); },
type: "POST",
url: "../social/data_personal.inc.php",
data: "load_ajax="+id_elem+"&action="+action+"&course_code="+course_code,
success: function(datos) {
//$("div#"+name_div_id).hide("slow");
$("div#"+content).html(datos);
}
});
}
</script>';
$htmlHeadXtra[] = '<script type="text/javascript">
$(document).ready(function (){
$("input#id_btn_send_invitation").bind("click", function(){
if (confirm("'.get_lang('SendMessageInvitation', '').'")) {
$("#form_register_friend").submit();
}
});
});
function change_panel (mypanel_id,myuser_id) {
$.ajax({
contentType: "application/x-www-form-urlencoded",
beforeSend: function(objeto) {
$("#id_content_panel").html("<img src=\'../inc/lib/javascript/indicator.gif\' />"); },
type: "POST",
url: "../messages/send_message.php",
data: "panel_id="+mypanel_id+"&user_id="+myuser_id,
success: function(datos) {
$("div#id_content_panel_init").html(datos);
$("div#display_response_id").html("");
}
});
}
function action_database_panel (option_id,myuser_id) {
if (option_id==5) {
my_txt_subject=$("#txt_subject_id").val();
} else {
my_txt_subject="clear";
}
my_txt_content=$("#txt_area_invite").val();
if (my_txt_content.length==0 || my_txt_subject.length==0) {
$("#display_response_id").html("&nbsp;&nbsp;&nbsp;'.get_lang('MessageInvitationNotSent', '').'");
setTimeout("message_information_display()",3000);
return false;
}
$.ajax({
contentType: "application/x-www-form-urlencoded",
beforeSend: function(objeto) {
$("#display_response_id").html("<img src=\'../inc/lib/javascript/indicator.gif\' />"); },
type: "POST",
url: "../messages/send_message.php",
data: "panel_id="+option_id+"&user_id="+myuser_id+"&txt_subject="+my_txt_subject+"&txt_content="+my_txt_content,
success: function(datos) {
$("#display_response_id").html(datos);
}
});
}
function display_hide () {
setTimeout("hide_display_message()",3000);
}
function message_information_display() {
$("#display_response_id").html("");
}
function hide_display_message () {
$("div#display_response_id").html("");
try {
$("#txt_subject_id").val("");
$("#txt_area_invite").val("");
}catch(e) {
$("#txt_area_invite").val("");
}
}
function register_friend(element_input) {
if(confirm("'.get_lang('AddToFriends').'")) {
name_button=$(element_input).attr("id");
name_div_id="id_"+name_button.substring(13);
user_id=name_div_id.split("_");
user_friend_id=user_id[1];
$.ajax({
contentType: "application/x-www-form-urlencoded",
beforeSend: function(objeto) {
$("div#dpending_"+user_friend_id).html("<img src=\'../inc/lib/javascript/indicator.gif\' />"); },
type: "POST",
url: "../social/register_friend.php",
data: "friend_id="+user_friend_id+"&is_my_friend="+"friend",
success: function(datos) {
$("form").submit()
}
});
}
}
</script>';
if (isset($_GET['shared'])) {
$my_link='../social/index.php';
$link_shared='shared='.Security::remove_XSS($_GET['shared']);
} else {
$my_link='../auth/profile.php';
$link_shared='';
}
$interbreadcrumb[]= array ('url' =>$my_link,'name' => get_lang('ModifyProfile') );
$interbreadcrumb[]= array (
'url' => '../social/profile.php?'.$link_shared.'#remote-tab-1',
'name' => get_lang('ViewMySharedProfile')
);
if (isset($_GET['u']) && is_numeric($_GET['u'])) {
$info_user=api_get_user_info($_GET['u']);
$interbreadcrumb[]= array (
'url' => 'javascript: void(0);',
'name' => api_get_person_name($info_user['firstName'], $info_user['lastName'])
);
}
if (isset($_GET['u'])) {
$param_user='u='.Security::remove_XSS($_GET['u']);
}else {
$info_user=api_get_user_info(api_get_user_id());
$param_user='';
}
$_SESSION['social_user_id'] = $user_id;
/**
* Display
*/
Display :: display_header(null);
// @todo here we must show the user information as read only
//User picture size is calculated from SYSTEM path
$img_array= UserManager::get_user_picture_path_by_id($user_id,'web',true,true);
//print_r($user_info);
// Added by Ivan Tcholakov, 03-APR-2009.
if (USE_JQUERY_CORNERS_SCRIPT) {
echo $s="<script>$(document).ready( function(){
$('.rounded').corners();
});</script>";
}
//echo '<div id="actions">';
//echo '<a href="../auth/profile.php?show=1"">'.Display::return_icon('edit.gif').'&nbsp;'.api_convert_encoding(get_lang('EditInformation'),'UTF-8',$charset).'</a>';
//echo '</div>';
//Setting some course info
$my_user_id=isset($_GET['u']) ? Security::remove_XSS($_GET['u']) : api_get_user_id();
$personal_course_list = UserManager::get_personal_session_course_list($my_user_id);
$course_list_code = array();
$i=1;
//print_r($personal_course_list);
if (is_array($personal_course_list)) {
foreach ($personal_course_list as $my_course) {
if ($i<=10) {
$list[] = SocialManager::get_logged_user_course_html($my_course,$i);
//$course_list_code[] = array('code'=>$my_course['c'],'dbName'=>$my_course['db'], 'title'=>$my_course['i']); cause double
$course_list_code[] = array('code'=>$my_course['c'],'dbName'=>$my_course['db']);
} else {
break;
}
$i++;
}
//to avoid repeted courses
$course_list_code = array_unique_dimensional($course_list_code);
}
echo '<div class="actions">';
echo '<a href="profile.php">'.Display::return_icon('shared_profile.png').' '.get_lang('MySharedProfile').'</a>';
echo '<a href="friends.php">'.Display::return_icon('lp_users.png').' '.get_lang('Friends').'</a>';
echo '<a href="../messages/inbox.php">'.Display::return_icon('inbox.png').' '.get_lang('Inbox').'</a>';
echo '<a href="group.php">'.Display::return_icon('group.gif').' '.get_lang('MyGroups').'</a>';
echo '<a href="/main/social/search.php">'.Display::return_icon('search.gif').' '.get_lang('Search').'</a>';
echo '<span style="float:right; padding-top:7px;">'.
'<a href="/main/auth/profile.php?show=1">'.Display::return_icon('edit.gif').' '.get_lang('Configuration').'</a>';
'</span>';
echo '</div>';
echo '<div class="actions-title">';
if ($user_id == api_get_user_id())
echo get_lang('ViewMySharedProfile');
else
echo get_lang('ViewSharedProfile').' - '.api_get_person_name($user_info['firstname'], $user_info['lastname']);
echo '</div>';
echo '<div id="social-profile-wrapper">';
// RIGHT COLUMN
echo '<div id="social-profile-right">';
//---- FRIENDS
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);
$j=0;
$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>';
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="index.php?#remote-tab-6">'.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>';
// 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.'" />';
$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.= '</div>';
}
$j++;
}
}
} else {
// No friends!! :(
$friend_html .= '<div class="sectiontitle">'.get_lang('Friends').'</div>';
$friend_html.= '<div id="friend-container" class="social-friend-container">';
$friend_html.= '<div id="friend-header">';
$friend_html.= '<div style="float:left; padding:0px 8px 0px 8px;">'.get_lang('NoFriendsInYourContactList').'<br /><a href="'.api_get_path(WEB_PATH).'whoisonline.php">'.get_lang('TryAndFindSomeFriends').'</a></div>';
$friend_html.= '</div>'; // close div friend-header
}
$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());
$list_get_path_web=SocialManager::get_list_web_path_user_invitation_by_user_id(api_get_user_id());
$count_pending_invitations = count($pending_invitations);
//echo '<div class="clear"></div><br />';
//javascript:register_friend(this)
//var_dump($pending_invitations);
echo '<div class="clear"></div><br />';
echo '<div id="social-profile-invitations" >';
if ($count_pending_invitations > 0) {
echo '<div class="sectiontitle">';
echo api_convert_encoding(get_lang('PendingInvitations'),$charset,'UTF-8');
echo '</div><br />';
for ($i=0;$i<$count_pending_invitations;$i++) {
//var_dump($invitations);
echo '<div id="dpending_'.$pending_invitations[$i]['user_sender_id'].'" class="friend_invitations">';
echo '<div style="float:left;width:60px;" >';
echo '<img style="margin-bottom:5px;" src="'.$list_get_path_web[$i]['dir'].'/'.$list_get_path_web[$i]['file'].'" width="60px">';
echo '</div>';
echo '<div style="padding-left:70px;">';
echo ' '.api_convert_encoding(substr($pending_invitations[$i]['content'],0,50),$charset,'UTF-8');
echo '<br />';
echo '<a id="btn_accepted_'.$pending_invitations[$i]['user_sender_id'].'" onclick="register_friend(this)" href="javascript:void(0)">'.get_lang('SocialAddToFriends').'</a>';
echo '<div id="id_response">&nbsp;</div>';
echo '</div>';
echo '</div>';
echo '<div class="clear"></div>';
}
}
echo '</div>';
}
//--Productions
$production_list = UserManager::build_production_list($user_id);
if (!empty($production_list )) {
echo '<div class="clear"></div><br />';
echo '<div class="sectiontitle">';
echo get_lang('MyProductions');
echo '</div>';
echo '<div class="rounded1">';
echo $production_list;
echo '</div>';
}
// Images uploaded by course
$file_list = '';
if (is_array($course_list_code) && count($course_list_code)>0) {
foreach ($course_list_code as $course) {
$file_list.= UserManager::get_user_upload_files_by_course($user_id,$course['code']);
}
}
if (!empty($file_list)) {
echo '<div class="clear"></div><br />';
echo '<div class="sectiontitle">';
echo get_lang('ImagesUploaded');
echo '</div><br />';
echo '</br><div class="social-content-information">';
echo $file_list;
echo '</div>';
}
//loading this information
//-- Competences
if (!empty($user_info['competences']) || !empty($user_info['diplomas']) || !empty($user_info['openarea']) || !empty($user_info['teach']) ) {
echo '<div class="clear"></div>';
echo '<div class="sectiontitle">';
echo get_lang('MoreInformation');
echo '</div>';
}
echo '<div class="social-content-competences">';
$cut_size = 220;
if (!empty($user_info['competences'])) {
echo '<br />';
echo '<div class="social-background-content" style="width:100%;">';
echo '<div class="social-actions-message">'.get_lang('MyCompetences').'</div>';
echo cut($user_info['competences'],$cut_size);
echo '</div>';
echo '<br />';
}
if (!empty($user_info['diplomas'])) {
echo '<div class="social-background-content" style="width:100%;" >';
echo '<div class="social-actions-message">'.get_lang('MyDiplomas').'</div>';
echo cut($user_info['diplomas'],$cut_size);
echo '</div>';
echo '<br />';
}
if (!empty($user_info['openarea'])) {
echo '<div class="social-background-content" style="width:100%;" >';
echo '<div class="social-actions-message">'.get_lang('MyPersonalOpenArea').'</div>';
echo cut($user_info['openarea'],$cut_size);
echo '</div>';
echo '<br />';
}
if (!empty($user_info['teach'])) {
echo '<div class="social-background-content" style="width:100%;" >';
echo '<div class="social-actions-message">'.get_lang('MyTeach').'</div>';
echo cut($user_info['teach'],$cut_size);
echo '</div>';
echo '<br />';
}
echo '</div>';
} else {
echo '<div class="clear"></div><br />';
}
echo '</div>'; // end of content section
echo '<div id="social-profile-container">';
// LEFT COLUMN
echo '<div id="social-profile-left">';
//--- User image
echo '<div class="social-content-image">';
echo '<div class="social-background-content" style="width:95%;" align="center">';
echo '<br/>';
echo '<a href="../auth/profile.php?show=1"><img src='.$img_array['dir'].$img_array['file'].' /></a><br /><br />';
echo '</div>';
echo '</div>';
// Send message or Add to friend links
/*if (!$show_full_profile) {
echo '&nbsp;&nbsp;<a href="../messages/send_message_to_userfriend.inc.php?height=365&width=610&user_friend='.$user_id.'&view=profile" class="thickbox" title="'.get_lang('SendMessage').'">'.Display::return_icon('message_new.png').'&nbsp;&nbsp;'.get_lang('SendMessage').'</a><br />';
}*/
// Extra information
if ($show_full_profile) {
//-- Extra Data
$t_uf = Database :: get_main_table(TABLE_MAIN_USER_FIELD);
$t_ufo = Database :: get_main_table(TABLE_MAIN_USER_FIELD_OPTIONS);
$extra_user_data = UserManager::get_extra_user_data($user_id);
$extra_information = '';
if (is_array($extra_user_data) && count($extra_user_data)>0 ) {
$extra_information = '<div class="sectiontitle">';
$extra_information .= get_lang('ExtraInformation');
$extra_information .= '</div><br />';
$extra_information .='<div class="social-content-information">';
$extra_information_value = '';
foreach($extra_user_data as $key=>$data) {
// get display text, visibility and type from user_field table
$field_variable = str_replace('extra_','',$key);
$sql = "SELECT field_display_text,field_visible,field_type,id FROM $t_uf WHERE field_variable ='$field_variable'";
$res_field = Database::query($sql,__FILE__,__LINE__);
$row_field = Database::fetch_row($res_field);
$field_display_text = $row_field[0];
$field_visible = $row_field[1];
$field_type = $row_field[2];
$field_id = $row_field[3];
if ($field_visible == 1) {
if (is_array($data)) {
$extra_information_value .= '<strong>'.ucfirst($field_display_text).':</strong> '.implode(',',$data).'<br />';
} else {
if ($field_type == USER_FIELD_TYPE_DOUBLE_SELECT) {
$id_options = explode(';',$data);
$value_options = array();
// get option display text from user_field_options table
foreach ($id_options as $id_option) {
$sql = "SELECT option_display_text FROM $t_ufo WHERE id = '$id_option'";
$res_options = Database::query($sql,__FILE__,__LINE__);
$row_options = Database::fetch_row($res_options);
$value_options[] = $row_options[0];
}
$extra_information_value .= '<strong>'.ucfirst($field_display_text).':</strong> '.implode(' ',$value_options).'<br />';
} elseif($field_type == USER_FIELD_TYPE_TAG ) {
$user_tags = UserManager::get_user_tags($user_id, $field_id);
$tag_tmp = array();
foreach ($user_tags as $tags) {
//$tag_tmp[] = $tags['tag'];
$tag_tmp[] = '<a href="../tag/?q='.$tags['tag'].'">'.$tags['tag'].'</a>';
}
if (is_array($user_tags) && count($user_tags)>0) {
$extra_information_value .= '<strong>'.ucfirst($field_display_text).':</strong> '.implode(', ',$tag_tmp).'<br />';
}
} else {
$extra_information_value .= '<strong>'.ucfirst($field_display_text).':</strong> '.$data.'<br />';
}
}
}
}
// if there are information to show
if (!empty($extra_information_value)) {
$extra_information .= $extra_information_value;
}
$extra_information .= '</div>';
$extra_information .= '<br /><br />';
}
// if there are information to show
if (!empty($extra_information_value))
echo $extra_information;
// ---- My Agenda Items
$my_agenda_items = show_simple_personal_agenda($user_id);
if (!empty($my_agenda_items)) {
echo '<div class="sectiontitle">';
echo get_lang('MyAgenda');
echo '</div>';
$tbl_personal_agenda = Database :: get_user_personal_table(TABLE_PERSONAL_AGENDA);
echo '<div class="social-content-agenda">';
echo '<div class="social-background-content">';
echo $my_agenda_items;
echo '</div>';
echo '<br /><br />';
echo '</div>';
}
//-----Announcements
$announcement_content = '';
$my_announcement_by_user_id=isset($_GET['u']) ? Security::remove_XSS($_GET['u']) : api_get_user_id();
foreach ($course_list_code as $course) {
$content = get_all_annoucement_by_user_course($course['dbName'],$my_announcement_by_user_id);
$course_info=api_get_course_info($course['code']);
if (!empty($content)) {
$announcement_content.= '<div class="social-background-content" style="width:100%">';
$announcement_content.= '<div class="actions">'.$course_info['name'].'</div>';
$announcement_content.= $content;
$announcement_content.= '</div>';
$announcement_content.= '<br/>';
}
}
if(!empty($announcement_content)) {
echo '<div class="sectiontitle">';
echo get_lang('Announcements');
echo '</div><br/>';
echo '<div class="social-content-announcements">';
echo $announcement_content.'<br/>';
echo '</div>';
}
}
echo '</div>';
// CENTER COLUMN
echo '<div id="social-profile-content">';
//--- Basic Information
echo 'ssss';
echo '</div>';
echo '</div>';
echo '</div>'; //from the main
echo '<form id="id_reload" name="id_reload" action="profile.php">&nbsp;</form>';
Display :: display_footer();

@ -5,6 +5,8 @@ $cidReset = true;
$language_file = array('registration','messages','userInfo','admin');
require '../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php';
require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php';
$this_section = SECTION_MYPROFILE;
$_SESSION['this_section']=$this_section;
api_block_anonymous_users();
@ -15,391 +17,7 @@ $htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jqu
$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/thickbox.js" type="text/javascript" language="javascript"></script>';
//$htmlHeadXtra[] = '<style rel="stylesheet" href="../inc/lib/javascript/thickbox.css" type="text/css" media="projection, screen">';
$htmlHeadXtra[]='<style type="text/css" media="all">@import "'.api_get_path(WEB_LIBRARY_PATH).'javascript/thickbox.css";</style>';
$htmlHeadXtra[] = '<script type="text/javascript">
$(function() {
$("#container-9").tabs({ remote: true});
});
function register_friend(element_input) {
name_button=$(element_input).attr("id");
name_div_id="id_"+name_button.substring(13);
user_id=name_div_id.split("_");
user_friend_id=user_id[1];
$.ajax({
contentType: "application/x-www-form-urlencoded",
beforeSend: function(objeto) {
$("#id_response").html("<img src=\'../inc/lib/javascript/indicator.gif\' />"); },
type: "POST",
url: "../social/register_friend.php",
data: "friend_id="+user_friend_id,
success: function(datos) {
$("div#"+name_div_id).hide("slow");
$("#id_response").html(datos);
}
});
}
function denied_friend (element_input) {
name_button=$(element_input).attr("id");
name_div_id="id_"+name_button.substring(13);
user_id=name_div_id.split("_");
friend_user_id=user_id[1];
$.ajax({
contentType: "application/x-www-form-urlencoded",
beforeSend: function(objeto) {
$("#id_response").html("<img src=\'../inc/lib/javascript/indicator.gif\' />"); },
type: "POST",
url: "../social/register_friend.php",
data: "denied_friend_id="+friend_user_id,
success: function(datos) {
$("div#"+name_div_id).hide("slow");
$("#id_response").html(datos);
}
});
}
function delete_friend (element_div) {
id_image=$(element_div).attr("id");
user_id=id_image.split("_");
if (confirm("'.get_lang('Delete', '').'")) {
$.ajax({
contentType: "application/x-www-form-urlencoded",
beforeSend: function(objeto) {
/*$("#id_response").html("Cargando...");*/ },
type: "POST",
url: "../social/register_friend.php",
data: "delete_friend_id="+user_id[1],
success: function(datos) {
//alert(datos);
$("div#"+"div_"+user_id[1]).hide("slow");
$("div#"+"div_"+user_id[1]).html("");
clear_form ();
}
});
}
}
function qualify_friend(element_div) {
name_user=$(element_div).attr("title");
id_full=$(element_div).attr("id");
$("div#div_info_user").html(name_user);
user_qualify=id_full.split("_");
user_qualify_id=user_qualify[1];
$("#user_cod_qualify").attr("value",user_qualify_id);
get_image_url=$(element_div).attr("src");
img_html="<img width=100 height=120 src="+get_image_url+" />";
$("div#div_qualify_image").html(img_html);
}
function set_qualify_friend() {
user_id_friend = $("#user_cod_qualify").attr("value");
type_friend = $("input[@name=list_type_friend]:checked").val();
if (user_id_friend==0) {
alert("'.get_lang('SelectOneContact', '').'");
return false;
}
if (type_friend==null) {
alert("'.get_lang('SelectOneGroup', '').'");
return false;
}
if (confirm("'.get_lang('AttachContactsPersonal', '').' ?")) {
$.ajax({
contentType: "application/x-www-form-urlencoded",
beforeSend: function(objeto) {
/*$("#id_response").html("Cargando...");*/ },
type: "POST",
url: "../social/register_friend.php",
data: "user_id_friend_q="+user_id_friend+"&type_friend_q="+type_friend,
success: function(datos) {
//alert(datos);
tb_remove();
//clear_form();
}
});
}
}
function show_icon_delete(element_html) {
elem_id=$(element_html).attr("id");
id_elem=elem_id.split("_");
ident="#img_"+id_elem[1];
$(ident).attr("src","../img/delete.gif");
$(ident).attr("alt","'.get_lang('Delete', '').'");
$(ident).attr("title","'.get_lang('Delete', '').'");
}
function hide_icon_delete(element_html) {
elem_id=$(element_html).attr("id");
id_elem=elem_id.split("_");
ident="#img_"+id_elem[1];
$(ident).attr("src","../img/blank.gif");
$(ident).attr("alt","");
$(ident).attr("title","");
}
function search_image_social(element_html) {
name_search=$(element_html).attr("value");
$.ajax({
contentType: "application/x-www-form-urlencoded",
beforeSend: function(objeto) {
$("#div_content_table").html("<img src=\'../inc/lib/javascript/indicator.gif\' />"); },
type: "POST",
url: "../social/show_search_image.inc.php",
data: "search_name_q="+name_search,
success: function(datos) {
$("div#div_content_table").html(datos);
}
});
}
function clear_form () {
$("input[@type=radio]").attr("checked", false);
$("div#div_qualify_image").html("");
$("div#div_info_user").html("");
}
function toogle_function (element_html){
elem_id=$(element_html).attr("id");
id_elem=elem_id.split("_");
ident="div#div_group_"+id_elem[1];
id_button="#btn_"+id_elem[1];
elem_src=$(id_button).attr("src");
image_show=elem_src.split("/");
for (i=0;i<image_show.length;i++) {
if (image_show[i]=="visible.gif" || image_show[i]=="invisible_na.gif") {
my_image=image_show[i];
}
}
if (my_image=="visible.gif") {
$(ident).hide("slow");
$(id_button).attr("src","../img/invisible_na.gif");
} else {
$(ident).show("slow");
$(id_button).attr("src","../img/visible.gif");
}
}
function selectall_cheks() {
$("input[@type=checkbox]").attr("checked", true);
}
function unselectall_cheks() {
$("input[@type=checkbox]").attr("checked", false);
}
function submit_form (path_submit) {
if (path_submit=="inbox") {
if (count_checkbox("inbox") > 0) {
document.getElementById(\'form_send\').action="../social/index.php?inbox=true#remote-tab-2";
if (confirm("'.get_lang('ConfirmYourChoice', '').'")) {
$("#form_send").submit();
}
} else {
alert("'.get_lang('SelectTheCheckbox', '').'");
}
} else {
if (count_checkbox("outbox") > 0) {
document.getElementById(\'form_send_out\').action="../social/index.php?outbox=true#remote-tab-3";
if (confirm("'.get_lang('ConfirmYourChoice', '').'")) {
$("#form_send_out").submit();
}
} else {
alert("'.get_lang('SelectedMoreOptions', '').'");
}
}
}
function count_checkbox(status_type) {
if (status_type=="inbox") {
var checkboxes = document.getElementsByName("id[]");
var cont = 0;
for (var x=0; x < checkboxes.length; x++) {
if (checkboxes[x].checked) {
cont = cont + 1;
}
}
return cont;
} else {
var checkboxes = document.getElementsByName("out[]");
var cont = 0;
for (var x=0; x < checkboxes.length; x++) {
if (checkboxes[x].checked) {
cont = cont + 1;
}
}
return cont;
}
}
function get_action_url_and_show_messages (name_rs,name_id) {
$(".confirmation-message").remove();
$(".normal-message").remove();
$(".error-message").remove();
$.ajax({
contentType: "application/x-www-form-urlencoded",
beforeSend: function(objeto) {
$("div#div_content_messages").html("<img src=\'../inc/lib/javascript/indicator.gif\' />"); },
type: "GET",
url: "../messages/view_message.php",
data: "rs="+name_rs+"&id="+name_id,
success: function(datos) {
$("div#div_content_messages").html(datos);
$("div#div_content_table_data").html(" ");
}
});
}
function close_div_show (my_div) {
$(".confirmation-message").remove();
$(".normal-message").remove();
$(".error-message").remove();
$("div#"+my_div).html("");
$.ajax({
contentType: "application/x-www-form-urlencoded",
beforeSend: function(objeto) {
$("div#div_content_table_data").html("<img src=\'../inc/lib/javascript/indicator.gif\' />"); },
type: "POST",
url: "../messages/inbox.php",
data:"",
success: function(datos) {
$("div#div_content_table_data").html(datos);
}
});
}
function reply_to_messages (my_action,name_rs,name_id) {
$(".confirmation-message").remove();
$(".normal-message").remove();
$(".error-message").remove();
if(my_action=="show") {
$("div#div_content_messages").html("");
$("div#div_content_table_data").html("");
$.ajax({
contentType: "application/x-www-form-urlencoded",
beforeSend: function(objeto) {
$("div#div_content_messages").html("<img src=\'../inc/lib/javascript/indicator.gif\' />"); },
type: "GET",
url: "../messages/new_message.php",
data:"re_id="+name_rs+"&id="+name_id,
success: function(datos) {
$("div#div_content_messages").html(datos);
}
});
}
}
function compose_and_show_message (my_action,name_rs) {
if(my_action=="show") {
$("div#div_content_messages").html("");
$("div#div_content_table_data").html("");
$(".confirmation-message").remove();
$(".normal-message").remove();
$(".error-message").remove();
$.ajax({
contentType: "application/x-www-form-urlencoded",
beforeSend: function(objeto) {
$("div#div_content_messages").html("<img src=\'../inc/lib/javascript/indicator.gif\' />"); },
type: "GET",
url: "../messages/new_message.php",
data:"rs="+name_rs,
success: function(datos) {
$("div#div_content_messages").html(datos);
}
});
}
}
function send_request_and_search() {
cont=0;
//$("#id_text_name").bind("keyup", function(){
name=$("#id_text_name").get(0).value;
if (name.length==0) {
return false;
}
$.ajax({
contentType: "application/x-www-form-urlencoded",
beforeSend: function(objeto) {
//$("#id_div_search").html("Searching...");
},
type: "POST",
url: "../social/select_options.php",
data: "search="+name,
success: function(datos){
num_records=datos.split(\'</option>\');
if (num_records.length==1) {
$("#id_div_search").html("");
return false;
} else {
$("#id_div_search").html(datos)
list_search_hide();
}
$("#id_search_name").bind("click", function() {
name_option=$("select#id_search_name option:selected").text();
code_option=$("select#id_search_name option:selected").val();
$("#user_list").attr("value", code_option);
$("#id_text_name").attr("value", name_option);
$("#id_div_search").html("");
cont++;
});
}
});
//});
}
function delete_one_message (num_id) {
$("div#div_content_messages").html("");
$("div#div_content_table_data").html("");
$(".confirmation-message").remove();
$(".normal-message").remove();
$(".error-message").remove();
$.ajax({
contentType: "application/x-www-form-urlencoded",
beforeSend: function(objeto) {
$("#div_content_table_data").html("<img src=\'../inc/lib/javascript/indicator.gif\' />"); },
type: "GET",
url: "../messages/inbox.php",
data: "action="+"deleteone"+"&id="+num_id,
success: function(datos){
$("#div_content_table_data").html(datos)
}
});
}
function show_sent_message (id_sent) {
$("div#div_content_messages_sent").html("");
$("div#div_content_table_data_sent").html("");
$.ajax({
contentType: "application/x-www-form-urlencoded",
beforeSend: function(objeto) {
$("#div_content_table_data_sent").html("<img src=\'../inc/lib/javascript/indicator.gif\' />"); },
type: "GET",
url: "../messages/view_message.php",
data: "rs="+"1"+"&id_send="+id_sent,
success: function(datos){
$("#div_content_table_data_sent").html(datos)
}
});
}
function close_and_open_outbox() {
$("div#div_content_messages_sent").html("");
$("div#div_content_table_data_sent").html("");
$.ajax({
contentType: "application/x-www-form-urlencoded",
beforeSend: function(objeto) {
$("div#div_content_table_data_sent").html("<img src=\'../inc/lib/javascript/indicator.gif\' />"); },
type: "POST",
url: "../messages/outbox.php",
data:"",
success: function(datos) {
$("div#div_content_table_data_sent").html(datos);
}
});
}
function delete_one_message_outbox (num_id) {
$("div#div_content_messages_sent").html("");
$("div#div_content_table_data_sent").html("");
$.ajax({
contentType: "application/x-www-form-urlencoded",
beforeSend: function(objeto) {
$("#div_content_table_data_sent").html("<img src=\'../inc/lib/javascript/indicator.gif\' />"); },
type: "GET",
url: "../messages/outbox.php",
data: "action="+"deleteone"+"&id="+num_id,
success: function(datos){
$("#div_content_table_data_sent").html(datos)
}
});
}
function list_search_hide () {
setTimeout("hide_search_list()",2000);
}
function hide_search_list () {
$("div#id_div_search").html("");
}
</script>';
if (api_get_setting('allow_message_tool')=='true') {
$htmlHeadXtra[] ='<script type="text/javascript">
function delete_message_js() {
@ -443,7 +61,7 @@ if (isset($_GET['sendform'])) {
$form_reply[]=urlencode($_POST['compose']);
$form_reply[]=urlencode($_POST['id_text_name']);
$form_reply[]=urlencode($_POST['save_form']);
$form_info=implode(base64_encode('&%ff..x'),$form_reply);
$form_info=implode(base64_encode('&%ff..x'),$form_reply);
$form_send_data_message='?form_reply='.$form_info;
} elseif (isset($_GET['inbox'])) {
$form_delete=array();
@ -461,29 +79,42 @@ if (isset($_GET['sendform'])) {
}
$form_info_outbox=implode(',',$form_delete_outbox);
$form_send_data_message='?form_delete_outbox='.($form_info_outbox);
}
}
$form_url_send=isset($form_send_data_message) ? $form_send_data_message :'';
if(isset($_GET['add_group'])) {
$form_reply=array();
$form_reply['name'] = urlencode($_POST['name']);
$form_reply['description'] = urlencode(api_html_entity_decode($_POST['description']));
$form_reply['url'] = $_POST['url'];
$form_reply['picture'] = $_POST['picture'];
$form_reply['add_group'] = $_POST['add_group'];
$form_info = implode(base64_encode('&%ff..x'),$form_reply);
$form_send_data_message = '?add_group='.$form_info;
}
$_GET['add_group'] = null;
$form_group_send=isset($form_send_data_message) ? $form_send_data_message :'';
//var_dump($form_group_send);
/* Social menu */
UserManager::show_menu();
?>
<div id="container-9">
<ul>
<li><a href="data_personal.inc.php"><span><?php Display :: display_icon('profile.png',get_lang('PersonalData')); echo '&nbsp;&nbsp;'.get_lang('PersonalData'); ?></span></a></li>
<?php
if (api_get_setting('allow_message_tool')=='true') {
?>
<li><a href="../messages/inbox.php<?php echo $form_url_send; ?>"><span><?php Display :: display_icon('inbox.png',get_lang('Inbox')); echo '&nbsp;&nbsp;'.get_lang('Inbox');?></span></a></li>
<li><a href="../messages/outbox.php<?php echo $form_url_send; ?>"><span><?php Display :: display_icon('outbox.png',get_lang('Outbox') ); echo '&nbsp;&nbsp;'.get_lang('Outbox');?></span></a></li>
<?php }
if (api_get_setting('allow_social_tool')=='true') {
?>
<li><a href="../messages/inbox.php<?php echo $form_url_send; ?>"><span><?php Display :: display_icon('inbox.png',get_lang('Inbox')); echo '&nbsp;&nbsp;'.get_lang('Inbox');?></span></a></li>
<li><a href="../messages/outbox.php<?php echo $form_url_send; ?>"><span><?php Display :: display_icon('outbox.png',get_lang('Outbox') ); echo '&nbsp;&nbsp;'.get_lang('Outbox');?></span></a></li>
<?php
}
?>
<li><a href="select_friend_response.php"><span><?php Display :: display_icon('pending_invitation.png',get_lang('PendingInvitations'), array('height'=>'22px')); echo '&nbsp;&nbsp;'.get_lang('PendingInvitations'); ?></span></a></li>
<li><a href="contacts.inc.php"><span><?php Display :: display_icon('contacts.png',get_lang('Contacts')); echo '&nbsp;&nbsp;'.get_lang('Contacts'); ?></span></a></li>
<li><a href="group_contact.inc.php"><span><?php Display :: display_icon('group_contact.png',get_lang('ContactsGroups')); echo '&nbsp;&nbsp;'.get_lang('ContactsGroups'); ?></span></a></li>
<?php
}
?>
</ul>
<?php //echo '<div id="show">&nbsp;</div>';?>
</ul>
</div>
<?php
Display :: display_footer();
?>
?>

@ -0,0 +1,128 @@
<?php
/* For licensing terms, see /dokeos_license.txt */
$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_SOCIAL;
$interbreadcrumb[]= array ('url' =>'home.php','name' => get_lang('Social'));
Display :: display_header($tool_name, 'Groups');
SocialManager::show_social_menu();
echo '<div class="actions-title">';
echo get_lang('Invitations');
echo '</div>';
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
}
Display::display_footer();
?>

@ -0,0 +1,148 @@
<?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>';
}
?>

@ -18,6 +18,8 @@ require_once api_get_path(LIBRARY_PATH).'social.lib.php';
require_once api_get_path(LIBRARY_PATH).'array.lib.php';
$user_id = api_get_user_id();
$show_full_profile = true;
//social tab
$this_section = SECTION_SOCIAL;
//I'm your friend? I can see your profile?
if (isset($_GET['u'])) {
@ -31,12 +33,12 @@ if (isset($_GET['u'])) {
api_not_allowed();
} else {
//checking the relationship between me and my friend
$my_status= UserFriend::get_relation_between_contacts(api_get_user_id(), $user_id);
$my_status= SocialManager::get_relation_between_contacts(api_get_user_id(), $user_id);
if (in_array($my_status, array(SOCIALPARENT, SOCIALFRIEND, SOCIALGOODFRIEND))) {
$show_full_profile = true;
}
//checking the relationship between my friend and me
$my_friend_status = UserFriend::get_relation_between_contacts($user_id, api_get_user_id());
$my_friend_status = SocialManager::get_relation_between_contacts($user_id, api_get_user_id());
if (in_array($my_friend_status, array(SOCIALPARENT, SOCIALFRIEND, SOCIALGOODFRIEND))) {
$show_full_profile = true;
} else {
@ -210,239 +212,14 @@ if (isset($_GET['u'])) {
$param_user='';
}
$_SESSION['social_user_id'] = $user_id;
/**
* Helper functions definition
*/
function get_logged_user_course_html($my_course, $count) {
global $nosession;
if (api_get_setting('use_session_mode')=='true' && !$nosession) {
global $now, $date_start, $date_end;
}
//initialise
$result = '';
// Table definitions
$main_user_table = Database :: get_main_table(TABLE_MAIN_USER);
$tbl_session = Database :: get_main_table(TABLE_MAIN_SESSION);
$course_database = $my_course['db'];
$course_tool_table = Database :: get_course_table(TABLE_TOOL_LIST, $course_database);
$tool_edit_table = Database :: get_course_table(TABLE_ITEM_PROPERTY, $course_database);
$course_group_user_table = Database :: get_course_table(TOOL_USER, $course_database);
$user_id = api_get_user_id();
$course_system_code = $my_course['k'];
$course_visual_code = $my_course['c'];
$course_title = $my_course['i'];
$course_directory = $my_course['d'];
$course_teacher = $my_course['t'];
$course_teacher_email = isset($my_course['email'])?$my_course['email']:'';
$course_info = Database :: get_course_info($course_system_code);
//error_log(print_r($course_info,true));
$course_access_settings = CourseManager :: get_access_settings($course_system_code);
$course_visibility = $course_access_settings['visibility'];
$user_in_course_status = CourseManager :: get_user_in_course_status(api_get_user_id(), $course_system_code);
//function logic - act on the data
$is_virtual_course = CourseManager :: is_virtual_course_from_system_code($my_course['k']);
if ($is_virtual_course) {
// If the current user is also subscribed in the real course to which this
// virtual course is linked, we don't need to display the virtual course entry in
// the course list - it is combined with the real course entry.
$target_course_code = CourseManager :: get_target_of_linked_course($course_system_code);
$is_subscribed_in_target_course = CourseManager :: is_user_subscribed_in_course(api_get_user_id(), $target_course_code);
if ($is_subscribed_in_target_course) {
return; //do not display this course entry
}
}
$has_virtual_courses = CourseManager :: has_virtual_courses_from_code($course_system_code, api_get_user_id());
if ($has_virtual_courses) {
$return_result = CourseManager :: determine_course_title_from_course_info(api_get_user_id(), $course_info);
$course_display_title = $return_result['title'];
$course_display_code = $return_result['code'];
} else {
$course_display_title = $course_title;
$course_display_code = $course_visual_code;
}
$s_course_status=$my_course['s'];
$s_htlm_status_icon="";
if ($s_course_status==1) {
$s_htlm_status_icon=Display::return_icon('teachers.gif', get_lang('Teacher'));
}
if ($s_course_status==2) {
$s_htlm_status_icon=Display::return_icon('coachs.gif', get_lang('GeneralCoach'));
}
if ($s_course_status==5) {
$s_htlm_status_icon=Display::return_icon('students.gif', get_lang('Student'));
}
//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 .= $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>';
/*
if(api_get_setting('use_session_mode')=='true' && !$nosession) {
if(empty($my_course['id_session'])) {
$my_course['id_session'] = 0;
}
if($user_in_course_status == COURSEMANAGER || ($date_start <= $now && $date_end >= $now) || $date_start=='0000-00-00') {
//$result .= '<a href="'.api_get_path(WEB_COURSE_PATH).$course_directory.'/?id_session='.$my_course['id_session'].'">'.$course_display_title.'</a>';
$result .= '<a href="#">'.$course_display_title.'</a>';
}
} else {
//$result .= '<a href="'.api_get_path(WEB_COURSE_PATH).$course_directory.'/">'.$course_display_title.'</a>';
$result .= '<a href="'.api_get_path(WEB_COURSE_PATH).$course_directory.'/">'.$course_display_title.'</a>';
}*/
} else {
$result .= $course_display_title." "." ".get_lang('CourseClosed')."";
}
// show the course_code and teacher if chosen to display this
// we dont need this!
/*
if (api_get_setting('display_coursecode_in_courselist') == 'true' OR api_get_setting('display_teacher_in_courselist') == 'true') {
$result .= '<br />';
}
if (api_get_setting('display_coursecode_in_courselist') == 'true') {
$result .= $course_display_code;
}
if (api_get_setting('display_coursecode_in_courselist') == 'true' AND api_get_setting('display_teacher_in_courselist') == 'true') {
$result .= ' &ndash; ';
}
if (api_get_setting('display_teacher_in_courselist') == 'true') {
$result .= $course_teacher;
if(!empty($course_teacher_email)) {
$result .= ' ('.$course_teacher_email.')';
}
}
*/
$current_course_settings = CourseManager :: get_access_settings($my_course['k']);
// display the what's new icons
// $result .= show_notification($my_course);
if ((CONFVAL_showExtractInfo == SCRIPTVAL_InCourseList || CONFVAL_showExtractInfo == SCRIPTVAL_Both) && $nbDigestEntries > 0) {
reset($digest);
$result .= '<ul>';
while (list ($key2) = each($digest[$thisCourseSysCode])) {
$result .= '<li>';
if ($orderKey[1] == 'keyTools') {
$result .= "<a href=\"$toolsList[$key2] [\"path\"] $thisCourseSysCode \">";
$result .= "$toolsList[$key2][\"name\"]</a>";
} else {
$result .= format_locale_date(CONFVAL_dateFormatForInfosFromCourses, strtotime($key2));
}
$result .= '</li>';
$result .= '<ul>';
reset($digest[$thisCourseSysCode][$key2]);
while (list ($key3, $dataFromCourse) = each($digest[$thisCourseSysCode][$key2])) {
$result .= '<li>';
if ($orderKey[2] == 'keyTools') {
$result .= "<a href=\"$toolsList[$key3] [\"path\"] $thisCourseSysCode \">";
$result .= "$toolsList[$key3][\"name\"]</a>";
} else {
$result .= format_locale_date(CONFVAL_dateFormatForInfosFromCourses, strtotime($key3));
}
$result .= '<ul compact="compact">';
reset($digest[$thisCourseSysCode][$key2][$key3]);
while (list ($key4, $dataFromCourse) = each($digest[$thisCourseSysCode][$key2][$key3])) {
$result .= '<li>';
$result .= htmlspecialchars(substr(strip_tags($dataFromCourse), 0, CONFVAL_NB_CHAR_FROM_CONTENT));
$result .= '</li>';
}
$result .= '</ul>';
$result .= '</li>';
}
$result .= '</ul>';
$result .= '</li>';
}
$result .= '</ul>';
}
$result .= '</li>';
$result .= '</div>';
if (api_get_setting('use_session_mode')=='true' && !$nosession) {
$session = '';
$active = false;
if (!empty($my_course['session_name'])) {
// Request for the name of the general coach
$sql = 'SELECT lastname, firstname
FROM '.$tbl_session.' ts LEFT JOIN '.$main_user_table .' tu
ON ts.id_coach = tu.user_id
WHERE ts.id='.(int) $my_course['id_session']. ' LIMIT 1';
$rs = Database::query($sql, __FILE__, __LINE__);
$sessioncoach = Database::store_result($rs);
$sessioncoach = $sessioncoach[0];
$session = array();
$session['title'] = $my_course['session_name'];
if ( $my_course['date_start']=='0000-00-00' ) {
$session['dates'] = get_lang('WithoutTimeLimits');
if ( api_get_setting('show_session_coach') === 'true' ) {
$session['coach'] = get_lang('GeneralCoach').': '.api_get_person_name($sessioncoach['firstname'], $sessioncoach['lastname']);
}
$active = true;
} else {
$session ['dates'] = ' - '.get_lang('From').' '.$my_course['date_start'].' '.get_lang('To').' '.$my_course['date_end'];
if ( api_get_setting('show_session_coach') === 'true' ) {
$session['coach'] = get_lang('GeneralCoach').': '.api_get_person_name($sessioncoach['firstname'], $sessioncoach['lastname']);
}
$active = ($date_start <= $now && $date_end >= $now)?true:false;
}
}
$output = array ($my_course['user_course_cat'], $result, $my_course['id_session'], $session, 'active'=>$active);
} else {
$output = array ($my_course['user_course_cat'], $result);
}
//$my_course['creation_date'];
return $output;
}
/**
* Get user's feeds
* @param int User ID
* @param int Limit of posts per feed
* @return string HTML section with all feeds included
* @author Yannick Warnier
* @since Dokeos 1.8.6.1
*/
function get_user_feeds($user,$limit=5) {
if (!function_exists('fetch_rss')) { return '';}
$fields = UserManager::get_extra_fields();
$feed_fields = array();
$feeds = array();
$res = '<div class="sectiontitle">'.get_lang('RSSFeeds').'</div>';
$res .= '<div class="social-content-training">';
$feed = UserManager::get_extra_user_data_by_field($user,'rssfeeds');
if(empty($feed)) { return ''; }
$feeds = split(';',$feed['rssfeeds']);
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++;
}
$res .= '</div>';
}
$res .= '</div>';
$res .= '<div class="clear"></div><br />';
return $res;
}
/**
* Display
*/
Display :: display_header(null);
// @todo here we must show the user information as read only
//User picture size is calculated from SYSTEM path
@ -451,17 +228,10 @@ $img_array= UserManager::get_user_picture_path_by_id($user_id,'web',true,true);
//print_r($user_info);
// Added by Ivan Tcholakov, 03-APR-2009.
if (USE_JQUERY_CORNERS_SCRIPT) {
//
echo $s="<script>$(document).ready( function(){
echo $s="<script>$(document).ready( function(){
$('.rounded').corners();
});</script>";
//
}
//
//echo '<div id="actions">';
//echo '<a href="../auth/profile.php?show=1"">'.Display::return_icon('edit.gif').'&nbsp;'.api_convert_encoding(get_lang('EditInformation'),'UTF-8',$charset).'</a>';
//echo '</div>';
//Setting some course info
$my_user_id=isset($_GET['u']) ? Security::remove_XSS($_GET['u']) : api_get_user_id();
@ -470,12 +240,10 @@ $course_list_code = array();
$i=1;
//print_r($personal_course_list);
if (is_array($personal_course_list)) {
foreach ($personal_course_list as $my_course) {
if ($i<=10) {
$list[] = get_logged_user_course_html($my_course,$i);
$list[] = SocialManager::get_logged_user_course_html($my_course,$i);
//$course_list_code[] = array('code'=>$my_course['c'],'dbName'=>$my_course['db'], 'title'=>$my_course['i']); cause double
$course_list_code[] = array('code'=>$my_course['c'],'dbName'=>$my_course['db']);
@ -488,14 +256,18 @@ if (is_array($personal_course_list)) {
$course_list_code = array_unique_dimensional($course_list_code);
}
//show the action menu
SocialManager::show_social_menu();
echo '<div class="actions-title">';
if ($user_id == api_get_user_id())
echo get_lang('ViewMySharedProfile');
else
echo get_lang('ViewSharedProfile').' - '.api_get_person_name($user_info['firstname'], $user_info['lastname']);
echo '</div>';
echo '<div id="social-profile-wrapper">';
// RIGHT COLUMN
echo '<div id="social-profile-right">';
@ -504,9 +276,9 @@ 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 = UserFriend::get_list_path_web_by_user_id($user_id, SOCIALGOODFRIEND);
$list_path_normal_friends = UserFriend::get_list_path_web_by_user_id($user_id, SOCIALFRIEND);
$list_path_parents = UserFriend::get_list_path_web_by_user_id($user_id, SOCIALPARENT);
$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);
@ -538,7 +310,7 @@ echo '<div id="social-profile-wrapper">';
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="index.php?#remote-tab-6">'.get_lang('SeeAll').'</a></div>';
$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++) {
@ -551,7 +323,7 @@ echo '<div id="social-profile-wrapper">';
$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>';
// the height = 92 must be the sqme in the image_friend_network span style in default.css
$friends_profile = UserFriend::get_picture_user($list_friends_id[$j], $list_friends_file[$j], 92, 'medium_', 'width="85" height="90" ');
$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.'" />';
$friend_html.= '</center></span>';
@ -573,8 +345,8 @@ echo '<div id="social-profile-wrapper">';
echo $friend_html;
//Pending invitations
if (!isset($_GET['u']) || (isset($_GET['u']) && $_GET['u']==api_get_user_id())) {
$pending_invitations = UserFriend::get_list_invitation_of_friends_by_user_id(api_get_user_id());
$list_get_path_web=UserFriend::get_list_web_path_user_invitation_by_user_id(api_get_user_id());
$pending_invitations = SocialManager::get_list_invitation_of_friends_by_user_id(api_get_user_id());
$list_get_path_web=SocialManager::get_list_web_path_user_invitation_by_user_id(api_get_user_id());
$count_pending_invitations = count($pending_invitations);
//echo '<div class="clear"></div><br />';
//javascript:register_friend(this)
@ -694,10 +466,10 @@ 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;">';
if (api_get_user_id() == $user_id) {
// if i'm me
/* // if i'm me
echo '<div>';
echo Display::return_icon('email.gif');
echo '&nbsp;<a href="../social/index.php#remote-tab-2">'.get_lang('MyInbox').'</a>&nbsp;';
@ -705,12 +477,13 @@ echo '<div id="social-profile-container">';
echo '<div>';
echo Display::return_icon('edit.gif');
echo '&nbsp;<a href="../auth/profile.php?show=1">'.get_lang('EditInformation').'</a>&nbsp;';
echo '</div>';
echo '</div>';*/
} else {
echo '<br/>';
echo '<div class="actions" style="margin-right:5px;">';
echo '&nbsp;<a href="../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 />';
//echo '&nbsp;&nbsp;<a href="javascript: void(0);">'.get_lang('SendMessage').'</a>';
}
echo '</div>';
echo '</div>';
}
echo '<br />';
// Send message or Add to friend links
@ -761,8 +534,9 @@ echo '<div id="social-profile-container">';
$user_tags = UserManager::get_user_tags($user_id, $field_id);
$tag_tmp = array();
foreach ($user_tags as $tags) {
$tag_tmp[] = $tags['tag'];
}
//$tag_tmp[] = $tags['tag'];
$tag_tmp[] = '<a href="/main/social/search.php?q='.$tags['tag'].'">'.$tags['tag'].'</a>';
}
if (is_array($user_tags) && count($user_tags)>0) {
$extra_information_value .= '<strong>'.ucfirst($field_display_text).':</strong> '.implode(', ',$tag_tmp).'<br />';
}
@ -927,7 +701,7 @@ echo '<div id="social-profile-container">';
*/
}
echo '</ul><br />';
echo get_user_feeds($user_id);
echo SocialManager::get_user_feeds($user_id);
echo '</div>';
}
echo '</div>';

@ -9,13 +9,13 @@ $user_friend=(int)$_POST['user_friend'];
$list_of_options=array();
$img_user=array();
$img_info_user=array();
$list_of_options=UserFriend::show_list_type_friends();
$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=UserFriend::get_relation_between_contacts(api_get_user_id(),$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">

@ -23,9 +23,9 @@ if (isset($_POST['is_my_friend'])) {
}
if (isset($_POST['friend_id'])) {
UserFriend::register_friend ((int)$the_current_user_id,(int)$my_current_friend,(int)$relation_type);
UserFriend::register_friend ((int)$my_current_friend,(int)$the_current_user_id,(int)$relation_type);
UserFriend::invitation_accepted ((int)$my_current_friend,(int)$the_current_user_id);
SocialManager::register_friend ((int)$the_current_user_id,(int)$my_current_friend,(int)$relation_type);
SocialManager::register_friend ((int)$my_current_friend,(int)$the_current_user_id,(int)$relation_type);
SocialManager::invitation_accepted ((int)$my_current_friend,(int)$the_current_user_id);
if (isset($_POST['is_my_friend'])) {
echo api_xml_http_response_encode(get_lang('AddedContactToList'));
} else {
@ -34,14 +34,14 @@ if (isset($_POST['friend_id'])) {
}
if (isset($_POST['denied_friend_id'])) {
UserFriend::invitation_denied((int)$my_denied_current_friend,(int)$the_current_user_id);
SocialManager::invitation_denied((int)$my_denied_current_friend,(int)$the_current_user_id);
Display::display_confirmation_message(api_xml_http_response_encode(get_lang('InvitationDenied')));
}
if (isset($_POST['delete_friend_id'])) {
UserFriend::removed_friend((int)$my_delete_friend);
SocialManager::removed_friend((int)$my_delete_friend);
}
if(isset($_POST['user_id_friend_q']) && isset($_POST['type_friend_q'])) {
UserFriend::qualify_friend((int)$friend_id_qualify,(int)$type_friend_qualify);
SocialManager::qualify_friend((int)$friend_id_qualify,(int)$type_friend_qualify);
echo api_xml_http_response_encode(get_lang('AttachContactsToGroupSuccesfuly'));
}
?>

@ -2,284 +2,66 @@
/* For licensing terms, see /dokeos_license.txt */
// name of the language file that needs to be included
$language_file = array ('registration','admin');
$language_file = array('registration','admin');
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).'group_portal_manager.lib.php';
require_once (api_get_path(LIBRARY_PATH).'sortabletable.class.php');
require_once (api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php');
require_once (api_get_path(LIBRARY_PATH).'security.lib.php');
require_once (api_get_path(LIBRARY_PATH).'usermanager.lib.php');
$this_section = SECTION_SOCIAL;
$tool_name = get_lang('Search');
$interbreadcrumb[]= array ('url' =>'home.php','name' => get_lang('Social'));
$tool_name = get_lang('SearchAUser');
Display :: display_header($tool_name);
// Build search-form
$form = new FormValidator('search_user', 'get', '', '', null, false);
$renderer = & $form->defaultRenderer();
$renderer->setElementTemplate('<span>{element}</span> ');
$form->add_textfield('keyword', '', false);
$form->addElement('style_submit_button', 'submit', get_lang('SearchButton'), 'class="search"');
$form->addElement('static', 'additionalactions', null, $actions);
$form->display();
if (isset ($_GET['keyword'])) {
if (isset ($_GET['keyword'])) {
$parameters = array ('keyword' => Security::remove_XSS($_GET['keyword']));
}
// Create a sortable table with user-data
$parameters['sec_token'] = Security::get_token();
//show the action menu
SocialManager::show_social_menu();
echo '<div class="actions-title">';
echo get_lang('Search');
echo '</div>';
$query = $_GET['q'];
echo UserManager::get_search_form($query);
$table = new SortableTable('users', 'get_number_of_users', 'get_user_data', (api_is_western_name_order() xor api_sort_by_first_name()) ? 3 : 2);
$table->set_additional_parameters($parameters);
$table->set_header(0, '', false);
$table->set_header(1, get_lang('OfficialCode'));
if (api_is_western_name_order()) {
$table->set_header(2, get_lang('FirstName'));
$table->set_header(3, get_lang('LastName'));
} else {
$table->set_header(2, get_lang('LastName'));
$table->set_header(3, get_lang('FirstName'));
}
$table->set_header(4, get_lang('LoginName'));
$table->set_header(5, get_lang('Email'));
//tag
$table_tag = new SortableTable('tags', 'get_number_of_user_tags', 'get_user_tag_data');
$table_tag->set_additional_parameters($parameters);
$table_tag->set_header(0, '', false);
$table->set_header(1, get_lang('OfficialCode'));
if (api_is_western_name_order()) {
$table_tag->set_header(2, get_lang('FirstName'));
$table_tag->set_header(3, get_lang('LastName'));
} else {
$table_tag->set_header(2, get_lang('LastName'));
$table_tag->set_header(3, get_lang('FirstName'));
}
/*
//groups
$table_tag = new SortableTable('groups', 'get_number_of_user_tags', 'get_user_tag_data');
$table_tag->set_additional_parameters($parameters);
$table_tag->set_header(0, '', false);
$table->set_header(1, get_lang('OfficialCode'));
if (api_is_western_name_order()) {
$table_tag->set_header(2, get_lang('FirstName'));
$table_tag->set_header(3, get_lang('LastName'));
} else {
$table_tag->set_header(2, get_lang('LastName'));
$table_tag->set_header(3, get_lang('FirstName'));
}
*/
echo get_lang('Users');
$table->display_grid();
echo get_lang('Tags');
$table_tag->display_grid();
/*
echo get_lang('Groups');
$table_group->display_grid();
*/
}
/**
* Get the users to display on the current page (fill the sortable-table)
* @param int offset of first user to recover
* @param int Number of users to get
* @param int Column to sort on
* @param string Order (ASC,DESC)
* @see SortableTable#get_table_data($from)
*/
function get_user_tag_data($from, $number_of_items, $column, $direction)
{
if (isset ($_GET['keyword'])) {
$keyword = Database::escape_string($_GET['keyword']);
}
$user_tags = UserManager::get_all_user_tags($keyword,'5',$from, $number_of_items);
return $user_tags;
}
/**
* Get the total number of users on the platform
* @see SortableTable#get_total_number_of_items()
*/
function get_number_of_user_tags()
{
$tag_table = Database :: get_main_table(TABLE_MAIN_USER_TAG);
$sql = "SELECT COUNT(tag) AS total_number_of_items FROM $tag_table u";
if (isset ($_GET['keyword'])) {
$keyword = Database::escape_string($_GET['keyword']);
$sql .= " WHERE (tag LIKE '%".$keyword."%' )";
}
$res = Database::query($sql, __FILE__, __LINE__);
$obj = Database::fetch_object($res);
return $obj->total_number_of_items;
}
/**
* Get the users to display on the current page (fill the sortable-table)
* @param int offset of first user to recover
* @param int Number of users to get
* @param int Column to sort on
* @param string Order (ASC,DESC)
* @see SortableTable#get_table_data($from)
*/
function get_user_data($from, $number_of_items, $column, $direction)
{
$user_table = Database :: get_main_table(TABLE_MAIN_USER);
$sql = "SELECT
u.user_id AS col0,
u.official_code AS col1,
".(api_is_western_name_order()
? "u.firstname AS col2,
u.lastname AS col3,"
: "u.lastname AS col2,
u.firstname AS col3,")."
u.username AS col4,
u.email AS col5
FROM $user_table u ";
// adding the filter to see the user's only of the current access_url
global $_configuration;
if ((api_is_platform_admin() || api_is_session_admin()) && $_configuration['multiple_access_urls']==true && api_get_current_access_url_id()!=-1) {
$access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
$sql.= " INNER JOIN $access_url_rel_user_table url_rel_user ON (u.user_id=url_rel_user.user_id)";
}
if (isset ($_GET['keyword'])) {
$keyword = Database::escape_string($_GET['keyword']);
$sql .= " WHERE (u.firstname LIKE '%".$keyword."%' OR u.lastname LIKE '%".$keyword."%' OR u.username LIKE '%".$keyword."%' OR u.official_code LIKE '%".$keyword."%' OR u.email LIKE '%".$keyword."%' )";
} elseif (isset ($_GET['keyword_firstname'])) {
$admin_table = Database :: get_main_table(TABLE_MAIN_ADMIN);
$keyword_firstname = Database::escape_string($_GET['keyword_firstname']);
$keyword_lastname = Database::escape_string($_GET['keyword_lastname']);
$keyword_email = Database::escape_string($_GET['keyword_email']);
$keyword_officialcode = Database::escape_string($_GET['keyword_officialcode']);
$keyword_username = Database::escape_string($_GET['keyword_username']);
$keyword_status = Database::escape_string($_GET['keyword_status']);
$query_admin_table = '';
$keyword_admin = '';
if ($keyword_status == SESSIONADMIN) {
$keyword_status = '%';
$query_admin_table = " , $admin_table a ";
$keyword_admin = ' AND a.user_id = u.user_id ';
//I'm searching something
if ($query != '') {
if (isset($query) && $query!='') {
//get users from tags
$users = UserManager::get_all_user_tags($query, 0, 0, 5);
$results = array();
if (is_array($users)) {
echo '<h2>'.get_lang('Users').'</h2>';
foreach($users as $user) {
$picture = UserManager::get_picture_user($user['user_id'], $user['picture_uri'],80);
$url_open = '<a href="/main/social/profile.php?u='.$user['user_id'].'">';
$url_close ='</a>';
$img = $url_open.'<img src="'.$picture['file'].'" />'.$url_close;
$user['firstname'] = $url_open.$user['firstname'].$url_close;
$results[] = array($img, $user['firstname'],$user['lastname'],$user['tag']);
}
}
$keyword_active = isset($_GET['keyword_active']);
$keyword_inactive = isset($_GET['keyword_inactive']);
$sql .= $query_admin_table." WHERE (u.firstname LIKE '%".$keyword_firstname."%' " .
"AND u.lastname LIKE '%".$keyword_lastname."%' " .
"AND u.username LIKE '%".$keyword_username."%' " .
"AND u.email LIKE '%".$keyword_email."%' " .
"AND u.official_code LIKE '%".$keyword_officialcode."%' " .
"AND u.status LIKE '".$keyword_status."'" .
$keyword_admin;
if ($keyword_active && !$keyword_inactive) {
$sql .= " AND u.active='1'";
} elseif($keyword_inactive && !$keyword_active) {
$sql .= " AND u.active='0'";
}
$sql .= " ) ";
}
// adding the filter to see the user's only of the current access_url
if ((api_is_platform_admin() || api_is_session_admin()) && $_configuration['multiple_access_urls']==true && api_get_current_access_url_id()!=-1) {
$sql.= " AND url_rel_user.access_url_id=".api_get_current_access_url_id();
}
if (!in_array($direction, array('ASC','DESC'))) {
$direction = 'ASC';
}
$column = intval($column);
$from = intval($from);
$number_of_items = intval($number_of_items);
$sql .= " ORDER BY col$column $direction ";
$sql .= " LIMIT $from,$number_of_items";
$res = Database::query($sql, __FILE__, __LINE__);
$users = array ();
$t = time();
while ($user = Database::fetch_row($res)) {
if ($user[7] == 1 && $user[9] != '0000-00-00 00:00:00') {
// check expiration date
$expiration_time = convert_mysql_date($user[9]);
// if expiration date is passed, store a special value for active field
if ($expiration_time < $t) {
$user[7] = '-1';
}
}
// forget about the expiration date field
$users[] = array($user[0],$user[1],$user[2],$user[3],$user[4],$user[5]);
}
return $users;
Display::display_sortable_grid('search_users', array(), $results, array('hide_navigation'=>true, 'per_page' => 5), $query_vars, false ,true);
//get users from tags
$groups = GroupPortalManager::get_all_group_tags($query);
$results = array();
if (is_array($groups) && count($groups)>0) {
echo '<h2>'.get_lang('Groups').'</h2>';
foreach($groups as $group) {
$picture = GroupPortalManager::get_picture_group($group['id'], $group['picture_uri'],80);
$img = '<img src="'.$picture['file'].'" />';
$tags = GroupPortalManager::get_group_tags($group['id']);
$group['name'] = '<a href="/main/social/groups.php?id='.$group['id'].'">'.$group['name'].'</a>';
$img = '<a href="/main/social/groups.php?id='.$group['id'].'">'.$img.'</a>';
$results[] = array($img, $group['name'],$group['description'],$tags);
}
}
Display::display_sortable_grid('search_users', array(), $results, array('hide_navigation'=>true, 'per_page' => 5), $query_vars, false, array(true,true,true,true,true));
}
} else {
//we should show something
}
/**
* Get the total number of users on the platform
* @see SortableTable#get_total_number_of_items()
*/
function get_number_of_users()
{
$user_table = Database :: get_main_table(TABLE_MAIN_USER);
$sql = "SELECT COUNT(u.user_id) AS total_number_of_items FROM $user_table u";
// adding the filter to see the user's only of the current access_url
global $_configuration;
if ((api_is_platform_admin() || api_is_session_admin()) && $_configuration['multiple_access_urls']==true && api_get_current_access_url_id()!=-1) {
$access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
$sql.= " INNER JOIN $access_url_rel_user_table url_rel_user ON (u.user_id=url_rel_user.user_id)";
}
if ( isset ($_GET['keyword'])) {
$keyword = Database::escape_string($_GET['keyword']);
$sql .= " WHERE (u.firstname LIKE '%".$keyword."%' OR u.lastname LIKE '%".$keyword."%' OR u.username LIKE '%".$keyword."%' OR u.email LIKE '%".$keyword."%' OR u.official_code LIKE '%".$keyword."%') ";
} elseif (isset ($_GET['keyword_firstname'])) {
$admin_table = Database :: get_main_table(TABLE_MAIN_ADMIN);
$keyword_firstname = Database::escape_string($_GET['keyword_firstname']);
$keyword_lastname = Database::escape_string($_GET['keyword_lastname']);
$keyword_email = Database::escape_string($_GET['keyword_email']);
$keyword_officialcode = Database::escape_string($_GET['keyword_officialcode']);
$keyword_username = Database::escape_string($_GET['keyword_username']);
$keyword_status = Database::escape_string($_GET['keyword_status']);
$query_admin_table = '';
$keyword_admin = '';
if ($keyword_status == SESSIONADMIN) {
$keyword_status = '%';
$query_admin_table = " , $admin_table a ";
$keyword_admin = ' AND a.user_id = u.user_id ';
}
$keyword_active = isset($_GET['keyword_active']);
$keyword_inactive = isset($_GET['keyword_inactive']);
$sql .= $query_admin_table .
" WHERE (u.firstname LIKE '%".$keyword_firstname."%' " .
"AND u.lastname LIKE '%".$keyword_lastname."%' " .
"AND u.username LIKE '%".$keyword_username."%' " .
"AND u.email LIKE '%".$keyword_email."%' " .
"AND u.official_code LIKE '%".$keyword_officialcode."%' " .
"AND u.status LIKE '".$keyword_status."'" .
$keyword_admin;
if($keyword_active && !$keyword_inactive) {
$sql .= " AND u.active='1'";
} elseif($keyword_inactive && !$keyword_active) {
$sql .= " AND u.active='0'";
}
$sql .= " ) ";
}
// adding the filter to see the user's only of the current access_url
if ((api_is_platform_admin() || api_is_session_admin()) && $_configuration['multiple_access_urls']==true && api_get_current_access_url_id()!=-1) {
$sql.= " AND url_rel_user.access_url_id=".api_get_current_access_url_id();
}
$res = Database::query($sql, __FILE__, __LINE__);
$obj = Database::fetch_object($res);
return $obj->total_number_of_items;
}
Display :: display_footer();
?>

@ -19,8 +19,8 @@ $language_comment=api_xml_http_response_encode(get_lang('SocialInvitesComment'))
$list_get_invitation=array();
$list_get_path_web=array();
$user_id=api_get_user_id();
$list_get_invitation=UserFriend::get_list_invitation_of_friends_by_user_id($user_id);
$list_get_path_web=UserFriend::get_list_web_path_user_invitation_by_user_id($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')));
@ -47,7 +47,7 @@ cellpadding="0" cellspacing="0" bgcolor="#9DACBF">
<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 = UserFriend::get_picture_user($list_get_invitation[$i]['user_sender_id'], $list_get_path_web[$i]['file'], 92); ?>
<?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>

@ -34,9 +34,9 @@ $list_path_friends=array();
$user_id=api_get_user_id();
$name_search=Security::remove_XSS($_POST['search_name_q']);
if (isset($name_search) && $name_search!='undefined') {
$list_path_friends=UserFriend::get_list_path_web_by_user_id($user_id,null,$name_search);
$list_path_friends=SocialManager::get_list_path_web_by_user_id($user_id,null,$name_search);
} else {
$list_path_friends=UserFriend::get_list_path_web_by_user_id($user_id);
$list_path_friends=SocialManager::get_list_path_web_by_user_id($user_id);
}
$friend_html='';
$number_of_images=8;
@ -64,7 +64,7 @@ if (count($list_path_friends)!=0) {
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 = UserFriend::get_picture_user($list_friends_id[$j], $list_friends_file[$j], 92);
$friends_profile = SocialManager::get_picture_user($list_friends_id[$j], $list_friends_file[$j], 92);
$friend_html.='<div onMouseover="show_icon_delete(this)" onMouseout="hide_icon_delete(this)" class="image-social-content" id=div_'.$list_friends_id[$j].' >
<span><center><img src="'.$friends_profile['file'].'" '.$friends_profile['style'].' id="imgfriend_'.$list_friends_id[$j].'" title="'.$user_name.'" onclick=load_thick(\'qualify_contact.inc.php?path_user="'.urlencode($list_friends_dir[$j].$list_friends_file[$j]).'&amp;id_user="'.$list_friends_id[$j].'"\',"") /></center></span>
<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>';

@ -19,7 +19,8 @@ require_once './main/inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'fileManage.lib.php';
require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php';
require_once api_get_path(LIBRARY_PATH).'social.lib.php';
//social tab
$this_section = SECTION_SOCIAL;
// table definitions
$track_user_table = Database::get_main_table(TABLE_MAIN_USER);
@ -130,10 +131,14 @@ function display_user_list($user_list, $_plugins) {
$uid = $user[0];
$user_info = api_get_user_info($uid);
$table_row = array();
$url = '?id='.$uid.$course_url;
if (api_get_setting('allow_social_tool')=='true') {
$url = '/main/social/profile.php?u='.$uid.$course_url;
} else {
$url = '?id='.$uid.$course_url;
}
$image_array = UserManager::get_user_picture_path_by_id($uid, 'system', false, true);
$friends_profile = UserFriend::get_picture_user($uid, $image_array['file'], 92, 'medium_', ' width="90" height="90" ');
$friends_profile = SocialManager::get_picture_user($uid, $image_array['file'], 92, 'medium_', ' width="90" height="90" ');
// reduce image
$name = api_get_person_name($user_info['firstName'], $user_info['lastName']);
$table_row[] = '<a href="'.$url.'"><img title = "'.$name.'" alt="'.$name.'" src="'.$friends_profile['file'].'" '.$friends_profile['style'].' border="1"></a>';
@ -247,7 +252,7 @@ function display_individual_user($user_id) {
$user_anonymous = api_get_anonymous_id();
if ($safe_user_id != api_get_user_id() && !api_is_anonymous($safe_user_id)) {
$user_relation = UserFriend::get_relation_between_contacts(api_get_user_id(), $safe_user_id);
$user_relation = SocialManager::get_relation_between_contacts(api_get_user_id(), $safe_user_id);
if ($user_relation == 0 || $user_relation == 6) {
echo '<a href="main/messages/send_message_to_userfriend.inc.php?view_panel=2&height=300&width=610&user_friend='.$safe_user_id.'" class="thickbox" title="'.get_lang('SendInvitation').'">'.Display :: return_icon('add_multiple_users.gif', get_lang('SocialInvitationToFriends')).'&nbsp;'.get_lang('SendInvitation').'</a><br />
<a href="main/messages/send_message_to_userfriend.inc.php?view_panel=1&height=310&width=610&user_friend='.$safe_user_id.'" class="thickbox" title="'.get_lang('SendAMessage').'">'.Display :: return_icon('mail_send.png', get_lang('SendAMessage')).'&nbsp;'.get_lang('SendAMessage').'</a>';
@ -366,6 +371,7 @@ if ((api_get_setting('showonline', 'world') == 'true' && !$_user['user_id']) ||
if ($user_list) {
if (!isset($_GET['id'])) {
echo UserManager::get_search_form($_GET['q']);
display_user_list($user_list, $_plugins);
} else {
//individual user information - also displays header info

Loading…
Cancel
Save