Merging the Social Group with the Classes(usergroup). Now the social groups are inserted in the usergroup table. See BT#4301

skala
Julio Montoya 12 years ago
parent 35bbf2d231
commit f39d0d90e3
  1. 7
      main/admin/add_users_to_usergroup.php
  2. 4
      main/admin/index.php
  3. 24
      main/admin/system_announcements.php
  4. 48
      main/admin/usergroups.php
  5. 7
      main/inc/global.inc.php
  6. 1
      main/inc/lib/database.constants.inc.php
  7. 1
      main/inc/lib/group_portal_manager.lib.php
  8. 196
      main/inc/lib/image.lib.php
  9. 19
      main/inc/lib/main_api.lib.php
  10. 48
      main/inc/lib/message.lib.php
  11. 15
      main/inc/lib/notification.lib.php
  12. 14
      main/inc/lib/page.lib.php
  13. 3
      main/inc/lib/sessionmanager.lib.php
  14. 30
      main/inc/lib/social.lib.php
  15. 13
      main/inc/lib/system_announcements.lib.php
  16. 7
      main/inc/lib/template.lib.php
  17. 989
      main/inc/lib/usergroup.lib.php
  18. 10
      main/inc/lib/usermanager.lib.php
  19. 5
      main/messages/download.php
  20. 3
      main/messages/new_message.php
  21. 34
      main/social/group_add.php
  22. 37
      main/social/group_edit.php
  23. 26
      main/social/group_invitation.php
  24. 36
      main/social/group_members.php
  25. 31
      main/social/group_topics.php
  26. 22
      main/social/group_waiting_list.php
  27. 91
      main/social/groups.php
  28. 17
      main/social/home.php
  29. 14
      main/social/invitations.php
  30. 24
      main/social/message_for_group_form.inc.php
  31. 7
      main/social/myfiles.php
  32. 14
      main/social/profile.php
  33. 7
      main/social/profile_friends_and_groups.inc.php
  34. 16
      main/social/search.php

@ -102,7 +102,7 @@ $usergroup = new UserGroup();
$id = intval($_GET['id']);
$first_letter_user = '';
if ($_POST['form_sent']) {
if (isset($_POST['form_sent']) && $_POST['form_sent']) {
$form_sent = $_POST['form_sent'];
$elements_posted = $_POST['elements_in_name'];
$first_letter_user = $_POST['firstLetterUser'];
@ -210,11 +210,11 @@ if (!empty($user_list)) {
$add_type == 'unique' ? true : false;
Display::display_header($tool_name);
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_unique = '<a href="'.api_get_self().'?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>';
$link_add_type_multiple = '<a href="'.api_get_self().'?add='.Security::remove_XSS($_GET['add']).'&add_type=multiple">'.Display::return_icon('multiple.gif').get_lang('SessionAddTypeMultiple').'</a>';
}
echo '<div class="actions">';
@ -254,6 +254,7 @@ if ($add_type=='multiple') {
}
}
}
echo Display::input('hidden','id',$id);
echo Display::input('hidden','form_sent','1');
echo Display::input('hidden','add_type',null);

@ -74,10 +74,10 @@ if (api_is_platform_admin()) {
array('url'=>'user_import.php', 'label' => get_lang('ImportUserListXMLCSV')),
);
if (api_get_setting('allow_social_tool') == 'true') {
/*if (api_get_setting('allow_social_tool') == 'true') {
$items[] = array('url'=>'group_add.php', 'label' => get_lang('AddGroups'));
$items[] = array('url'=>'group_list.php', 'label' => get_lang('GroupList'));
}
}*/
if (isset($extAuthSource) && isset($extAuthSource['ldap']) && count($extAuthSource['ldap']) > 0) {
$items[] = array('url'=>'ldap_users_list.php', 'label' => get_lang('ImportLDAPUsersIntoPlatform'));
}

@ -36,14 +36,16 @@ if (empty($_GET['lang'])) {
$_GET['lang'] = $_SESSION['user_language_choice'];
}
$usergroup = new UserGroup();
if (isset($_GET['action'])) {
$interbreadcrumb[] = array ("url" => "system_announcements.php", "name" => get_lang('SystemAnnouncements'));
if ($_GET['action'] == 'add') {
$interbreadcrumb[] = array ("url" => '#', "name" => get_lang('AddAnnouncement'));
}
}
if ($_GET['action'] == 'edit') {
$interbreadcrumb[] = array ("url" => '#', "name" => get_lang('Edit'));
}
}
} else {
$tool_name = get_lang('SystemAnnouncements');
}
@ -82,7 +84,7 @@ switch($action) {
SystemAnnouncementManager :: delete_announcement($_GET['id']);
Display :: display_confirmation_message(get_lang('AnnouncementDeleted'));
break;
case 'delete_selected':
foreach($_POST['id'] as $index => $id) {
SystemAnnouncementManager :: delete_announcement($id);
@ -141,21 +143,21 @@ if ($action_todo) {
}
$form->add_timewindow('start','end',get_lang('StartTimeWindow'),get_lang('EndTimeWindow'));
$group = array();
$group[]= $form->createElement('checkbox', 'visible_teacher', null, get_lang('Teacher'));
$group[]= $form->createElement('checkbox', 'visible_student', null, get_lang('Student'));
$group[]= $form->createElement('checkbox', 'visible_guest', null, get_lang('Guest'));
$form->addGroup($group, null, get_lang('Visible'), '');
$form->addElement('hidden', 'id');
$group_list = GroupPortalManager::get_groups_list();
$group_list = $usergroup->get_groups_list();
$group_list[0] = get_lang('All');
$form->addElement('select', 'group',get_lang('AnnouncementForGroup'),$group_list);
$values['group'] = isset($values['group']) ? $values['group'] : '0';
$form->addElement('checkbox', 'send_mail', null, get_lang('SendMail'));
$form->addElement('checkbox', 'send_mail', null, get_lang('SendMail'));
if (isset($_REQUEST['action']) && $_REQUEST['action']=='add') {
$form->addElement('checkbox', 'add_to_calendar', null, get_lang('AddToCalendar'));
@ -234,13 +236,13 @@ if ($show_announcement_list) {
$row = array();
$row[] = $announcement->id;
$row[] = Display::return_icon(($announcement->visible ? 'accept.png' : 'exclamation.png'), ($announcement->visible ? get_lang('AnnouncementAvailable') : get_lang('AnnouncementNotAvailable')));
$row[] = $announcement->title;
$row[] = $announcement->title;
$row[] = api_convert_and_format_date($announcement->date_start);
$row[] = api_convert_and_format_date($announcement->date_end);
$row[] = "<a href=\"?id=".$announcement->id."&amp;person=".SystemAnnouncementManager::VISIBLE_TEACHER."&amp;action=". ($announcement->visible_teacher ? 'make_invisible' : 'make_visible')."\">".Display::return_icon(($announcement->visible_teacher ? 'visible.gif' : 'invisible.gif'), get_lang('ShowOrHide'))."</a>";
$row[] = "<a href=\"?id=".$announcement->id."&amp;person=".SystemAnnouncementManager::VISIBLE_STUDENT."&amp;action=". ($announcement->visible_student ? 'make_invisible' : 'make_visible')."\">".Display::return_icon(($announcement->visible_student ? 'visible.gif' : 'invisible.gif'), get_lang('ShowOrHide'))."</a>";
$row[] = "<a href=\"?id=".$announcement->id."&amp;person=".SystemAnnouncementManager::VISIBLE_GUEST."&amp;action=". ($announcement->visible_guest ? 'make_invisible' : 'make_visible')."\">".Display::return_icon(($announcement->visible_guest ? 'visible.gif' : 'invisible.gif'), get_lang('ShowOrHide'))."</a>";
$row[] = $announcement->lang;
$row[] = "<a href=\"?action=edit&id=".$announcement->id."\">".Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL)."</a> <a href=\"?action=delete&id=".$announcement->id."\" onclick=\"javascript:if(!confirm('".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"), ENT_QUOTES))."')) return false;\">".Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL)."</a>";
$announcement_data[] = $row;
@ -254,7 +256,7 @@ if ($show_announcement_list) {
$table->set_header(5, get_lang('Teacher'));
$table->set_header(6, get_lang('Student'));
$table->set_header(7, get_lang('Guest'));
$table->set_header(8, get_lang('Language'));
$table->set_header(9, get_lang('Modify'), false, 'width="50px"');
$form_actions = array();

@ -16,9 +16,10 @@ api_protect_admin_script(true);
//Add the JS needed to use the jqgrid
$htmlHeadXtra[] = api_get_jqgrid_js();
// setting breadcrumbs
$interbreadcrumb[]=array('url' => 'index.php','name' => get_lang('PlatformAdmin'));
$action = $_GET['action'];
$action = isset($_GET['action']) ? $_GET['action'] : null;
if ($action == 'add') {
$interbreadcrumb[]=array('url' => 'usergroups.php','name' => get_lang('Classes'));
$interbreadcrumb[]=array('url' => '#','name' => get_lang('Add'));
@ -30,7 +31,7 @@ if ($action == 'add') {
}
// The header.
Display::display_header($tool_name);
Display::display_header();
// Tool name
if (isset($_GET['action']) && $_GET['action'] == 'add') {
@ -51,13 +52,13 @@ $columns = array(get_lang('Name'), get_lang('Users'), get_lang('Courses')
//Column config
$column_model = array(
array('name'=>'name', 'index'=>'name', 'width'=>'35', 'align'=>'left'),
//array('name'=>'description', 'index'=>'description', 'width'=>'500', 'align'=>'left'),
array('name'=>'users', 'index'=>'users', 'width'=>'15', 'align'=>'left'),
array('name'=>'courses', 'index'=>'courses', 'width'=>'15', 'align'=>'left'),
array('name'=>'sessions', 'index'=>'sessions', 'width'=>'15', 'align'=>'left'),
array('name'=>'actions', 'index'=>'actions', 'width'=>'20', 'align'=>'left','sortable'=>'false','formatter'=>'action_formatter'),
);
array('name'=>'name', 'index'=>'name', 'width'=>'35', 'align'=>'left'),
//array('name'=>'description', 'index'=>'description', 'width'=>'500', 'align'=>'left'),
array('name'=>'users', 'index'=>'users', 'width'=>'15', 'align'=>'left'),
array('name'=>'courses', 'index'=>'courses', 'width'=>'15', 'align'=>'left'),
array('name'=>'sessions', 'index'=>'sessions', 'width'=>'15', 'align'=>'left'),
array('name'=>'actions', 'index'=>'actions', 'width'=>'20', 'align'=>'left','sortable'=>'false','formatter'=>'action_formatter'),
);
//Autowidth
$extra_params['autowidth'] = 'true';
//height auto
@ -65,13 +66,13 @@ $extra_params['height'] = 'auto';
//With this function we can add actions to the jgrid
$action_links = 'function action_formatter (cellvalue, options, rowObject) {
return \''
.' <a href="add_users_to_usergroup.php?id=\'+options.rowId+\'"><img src="../img/icons/22/user_to_class.png" title="'.get_lang('SubscribeUsersToClass').'"></a>'
.' <a href="add_courses_to_usergroup.php?id=\'+options.rowId+\'"><img src="../img/icons/22/course_to_class.png" title="'.get_lang('SubscribeClassToCourses').'"></a>'
.' <a href="add_sessions_to_usergroup.php?id=\'+options.rowId+\'"><img src="../img/icons/22/sessions_to_class.png" title="'.get_lang('SubscribeClassToSessions').'"></a>'
.' <a href="?action=edit&id=\'+options.rowId+\'"><img width="20px" src="../img/edit.png" title="'.get_lang('Edit').'" ></a>'
.' <a onclick="javascript:if(!confirm('."\'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES))."\'".')) return false;" href="?action=delete&id=\'+options.rowId+\'"><img title="'.get_lang('Delete').'" src="../img/delete.png"></a>\';
}';
return \''
.' <a href="add_users_to_usergroup.php?id=\'+options.rowId+\'"><img src="../img/icons/22/user_to_class.png" title="'.get_lang('SubscribeUsersToClass').'"></a>'
.' <a href="add_courses_to_usergroup.php?id=\'+options.rowId+\'"><img src="../img/icons/22/course_to_class.png" title="'.get_lang('SubscribeClassToCourses').'"></a>'
.' <a href="add_sessions_to_usergroup.php?id=\'+options.rowId+\'"><img src="../img/icons/22/sessions_to_class.png" title="'.get_lang('SubscribeClassToSessions').'"></a>'
.' <a href="?action=edit&id=\'+options.rowId+\'"><img width="20px" src="../img/edit.png" title="'.get_lang('Edit').'" ></a>'
.' <a onclick="javascript:if(!confirm('."\'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES))."\'".')) return false;" href="?action=delete&id=\'+options.rowId+\'"><img title="'.get_lang('Delete').'" src="../img/delete.png"></a>\';
}';
?>
<script>
$(function() {
@ -93,8 +94,7 @@ if (isset($_GET['action']) && $_GET['action'] == 'add') {
api_not_allowed();
}
$_SESSION['notebook_view'] = 'creation_date';
//@todo move this in the career.lib.php
//@todo move this in the .lib.php
// Initiate the object
$form = new FormValidator('note', 'post', api_get_self().'?action='.Security::remove_XSS($_GET['action']));
@ -103,6 +103,11 @@ if (isset($_GET['action']) && $_GET['action'] == 'add') {
$form->addElement('text', 'name', get_lang('name'), array('size' => '70', 'id' => 'name'));
//$form->applyFilter('note_title', 'html_filter');
$form->add_html_editor('description', get_lang('Description'), false, false, array('Width' => '95%', 'Height' => '250'));
//$form->addElement('text', 'url', 'URL');
$form->addElement('checkbox', 'group_type', null, get_lang('SocialGroup'));
$form->addElement('style_submit_button', 'submit', get_lang('Add'), 'class="add"');
// Setting the rules
@ -129,7 +134,7 @@ if (isset($_GET['action']) && $_GET['action'] == 'add') {
$form->setConstants(array('sec_token' => $token));
$form->display();
}
}// Action handling: Editing a note
}// Action handling: Edition
elseif (isset($_GET['action']) && $_GET['action'] == 'edit' && is_numeric($_GET['id'])) {
// Initialize the object
$form = new FormValidator('career', 'post', api_get_self().'?action='.Security::remove_XSS($_GET['action']).'&id='.Security::remove_XSS($_GET['id']));
@ -138,6 +143,8 @@ elseif (isset($_GET['action']) && $_GET['action'] == 'edit' && is_numeric($_GET[
$form->addElement('hidden', 'id',intval($_GET['id']));
$form->addElement('text', 'name', get_lang('Name'), array('size' => '70'));
$form->add_html_editor('description', get_lang('Description'), false, false, array('Width' => '95%', 'Height' => '250'));
$form->addElement('checkbox', 'group_type', null, get_lang('SocialGroup'));
$form->addElement('style_submit_button', 'submit', get_lang('Modify'), 'class="save"');
// Setting the defaults
@ -179,5 +186,4 @@ elseif (isset($_GET['action']) && $_GET['action'] == 'delete' && is_numeric($_GE
} else {
$usergroup->display();
}
Display :: display_footer();
Display :: display_footer();

@ -430,6 +430,13 @@ if (isset($_configuration['main_database'])) {
$app['db.event_manager']->addEventSubscriber($sortableListener);
}
define('IMAGE_PROCESSOR', 'gd'); // imagick or gd strings
$app->register(new Grom\Silex\ImagineServiceProvider(), array(
'imagine.factory' => 'Gd',
'imagine.base_path' => __DIR__.'/vendor/imagine',
));
$app['is_admin'] = false;
//Creating a Chamilo service provider

@ -315,6 +315,7 @@ define('TABLE_USERGROUP', 'usergroup');
define('TABLE_USERGROUP_REL_USER', 'usergroup_rel_user');
define('TABLE_USERGROUP_REL_COURSE', 'usergroup_rel_course');
define('TABLE_USERGROUP_REL_SESSION', 'usergroup_rel_session');
define('TABLE_USERGROUP_REL_TAG', 'usergroup_rel_tag');
// Mail notifications
define('TABLE_NOTIFICATION', 'notification');

@ -4,6 +4,7 @@
* This library provides functions for the group management.
* Include/require it in your code to use its functionality.
* @author Julio Montoya <gugli100@gmail.com>
* @deprecated use usergroup.lib.php
* @package chamilo.library
*/
/**

@ -9,7 +9,7 @@
/**
* Code
*/
define('IMAGE_PROCESSOR', 'gd'); // imagick or gd strings
/**
* Image class
* @package chamilo.include.image
@ -17,25 +17,25 @@ define('IMAGE_PROCESSOR', 'gd'); // imagick or gd strings
class Image {
var $image_wrapper = null;
function __construct($path) {
function __construct($path) {
$path = preg_match(VALID_WEB_PATH, $path) ? (api_is_internal_path($path) ? api_get_path(TO_SYS, $path) : $path) : $path;
if (IMAGE_PROCESSOR == 'gd') {
$this->image_wrapper = new GDWrapper($path);
$this->image_wrapper = new GDWrapper($path);
} else {
if (class_exists('Imagick')) {
$this->image_wrapper = new ImagickWrapper($path);
} else {
Display::display_warning_message('Class Imagick not found');
exit;
}
}
exit;
}
}
}
public function resize($thumbw, $thumbh, $border = 0, $specific_size = false) {
$this->image_wrapper->resize($thumbw, $thumbh, $border, $specific_size );
}
}
public function send_image($file = '', $compress = -1, $convert_file_to = null) {
return $this->image_wrapper->send_image($file, $compress, $convert_file_to);
}
}
public function get_image_size() {
return $this->image_wrapper->get_image_size();
}
@ -56,31 +56,31 @@ abstract class ImageWrapper {
var $type;
var $allowed_extensions = array('jpeg', 'jpg', 'png', 'gif');
var $image_validated = false;
public function __construct($path) {
if (empty($path)) {
return false;
}
$this->path = preg_match(VALID_WEB_PATH, $path) ? (api_is_internal_path($path) ? api_get_path(TO_SYS, $path) : $path) : $path;
$this->set_image_wrapper(); //Creates image obj
}
}
$this->path = preg_match(VALID_WEB_PATH, $path) ? (api_is_internal_path($path) ? api_get_path(TO_SYS, $path) : $path) : $path;
$this->set_image_wrapper(); //Creates image obj
}
abstract function set_image_wrapper();
abstract function fill_image_info();
abstract function fill_image_info();
abstract function get_image_size();
abstract function resize($thumbw, $thumbh, $border, $specific_size = false);
abstract function send_image($file = '', $compress = -1, $convert_file_to = null);
public function get_image_info() {
return array('width' => $this->width,
'height' => $this->height,
'type' => $this->type
'type' => $this->type
);
}
}
}
/**
* Imagick Chamilo wrapper
*
*
* @author jmontoya
*
* @package chamilo.include.image
@ -88,100 +88,100 @@ abstract class ImageWrapper {
class ImagickWrapper extends ImageWrapper {
var $image;
var $filter = Imagick::FILTER_LANCZOS;
public function __construct($path) {
public function __construct($path) {
parent::__construct($path);
}
}
public function set_image_wrapper() {
if ($this->debug) error_log('Image::set_image_wrapper loaded');
try {
try {
if (file_exists($this->path)) {
$this->image = new Imagick($this->path);
if ($this->image) {
$this->fill_image_info(); //Fills height, width and type
}
if ($this->image) {
$this->fill_image_info(); //Fills height, width and type
}
} else {
if ($this->debug) error_log('Image::image does not exist');
}
} catch(ImagickException $e) {
if ($this->debug) error_log($e->getMessage());
}
}
} catch(ImagickException $e) {
if ($this->debug) error_log($e->getMessage());
}
}
public function fill_image_info() {
public function fill_image_info() {
$image_info = $this->image->identifyImage();
$this->width = $image_info['geometry']['width'];
$this->height = $image_info['geometry']['height'];
$this->type = strtolower($this->image->getImageFormat());
if (in_array($this->type, $this->allowed_extensions)) {
$this->image_validated = true;
if ($this->debug) error_log('image_validated true');
}
$this->image_validated = true;
if ($this->debug) error_log('image_validated true');
}
}
public function get_image_size() {
$imagesize = array('width'=>0,'height'=>0);
if ($this->image_validated) {
$imagesize = $this->image->getImageGeometry();
$imagesize = $this->image->getImageGeometry();
}
return $imagesize;
}
//@todo implement border logic case for Imagick
//@todo implement border logic case for Imagick
public function resize($thumbw, $thumbh, $border, $specific_size = false) {
if (!$this->image_validated) return false;
if (!$this->image_validated) return false;
if ($specific_size) {
$width = $thumbw;
$height = $thumbh;
} else {
$scale = ($this->width > 0 && $this->height > 0) ? min($thumbw / $this->width, $thumbh / $this->height) : 0;
$width = (int)($this->width * $scale);
$height = (int)($this->height * $scale);
$height = (int)($this->height * $scale);
}
$result = $this->image->resizeImage($width, $height, $this->filter, 1);
$result = $this->image->resizeImage($width, $height, $this->filter, 1);
$this->width = $thumbw;
$this->height = $thumbh;
$this->height = $thumbh;
}
public function send_image($file = '', $compress = -1, $convert_file_to = null) {
if (!$this->image_validated) return false;
$type = $this->type;
if (!empty($convert_file_to) && in_array($convert_file_to, $this->allowed_extensions)) {
$type = $convert_file_to;
$type = $convert_file_to;
}
switch ($type) {
case 'jpeg':
case 'jpg':
if (!$file) header("Content-type: image/jpeg");
break;
if (!$file) header("Content-type: image/jpeg");
break;
case 'png':
if (!$file) header("Content-type: image/png");
if (!$file) header("Content-type: image/png");
break;
case 'gif':
if (!$file) header("Content-type: image/gif");
if (!$file) header("Content-type: image/gif");
break;
}
$result = false;
try {
$result = $this->image->writeImage($file);
} catch(ImagickException $e) {
if ($this->debug) error_log($e->getMessage());
}
if (!$file) {
try {
$result = $this->image->writeImage($file);
} catch(ImagickException $e) {
if ($this->debug) error_log($e->getMessage());
}
if (!$file) {
echo $this->image;
$this->image->clear();
$this->image->destroy();
} else {
$this->image->clear();
$this->image->destroy();
$this->image->destroy();
return $result;
}
}
}
}
@ -191,60 +191,60 @@ class ImagickWrapper extends ImageWrapper {
*/
class GDWrapper extends ImageWrapper {
var $bg;
function __construct($path) {
parent::__construct($path);
parent::__construct($path);
}
public function set_image_wrapper() {
public function set_image_wrapper() {
$handler = null;
$this->fill_image_info();
$this->fill_image_info();
switch ($this->type) {
case 0:
$handler = false;
break;
case 1 :
case 1 :
$handler = @imagecreatefromgif($this->path);
$this->type = 'gif';
$this->type = 'gif';
break;
case 2 :
$handler = @imagecreatefromjpeg($this->path);
$this->type = 'jpg';
break;
case 3 :
$this->type = 'jpg';
break;
case 3 :
$handler = @imagecreatefrompng($this->path);
$this->type = 'png';
break;
$this->type = 'png';
break;
}
if ($handler) {
$this->image_validated = true;
$this->bg = $handler;
@imagealphablending($this->bg, true);
}
@imagealphablending($this->bg, true);
}
}
public function get_image_size() {
$return_array = array('width'=>0,'height'=>0);
if ($this->image_validated) {
$return_array = array('width'=>0,'height'=>0);
if ($this->image_validated) {
$return_array = array('width'=>$this->width,'height'=>$this->height);
}
return $return_array;
}
public function fill_image_info() {
if (file_exists($this->path)) {
$image_info = getimagesize($this->path);
public function fill_image_info() {
if (file_exists($this->path)) {
$image_info = getimagesize($this->path);
$this->width = $image_info[0];
$this->height = $image_info[1];
$this->type = $image_info[2];
$this->type = $image_info[2];
} else {
$this->width = 0;
$this->height = 0;
$this->type = 0;
}
}
public function resize($thumbw, $thumbh, $border, $specific_size = false) {
if (!$this->image_validated) return false;
if ($border == 1) {
@ -271,7 +271,7 @@ class GDWrapper extends ImageWrapper {
} else {
$scale = ($this->width > 0 && $this->height > 0) ? min($thumbw / $this->width, $thumbh / $this->height) : 0;
$width = (int)($this->width * $scale);
$height = (int)($this->height * $scale);
$height = (int)($this->height * $scale);
}
$deltaw = 0;
$deltah = 0;
@ -284,15 +284,15 @@ class GDWrapper extends ImageWrapper {
$this->bg = $dst_img;
@imagedestroy($src_img);
}
public function send_image($file = '', $compress = -1, $convert_file_to = null) {
public function send_image($file = '', $compress = -1, $convert_file_to = null) {
if (!$this->image_validated) return false;
$compress = (int)$compress;
$type = $this->type;
if (!empty($convert_file_to) && in_array($convert_file_to, $this->allowed_extensions)) {
$type = $convert_file_to;
$type = $convert_file_to;
}
switch ($type) {
switch ($type) {
case 'jpeg':
case 'jpg':
if (!$file) header("Content-type: image/jpeg");
@ -320,11 +320,11 @@ class GDWrapper extends ImageWrapper {
//@imagedestroy($this->logo);
}
/*
/*
* @deprecated
*
*
function addlogo($file) {
$this->logo = image::createimagefromtype($file, 'logo');
@imagealphablending($this->logo , true);
@ -355,7 +355,7 @@ class GDWrapper extends ImageWrapper {
@imagettftext($this->bg, $size, $angle, $x, $y, $this->color, $this->fontfile , $text);
}
*/
/* //@deprecated
function mergelogo($x, $y, $alpha = 100) {
if ($x < 0) $x = $this->width - $this->logox + $x;
@ -371,6 +371,6 @@ class GDWrapper extends ImageWrapper {
/* //@deprecated
function setfont($fontfile) {
$this->fontfile = $fontfile;
}*/
}*/
}

@ -331,7 +331,7 @@ define('GROUP_PERMISSION_OPEN' , '1');
define('GROUP_PERMISSION_CLOSED', '2');
// Group user permissions
define('GROUP_USER_PERMISSION_ADMIN' , '1'); // the admin of a group
define('GROUP_USER_PERMISSION_ADMIN' , '1'); // the admin of a group
define('GROUP_USER_PERMISSION_READER', '2'); // a normal user
define('GROUP_USER_PERMISSION_PENDING_INVITATION', '3'); // When an admin/moderator invites a user
define('GROUP_USER_PERMISSION_PENDING_INVITATION_SENT_BY_USER', '4'); // an user joins a group
@ -371,10 +371,9 @@ define('TEACHER_HTML', 3);
define('STUDENT_HTML_FULLPAGE', 4);
define('TEACHER_HTML_FULLPAGE', 5);
//Exercise
define('EXERCISE_NUMBER_OF_DECIMALS', 2);
/* XML processing functions */
// A regular expression for accessing declared encoding within xml-formatted text.
@ -383,6 +382,13 @@ define('EXERCISE_NUMBER_OF_DECIMALS', 2);
define('_PCRE_XML_ENCODING', '/<\?xml.*encoding=[\'"](.*?)[\'"].*\?>/m');
//Social PLUGIN PLACES
define('SOCIAL_LEFT_PLUGIN', 1);
define('SOCIAL_CENTER_PLUGIN', 2);
define('SOCIAL_RIGHT_PLUGIN', 3);
define('CUT_GROUP_NAME', 50);
/* PATHS & FILES - ROUTINES */
/**
@ -1133,9 +1139,9 @@ function api_get_user_courses($userid, $fetch_session = true) {
function _api_format_user($user, $add_password = false) {
$result = array();
if (api_is_anonymous()) {
/*if (api_is_anonymous()) {
return $user;
}
}*/
$firstname = $lastname = null;
@ -1276,7 +1282,8 @@ function api_get_user_info($user_id = '', $check_if_user_is_online = false, $sho
}
$result_array['user_is_online_in_chat'] = $user_online_in_chat;
}
$user = _api_format_user($result_array, $show_password);
$user = _api_format_user($result_array, $show_password);
if ($add_extra_values) {
$extra_field_values = new ExtraField('user');

@ -160,7 +160,6 @@ class MessageManager
return $message_list;
}
/**
* Sends a message to a user/group
*
@ -236,12 +235,12 @@ class MessageManager
//@todo it's possible to edit a message? yes, only for groups
if ($edit_message_id) {
$query = " UPDATE $table_message SET update_date = '".$now."', content = '$clean_content' WHERE id = '$edit_message_id' ";
$result = Database::query($query);
Database::query($query);
$inbox_last_id = $edit_message_id;
} else {
$query = "INSERT INTO $table_message(user_sender_id, user_receiver_id, msg_status, send_date, title, content, group_id, parent_id, update_date ) ".
"VALUES ('$user_sender_id', '$receiver_user_id', '1', '".$now."','$clean_subject','$clean_content','$group_id','$parent_id', '".$now."')";
$result = Database::query($query);
Database::query($query);
$inbox_last_id = Database::insert_id();
}
@ -250,9 +249,10 @@ class MessageManager
$i = 0;
foreach ($file_attachments as $file_attach) {
if ($file_attach['error'] == 0) {
$comments = isset($file_comments[$i]) ? $file_comments[$i] : null;
self::save_message_attachment_file(
$file_attach,
$file_comments[$i],
$comments,
$inbox_last_id,
null,
$receiver_user_id,
@ -303,11 +303,12 @@ class MessageManager
$sender_info
);
} else {
$group_info = GroupPortalManager::get_group_data($group_id);
$usergroup = new UserGroup();
$group_info = $usergroup->get($group_id);
$group_info['topic_id'] = $topic_id;
$group_info['msg_id'] = $inbox_last_id;
$user_list = GroupPortalManager::get_users_by_group($group_id, false, array(), 0, 1000);
$user_list = $usergroup->get_users_by_group($group_id, false, array(), 0, 1000);
//Adding more sens to the message group
$subject = sprintf(get_lang('ThereIsANewMessageInTheGroupX'), $group_info['name']);
@ -319,7 +320,7 @@ class MessageManager
$group_info = array('group_info' => $group_info, 'user_info' => $sender_info);
$notification->save_notification(
NOTIFICATION_TYPE_GROUP,
Notification::NOTIFICATION_TYPE_GROUP,
$new_user_list,
$subject,
$content,
@ -474,7 +475,7 @@ class MessageManager
Display :: display_error_message(get_lang('UplUnableToSaveFileFilteredExtension'));
} else {
$new_file_name = uniqid('');
$usergroup = new UserGroup();
$message_user_id = '';
if (!empty($receiver_user_id)) {
$message_user_id = $receiver_user_id;
@ -485,7 +486,7 @@ class MessageManager
// User-reserved directory where photos have to be placed.
if (!empty($group_id)) {
$path_user_info = GroupPortalManager::get_group_picture_path_by_id($group_id, 'system', true);
$path_user_info = $usergroup->get_group_picture_path_by_id($group_id, 'system', true);
} else {
$path_user_info = UserManager::get_user_picture_path_by_id($message_user_id, 'system', true);
}
@ -527,13 +528,14 @@ class MessageManager
$sql = "SELECT * FROM $table_message_attach WHERE message_id = '$message_id'";
$rs = Database::query($sql);
$new_paths = array();
$usergroup = new UserGroup();
while ($row = Database::fetch_array($rs)) {
$path = $row['path'];
$attach_id = $row['id'];
$new_path = $path.'_DELETED_'.$attach_id;
if (!empty($group_id)) {
$path_user_info = GroupPortalManager::get_group_picture_path_by_id($group_id, 'system', true);
$path_user_info = $usergroup->get_group_picture_path_by_id($group_id, 'system', true);
} else {
$path_user_info = UserManager::get_user_picture_path_by_id($message_uid, 'system', true);
}
@ -837,12 +839,6 @@ class MessageManager
$files_attachments = self::get_links_message_attachment_files($message_id, $source);
$user_con = self::users_connected_by_id();
$band = 0;
for ($i = 0; $i < count($user_con); $i++) {
if ($user_sender_id == $user_con[$i]) {
$band = 1;
}
}
$title = Security::remove_XSS($row['title'], STUDENT, true);
$content = Security::remove_XSS($row['content'], STUDENT, true);
@ -859,7 +855,7 @@ class MessageManager
}
if (api_get_setting('allow_social_tool') == 'true') {
$userInfo = api_get_user_info($row[2]);
$userInfo = api_get_user_info($row['user_sender_id']);
if ($source == 'outbox') {
$message_content .= get_lang('From').': <a href="'.api_get_path(
WEB_PATH
@ -1023,7 +1019,7 @@ class MessageManager
'group_topics.php?id='.$group_id.'&topic_id='.$topic['id']
)
);
$actions = null;
if ($my_group_role == GROUP_USER_PERMISSION_ADMIN || $my_group_role == GROUP_USER_PERMISSION_MODERATOR) {
$actions = '<br />'.Display::url(
get_lang('Delete'),
@ -1129,20 +1125,20 @@ class MessageManager
$topic_page_nr = isset($_GET['topics_page_nr']) ? intval($_GET['topics_page_nr']) : null;
$links .= '<div id="message-reply-link">';
if (($my_group_role == GROUP_USER_PERMISSION_ADMIN || $my_group_role == GROUP_USER_PERMISSION_MODERATOR) || $main_message['user_sender_id'] == $current_user_id) {
$links .= '<a href="'.api_get_path(
$links .= '<a class="ajax btn" href="'.api_get_path(
WEB_CODE_PATH
).'social/message_for_group_form.inc.php?view_panel=1&height=390&width=610&&user_friend='.$current_user_id.'&group_id='.$group_id.'&message_id='.$main_message['id'].'&action=edit_message_group&anchor_topic=topic_'.$main_message['id'].'&topics_page_nr='.$topic_page_nr.'&items_page_nr='.$items_page_nr.'&topic_id='.$main_message['id'].'" class="group_message_popup" title="'.get_lang(
'Edit'
).'">';
$links .= Display :: return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL).'</a>';
$links .= get_lang('Edit').'</a>';
}
$links .= '&nbsp;&nbsp;<a href="'.api_get_path(
$links .= '&nbsp;&nbsp;<a class="ajax btn btn-primary" href="'.api_get_path(
WEB_CODE_PATH
).'social/message_for_group_form.inc.php?view_panel=1&height=390&width=610&&user_friend='.api_get_user_id(
).'&group_id='.$group_id.'&message_id='.$main_message['id'].'&action=reply_message_group&anchor_topic=topic_'.$main_message['id'].'&topics_page_nr='.$topic_page_nr.'&items_page_nr='.$items_page_nr.'&topic_id='.$main_message['id'].'" class="group_message_popup" title="'.get_lang(
'Reply'
).'">';
$links .= Display :: return_icon('talk.png', get_lang('Reply')).'</a>';
$links .= get_lang('Reply').'</a>';
$links .= '</div>';
$image_path = UserManager::get_user_picture_path_by_id($main_message['user_sender_id'], 'web', false, true);
@ -1205,19 +1201,19 @@ class MessageManager
$links .= '<div id="message-reply-link">';
if (($my_group_role == GROUP_USER_PERMISSION_ADMIN || $my_group_role == GROUP_USER_PERMISSION_MODERATOR) || $topic['user_sender_id'] == $current_user_id) {
$links .= '<a href="'.api_get_path(
$links .= '<a class="btn ajax" href="'.api_get_path(
WEB_CODE_PATH
).'social/message_for_group_form.inc.php?view_panel=1&height=390&width=610&&user_friend='.$current_user_id.'&group_id='.$group_id.'&message_id='.$topic['id'].'&action=edit_message_group&anchor_topic=topic_'.$topic_id.'&topics_page_nr='.$topic_page_nr.'&items_page_nr='.$items_page_nr.'&topic_id='.$topic_id.'" class="group_message_popup" title="'.get_lang(
'Edit'
).'">'.Display :: return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL).'</a>';
).'">'.get_lang('Edit').'</a>';
}
$links .= '&nbsp;&nbsp;<a href="'.api_get_path(
$links .= '&nbsp;&nbsp;<a class="btn btn-primary ajax" href="'.api_get_path(
WEB_CODE_PATH
).'social/message_for_group_form.inc.php?view_panel=1&height=390&width=610&&user_friend='.api_get_user_id(
).'&group_id='.$group_id.'&message_id='.$topic['id'].'&action=reply_message_group&anchor_topic=topic_'.$topic_id.'&topics_page_nr='.$topic_page_nr.'&items_page_nr='.$items_page_nr.'&topic_id='.$topic_id.'" class="group_message_popup" title="'.get_lang(
'Reply'
).'">';
$links .= Display :: return_icon('talk.png', get_lang('Reply')).'</a>';
$links .= get_lang('Reply').'</a>';
$links .= '</div>';
$image_path = UserManager::get_user_picture_path_by_id($topic['user_sender_id'], 'web', false, true);

@ -118,7 +118,7 @@ class Notification extends Model
* @param array recipients: user list of ids
* @param string title
* @param string content of the message
* @param array result of api_get_user_info() or GroupPortalManager:get_group_data()
* @param array result of api_get_user_info() or UserGroup->get()
*/
public function save_notification($type, $user_list, $title, $content, $sender_info = array()) {
$this->type = intval($type);
@ -133,6 +133,8 @@ class Notification extends Model
$setting_to_check = '';
$avoid_my_self = false;
$default_status = self::NOTIFY_MESSAGE_AT_ONCE;
switch ($this->type) {
case self::NOTIFICATION_TYPE_MESSAGE;
$setting_to_check = 'mail_notify_message';
@ -209,7 +211,7 @@ class Notification extends Model
/**
* Formats the content in order to add the welcome message, the notification preference, etc
* @param string the content
* @param array result of api_get_user_info() or GroupPortalManager:get_group_data()
* @param array result of api_get_user_info() or UserGroup->get()
* */
public function format_content($content, $sender_info) {
$new_message_text = $link_to_new_message = '';
@ -235,10 +237,11 @@ class Notification extends Model
if (!empty($sender_info)) {
$sender_name = $sender_info['group_info']['name'];
$new_message_text = sprintf(get_lang('YouHaveReceivedANewMessageInTheGroupX'), $sender_name);
$sender_name = api_get_person_name($sender_info['user_info']['firstname'], $sender_info['user_info']['lastname'], null, PERSON_NAME_EMAIL_ADDRESS);
$sender_name = Display::url($sender_name , api_get_path(WEB_CODE_PATH).'social/profile.php?'.$sender_info['user_info']['user_id']);
$new_message_text .= '<br />'.get_lang('User').': '.$sender_name;
if (isset($sender_info['user_info']) && !empty($sender_info['user_info'])) {
$sender_name = api_get_person_name($sender_info['user_info']['firstname'], $sender_info['user_info']['lastname'], null, PERSON_NAME_EMAIL_ADDRESS);
$sender_name = Display::url($sender_name , api_get_path(WEB_CODE_PATH).'social/profile.php?'.$sender_info['user_info']['user_id']);
$new_message_text .= '<br />'.get_lang('User').': '.$sender_name;
}
}
$group_url = api_get_path(WEB_CODE_PATH).'social/group_topics.php?id='.$sender_info['group_info']['id'].'&topic_id='.$sender_info['group_info']['topic_id'].'&msg_id='.$sender_info['group_info']['msg_id'].'&topics_page_nr='.$topic_page;
$link_to_new_message = Display::url(get_lang('SeeMessage'), $group_url);

@ -1038,14 +1038,18 @@ class PageController
$loadHistory = (isset($filter) && $filter == 'history') ? true : false;
$app['session_menu'] = function($app) use ($loadHistory) {
$menu = $app['knp_menu.factory']->createItem('root');
$menu->setUri($app['request']->getRequestUri());
$menu = $app['knp_menu.factory']->createItem('root', array(
'childrenAttributes' => array(
'class' => 'nav nav-tabs',
'currentClass' => 'active'
)
));
//$menu->setUri($app['request']->getRequestUri());
/*
$menu->setChildrenAttributes(array(
'class' => 'nav nav-tabs',
'currentClass' => 'active'
));
));*/
$current = $menu->addChild(get_lang('Current'), array(
'route' => 'userportal',

@ -1870,7 +1870,8 @@ class SessionManager {
$num_rows = Database::num_rows($result);
$courses = array();
if ($num_rows > 0) {
while ($row = Database::fetch_array($result,'ASSOC')) {
while ($row = Database::fetch_array($result,'ASSOC')) {
$row['real_id'] = $row['id'];
$courses[$row['id']] = $row;
}
}

@ -10,15 +10,6 @@
/**
* Code
*/
//PLUGIN PLACES
define('SOCIAL_LEFT_PLUGIN', 1);
define('SOCIAL_CENTER_PLUGIN', 2);
define('SOCIAL_RIGHT_PLUGIN', 3);
define('CUT_GROUP_NAME', 50);
//This require is necessary because we use constants that need to be loaded before the SocialManager class
require_once api_get_path(LIBRARY_PATH).'message.lib.php';
/**
*
@ -401,7 +392,7 @@ class SocialManager extends UserManager {
$course_code = $my_course['code'];
$course_title = $my_course['course_info']['title'];
$course_id = $my_course['id'];
$course_id = $my_course['course_info']['real_id'];
$course_access_settings = CourseManager :: get_access_settings($course_code);
@ -442,6 +433,7 @@ class SocialManager extends UserManager {
if (empty($user_id)) {
$user_id = api_get_user_id();
}
$usergroup = new UserGroup();
$user_info = api_get_user_info($user_id, true);
$current_user_id = api_get_user_id();
@ -454,14 +446,13 @@ class SocialManager extends UserManager {
}
$show_groups = array('groups', 'group_messages', 'messages_list', 'group_add', 'mygroups', 'group_edit', 'member_list', 'invite_friends', 'waiting_list', 'browse_groups');
//$show_messages = array('messages', 'messages_inbox', 'messages_outbox', 'messages_compose');
// get count unread message and total invitations
$count_unread_message = MessageManager::get_number_of_messages(true);
$count_unread_message = (!empty($count_unread_message)? Display::badge($count_unread_message) :'');
$number_of_new_messages_of_friend = SocialManager::get_message_number_invitation_by_user_id(api_get_user_id());
$group_pending_invitations = GroupPortalManager::get_groups_by_user(api_get_user_id(), GROUP_USER_PERMISSION_PENDING_INVITATION,false);
$group_pending_invitations = $usergroup->get_groups_by_user(api_get_user_id(), GROUP_USER_PERMISSION_PENDING_INVITATION,false);
$group_pending_invitations = count($group_pending_invitations);
$total_invitations = $number_of_new_messages_of_friend + $group_pending_invitations;
$total_invitations = (!empty($total_invitations) ? Display::badge($total_invitations) :'');
@ -469,13 +460,13 @@ class SocialManager extends UserManager {
$html = '<div class="social-menu">';
if (in_array($show, $show_groups) && !empty($group_id)) {
//--- Group image
$group_info = GroupPortalManager::get_group_data($group_id);
$big = GroupPortalManager::get_picture_group($group_id, $group_info['picture_uri'],160,GROUP_IMAGE_SIZE_BIG);
$group_info = $usergroup->get($group_id);
$big = $usergroup->get_picture_group($group_id, $group_info['picture'],160,GROUP_IMAGE_SIZE_BIG);
$html .= '<div class="social-content-image">';
$html .= '<div class="well social-background-content">';
$html .= Display::url('<img src='.$big['file'].' class="social-groups-image" /> </a><br /><br />', api_get_path(WEB_PATH).'main/social/groups.php?id='.$group_id);
if (GroupPortalManager::is_group_admin($group_id, api_get_user_id())) {
if ($usergroup->is_group_admin($group_id, api_get_user_id())) {
$html .= '<div id="edit_image" class="hidden_message" style="display:none"><a href="'.api_get_path(WEB_PATH).'main/social/group_edit.php?id='.$group_id.'">'.get_lang('EditGroup').'</a></div>';
}
$html .= '</div>';
@ -534,7 +525,7 @@ class SocialManager extends UserManager {
}
if (in_array($show, $show_groups) && !empty($group_id)) {
$html .= GroupPortalManager::show_group_column_information($group_id, api_get_user_id(), $show);
$html .= $usergroup->show_group_column_information($group_id, api_get_user_id(), $show);
}
if ($show == 'shared_profile') {
@ -665,7 +656,9 @@ class SocialManager extends UserManager {
* @param array $user_list
*/
public static function display_user_list($user_list) {
if ($_GET['id'] == '') {
if (!isset($_GET['id'])) {
$html = null;
$column_size = '9';
$add_row = false;
@ -676,7 +669,8 @@ class SocialManager extends UserManager {
$extra_params = array();
$course_url = '';
if (strlen($_GET['cidReq']) > 0) {
if (isset($_GET['cidReq']) && !empty($_GET['cidReq'])) {
$extra_params['cidReq'] = Security::remove_XSS($_GET['cidReq']);
$course_url = '&amp;cidReq='.Security::remove_XSS($_GET['cidReq']);
}

@ -28,15 +28,16 @@ class SystemAnnouncementManager {
$user_selected_language = api_get_interface_language();
$db_table = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS);
$tbl_announcement_group = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS_GROUPS);
$temp_user_groups = GroupPortalManager::get_groups_by_user(api_get_user_id(),0);
$usergroup = new UserGroup();
$temp_user_groups = $usergroup->get_groups_by_user(api_get_user_id(),0);
$groups =array();
foreach ($temp_user_groups as $user_group) {
$groups = array_merge($groups, array($user_group['id']));
$groups = array_merge($groups, GroupPortalManager::get_parent_groups($user_group['id']));
$groups = array_merge($groups, $usergroup->get_parent_groups($user_group['id']));
}
//checks if tables exists to not break platform not updated
$ann_group_db_ok =false;
if( Database::num_rows(Database::query("SHOW TABLES LIKE 'announcement_rel_group'")) > 0)
if (Database::num_rows(Database::query("SHOW TABLES LIKE 'announcement_rel_group'")) > 0)
$ann_group_db_ok =true;
$groups_string = '('.implode($groups,',').')';
@ -110,13 +111,13 @@ class SystemAnnouncementManager {
public static function display_all_announcements($visible, $id = -1, $start = 0,$user_id='') {
$user_selected_language = api_get_interface_language();
$start = intval($start);
$usergroup = new UserGroup();
$tbl_announcement_group = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS_GROUPS);
$temp_user_groups = GroupPortalManager::get_groups_by_user(api_get_user_id(),0);
$temp_user_groups = $usergroup->get_groups_by_user(api_get_user_id(),0);
$groups =array();
foreach ($temp_user_groups as $user_group) {
$groups = array_merge($groups, array($user_group['id']));
$groups = array_merge($groups, GroupPortalManager::get_parent_groups($user_group['id']));
$groups = array_merge($groups, $usergroup->get_parent_groups($user_group['id']));
}
//checks if tables exists to not break platform not updated
$ann_group_db_ok =false;

@ -267,8 +267,8 @@ class Template
$new_messages = MessageManager::get_new_messages();
$user_info['messages_count'] = $new_messages != 0 ? Display::label($new_messages, 'warning') : null;
$messages_invitations_count = GroupPortalManager::get_groups_by_user_count(
$usergroup = new UserGroup();
$messages_invitations_count = $usergroup->get_groups_by_user_count(
$user_info['user_id'],
GROUP_USER_PERMISSION_PENDING_INVITATION,
false
@ -410,8 +410,9 @@ class Template
if (api_is_global_chat_enabled()) {
//Do not include the global chat in LP
if ($this->show_learnpath == false && $this->show_footer == true && $this->hide_global_chat == false) {
$js_files[] = 'chat/js/chat.js';
//$js_files[] = 'chat/js/chat.js';
}
$js_files[] = 'chat/js/chat.js';
}
if (api_get_setting('accessibility_font_resize') == 'true') {

File diff suppressed because it is too large Load Diff

@ -501,7 +501,6 @@ class UserManager {
$sqlv = "DELETE FROM $t_ufv WHERE user_id = $user_id";
Database::query($sqlv);
require_once api_get_path(LIBRARY_PATH).'urlmanager.lib.php';
if (api_get_multiple_access_url()) {
$url_id = api_get_current_access_url_id();
UrlManager::delete_url_rel_user($user_id, $url_id);
@ -511,13 +510,12 @@ class UserManager {
}
if (api_get_setting('allow_social_tool')=='true' ) {
require_once api_get_path(LIBRARY_PATH).'group_portal_manager.lib.php';
$usergroup = new UserGroup();
//Delete user from portal groups
$group_list = GroupPortalManager::get_groups_by_user($user_id);
$group_list = $usergroup->get_groups_by_user($user_id);
if (!empty($group_list)) {
foreach($group_list as $group_id => $data) {
GroupPortalManager::delete_user_rel_group($user_id, $group_id);
$usergroup->delete_user_rel_group($user_id, $group_id);
}
}
@ -2562,7 +2560,6 @@ class UserManager {
// Database Table Definitions
$tbl_course = Database :: get_main_table(TABLE_MAIN_COURSE);
$tbl_user = Database :: get_main_table(TABLE_MAIN_USER);
$tbl_session = Database :: get_main_table(TABLE_MAIN_SESSION);
$tbl_session_user = Database :: get_main_table(TABLE_MAIN_SESSION_USER);
$tbl_course_user = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
@ -2639,7 +2636,6 @@ class UserManager {
if (!empty($sessions)) {
foreach ($sessions as $enreg) {
$session_id = $enreg['id'];
$courseList = SessionManager::get_course_list_by_session_id($session_id);
foreach ($courseList as $course) {
$sessionVisibility = api_get_session_visibility($session_id, $course['code']);

@ -55,11 +55,12 @@ if (in_array($_GET['type'],$message_type)) {
$message_uid = $row_users['user_sender_id'];
}
}
$usergroup = new UserGroup();
// allow to the correct user for download this file
$not_allowed_to_edit = false;
if (!empty($row_users['group_id'])) {
$users_group = GroupPortalManager::get_all_users_by_group($row_users['group_id']);
$users_group = $usergroup->get_all_users_by_group($row_users['group_id']);
if (!in_array($current_uid,array_keys($users_group))) {
$not_allowed_to_edit = true;
}
@ -76,7 +77,7 @@ if ($not_allowed_to_edit) {
// set the path directory file
if (!empty($row_users['group_id'])) {
$path_user_info = GroupPortalManager::get_group_picture_path_by_id($row_users['group_id'], 'system', true);
$path_user_info = $usergroup->get_group_picture_path_by_id($row_users['group_id'], 'system', true);
} else {
$path_user_info = UserManager::get_user_picture_path_by_id($message_uid, 'system', true);
}

@ -183,7 +183,8 @@ function manage_form($default, $select_from_user_list = null, $sent_to = null) {
}
}
} else {
$group_info = GroupPortalManager::get_group_data($group_id);
$usergroup = new UserGroup();
$group_info = $usergroup->get($group_id);
$form->addElement('label', get_lang('ToGroup'), api_xml_http_response_encode($group_info['name']));
$form->addElement('hidden','group_id',$group_id);

@ -34,7 +34,7 @@ function text_longitud(){
</script>';
$table_message = Database::get_main_table(TABLE_MESSAGE);
$usergroup = new UserGroup();
$form = new FormValidator('add_group');
// name
@ -59,11 +59,7 @@ $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);
$form->addElement('select', 'visibility', get_lang('GroupPermissions'), $usergroup->getGroupStatusList());
$form->addElement('style_submit_button','add_group', get_lang('AddGroup'),'class="save"');
$form->setRequiredNote(api_xml_http_response_encode('<span class="form_required">*</span> <small>'.get_lang('ThisFieldIsRequired').'</small>'));
@ -73,21 +69,21 @@ if ($form->validate()) {
$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);
GroupPortalManager::add_user_to_group(api_get_user_id(), $group_id,GROUP_USER_PERMISSION_ADMIN);
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);
}
header('Location: groups.php?id='.$group_id.'&action=show_message&message='.urlencode(get_lang('GroupAdded')));
$values['type'] = $usergroup::SOCIAL_CLASS;
$groupId = $usergroup->save($values);
if ($groupId) {
$usergroup->add_user_to_group(api_get_user_id(), $groupId, $values['visibility']);
if (!empty($picture['name'])) {
$picture = $usergroup->update_group_picture($groupId, $_FILES['picture']['name'], $_FILES['picture']['tmp_name']);
$params = array('id' => $groupId, 'picture' => $picture);
$usergroup->update($params);
}
}
header('Location: groups.php?id='.$groupId.'&action=show_message&message='.urlencode(get_lang('GroupAdded')));
exit();
}

@ -38,22 +38,19 @@ $tool_name = get_lang('GroupEdit');
$interbreadcrumb[] = array('url' => 'home.php', 'name' => get_lang('Social'));
$interbreadcrumb[] = array('url' => 'groups.php', 'name' => get_lang('Groups'));
$table_group = Database::get_main_table(TABLE_MAIN_GROUP);
$usergroup = new UserGroup();
$sql = "SELECT * FROM $table_group WHERE id = '".$group_id."'";
$res = Database::query($sql);
if (Database::num_rows($res) != 1) {
$group_data = $usergroup->get($group_id);
if (empty($group_data)) {
header('Location: groups.php?id='.$group_id);
exit;
}
//only group admins can edit the group
if (!GroupPortalManager::is_group_admin($group_id)) {
if (!$usergroup->is_group_admin($group_id)) {
api_not_allowed();
}
$group_data = Database::fetch_array($res, 'ASSOC');
// Create the form
$form = new FormValidator('group_edit', 'post', '', '');
$form->addElement('hidden', 'id', $group_id);
@ -89,15 +86,12 @@ $form->addRule(
'filetype',
$allowed_picture_types
);
if (strlen($group_data['picture_uri']) > 0) {
if (strlen($group_data['picture']) > 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());
//Status
$form->addElement('select', 'visibility', get_lang('GroupPermissions'), $usergroup->getGroupStatusList(), array());
// Submit button
@ -111,24 +105,19 @@ if ($form->validate()) {
$group = $form->exportValues();
$picture_element = $form->getElement('picture');
$picture = $picture_element->getValue();
$picture_uri = $group_data['picture_uri'];
$picture_uri = $group_data['picture'];
if ($group['delete_picture']) {
$picture_uri = GroupPortalManager::delete_group_picture($group_id);
$picture_uri = $usergroup->delete_group_picture($group_id);
} elseif (!empty($picture['name'])) {
$picture_uri = GroupPortalManager::update_group_picture(
$picture_uri = $usergroup->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);
$group['id'] = $group_id;
$usergroup->update($group);
$tok = Security::get_token();
header(
'Location: groups.php?id='.$group_id.'&action=show_message&message='.urlencode(
@ -139,7 +128,7 @@ if ($form->validate()) {
}
// Group picture
$image_path = GroupPortalManager::get_group_picture_path_by_id($group_id, 'web');
$image_path = $usergroup->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');

@ -45,17 +45,18 @@ $add_type = 'multiple';
if(isset($_REQUEST['add_type']) && $_REQUEST['add_type']!=''){
$add_type = Security::remove_XSS($_REQUEST['add_type']);
}
$usergroup = new UserGroup();
//todo @this validation could be in a function in group_portal_manager
if (empty($group_id)) {
api_not_allowed();
} else {
$group_info = GroupPortalManager::get_group_data($group_id);
$group_info = $usergroup->get($group_id);
if (empty($group_info)) {
api_not_allowed();
}
//only admin or moderator can do that
if (!GroupPortalManager::is_group_member($group_id)) {
if (!$usergroup->is_group_member($group_id)) {
api_not_allowed();
}
}
@ -199,19 +200,19 @@ $users=$sessions=array();
//Display :: display_header($tool_name, 'Groups');
if ($_POST['form_sent']) {
if (isset($_POST['form_sent']) && $_POST['form_sent']) {
$form_sent = $_POST['form_sent'];
$firstLetterUser = $_POST['firstLetterUser'];
$firstLetterSession = $_POST['firstLetterSession'];
$user_list = $_POST['sessionUsersList'];
$group_id = intval($_POST['id']);
if(!is_array($user_list)) {
if (!is_array($user_list)) {
$user_list=array();
}
if ($form_sent == 1) {
//invite this users
$result = GroupPortalManager::add_users_to_groups($user_list, array($group_id), GROUP_USER_PERMISSION_PENDING_INVITATION);
$result = $usergroup->add_users_to_groups($user_list, array($group_id), GROUP_USER_PERMISSION_PENDING_INVITATION);
$title = get_lang('YouAreInvitedToGroup').' '.$group_info['name'];
$content = get_lang('YouAreInvitedToGroupContent').' '.$group_info['name'].' <br />';
$content .= get_lang('ToSubscribeClickInTheLinkBelow').' <br />';
@ -260,14 +261,13 @@ if ($ajax_search) {
}
} else {
$friends = SocialManager::get_friends(api_get_user_id());
$suggest_friends = false;
$Users = array();
if (!$friends) {
$suggest_friends = true;
} else {
foreach($friends as $friend) {
$group_friend_list = GroupPortalManager::get_groups_by_user($friend['friend_user_id'], 0);
$group_friend_list = $usergroup->get_groups_by_user($friend['friend_user_id'], 0);
//var_dump($group_friend_list);
$friend_group_id = '';
if (isset($group_friend_list[$group_id]) && $group_friend_list[$group_id]['id'] == $group_id) {
@ -433,7 +433,7 @@ $form .= '</select></td>
$social_right_content .= $form;
//current group members
$members = GroupPortalManager::get_users_by_group($group_id, false, array(GROUP_USER_PERMISSION_PENDING_INVITATION));
$members = $usergroup->get_users_by_group($group_id, false, array(GROUP_USER_PERMISSION_PENDING_INVITATION));
if (is_array($members) && count($members)>0) {
foreach ($members as &$member) {
$image_path = UserManager::get_user_picture_path_by_id($member['user_id'], 'web', false, true);
@ -444,9 +444,7 @@ if (is_array($members) && count($members)>0) {
$social_right_content .= Display::return_sortable_grid('invitation_profile', array(), $members, array('hide_navigation'=>true, 'per_page' => 100), $query_vars, false, array(true, false, true,true));
}
$htmlHeadXtra[] = '
<script type="text/javascript">
<!--
$htmlHeadXtra[] = '<script>
function moveItem(origin , destination) {
for(var i = 0 ; i<origin.options.length ; i++) {
if(origin.options[i].selected) {
@ -525,7 +523,6 @@ function makepost(select) {
ret = ret + options[i].value +\'::\'+options[i].text+";;";
return ret;
}
-->
</script>';
$social_right_content = Display::div($social_right_content, array('class' => 'span9'));
@ -533,11 +530,8 @@ $social_right_content = Display::div($social_right_content, array('class' => 'sp
$tpl = new Template($tool_name);
$tpl->set_help('Groups');
$tpl->assign('social_left_content', $social_left_content);
$tpl->assign('social_left_menu', $social_left_menu);
$tpl->assign('social_right_content', $social_right_content);
$tpl->assign('actions', $actions);
$tpl->assign('message', $show_message);
$tpl->assign('content', $content);
$social_layout = $tpl->get_template('layout/social_layout.tpl');
$tpl->display($social_layout);

@ -21,17 +21,17 @@ $interbreadcrumb[]= array ('url' =>'home.php','name' => get_lang('Social'));
$interbreadcrumb[] = array('url' => 'groups.php','name' => get_lang('Groups'));
$interbreadcrumb[] = array('url' => '#','name' => get_lang('MemberList'));
$group_id = intval($_GET['id']);
$group_id = intval($_GET['id']);
$usergroup = new UserGroup();
//todo @this validation could be in a function in group_portal_manager
if (empty($group_id)) {
api_not_allowed();
} else {
$group_info = GroupPortalManager::get_group_data($group_id);
$group_info = $usergroup->get($group_id);
if (empty($group_info)) {
api_not_allowed();
}
$user_role = GroupPortalManager::get_user_group_role(api_get_user_id(), $group_id);
$user_role = $usergroup->get_user_group_role(api_get_user_id(), $group_id);
if (!in_array($user_role, array(GROUP_USER_PERMISSION_ADMIN, GROUP_USER_PERMISSION_MODERATOR, GROUP_USER_PERMISSION_READER))) {
api_not_allowed();
}
@ -43,8 +43,8 @@ if (isset($_GET['action']) && $_GET['action']=='add') {
// we add a user only if is a open group
$user_join = intval($_GET['u']);
//if i'm a moderator
if (GroupPortalManager::is_group_moderator($group_id)) {
GroupPortalManager::update_user_role($user_join, $group_id);
if ($usergroup->is_group_moderator($group_id)) {
$usergroup->update_user_role($user_join, $group_id);
$show_message = get_lang('UserAdded');
}
}
@ -53,8 +53,8 @@ if (isset($_GET['action']) && $_GET['action']=='delete') {
// we add a user only if is a open group
$user_join = intval($_GET['u']);
//if i'm a moderator
if (GroupPortalManager::is_group_moderator($group_id)) {
GroupPortalManager::delete_user_rel_group($user_join, $group_id);
if ($usergroup->is_group_moderator($group_id)) {
$usergroup->delete_user_rel_group($user_join, $group_id);
$show_message = Display::return_message(get_lang('UserDeleted'));
}
}
@ -63,8 +63,8 @@ if (isset($_GET['action']) && $_GET['action']=='set_moderator') {
// we add a user only if is a open group
$user_moderator= intval($_GET['u']);
//if i'm the admin
if (GroupPortalManager::is_group_admin($group_id)) {
GroupPortalManager::update_user_role($user_moderator, $group_id, GROUP_USER_PERMISSION_MODERATOR);
if ($usergroup->is_group_admin($group_id)) {
$usergroup->update_user_role($user_moderator, $group_id, GROUP_USER_PERMISSION_MODERATOR);
$show_message = Display::return_message(get_lang('UserChangeToModerator'));
}
}
@ -73,13 +73,13 @@ if (isset($_GET['action']) && $_GET['action']=='delete_moderator') {
// we add a user only if is a open group
$user_moderator= intval($_GET['u']);
//only group admins can do that
if (GroupPortalManager::is_group_admin($group_id)) {
GroupPortalManager::update_user_role($user_moderator, $group_id, GROUP_USER_PERMISSION_READER);
if ($usergroup->is_group_admin($group_id)) {
$usergroup->update_user_role($user_moderator, $group_id, GROUP_USER_PERMISSION_READER);
$show_message = Display::return_message(get_lang('UserChangeToReader'));
}
}
$users = GroupPortalManager::get_users_by_group($group_id, false, array(GROUP_USER_PERMISSION_ADMIN, GROUP_USER_PERMISSION_READER, GROUP_USER_PERMISSION_MODERATOR), 0 , 1000);
$users = $usergroup->get_users_by_group($group_id, false, array(GROUP_USER_PERMISSION_ADMIN, GROUP_USER_PERMISSION_READER, GROUP_USER_PERMISSION_MODERATOR), 0 , 1000);
$new_member_list = array();
$social_left_content = SocialManager::show_social_menu('member_list',$group_id);
@ -118,18 +118,14 @@ foreach($users as $user) {
$new_member_list[] = $user;
}
if (count($new_member_list) > 0) {
$social_right_content .= Display::return_sortable_grid('list_members', array(), $new_member_list, array('hide_navigation'=>true, 'per_page' => 100), $query_vars, false, array(true, false, true,true,false,true,true));
$social_right_content .= Display::return_sortable_grid('list_members', array(), $new_member_list, array('hide_navigation'=>true, 'per_page' => 100), null, false, array(true, false, true,true,false,true,true));
}
$social_right_content .= '</div>';
$tpl = new Template($tool_name);
$tpl = new Template(get_lang('Social'));
$tpl->set_help('Groups');
$tpl->assign('social_left_content', $social_left_content);
$tpl->assign('social_left_menu', $social_left_menu);
$tpl->assign('social_right_content', $social_right_content);
$tpl->assign('actions', $actions);
$tpl->assign('message', $show_message);
$tpl->assign('content', $content);
$social_layout = $tpl->get_template('layout/social_layout.tpl');
$tpl->display($social_layout);
$tpl->display($social_layout);

@ -7,6 +7,7 @@
$language_file = array('userInfo', 'forum');
$cidReset = true;
require_once '../inc/global.inc.php';
api_block_anonymous_users();
@ -15,33 +16,37 @@ if (api_get_setting('allow_social_tool') !='true') {
}
$group_id = intval($_GET['id']);
$topic_id = intval($_GET['topic_id']);
$message_id = intval($_GET['msg_id']);
$topic_id = isset($_GET['topic_id']) ? intval($_GET['topic_id']) : null;
$message_id = isset($_GET['msg_id']) ? intval($_GET['msg_id']) : null;
$usergroup = new UserGroup();
//todo @this validation could be in a function in group_portal_manager
if (empty($group_id)) {
api_not_allowed(true);
} else {
$group_info = GroupPortalManager::get_group_data($group_id);
$group_info = $usergroup->get($group_id);
if (empty($group_info)) {
api_not_allowed(true);
}
$is_member = GroupPortalManager::is_group_member($group_id);
$is_member = $usergroup->is_group_member($group_id);
if ($group_info['visibility'] == GROUP_PERMISSION_CLOSED && !$is_member ) {
api_not_allowed(true);
}
}
if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete') {
$group_role = GroupPortalManager::get_user_group_role(api_get_user_id(), $group_id);
$group_role = $usergroup->get_user_group_role(api_get_user_id(), $group_id);
if (api_is_platform_admin() || in_array($group_role, array(GROUP_USER_PERMISSION_ADMIN, GROUP_USER_PERMISSION_MODERATOR))) {
GroupPortalManager::delete_topic($group_id, $topic_id);
$usergroup->delete_topic($group_id, $topic_id);
header("Location: groups.php?id=$group_id&action=show_message&msg=topic_deleted");
exit;
}
}
$content = null;
// save message group
$currentToken = Security::getCurrentToken();
@ -70,7 +75,7 @@ if (isset($_POST['token']) && $_POST['token'] === $currentToken) {
if (!$res) {
$social_right_content .= Display::return_message(get_lang('Error'),'error');
}
$topic_id = intval($_GET['topic_id']);
$topic_id = isset($_GET['topic_id']) ? intval($_GET['topic_id']) : null;
if ($_POST['action'] == 'add_message_group') {
$topic_id = $res;
}
@ -78,7 +83,7 @@ if (isset($_POST['token']) && $_POST['token'] === $currentToken) {
}
}
$htmlHeadXtra[] = '<script type="text/javascript">
$htmlHeadXtra[] = '<script>
var counter_image = 1;
function remove_image_form(id_elem1) {
@ -179,22 +184,18 @@ $social_right_content = '<div class="breadcrumb">
<span class="divider">/</span>
<a href="groups.php?id='.$group_id.'#tabs_2">'.get_lang('Discussions').'</a>
</div> ';
$social_left_content .= SocialManager::show_social_menu('member_list', $group_id);
$social_left_content = SocialManager::show_social_menu('member_list', $group_id);
$show_message = null;
if (!empty($show_message)) {
$social_right_content .= Display::return_message($show_message, 'confirmation');
}
$social_right_content .= MessageManager::display_message_for_group($group_id, $topic_id, $is_member, $message_id);
$social_right_content = '<div class="span9">'.$social_right_content.'</div>';
$tpl = new Template($tool_name);
$tpl = new Template(get_lang('Social'));
$tpl->set_help('Groups');
$tpl->assign('social_left_content', $social_left_content);
$tpl->assign('social_left_menu', $social_left_menu);
$tpl->assign('social_right_content', $social_right_content);
$tpl->assign('actions', $actions);
$tpl->assign('message', $show_message);
$tpl->assign('content', $content);
$social_layout = $tpl->get_template('layout/social_layout.tpl');

@ -23,31 +23,33 @@ $interbreadcrumb[]= array ('url' =>'#','name' => get_lang('WaitingList'));
$group_id = intval($_GET['id']);
$usergroup = new UserGroup();
//todo @this validation could be in a function in group_portal_manager
if (empty($group_id)) {
api_not_allowed();
} else {
$group_info = GroupPortalManager::get_group_data($group_id);
$group_info = $usergroup->get($group_id);
if (empty($group_info)) {
api_not_allowed();
}
//only admin or moderator can do that
$user_role = GroupPortalManager::get_user_group_role(api_get_user_id(), $group_id);
$user_role = $usergroup->get_user_group_role(api_get_user_id(), $group_id);
if (!in_array($user_role, array(GROUP_USER_PERMISSION_ADMIN, GROUP_USER_PERMISSION_MODERATOR))) {
api_not_allowed();
}
}
// Group information
$admins = GroupPortalManager::get_users_by_group($group_id, true, array(GROUP_USER_PERMISSION_ADMIN), 0, 1000);
$admins = $usergroup->get_users_by_group($group_id, true, array(GROUP_USER_PERMISSION_ADMIN), 0, 1000);
$show_message = '';
if (isset($_GET['action']) && $_GET['action']=='accept') {
// we add a user only if is a open group
$user_join = intval($_GET['u']);
//if i'm a moderator
if (GroupPortalManager::is_group_moderator($group_id)) {
GroupPortalManager::update_user_role($user_join, $group_id);
if ($usergroup->is_group_moderator($group_id)) {
$usergroup->update_user_role($user_join, $group_id);
$show_message = get_lang('UserAdded');
}
}
@ -56,8 +58,8 @@ if (isset($_GET['action']) && $_GET['action']=='deny') {
// we add a user only if is a open group
$user_join = intval($_GET['u']);
//if i'm a moderator
if (GroupPortalManager::is_group_moderator($group_id)) {
GroupPortalManager::delete_user_rel_group($user_join, $group_id);
if ($usergroup->is_group_moderator($group_id)) {
$usergroup->delete_user_rel_group($user_join, $group_id);
$show_message = get_lang('UserDeleted');
}
}
@ -67,13 +69,13 @@ if (isset($_GET['action']) && $_GET['action']=='set_moderator') {
// we add a user only if is a open group
$user_moderator= intval($_GET['u']);
//if i'm the admin
if (GroupPortalManager::is_group_admin($group_id)) {
GroupPortalManager::update_user_role($user_moderator, $group_id, GROUP_USER_PERMISSION_MODERATOR);
if ($usergroup->is_group_admin($group_id)) {
$usergroup->update_user_role($user_moderator, $group_id, GROUP_USER_PERMISSION_MODERATOR);
$show_message = get_lang('UserChangeToModerator');
}
}
$users = GroupPortalManager::get_users_by_group($group_id, true, array(GROUP_USER_PERMISSION_PENDING_INVITATION_SENT_BY_USER), 0, 1000);
$users = $usergroup->get_users_by_group($group_id, true, array(GROUP_USER_PERMISSION_PENDING_INVITATION_SENT_BY_USER), 0, 1000);
$new_member_list = array();
$social_left_content = SocialManager::show_social_menu('waiting_list',$group_id);

@ -10,6 +10,7 @@ $language_file = array('userInfo');
require_once '../inc/global.inc.php';
api_block_anonymous_users();
if (api_get_setting('allow_social_tool') !='true') {
api_not_allowed();
}
@ -90,21 +91,21 @@ jQuery(document).ready(function() {
var valor = "'.$anchor.'";
$(".head").click(function() {
$(this).next().next().slideToggle("fast");
image_clicked = $("#" + this.id + " img").attr("src");
image_clicked_info = image_clicked.split("/");
image_real_clicked = image_clicked_info[image_clicked_info.length-1];
image_path = image_clicked.split("img");
current_path = image_path[0]+"img/";
if (image_real_clicked == "div_show.gif") {
current_path = current_path+"div_hide.gif";
$("#" + this.id + " img").attr("src", current_path);
} else {
current_path = current_path+"div_show.gif";
$("#" + this.id + " img").attr("src", current_path)
}
return false;
}).next().next().hide();
$(this).next().next().slideToggle("fast");
image_clicked = $("#" + this.id + " img").attr("src");
image_clicked_info = image_clicked.split("/");
image_real_clicked = image_clicked_info[image_clicked_info.length-1];
image_path = image_clicked.split("img");
current_path = image_path[0]+"img/";
if (image_real_clicked == "div_show.gif") {
current_path = current_path+"div_hide.gif";
$("#" + this.id + " img").attr("src", current_path);
} else {
current_path = current_path+"div_show.gif";
$("#" + this.id + " img").attr("src", current_path)
}
return false;
}).next().next().hide();
// anchor for current topic
if (valor) {
@ -146,17 +147,19 @@ $group_id = isset($_GET['id']) ? intval($_GET['id']) : null;
$relation_group_title = '';
$my_group_role = 0;
$usergroup = new UserGroup();
if ($group_id != 0 ) {
$user_leave_message = false;
$user_added_group_message = false;
$user_invitation_sent = false;
$group_info = GroupPortalManager::get_group_data($group_id);
$group_info = $usergroup->get($group_id);
if (isset($_GET['action']) && $_GET['action']=='leave') {
$user_leaved = intval($_GET['u']);
//I can "leave me myself"
if (api_get_user_id() == $user_leaved) {
GroupPortalManager::delete_user_rel_group($user_leaved, $group_id);
$usergroup->delete_user_rel_group($user_leaved, $group_id);
$user_leave_message = true;
}
}
@ -166,10 +169,10 @@ if ($group_id != 0 ) {
$user_join = intval($_GET['u']);
if (api_get_user_id() == $user_join && !empty($group_id)) {
if ($group_info['visibility'] == GROUP_PERMISSION_OPEN) {
GroupPortalManager::add_user_to_group($user_join, $group_id);
$usergroup->add_user_to_group($user_join, $group_id);
$user_added_group_message = true;
} else {
GroupPortalManager::add_user_to_group($user_join, $group_id, GROUP_USER_PERMISSION_PENDING_INVITATION_SENT_BY_USER);
$usergroup->add_user_to_group($user_join, $group_id, GROUP_USER_PERMISSION_PENDING_INVITATION_SENT_BY_USER);
$user_invitation_sent = true;
}
}
@ -191,7 +194,7 @@ $social_right_content = null;
if ($group_id != 0 ) {
$group_info = GroupPortalManager::get_group_data($group_id);
$group_info = $usergroup->get($group_id);
//Loading group information
if (isset($_GET['status']) && $_GET['status']=='sent') {
@ -210,13 +213,13 @@ if ($group_id != 0 ) {
$social_right_content .= Display::return_message(get_lang('InvitationSent'), 'confirmation', false);
}
$is_group_member = GroupPortalManager::is_group_member($group_id);
$is_group_member = $usergroup->is_group_member($group_id);
// details about the current group
$social_right_content = '<div class="span9">';
$social_right_content .= '<div id="social-group-details">';
//Group's title
$social_right_content .= Display::tag('h2', Security::remove_XSS($group_info['name'], STUDENT, true));
$social_right_content .= Display::tag('h3', Security::remove_XSS($group_info['name'], STUDENT, true));
//Privacy
if (!$is_group_member) {
@ -231,7 +234,7 @@ if ($group_id != 0 ) {
}
if (!$is_group_member && $group_info['visibility'] == GROUP_PERMISSION_CLOSED) {
$role = GroupPortalManager::get_user_group_role(api_get_user_id(), $group_id);
$role = $usergroup->get_user_group_role(api_get_user_id(), $group_id);
if ($role == GROUP_USER_PERMISSION_PENDING_INVITATION_SENT_BY_USER) {
$social_right_content .= Display::return_message(get_lang('YouAlreadySentAnInvitation'));
}
@ -244,10 +247,12 @@ if ($group_id != 0 ) {
echo $relation_group_title;
echo '</div>';*/
}
//Group's tags
/*
if (!empty($tags)) {
$social_right_content .= '<div id="social-group-details-info"><span>'.get_lang('Tags').' : </span>'.$tags.'</div>';
}
}*/
$social_right_content .= '</div>';
$social_right_content .= '</div>';
@ -271,7 +276,7 @@ if ($group_id != 0 ) {
$create_thread_link = '<a href="'.api_get_path(WEB_CODE_PATH).'social/message_for_group_form.inc.php?view_panel=1&height=400&width=610&&user_friend='.api_get_user_id().'&group_id='.$group_id.'&action=add_message_group" class="ajax btn" title="'.get_lang('ComposeMessage').'">'.get_lang('NewTopic').'</a>';
}
}
$members = GroupPortalManager::get_users_by_group($group_id);
$members = $usergroup->get_users_by_group($group_id);
$member_content = '';
//Members
@ -304,10 +309,6 @@ if ($group_id != 0 ) {
if (!empty($create_thread_link)) {
$create_thread_link = Display::div($create_thread_link, array('style'=>'padding-top:2px;height:40px'));
}
//api_get_item_property_by_tool('group', $course_info, $group_id);
//$updates =
//get_lang('Updates'),
$headers = array(get_lang('Discussions'), get_lang('Members'));
$social_right_content .= Display::tabs($headers, array($create_thread_link.$content, $member_content),'tabs');
} else {
@ -322,7 +323,7 @@ if ($group_id != 0 ) {
} else {
// My groups -----
$results = GroupPortalManager::get_groups_by_user(api_get_user_id(), 0);
$results = $usergroup->get_groups_by_user(api_get_user_id(), 0);
$grid_my_groups = array();
$my_group_list = array();
if (is_array($results) && count($results) > 0) {
@ -340,16 +341,16 @@ if ($group_id != 0 ) {
} elseif ($result['relation_type'] == GROUP_USER_PERMISSION_MODERATOR) {
$name .= ' '.Display::return_icon('social_group_moderator.png', get_lang('Moderator'), array('style'=>'vertical-align:middle'));
}
$count_users_group = count(GroupPortalManager::get_users_by_group($id, false, array(GROUP_USER_PERMISSION_ADMIN, GROUP_USER_PERMISSION_READER, GROUP_USER_PERMISSION_MODERATOR), 0 , 1000));
$count_users_group = count($usergroup->get_users_by_group($id, false, array(GROUP_USER_PERMISSION_ADMIN, GROUP_USER_PERMISSION_READER, GROUP_USER_PERMISSION_MODERATOR), 0 , 1000));
if ($count_users_group == 1 ) {
$count_users_group = $count_users_group.' '.get_lang('Member');
} else {
$count_users_group = $count_users_group.' '.get_lang('Members');
}
$picture = GroupPortalManager::get_picture_group($result['id'], $result['picture_uri'],80);
$result['picture_uri'] = '<img class="social-groups-image" src="'.$picture['file'].'" hspace="4" height="50" border="2" align="left" width="50" />';
$item_0 = Display::div($result['picture_uri'], array('class'=>'box_description_group_image'));
$picture = $usergroup->get_picture_group($result['id'], $result['picture'],80);
$result['picture'] = '<img class="social-groups-image" src="'.$picture['file'].'" hspace="4" height="50" border="2" align="left" width="50" />';
$item_0 = Display::div($result['picture'], array('class'=>'box_description_group_image'));
$members = Display::span($count_users_group, array('class'=>'box_description_group_member'));
$item_1 = Display::div(Display::tag('h3', $url_open.$name.$url_close).$members, array('class'=>'box_description_group_title'));
@ -367,7 +368,7 @@ if ($group_id != 0 ) {
}
// Newest groups
$results = GroupPortalManager::get_groups_by_age(4,false);
$results = $usergroup->get_groups_by_age(4,false);
$grid_newest_groups = array();
foreach ($results as $result) {
$result['name'] = Security::remove_XSS($result['name'], STUDENT, true);
@ -375,7 +376,7 @@ if ($group_id != 0 ) {
$id = $result['id'];
$url_open = '<a href="groups.php?id='.$id.'">';
$url_close = '</a>';
$count_users_group = count(GroupPortalManager::get_users_by_group($id, false, array(GROUP_USER_PERMISSION_ADMIN, GROUP_USER_PERMISSION_READER, GROUP_USER_PERMISSION_MODERATOR), 0 , 1000));
$count_users_group = count($usergroup->get_users_by_group($id, false, array(GROUP_USER_PERMISSION_ADMIN, GROUP_USER_PERMISSION_READER, GROUP_USER_PERMISSION_MODERATOR), 0 , 1000));
if ($count_users_group == 1 ) {
$count_users_group = $count_users_group.' '.get_lang('Member');
} else {
@ -383,10 +384,10 @@ if ($group_id != 0 ) {
}
$name = Text::cut($result['name'],GROUP_TITLE_LENGTH,true);
$picture = GroupPortalManager::get_picture_group($result['id'], $result['picture_uri'],80);
$result['picture_uri'] = '<img class="social-groups-image" src="'.$picture['file'].'" hspace="4" height="50" border="2" align="left" width="50" />';
$picture = $usergroup->get_picture_group($result['id'], $result['picture'],80);
$result['picture'] = '<img class="social-groups-image" src="'.$picture['file'].'" hspace="4" height="50" border="2" align="left" width="50" />';
$item_0 = Display::div($result['picture_uri'], array('class'=>'box_description_group_image'));
$item_0 = Display::div($result['picture'], array('class'=>'box_description_group_image'));
$members = Display::span($count_users_group, array('class'=>'box_description_group_member'));
$item_1 = Display::div(Display::tag('h3', $url_open.$name.$url_close).$members, array('class'=>'box_description_group_title'));
@ -410,7 +411,7 @@ if ($group_id != 0 ) {
}
// Pop groups
$results = GroupPortalManager::get_groups_by_popularity(4,false);
$results = $usergroup->get_groups_by_popularity(4,false);
$grid_pop_groups = array();
if (is_array($results) && count($results) > 0) {
@ -421,7 +422,7 @@ if ($group_id != 0 ) {
$url_open = '<a href="groups.php?id='.$id.'">';
$url_close = '</a>';
$count_users_group = count(GroupPortalManager::get_users_by_group($id, false, array(GROUP_USER_PERMISSION_ADMIN, GROUP_USER_PERMISSION_READER, GROUP_USER_PERMISSION_MODERATOR), 0 , 1000));
$count_users_group = count($usergroup->get_users_by_group($id, false, array(GROUP_USER_PERMISSION_ADMIN, GROUP_USER_PERMISSION_READER, GROUP_USER_PERMISSION_MODERATOR), 0 , 1000));
if ($count_users_group == 1 ) {
$count_users_group = $count_users_group.' '.get_lang('Member');
} else {
@ -429,10 +430,10 @@ if ($group_id != 0 ) {
}
$name = Text::cut($result['name'],GROUP_TITLE_LENGTH,true);
$picture = GroupPortalManager::get_picture_group($result['id'], $result['picture_uri'],80);
$result['picture_uri'] = '<img class="social-groups-image" src="'.$picture['file'].'" hspace="4" height="50" border="2" align="left" width="50" />';
$picture = $usergroup->get_picture_group($result['id'], $result['picture'],80);
$result['picture'] = '<img class="social-groups-image" src="'.$picture['file'].'" hspace="4" height="50" border="2" align="left" width="50" />';
$item_0 = Display::div($result['picture_uri'], array('class'=>'box_description_group_image'));
$item_0 = Display::div($result['picture'], array('class'=>'box_description_group_image'));
$members = Display::span($count_users_group, array('class'=>'box_description_group_member'));
$item_1 = Display::div(Display::tag('h3', $url_open.$name.$url_close).$members, array('class'=>'box_description_group_title'));
@ -526,7 +527,7 @@ if ($group_id != 0 ) {
}
$show_message = null;
if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'show_message' && $_REQUEST['msg'] == 'topic_deleted') {
if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'show_message' && isset($_REQUEST['msg']) && $_REQUEST['msg'] == 'topic_deleted') {
$show_message = Display::return_message(get_lang('Deleted'), 'success');
}

@ -64,9 +64,12 @@ $social_right_content .= '<div class="well_border">';
$social_right_content .= '<h3>'.get_lang('ContactInformation').'</h3>';
$list = array(
array('title' => get_lang('Name'), 'content' => api_get_person_name($user_info['firstname'], $user_info['lastname'])),
array('title' => get_lang('Email'), 'content' => $user_info['email']),
);
array('title' => get_lang('Name'), 'content' => api_get_person_name($user_info['firstname'], $user_info['lastname'])),
array('title' => get_lang('Email'), 'content' => $user_info['email']),
);
$usergroup = new UserGroup();
// information current user
$social_right_content .= '<div>'.Display::description($list).'</div>';
$social_right_content .= '
@ -107,7 +110,7 @@ $social_right_content .= '
$social_right_content .= '<br />';
//Group box by age
$results = GroupPortalManager::get_groups_by_age(1,false);
$results = $usergroup->get_groups_by_age(1,false);
$groups_newest = array();
if (!empty($results)) {
@ -122,14 +125,14 @@ $social_right_content .= '
}
$group_url = "groups.php?id=$id";
$result['name'] = Display::url(api_ucwords(Text::cut($result['name'],40,true)), $group_url).Display::span('<br />'.$result['count'],array('class'=>'box_description_group_member'));
$picture = GroupPortalManager::get_picture_group($id, $result['picture_uri'],80);
$picture = $usergroup->get_picture_group($id, $result['picture'],80);
$result['picture_uri'] = '<img class="social-groups-image" src="'.$picture['file'].'" hspace="10" height="44" border="2" align="left" width="44" />';
$group_actions = '<div class="box_description_group_actions"><a href="groups.php?#tab_browse-2">'.get_lang('SeeMore').'</a></div>';
$groups_newest[]= array(Display::url($result['picture_uri'], $group_url), $result['name'], Text::cut($result['description'],120,true).$group_actions);
}
}
$results = GroupPortalManager::get_groups_by_popularity(1,false);
$results = $usergroup->get_groups_by_popularity(1,false);
$groups_pop = array();
foreach ($results as $result) {
@ -144,7 +147,7 @@ $social_right_content .= '
$result['count'] = $result['count'].' '.get_lang('Members');
}
$result['name'] = Display::url(api_ucwords(Text::cut($result['name'],40,true)), $group_url).Display::span('<br />'.$result['count'],array('class'=>'box_description_group_member'));
$picture = GroupPortalManager::get_picture_group($id, $result['picture_uri'],80);
$picture = $usergroup->get_picture_group($id, $result['picture'],80);
$result['picture_uri'] = '<img class="social-groups-image" src="'.$picture['file'].'" hspace="10" height="44" border="2" align="left" width="44" />';
$group_actions = '<div class="box_description_group_actions" ><a href="groups.php?#tab_browse-3">'.get_lang('SeeMore').'</a></div>';
$groups_pop[]= array(Display::url($result['picture_uri'], $group_url) , $result['name'], Text::cut($result['description'],120,true).$group_actions);

@ -16,7 +16,7 @@ api_block_anonymous_users();
if (api_get_setting('allow_social_tool') !='true') {
api_not_allowed();
}
$usergroup = new UserGroup();
$this_section = SECTION_SOCIAL;
$interbreadcrumb[]= array ('url' =>'profile.php','name' => get_lang('SocialNetwork'));
@ -73,9 +73,9 @@ if (is_array($_GET) && count($_GET)>0) {
foreach ($_GET as $key => $value) {
switch ($key) {
case 'accept':
$user_role = GroupPortalManager::get_user_group_role(api_get_user_id(), $value);
$user_role = $usergroup->get_user_group_role(api_get_user_id(), $value);
if (in_array($user_role , array(GROUP_USER_PERMISSION_PENDING_INVITATION_SENT_BY_USER,GROUP_USER_PERMISSION_PENDING_INVITATION))) {
GroupPortalManager::update_user_role(api_get_user_id(), $value, GROUP_USER_PERMISSION_READER);
$usergroup->update_user_role(api_get_user_id(), $value, GROUP_USER_PERMISSION_READER);
$show_message = Display::return_message(get_lang('UserIsSubscribedToThisGroup'), 'success');
} elseif (in_array($user_role , array(GROUP_USER_PERMISSION_READER, GROUP_USER_PERMISSION_ADMIN, GROUP_USER_PERMISSION_MODERATOR))) {
$show_message = Display::return_message(get_lang('UserIsAlreadySubscribedToThisGroup'), 'warning');
@ -85,7 +85,7 @@ if (is_array($_GET) && count($_GET)>0) {
break 2;
case 'deny':
// delete invitation
GroupPortalManager::delete_user_rel_group(api_get_user_id(), $value);
$usergroup->delete_user_rel_group(api_get_user_id(), $value);
$show_message = Display::return_message(get_lang('GroupInvitationWasDeny'));
break 2;
}
@ -97,7 +97,7 @@ $social_right_content = '<div id="id_response" align="center"></div>';
$user_id = api_get_user_id();
$list_get_invitation = SocialManager::get_list_invitation_of_friends_by_user_id($user_id);
$list_get_invitation_sent = SocialManager::get_list_invitation_sent_by_user_id($user_id);
$pending_invitations = GroupPortalManager::get_groups_by_user($user_id, GROUP_USER_PERMISSION_PENDING_INVITATION);
$pending_invitations = $usergroup->get_groups_by_user($user_id, GROUP_USER_PERMISSION_PENDING_INVITATION);
$number_loop = count($list_get_invitation);
$total_invitations = $number_loop + count($list_get_invitation_sent) + count($pending_invitations);
@ -177,10 +177,10 @@ if (count($pending_invitations) > 0) {
$social_right_content .= Display::page_subheader(get_lang('GroupsWaitingApproval'));
$new_invitation = array();
foreach ($pending_invitations as $invitation) {
$picture = GroupPortalManager::get_picture_group($invitation['id'], $invitation['picture_uri'],80);
$picture = $usergroup->get_picture_group($invitation['id'], $invitation['picture'],80);
$img = '<img class="social-groups-image" src="'.$picture['file'].'" hspace="4" height="50" border="2" align="left" width="50" />';
$invitation['picture_uri'] = '<a href="groups.php?id='.$invitation['id'].'">'.$img.'</a>';
$invitation['picture'] = '<a href="groups.php?id='.$invitation['id'].'">'.$img.'</a>';
$invitation['name'] = '<a href="groups.php?id='.$invitation['id'].'">'.Text::cut($invitation['name'],120,true).'</a>';
$invitation['join'] = '<a href="invitations.php?accept='.$invitation['id'].'">'.Display::return_icon('accept_invitation.png', get_lang('AcceptInvitation')).'&nbsp;&nbsp;'.get_lang('AcceptInvitation').'</a>';
$invitation['deny'] = '<a href="invitations.php?deny='.$invitation['id'].'">'.Display::return_icon('denied_invitation.png', get_lang('DenyInvitation')).'&nbsp;&nbsp;'.get_lang('DenyInvitation').'</a>';

@ -31,9 +31,8 @@ if (isset($_REQUEST['user_friend'])) {
$info_path_friend = UserManager::get_user_picture_path_by_id($userfriend_id,'web',false,true);
}
$group_id = intval($_GET['group_id']);
$message_id = intval($_GET['message_id']);
$group_id = isset($_GET['group_id']) ? intval($_GET['group_id']) : null;
$message_id = isset($_GET['message_id']) ? intval($_GET['message_id']) : null;
$actions = array('add_message_group', 'edit_message_group', 'reply_message_group');
$allowed_action = (isset($_GET['action']) && in_array($_GET['action'],$actions))?Security::remove_XSS($_GET['action']):'';
@ -41,9 +40,10 @@ $allowed_action = (isset($_GET['action']) && in_array($_GET['action'],$actions))
$to_group = '';
$subject = '';
$message = '';
$usergroup = new UserGroup();
if (!empty($group_id) && $allowed_action) {
$group_info = GroupPortalManager::get_group_data($group_id);
$is_member = GroupPortalManager::is_group_member($group_id);
$group_info = $usergroup->get($group_id);
$is_member = $usergroup->is_group_member($group_id);
if ($group_info['visibility'] == GROUP_PERMISSION_CLOSED && !$is_member) {
api_not_allowed(true);
@ -62,13 +62,17 @@ if (!empty($group_id) && $allowed_action) {
}
}
$page_item = !empty($_GET['topics_page_nr'])?intval($_GET['topics_page_nr']):1;
$param_item_page = isset($_GET['items_page_nr']) && isset($_GET['topic_id'])?('&items_'.intval($_GET['topic_id']).'_page_nr='.(!empty($_GET['topics_page_nr'])?intval($_GET['topics_page_nr']):1)):'';
$param_item_page .= '&topic_id='.intval($_GET['topic_id']);
$page_topic = !empty($_GET['topics_page_nr'])?intval($_GET['topics_page_nr']):1;
$page_item = !empty($_GET['topics_page_nr']) ? intval($_GET['topics_page_nr']):1;
$param_item_page = isset($_GET['items_page_nr']) && isset($_GET['topic_id']) ? ('&items_'.intval($_GET['topic_id']).'_page_nr='.(!empty($_GET['topics_page_nr'])?intval($_GET['topics_page_nr']):1)):'';
if (isset($_GET['topic_id'])) {
$param_item_page .= '&topic_id='.intval($_GET['topic_id']);
}
$page_topic = isset($_GET['topics_page_nr']) ? intval($_GET['topics_page_nr']):1;
$anchor_topic = isset($_GET['anchor_topic']) ? Security::remove_XSS($_GET['anchor_topic']): null;
?>
<form name="form" action="group_topics.php?id=<?php echo $group_id ?>&anchor_topic=<?php echo Security::remove_XSS($_GET['anchor_topic']) ?>&topics_page_nr=<?php echo $page_topic.$param_item_page ?>" method="POST" enctype="multipart/form-data">
<form name="form" action="group_topics.php?id=<?php echo $group_id ?>&anchor_topic=<?php echo $anchor_topic ?>&topics_page_nr=<?php echo $page_topic.$param_item_page ?>" method="POST" enctype="multipart/form-data">
<input type="hidden" name="action" value="<?php echo $allowed_action ?>" />
<input type="hidden" name="group_id" value="<?php echo $group_id ?>" />
<input type="hidden" name="parent_id" value="<?php echo $message_id ?>" />

@ -67,15 +67,16 @@ function register_friend(element_input) {
</script>';
$show_message = null;
$usergroup = new UserGroup();
// easy links
if (is_array($_GET) && count($_GET)>0) {
foreach($_GET as $key => $value) {
switch ($key) {
case 'accept':
$user_role = GroupPortalManager::get_user_group_role(api_get_user_id(), $value);
$user_role = $usergroup->get_user_group_role(api_get_user_id(), $value);
if (in_array($user_role , array(GROUP_USER_PERMISSION_PENDING_INVITATION_SENT_BY_USER,GROUP_USER_PERMISSION_PENDING_INVITATION))) {
GroupPortalManager::update_user_role(api_get_user_id(), $value, GROUP_USER_PERMISSION_READER);
$usergroup->update_user_role(api_get_user_id(), $value, GROUP_USER_PERMISSION_READER);
$show_message = get_lang('UserIsSubscribedToThisGroup');
} elseif (in_array($user_role , array(GROUP_USER_PERMISSION_READER, GROUP_USER_PERMISSION_ADMIN, GROUP_USER_PERMISSION_MODERATOR))) {
$show_message = get_lang('UserIsAlreadySubscribedToThisGroup');
@ -85,7 +86,7 @@ if (is_array($_GET) && count($_GET)>0) {
break 2;
case 'deny':
// delete invitation
GroupPortalManager::delete_user_rel_group(api_get_user_id(), $value);
$usergroup->delete_user_rel_group(api_get_user_id(), $value);
$show_message = get_lang('GroupInvitationWasDeny');
break 2;
}

@ -468,14 +468,18 @@ if ($show_full_profile) {
$social_right_content .= SocialManager::social_wrapper_div($extra_information, 9);
}
$usergroup = new UserGroup();
// MY GROUPS
$results = GroupPortalManager::get_groups_by_user($my_user_id, 0);
$results = $usergroup->get_groups_by_user($my_user_id, 0);
$grid_my_groups = array();
$max_numbers_of_group = 4;
if (is_array($results) && count($results) > 0) {
$i = 1;
foreach ($results as $result) {
if ($i > $max_numbers_of_group) break;
if ($i > $max_numbers_of_group) {
break;
}
$id = $result['id'];
$url_open = '<a href="groups.php?id='.$id.'">';
$url_close = '</a>';
@ -486,13 +490,13 @@ if ($show_full_profile) {
} elseif ($result['relation_type'] == GROUP_USER_PERMISSION_MODERATOR) {
$icon = Display::return_icon('social_group_moderator.png', get_lang('Moderator'), array('style'=>'vertical-align:middle;width:16px;height:16px;'));
}
$count_users_group = count(GroupPortalManager::get_all_users_by_group($id));
$count_users_group = count($usergroup->get_all_users_by_group($id));
if ($count_users_group == 1 ) {
$count_users_group = $count_users_group.' '.get_lang('Member');
} else {
$count_users_group = $count_users_group.' '.get_lang('Members');
}
//$picture = GroupPortalManager::get_picture_group($result['id'], $result['picture_uri'],80);
$item_name = $url_open.$name.$icon.$url_close;
if ($result['description'] != '') {
@ -505,7 +509,7 @@ if ($show_full_profile) {
if (api_get_user_id() == $user_id) {
//$item_actions = '<div class="box_shared_profile_group_actions"><a href="groups.php?id='.$id.'">'.get_lang('SeeMore').$url_close.'</div>';
}
$grid_my_groups[]= array($item_name,$url_open.$result['picture_uri'].$url_close, $item_actions);
$grid_my_groups[]= array($item_name,$url_open.$result['picture'].$url_close, $item_actions);
$i++;
}
}

@ -59,9 +59,10 @@ if (isset($_GET['view']) && in_array($_GET['view'], $views)) {
echo $friend_html;
echo '</div>';
} else {
$usergroup = new UserGroup();
// show all groups by user_id
// MY GROUPS
$results = GroupPortalManager::get_groups_by_user($user_id, 0);
$results = $usergroup->get_groups_by_user($user_id, 0);
$grid_my_groups = array();
if (is_array($results) && count($results) > 0) {
$i = 1;
@ -76,13 +77,13 @@ if (isset($_GET['view']) && in_array($_GET['view'], $views)) {
} elseif ($result['relation_type'] == GROUP_USER_PERMISSION_MODERATOR) {
$icon = Display::return_icon('social_group_moderator.png', get_lang('Moderator'), array('style'=>'vertical-align:middle;width:16px;height:16px;'));
}
$count_users_group = count(GroupPortalManager::get_all_users_by_group($id));
$count_users_group = count($usergroup->get_all_users_by_group($id));
if ($count_users_group == 1 ) {
$count_users_group = $count_users_group.' '.get_lang('Member');
} else {
$count_users_group = $count_users_group.' '.get_lang('Members');
}
$picture = GroupPortalManager::get_picture_group($result['id'], $result['picture_uri'],80);
$picture = $usergroup->get_picture_group($result['id'], $result['picture'],80);
$item_name = '<div class="box_shared_profile_group_title">'.$url_open.api_xml_http_response_encode($name). $icon.$url_close.'</div>';
$item_description = '';
if (!empty($result['description'])) {

@ -29,11 +29,12 @@ $social_left_content = SocialManager::show_social_menu('search');
$social_right_content = '<div class="span9">'.UserManager::get_search_form($query).'</div>';
$usergroup = new UserGroup();
//I'm searching something
if ($query !='') {
//get users from tags
$users = UserManager::get_all_user_tags($_GET['q'], 0, 0, 5);
$groups = GroupPortalManager::get_all_group_tags($_GET['q']);
$groups = $usergroup->get_all_group_tags($_GET['q']);
if (empty($users) && empty($groups)) {
$social_right_content .= get_lang('SorryNoResults');
@ -44,7 +45,7 @@ if ($query !='') {
if (is_array($users) && count($users)> 0) {
$results .= Display::page_subheader(get_lang('Users'));
$results .= '<ul class="thumbnails">';
foreach($users as $user) {
foreach ($users as $user) {
$user_info = api_get_user_info($user['user_id'], true);
$url = api_get_path(WEB_PATH).'main/social/profile.php?u='.$user['user_id'];
@ -79,18 +80,17 @@ if ($query !='') {
$url_open = '<a href="groups.php?id='.$id.'" >';
$url_close = '</a>';
$name = Text::cut($group['name'],25,true);
$count_users_group = count(GroupPortalManager::get_all_users_by_group($id));
$count_users_group = count($usergroup->get_all_users_by_group($id));
if ($count_users_group == 1 ) {
$count_users_group = $count_users_group.' '.get_lang('Member');
} else {
$count_users_group = $count_users_group.' '.get_lang('Members');
}
$picture = GroupPortalManager::get_picture_group($group['id'], $group['picture_uri'],80);
$tags = GroupPortalManager::get_group_tags($group['id']);
$group['picture_uri'] = '<img class="social-groups-image" src="'.$picture['file'].'" hspace="4" height="50" border="2" align="left" width="50" />';
$picture = $usergroup->get_picture_group($group['id'], $group['picture'],80);
$tags = $usergroup->get_group_tags($group['id']);
$group['picture'] = '<img class="social-groups-image" src="'.$picture['file'].'" hspace="4" height="50" border="2" align="left" width="50" />';
$item_0 = Display::div($group['picture_uri'], array('class'=>'box_description_group_image'));
$item_0 = Display::div($group['picture'], array('class'=>'box_description_group_image'));
$members = Display::span($count_users_group, array('class'=>'box_description_group_member'));
$item_1 = Display::div(Display::tag('h3', $url_open.$name.$url_close).$members, array('class'=>'box_description_group_title'));

Loading…
Cancel
Save