Minor - format code.

1.10.x
Julio Montoya 10 years ago
parent a78f194b89
commit 1196819ce1
  1. 38
      main/admin/group_add.php
  2. 54
      main/admin/group_edit.php
  3. 14
      main/glossary/glossary_ajax_request.php
  4. 46
      main/social/group_add.php
  5. 18
      main/social/group_edit.php
  6. 2
      main/template/default/social/add_groups.tpl

@ -1,5 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
/**
* @package chamilo.admin
*/
@ -16,6 +17,8 @@ $this_section = SECTION_PLATFORM_ADMIN;
// User permissions
api_protect_admin_script();
$group_id = 0;
$htmlHeadXtra[] = '<script>
textarea = "";
num_characters_permited = 255;
@ -96,27 +99,38 @@ $form->setDefaults($defaults);
$form->addButtonCreate(get_lang('Add'));
// Validate form
if( $form->validate()) {
if ($form->validate()) {
$check = Security::check_token('post');
if ($check) {
$values = $form->exportValues();
$picture_element = $form->getElement('picture');
$picture = $picture_element->getValue();
$picture_uri = '';
$name = $values['name'];
$description = $values['description'];
$url = $values['url'];
$status = intval($values['visibility']);
$picture = $_FILES['picture'];
$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'];
$parent_group_id = intval($values['parent_group']);
$group_id = GroupPortalManager::add($name, $description, $url, $status);
GroupPortalManager::set_parent_group($group_id,$parent_group_id);
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);
$picture_uri = GroupPortalManager::update_group_picture(
$group_id,
$_FILES['picture']['name'],
$_FILES['picture']['tmp_name']
);
GroupPortalManager::update(
$group_id,
$name,
$description,
$url,
$status,
$picture_uri
);
}
//@todo send emails
@ -157,7 +171,7 @@ if( $form->validate()) {
// Display form
Display::display_header($tool_name);
//api_display_tool_title($tool_name);
if (!empty($message)) {
Display::display_normal_message(stripslashes($message));
}

@ -1,5 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
/**
* @package chamilo.admin
*/
@ -52,12 +53,22 @@ $form->applyFilter('name', 'trim');
$form->addRule('name', get_lang('ThisFieldIsRequired'), 'required');
// Description
$form->addElement('textarea', 'description', get_lang('Description'), array('rows'=>3, 'cols'=>58, 'onKeyDown' => "text_longitud()", 'onKeyUp' => "text_longitud()"));
$form->addElement(
'textarea',
'description',
get_lang('Description'),
array(
'rows' => 3,
'cols' => 58,
'onKeyDown' => "text_longitud()",
'onKeyUp' => "text_longitud()",
)
);
$form->applyFilter('description', 'html_filter');
$form->applyFilter('description', 'trim');
// url
$form->addElement('text', 'url', get_lang('URL'), array('size'=>35));
$form->addElement('text', 'url', get_lang('URL'), array('size' => 35));
$form->applyFilter('url', 'html_filter');
$form->applyFilter('url', 'trim');
// Picture
@ -68,7 +79,7 @@ if (strlen($group_data['picture_uri']) > 0) {
$form->addElement('checkbox', 'delete_picture', '', get_lang('DelImage'));
}
//Group Parentship
// Group parent
$groups = array();
$groups = GroupPortalManager::get_groups_list($group_id);
$groups[0] = get_lang('NoParentship');
@ -78,8 +89,8 @@ $form->addElement('select', 'parent_group', get_lang('GroupParentship'), $groups
// Status
$status = array();
$status[GROUP_PERMISSION_OPEN] = get_lang('Open');
$status[GROUP_PERMISSION_CLOSED] = get_lang('Closed');
$status[GROUP_PERMISSION_OPEN] = get_lang('Open');
$status[GROUP_PERMISSION_CLOSED] = get_lang('Closed');
$form->addElement('select', 'visibility', get_lang('GroupPermissions'), $status, array());
// Submit button
@ -100,17 +111,28 @@ if ( $form->validate()) {
$picture_uri = GroupPortalManager::delete_group_picture($group_id);
}
elseif (!empty($picture['name'])) {
$picture_uri = GroupPortalManager::update_group_picture($group_id, $_FILES['picture']['name'], $_FILES['picture']['tmp_name']);
$picture_uri = GroupPortalManager::update_group_picture(
$group_id,
$_FILES['picture']['name'],
$_FILES['picture']['tmp_name']
);
}
$name = $group['name'];
$description = $group['description'];
$url = $group['url'];
$status = intval($group['visibility']);
$parent_group_id = intval($group['parent_group']);
GroupPortalManager::update($group_id, $name, $description, $url, $status, $picture_uri);
GroupPortalManager::set_parent_group($group_id,$parent_group_id);
$name = $group['name'];
$description = $group['description'];
$url = $group['url'];
$status = intval($group['visibility']);
$parent_group_id = intval($group['parent_group']);
GroupPortalManager::update(
$group_id,
$name,
$description,
$url,
$status,
$picture_uri
);
GroupPortalManager::set_parent_group($group_id, $parent_group_id);
$tok = Security::get_token();
header('Location: group_list.php?action=show_message&message='.urlencode(get_lang('GroupUpdated')).'&sec_token='.$tok);
@ -127,10 +149,10 @@ $image_file = ($image != '' ? $image_dir.$image : api_get_path(WEB_CODE_PATH).'i
$image_size = api_getimagesize($image_file);
$img_attributes = 'src="'.$image_file.'?rand='.time().'" '
.'alt="'.api_get_person_name($user_data['firstname'], $user_data['lastname']).'" '
.'style="float:'.($text_dir == 'rtl' ? 'left' : 'right').'; padding:5px;" ';
if ($image_size['width'] > 300) { //limit display width to 300px
if ($image_size['width'] > 300) {
// limit display width to 300px
$img_attributes .= 'width="300" ';
}

@ -15,15 +15,21 @@ require_once '../inc/global.inc.php';
$charset = api_get_system_encoding();
//replace image path
$path_image=api_get_path(WEB_COURSE_PATH).api_get_course_path();
$path_image_search='../../courses/'.api_get_course_path();
$path_image = api_get_path(WEB_COURSE_PATH).api_get_course_path();
$path_image_search = '../../courses/'.api_get_course_path();
if (isset($_POST['glossary_id']) &&
$_POST['glossary_id'] == strval(intval($_POST['glossary_id']))
) {
$glossary_id= Security::remove_XSS($_POST['glossary_id']);
$glossary_description_by_id = GlossaryManager::get_glossary_term_by_glossary_id($glossary_id);
$glossary_description_by_id = str_replace($path_image_search,$path_image,$glossary_description_by_id);
$glossary_description_by_id = GlossaryManager::get_glossary_term_by_glossary_id(
$glossary_id
);
$glossary_description_by_id = str_replace(
$path_image_search,
$path_image,
$glossary_description_by_id
);
echo api_xml_http_response_encode($glossary_description_by_id);
} elseif (isset($_POST['glossary_data']) && $_POST['glossary_data']=='true') {
//get_glossary_terms

@ -42,20 +42,35 @@ if ($form->validate()) {
$values = $form->exportValues();
$picture_element = $form->getElement('picture');
$picture = $picture_element->getValue();
$picture_uri = '';
$name = $values['name'];
$description = $values['description'];
$url = $values['url'];
$status = intval($values['visibility']);
$picture = $_FILES['picture'];
$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);
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);
$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')));
exit();
@ -64,21 +79,20 @@ if ($form->validate()) {
$nameTools = get_lang('AddGroup');
$this_section = SECTION_SOCIAL;
$interbreadcrumb[]= array ('url' =>'home.php','name' => get_lang('Social'));
$interbreadcrumb[]= array ('url' =>'groups.php','name' => get_lang('Groups'));
$interbreadcrumb[]= array ('url' =>'#','name' => $nameTools);
$interbreadcrumb[] = array('url' => 'home.php', 'name' => get_lang('Social'));
$interbreadcrumb[] = array('url' => 'groups.php', 'name' => get_lang('Groups'));
$interbreadcrumb[] = array('url' => '#', 'name' => $nameTools);
$social_avatar_block = SocialManager::show_social_avatar_block('group_add');
$social_menu_block = SocialManager::show_social_menu('group_add');
$social_right_content = $form->return_form();
$social_right_content = $form->returnForm();
$tpl = new Template();
$tpl->set_help('Groups');
$tpl->assign('social_avatar_block', $social_avatar_block);
$tpl->assign('social_menu_block', $social_menu_block);
$tpl->assign('social_right_content', $social_right_content);
//$tpl->assign('actions', $actions);
//$tpl->assign('message', $show_message);
$social_layout = $tpl->get_template('social/add_groups.tpl');
$tpl->display($social_layout);

@ -64,13 +64,17 @@ if ($form->validate()) {
if ($group['delete_picture']) {
$picture_uri = GroupPortalManager::delete_group_picture($group_id);
} elseif (!empty($picture['name'])) {
$picture_uri = GroupPortalManager::update_group_picture($group_id, $_FILES['picture']['name'], $_FILES['picture']['tmp_name']);
$picture_uri = GroupPortalManager::update_group_picture(
$group_id,
$_FILES['picture']['name'],
$_FILES['picture']['tmp_name']
);
}
$name = $group['name'];
$description = $group['description'];
$url = $group['url'];
$status = intval($group['visibility']);
$name = $group['name'];
$description = $group['description'];
$url = $group['url'];
$status = intval($group['visibility']);
$allowMemberGroupToLeave = null;
if (GroupPortalManager::canLeaveFeatureEnabled($group_data)) {
@ -98,12 +102,12 @@ $url_big_image = $big_image.'?rnd='.time();
$social_avatar_block = SocialManager::show_social_avatar_block('group_edit', $group_id);
$social_menu_block = SocialManager::show_social_menu('group_edit', $group_id);
$social_right_content = $form->return_form();
$social_right_content = $form->returnForm();
$tpl = new Template($tool_name);
$tpl->set_help('Groups');
$tpl->assign('social_avatar_block', $social_avatar_block);
$tpl->assign('social_menu_block', $social_menu_block);
$tpl->assign('social_right_content', $social_right_content);
$social_layout = $tpl->get_template('social/home.tpl');
$social_layout = $tpl->get_template('social/groups.tpl');
$tpl->display($social_layout);

@ -8,7 +8,7 @@
{{ social_menu_block }}
</div>
</div>
<div id="wallMessages" class="col-md-5" style="min-height:1px">
<div id="wallMessages" class="col-md-9" style="min-height:1px">
<div class="row">
<div class="col-md-12">
<div id="message_ajax_reponse" class=""></div>

Loading…
Cancel
Save