Minor - format code.

1.9.x
Julio Montoya 12 years ago
parent 40b2d239db
commit 49fa5ac510
  1. 13
      main/social/group_add.php
  2. 15
      main/social/group_edit.php
  3. 27
      main/social/group_invitation.php
  4. 1
      main/social/group_members.php
  5. 5
      main/social/group_topics.php

@ -4,9 +4,6 @@
* @package chamilo.social * @package chamilo.social
* @author Julio Montoya <gugli100@gmail.com> * @author Julio Montoya <gugli100@gmail.com>
*/ */
/**
* Initialization
*/
$language_file= 'userInfo'; $language_file= 'userInfo';
$cidReset=true; $cidReset=true;
require_once '../inc/global.inc.php'; require_once '../inc/global.inc.php';
@ -23,16 +20,14 @@ if (api_get_setting('allow_students_to_create_groups_in_social') == 'false' && !
} }
global $charset; global $charset;
//jquery already called from main/inc/header.inc.php $htmlHeadXtra[] = '<script>
$htmlHeadXtra[] = '<script type="text/javascript">
textarea = ""; textarea = "";
num_characters_permited = 255; num_characters_permited = 255;
function text_longitud(){ function text_longitud(){
num_characters = document.forms[0].description.value.length; num_characters = document.forms[0].description.value.length;
if (num_characters > num_characters_permited){ if (num_characters > num_characters_permited){
document.forms[0].description.value = textarea; document.forms[0].description.value = textarea;
}else{ } else {
textarea = document.forms[0].description.value; textarea = document.forms[0].description.value;
} }
} }
@ -69,7 +64,7 @@ $status[GROUP_PERMISSION_OPEN] = get_lang('Open');
$status[GROUP_PERMISSION_CLOSED] = get_lang('Closed'); $status[GROUP_PERMISSION_CLOSED] = get_lang('Closed');
$form->addElement('select', 'visibility', get_lang('GroupPermissions'), $status); $form->addElement('select', 'visibility', get_lang('GroupPermissions'), $status);
$form->addElement('style_submit_button','add_group', get_lang('AddGroup'),'class="save"'); $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>')); $form->setRequiredNote(api_xml_http_response_encode('<span class="form_required">*</span> <small>'.get_lang('ThisFieldIsRequired').'</small>'));
@ -90,7 +85,7 @@ if ($form->validate()) {
if (!empty($picture['name'])) { if (!empty($picture['name'])) {
$picture_uri = GroupPortalManager::update_group_picture($group_id, $_FILES['picture']['name'], $_FILES['picture']['tmp_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); 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'))); header('Location: groups.php?id='.$group_id.'&action=show_message&message='.urlencode(get_lang('GroupAdded')));
exit(); exit();

@ -4,9 +4,6 @@
* @package chamilo.social * @package chamilo.social
* @author Julio Montoya <gugli100@gmail.com> * @author Julio Montoya <gugli100@gmail.com>
*/ */
/**
* Initialization
*/
// Language files that should be included // Language files that should be included
$language_file = array('userInfo'); $language_file = array('userInfo');
$cidReset = true; $cidReset = true;
@ -95,7 +92,6 @@ $status[GROUP_PERMISSION_OPEN] = get_lang('Open');
$status[GROUP_PERMISSION_CLOSED] = get_lang('Closed'); $status[GROUP_PERMISSION_CLOSED] = get_lang('Closed');
$form->addElement('select', 'visibility', get_lang('GroupPermissions'), $status, array()); $form->addElement('select', 'visibility', get_lang('GroupPermissions'), $status, array());
// Submit button // Submit button
$form->addElement('style_submit_button', 'submit', get_lang('ModifyInformation'), 'class="save"'); $form->addElement('style_submit_button', 'submit', get_lang('ModifyInformation'), 'class="save"');
@ -103,7 +99,7 @@ $form->addElement('style_submit_button', 'submit', get_lang('ModifyInformation')
$form->setDefaults($group_data); $form->setDefaults($group_data);
// Validate form // Validate form
if ( $form->validate()) { if ($form->validate()) {
$group = $form->exportValues(); $group = $form->exportValues();
$picture_element = $form->getElement('picture'); $picture_element = $form->getElement('picture');
$picture = $picture_element->getValue(); $picture = $picture_element->getValue();
@ -111,8 +107,7 @@ if ( $form->validate()) {
if ($group['delete_picture']) { if ($group['delete_picture']) {
$picture_uri = GroupPortalManager::delete_group_picture($group_id); $picture_uri = GroupPortalManager::delete_group_picture($group_id);
} } elseif (!empty($picture['name'])) {
elseif (!empty($picture['name'])) {
$picture_uri = GroupPortalManager::update_group_picture($group_id, $_FILES['picture']['name'], $_FILES['picture']['tmp_name']); $picture_uri = GroupPortalManager::update_group_picture($group_id, $_FILES['picture']['name'], $_FILES['picture']['tmp_name']);
} }
@ -128,7 +123,7 @@ if ( $form->validate()) {
} }
// Group picture // Group picture
$image_path = GroupPortalManager::get_group_picture_path_by_id($group_id,'web'); $image_path = GroupPortalManager::get_group_picture_path_by_id($group_id, 'web');
$image_dir = $image_path['dir']; $image_dir = $image_path['dir'];
$image = $image_path['file']; $image = $image_path['file'];
$image_file = ($image != '' ? $image_dir.$image : api_get_path(WEB_CODE_PATH).'img/unknown_group.jpg'); $image_file = ($image != '' ? $image_dir.$image : api_get_path(WEB_CODE_PATH).'img/unknown_group.jpg');
@ -141,10 +136,9 @@ $big_image_width = $big_image_size['width'];
$big_image_height = $big_image_size['height']; $big_image_height = $big_image_size['height'];
$url_big_image = $big_image.'?rnd='.time(); $url_big_image = $big_image.'?rnd='.time();
$social_left_content = SocialManager::show_social_menu('group_edit',$group_id); $social_left_content = SocialManager::show_social_menu('group_edit', $group_id);
$social_right_content = $form->return_form(); $social_right_content = $form->return_form();
$tpl = new Template($tool_name); $tpl = new Template($tool_name);
$tpl->set_help('Groups'); $tpl->set_help('Groups');
$tpl->assign('social_left_content', $social_left_content); $tpl->assign('social_left_content', $social_left_content);
@ -155,4 +149,3 @@ $tpl->assign('message', $show_message);
$tpl->assign('content', $content); $tpl->assign('content', $content);
$social_layout = $tpl->get_template('layout/social_layout.tpl'); $social_layout = $tpl->get_template('layout/social_layout.tpl');
$tpl->display($social_layout); $tpl->display($social_layout);

@ -42,7 +42,7 @@ $tool_name = get_lang('SubscribeUsersToGroup');
$group_id = intval($_REQUEST['id']); $group_id = intval($_REQUEST['id']);
$add_type = 'multiple'; $add_type = 'multiple';
if(isset($_REQUEST['add_type']) && $_REQUEST['add_type']!=''){ if (isset($_REQUEST['add_type']) && $_REQUEST['add_type']!=''){
$add_type = Security::remove_XSS($_REQUEST['add_type']); $add_type = Security::remove_XSS($_REQUEST['add_type']);
} }
@ -108,11 +108,10 @@ function search_users($needle,$type) {
$order_clause; $order_clause;
} }
global $_configuration; if (api_is_multiple_url_enabled()) {
if ($_configuration['multiple_access_urls']) { $tbl_user_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
$tbl_user_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
$access_url_id = api_get_current_access_url_id(); $access_url_id = api_get_current_access_url_id();
if ($access_url_id != -1){ if ($access_url_id != -1) {
if ($type == 'single') { if ($type == 'single') {
$sql = 'SELECT user.user_id, username, lastname, firstname FROM '.$tbl_user.' user $sql = 'SELECT user.user_id, username, lastname, firstname FROM '.$tbl_user.' user
INNER JOIN '.$tbl_user_rel_access_url.' url_user ON (url_user.user_id=user.user_id) INNER JOIN '.$tbl_user_rel_access_url.' url_user ON (url_user.user_id=user.user_id)
@ -128,12 +127,11 @@ function search_users($needle,$type) {
AND '.(api_sort_by_first_name() ? 'firstname' : 'lastname').' LIKE "'.$needle.'%" AND user.user_id<>"'.$user_anonymous.'"'.$cond_user_id. AND '.(api_sort_by_first_name() ? 'firstname' : 'lastname').' LIKE "'.$needle.'%" AND user.user_id<>"'.$user_anonymous.'"'.$cond_user_id.
$order_clause; $order_clause;
} }
} }
} }
$rs = Database::query($sql); $rs = Database::query($sql);
$i=0; $i = 0;
if ($type=='single') { if ($type=='single') {
while ($user = Database :: fetch_array($rs)) { while ($user = Database :: fetch_array($rs)) {
$i++; $i++;
@ -160,11 +158,10 @@ function search_users($needle,$type) {
return $xajax_response; return $xajax_response;
} }
$xajax -> processRequests(); $xajax->processRequests();
$htmlHeadXtra[] = $xajax->getJavascript('../inc/lib/xajax/'); $htmlHeadXtra[] = $xajax->getJavascript('../inc/lib/xajax/');
$htmlHeadXtra[] = ' $htmlHeadXtra[] = '<script>
<script type="text/javascript">
function add_user (code, content) { function add_user (code, content) {
// document.getElementById("user_to_add").value = ""; // document.getElementById("user_to_add").value = "";
//document.getElementById("ajax_list_users_single").innerHTML = ""; //document.getElementById("ajax_list_users_single").innerHTML = "";
@ -227,12 +224,10 @@ if ($_POST['form_sent']) {
} }
} }
} }
} }
$nosessionUsersList = $sessionUsersList = array(); $nosessionUsersList = $sessionUsersList = array();
$ajax_search = $add_type == 'unique' ? true : false; $ajax_search = $add_type == 'unique' ? true : false;
global $_configuration;
$order_clause = api_sort_by_first_name() ? ' ORDER BY firstname, lastname, username' : ' ORDER BY lastname, firstname, username'; $order_clause = api_sort_by_first_name() ? ' ORDER BY firstname, lastname, username' : ' ORDER BY lastname, firstname, username';
if ($ajax_search) { if ($ajax_search) {
@ -242,7 +237,7 @@ if ($ajax_search) {
ON (gu.user_id = u.user_id) WHERE gu.group_id = $group_id ". ON (gu.user_id = u.user_id) WHERE gu.group_id = $group_id ".
$order_clause; $order_clause;
if ($_configuration['multiple_access_urls']) { if (api_is_multiple_url_enabled()) {
$tbl_user_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); $tbl_user_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
$access_url_id = api_get_current_access_url_id(); $access_url_id = api_get_current_access_url_id();
if ($access_url_id != -1){ if ($access_url_id != -1){
@ -263,7 +258,6 @@ if ($ajax_search) {
} }
} else { } else {
$friends = SocialManager::get_friends(api_get_user_id()); $friends = SocialManager::get_friends(api_get_user_id());
$suggest_friends = false; $suggest_friends = false;
if (!$friends) { if (!$friends) {
@ -284,8 +278,9 @@ if ($ajax_search) {
} }
if (is_array($Users) && count($Users) > 0 ) { if (is_array($Users) && count($Users) > 0 ) {
foreach ($Users as $user) { foreach ($Users as $user) {
if($user['group_id'] != $group_id) if ($user['group_id'] != $group_id) {
$nosessionUsersList[$user['user_id']] = $user ; $nosessionUsersList[$user['user_id']] = $user;
}
} }
} }

@ -134,4 +134,3 @@ $tpl->assign('message', $show_message);
$tpl->assign('content', $content); $tpl->assign('content', $content);
$social_layout = $tpl->get_template('layout/social_layout.tpl'); $social_layout = $tpl->get_template('layout/social_layout.tpl');
$tpl->display($social_layout); $tpl->display($social_layout);

@ -23,15 +23,13 @@ $message_id = intval($_GET['msg_id']);
//todo @this validation could be in a function in group_portal_manager //todo @this validation could be in a function in group_portal_manager
if (empty($group_id)) { if (empty($group_id)) {
api_not_allowed(true); api_not_allowed(true);
} else { } else {
$group_info = GroupPortalManager::get_group_data($group_id); $group_info = GroupPortalManager::get_group_data($group_id);
if (empty($group_info)) { if (empty($group_info)) {
api_not_allowed(true); api_not_allowed(true);
} }
$is_member = GroupPortalManager::is_group_member($group_id); $is_member = GroupPortalManager::is_group_member($group_id);
if ($group_info['visibility'] == GROUP_PERMISSION_CLOSED && !$is_member ) { if ($group_info['visibility'] == GROUP_PERMISSION_CLOSED && !$is_member) {
api_not_allowed(true); api_not_allowed(true);
} }
} }
@ -167,7 +165,6 @@ $(document).ready(function() {
}); });
}); });
</script>'; </script>';
$this_section = SECTION_SOCIAL; $this_section = SECTION_SOCIAL;

Loading…
Cancel
Save