Minor - cleaning whitespaces.

1.9.x
Julio Montoya 11 years ago
parent e9e9d537b3
commit cf571a73ea
  1. 11
      main/group/group.php
  2. 2
      main/group/group_category.php
  3. 184
      main/group/group_creation.php
  4. 3
      main/group/group_edit.php
  5. 68
      main/group/group_space.php
  6. 1
      main/group/import.php

@ -164,7 +164,7 @@ if (api_is_allowed_to_edit(false, true)) {
Display::return_icon('new_group.png', get_lang('NewGroupCreate'),'',ICON_SIZE_MEDIUM).'</a>';
if (CourseManager::count_rows_course_table(Database::get_course_table(TABLE_GROUP), api_get_session_id(), api_get_course_int_id()) > 0) {
echo '<a href="group_overview.php?'.api_get_cidreq().'">'.
Display::return_icon('group_summary.png', get_lang('GroupOverview'),'',ICON_SIZE_MEDIUM).'</a>';
Display::return_icon('group_summary.png', get_lang('GroupOverview'), '', ICON_SIZE_MEDIUM).'</a>';
}
if (api_get_setting('allow_group_categories') == 'true') {
echo '<a href="group_category.php?'.api_get_cidreq().'&action=add_category">'.
@ -202,12 +202,15 @@ if (api_get_setting('allow_group_categories') == 'true') {
if (api_is_allowed_to_edit(false, true)) {
$actions .= '<a href="group_category.php?'.api_get_cidreq().'&id='.$category['id'].'" title="'.get_lang('Edit').'">'.
Display::return_icon('edit.png', get_lang('EditGroup'),'',ICON_SIZE_SMALL).'</a>';
$actions .= '<a href="group.php?'.api_get_cidreq().'&action=delete_category&amp;id='.$category['id'].'" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES))."'".')) return false;" title="'.get_lang('Delete').'">'.Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>';
$actions .= '<a href="group.php?'.api_get_cidreq().'&action=delete_category&amp;id='.$category['id'].'" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES))."'".')) return false;" title="'.get_lang('Delete').'">'.
Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>';
if ($index != 0) {
$actions .= ' <a href="group.php?'.api_get_cidreq().'&action=swap_cat_order&amp;id1='.$category['id'].'&amp;id2='.$group_cats[$index -1]['id'].'">'.Display::return_icon('up.png','&nbsp;','',ICON_SIZE_SMALL).'</a>';
$actions .= ' <a href="group.php?'.api_get_cidreq().'&action=swap_cat_order&amp;id1='.$category['id'].'&amp;id2='.$group_cats[$index -1]['id'].'">'.
Display::return_icon('up.png','&nbsp;','',ICON_SIZE_SMALL).'</a>';
}
if ($index != count($group_cats) - 1) {
$actions .= ' <a href="group.php?'.api_get_cidreq().'&action=swap_cat_order&amp;id1='.$category['id'].'&amp;id2='.$group_cats[$index +1]['id'].'">'.Display::return_icon('down.png','&nbsp;','',ICON_SIZE_SMALL).'</a>';
$actions .= ' <a href="group.php?'.api_get_cidreq().'&action=swap_cat_order&amp;id1='.$category['id'].'&amp;id2='.$group_cats[$index +1]['id'].'">'.
Display::return_icon('down.png','&nbsp;','',ICON_SIZE_SMALL).'</a>';
}
}

@ -193,7 +193,7 @@ $form->addElement('style_submit_button', 'submit', get_lang('PropModify'), 'clas
// If form validates -> save data
if ($form->validate()) {
$values = $form->exportValues();
if ($values['max_member_no_limit'] == GroupManager::MEMBER_PER_GROUP_NO_LIMIT) {
if ($values['max_member_no_limit'] == GroupManager::MEMBER_PER_GROUP_NO_LIMIT) {
$max_member = GroupManager::MEMBER_PER_GROUP_NO_LIMIT;
} else {
$max_member = $values['max_member'];

@ -21,51 +21,55 @@ api_protect_course_script(true);
/* Create the groups */
if (isset ($_POST['action'])) {
switch ($_POST['action']) {
case 'create_groups':
$groups = array();
switch ($_POST['action']) {
case 'create_groups':
$groups = array();
for ($i = 0; $i < $_POST['number_of_groups']; $i ++) {
$group1['name'] = empty($_POST['group_'.$i.'_name']) ? get_lang('Group').' '.$i : $_POST['group_'.$i.'_name'];
$group1['category'] = isset($_POST['group_'.$i.'_category']) ? $_POST['group_'.$i.'_category'] : null;
$group1['tutor'] = isset($_POST['group_'.$i.'_tutor']) ? $_POST['group_'.$i.'_tutor'] : null;
$group1['places'] = isset($_POST['group_'.$i.'_places']) ? $_POST['group_'.$i.'_places'] : null;
$groups[] = $group1;
}
for ($i = 0; $i < $_POST['number_of_groups']; $i ++) {
$group1['name'] = empty($_POST['group_'.$i.'_name']) ? get_lang('Group').' '.$i : $_POST['group_'.$i.'_name'];
$group1['category'] = isset($_POST['group_'.$i.'_category']) ? $_POST['group_'.$i.'_category'] : null;
$group1['tutor'] = isset($_POST['group_'.$i.'_tutor']) ? $_POST['group_'.$i.'_tutor'] : null;
$group1['places'] = isset($_POST['group_'.$i.'_places']) ? $_POST['group_'.$i.'_places'] : null;
$groups[] = $group1;
}
foreach ($groups as $index => $group) {
if (!empty($_POST['same_tutor'])) {
$group['tutor'] = $_POST['group_0_tutor'];
}
if (!empty($_POST['same_places'])) {
$group['places'] = $_POST['group_0_places'];
}
if (api_get_setting('allow_group_categories') == 'false') {
$group['category'] = GroupManager::DEFAULT_GROUP_CATEGORY;
} elseif ($_POST['same_category']) {
$group['category'] = $_POST['group_0_category'];
}
GroupManager :: create_group($group['name'], $group['category'], $group['tutor'], $group['places']);
}
$msg = urlencode(count($groups).' '.get_lang('GroupsAdded'));
header('Location: group.php?action=show_msg&msg='.$msg);
break;
case 'create_virtual_groups':
$ids = GroupManager :: create_groups_from_virtual_courses();
$msg = urlencode(count($ids).' '.get_lang('GroupsAdded'));
header('Location: group.php?action=show_msg&msg='.$msg);
break;
case 'create_subgroups':
GroupManager :: create_subgroups($_POST['base_group'], $_POST['number_of_groups']);
$msg = urlencode($_POST['number_of_groups'].' '.get_lang('GroupsAdded'));
header('Location: group.php?action=show_msg&msg='.$msg);
break;
case 'create_class_groups':
$ids = GroupManager :: create_class_groups($_POST['group_category']);
$msg = urlencode(count($ids).' '.get_lang('GroupsAdded'));
header('Location: group.php?action=show_msg&msg='.$msg);
break;
}
foreach ($groups as $index => $group) {
if (!empty($_POST['same_tutor'])) {
$group['tutor'] = $_POST['group_0_tutor'];
}
if (!empty($_POST['same_places'])) {
$group['places'] = $_POST['group_0_places'];
}
if (api_get_setting('allow_group_categories') == 'false') {
$group['category'] = GroupManager::DEFAULT_GROUP_CATEGORY;
} elseif ($_POST['same_category']) {
$group['category'] = $_POST['group_0_category'];
}
GroupManager :: create_group($group['name'], $group['category'], $group['tutor'], $group['places']);
}
$msg = urlencode(count($groups).' '.get_lang('GroupsAdded'));
header('Location: group.php?action=show_msg&msg='.$msg);
exit;
break;
case 'create_virtual_groups':
$ids = GroupManager :: create_groups_from_virtual_courses();
$msg = urlencode(count($ids).' '.get_lang('GroupsAdded'));
header('Location: group.php?action=show_msg&msg='.$msg);
exit;
break;
case 'create_subgroups':
GroupManager :: create_subgroups($_POST['base_group'], $_POST['number_of_groups']);
$msg = urlencode($_POST['number_of_groups'].' '.get_lang('GroupsAdded'));
header('Location: group.php?action=show_msg&msg='.$msg);
exit;
break;
case 'create_class_groups':
$ids = GroupManager :: create_class_groups($_POST['group_category']);
$msg = urlencode(count($ids).' '.get_lang('GroupsAdded'));
header('Location: group.php?action=show_msg&msg='.$msg);
exit;
break;
}
}
$nameTools = get_lang('GroupCreation');
@ -73,7 +77,7 @@ $interbreadcrumb[] = array ('url' => 'group.php', 'name' => get_lang('Groups'));
Display :: display_header($nameTools, 'Group');
if (!api_is_allowed_to_edit(false, true)) {
api_not_allowed();
api_not_allowed();
}
/* MAIN TOOL CODE */
@ -81,53 +85,48 @@ if (!api_is_allowed_to_edit(false, true)) {
/* Show group-settings-form */
elseif (isset($_POST['number_of_groups'])) {
if (!is_numeric($_POST['number_of_groups']) || intval($_POST['number_of_groups']) < 1) {
Display :: display_error_message(get_lang('PleaseEnterValidNumber').'<br /><br /><a href="group_creation.php?'.api_get_cidreq().'">&laquo; '.get_lang('Back').'</a>', false);
} else {
$number_of_groups = intval($_POST['number_of_groups']);
if ($number_of_groups > 1) {
?>
<script type="text/javascript">
<!--
var number_of_groups = <?php echo $number_of_groups; ?>;
function switch_state(key)
{
for( i=1; i<number_of_groups; i++)
{
element = document.getElementById(key+'_'+i);
element.disabled = !element.disabled;
disabled = element.disabled;
}
ref = document.getElementById(key+'_0');
if( disabled )
{
ref.addEventListener("change", copy, false);
}
else
{
ref.removeEventListener("change", copy, false);
}
copy_value(key);
}
function copy(e)
{
key = e.currentTarget.id;
var re = new RegExp ('_0', '') ;
var key = key.replace(re, '') ;
copy_value(key);
}
function copy_value(key)
{
ref = document.getElementById(key+'_0');
for( i=1; i<number_of_groups; i++)
{
element = document.getElementById(key+'_'+i);
element.value = ref.value;
}
}
-->
</script>
<?php
if (!is_numeric($_POST['number_of_groups']) || intval($_POST['number_of_groups']) < 1) {
Display :: display_error_message(get_lang('PleaseEnterValidNumber').'<br /><br /><a href="group_creation.php?'.api_get_cidreq().'">&laquo; '.get_lang('Back').'</a>', false);
} else {
$number_of_groups = intval($_POST['number_of_groups']);
if ($number_of_groups > 1) {
?>
<script type="text/javascript">
<!--
var number_of_groups = <?php echo $number_of_groups; ?>;
function switch_state(key) {
for( i=1; i<number_of_groups; i++) {
element = document.getElementById(key+'_'+i);
element.disabled = !element.disabled;
disabled = element.disabled;
}
ref = document.getElementById(key+'_0');
if( disabled ) {
ref.addEventListener("change", copy, false);
} else {
ref.removeEventListener("change", copy, false);
}
copy_value(key);
}
function copy(e) {
key = e.currentTarget.id;
var re = new RegExp ('_0', '') ;
var key = key.replace(re, '') ;
copy_value(key);
}
function copy_value(key) {
ref = document.getElementById(key+'_0');
for( i=1; i<number_of_groups; i++)
{
element = document.getElementById(key+'_'+i);
element.value = ref.value;
}
}
-->
</script>
<?php
}
$group_categories = GroupManager :: get_categories();
$group_id = GroupManager :: get_number_of_groups() + 1;
@ -323,8 +322,7 @@ EOT;
$create_class_groups_form->display();
echo '</blockquote>';
}
}
/* FOOTER */
Display :: display_footer();
Display :: display_footer();

@ -32,7 +32,7 @@ $interbreadcrumb[] = array ('url' => 'group_space.php?'.api_get_cidReq(), 'name'
$is_group_member = GroupManager :: is_tutor_of_group(api_get_user_id(), $group_id);
if (!api_is_allowed_to_edit(false,true) && !$is_group_member) {
if (!api_is_allowed_to_edit(false, true) && !$is_group_member) {
api_not_allowed(true);
}
@ -49,7 +49,6 @@ function search_members_keyword($firstname, $lastname, $username, $official_code
}
}
/**
* function to sort users after getting the list in the db. Necessary because there are 2 or 3 queries. Called by usort()
*/

@ -74,16 +74,16 @@ Display::display_introduction_section(TOOL_GROUP);
* User wants to register in this group
*/
if (!empty($_GET['selfReg']) && GroupManager :: is_self_registration_allowed($user_id, $current_group['id'])) {
GroupManager :: subscribe_users($user_id, $current_group['id']);
Display :: display_normal_message(get_lang('GroupNowMember'));
GroupManager :: subscribe_users($user_id, $current_group['id']);
Display :: display_normal_message(get_lang('GroupNowMember'));
}
/*
* User wants to unregister from this group
*/
if (!empty($_GET['selfUnReg']) && GroupManager :: is_self_unregistration_allowed($user_id, $current_group['id'])) {
GroupManager :: unsubscribe_users($user_id, $current_group['id']);
Display::display_normal_message(get_lang('StudentDeletesHimself'));
GroupManager :: unsubscribe_users($user_id, $current_group['id']);
Display::display_normal_message(get_lang('StudentDeletesHimself'));
}
echo '<div class="actions">';
echo '<a href="group.php">'.Display::return_icon('back.png',get_lang('BackToGroupList'),'',ICON_SIZE_MEDIUM).'</a>';
@ -157,51 +157,51 @@ if (api_is_allowed_to_edit(false, true) OR GroupManager :: is_user_in_group(api_
if ($current_group['doc_state'] != GroupManager::TOOL_NOT_AVAILABLE ) {
// Link to the documents area of this group
$actions_array[] = array(
'url' => '../document/document.php?'.api_get_cidreq(),
'content' => Display::return_icon('folder.png', get_lang('GroupDocument'), array(), 32)
);
'url' => '../document/document.php?'.api_get_cidreq(),
'content' => Display::return_icon('folder.png', get_lang('GroupDocument'), array(), 32)
);
}
if ($current_group['calendar_state'] != GroupManager::TOOL_NOT_AVAILABLE) {
// Link to a group-specific part of agenda
$actions_array[] = array(
'url' => '../calendar/agenda.php?'.api_get_cidreq(),
'content' => Display::return_icon('agenda.png', get_lang('GroupCalendar'), array(), 32)
'url' => '../calendar/agenda.php?'.api_get_cidreq(),
'content' => Display::return_icon('agenda.png', get_lang('GroupCalendar'), array(), 32)
);
}
if ($current_group['work_state'] != GroupManager::TOOL_NOT_AVAILABLE) {
// Link to the works area of this group
$actions_array[] = array(
'url' => '../work/work.php?'.api_get_cidreq(),
'content' => Display::return_icon('work.png', get_lang('GroupWork'), array(), 32)
'url' => '../work/work.php?'.api_get_cidreq(),
'content' => Display::return_icon('work.png', get_lang('GroupWork'), array(), 32)
);
}
if ($current_group['announcements_state'] != GroupManager::TOOL_NOT_AVAILABLE) {
// Link to a group-specific part of announcements
$actions_array[] = array(
'url' => '../announcements/announcements.php?'.api_get_cidreq(),
'content' => Display::return_icon('announce.png', get_lang('GroupAnnouncements'), array(), 32)
'url' => '../announcements/announcements.php?'.api_get_cidreq(),
'content' => Display::return_icon('announce.png', get_lang('GroupAnnouncements'), array(), 32)
);
}
if ($current_group['wiki_state'] != GroupManager::TOOL_NOT_AVAILABLE) {
// Link to the wiki area of this group
$actions_array[] = array(
'url' => '../wiki/index.php?'.api_get_cidreq().'&amp;action=show&amp;title=index&amp;session_id='.api_get_session_id().'&amp;group_id='.$current_group['id'],
'content' => Display::return_icon('wiki.png', get_lang('GroupWiki'), array(), 32)
'url' => '../wiki/index.php?'.api_get_cidreq().'&amp;action=show&amp;title=index&amp;session_id='.api_get_session_id().'&amp;group_id='.$current_group['id'],
'content' => Display::return_icon('wiki.png', get_lang('GroupWiki'), array(), 32)
);
}
if ($current_group['chat_state'] != GroupManager::TOOL_NOT_AVAILABLE) {
// Link to the chat area of this group
if (api_get_course_setting('allow_open_chat_window')) {
$actions_array[] = array(
'url' => "javascript: void(0);\" onclick=\"window.open('../chat/chat.php?".api_get_cidreq()."&amp;toolgroup=".$current_group['id']."','window_chat_group_".$_SESSION['_cid']."_".$_SESSION['_gid']."','height=380, width=625, left=2, top=2, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no') \"",
'content' => Display::return_icon('chat.png', get_lang('Chat'), array(), 32)
'url' => "javascript: void(0);\" onclick=\"window.open('../chat/chat.php?".api_get_cidreq()."&amp;toolgroup=".$current_group['id']."','window_chat_group_".$_SESSION['_cid']."_".$_SESSION['_gid']."','height=380, width=625, left=2, top=2, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no') \"",
'content' => Display::return_icon('chat.png', get_lang('Chat'), array(), 32)
);
} else {
$actions_array[] = array(
'url' => "../chat/chat.php?".api_get_cidreq()."&amp;toolgroup=".$current_group['id'],
'content' => Display::return_icon('chat.png', get_lang('Chat'), array(), 32)
'url' => "../chat/chat.php?".api_get_cidreq()."&amp;toolgroup=".$current_group['id'],
'content' => Display::return_icon('chat.png', get_lang('Chat'), array(), 32)
);
}
}
@ -230,50 +230,50 @@ if (api_is_allowed_to_edit(false, true) OR GroupManager :: is_user_in_group(api_
if ($current_group['doc_state'] == GroupManager::TOOL_PUBLIC) {
// Link to the documents area of this group
$actions_array[] = array(
'url' => '../document/document.php?cidReq='.api_get_course_id().'&amp;origin='.$origin,
'content' => Display::return_icon('folder.png', get_lang('GroupDocument'), array(), ICON_SIZE_MEDIUM)
'url' => '../document/document.php?cidReq='.api_get_course_id().'&amp;origin='.$origin,
'content' => Display::return_icon('folder.png', get_lang('GroupDocument'), array(), ICON_SIZE_MEDIUM)
);
}
if ($current_group['calendar_state'] == GroupManager::TOOL_PUBLIC) {
// Link to a group-specific part of agenda
$actions_array[] = array(
'url' => '../calendar/agenda.php?'.api_get_cidreq(),
'content' => Display::return_icon('agenda.png', get_lang('GroupCalendar'), array(), ICON_SIZE_MEDIUM)
'url' => '../calendar/agenda.php?'.api_get_cidreq(),
'content' => Display::return_icon('agenda.png', get_lang('GroupCalendar'), array(), ICON_SIZE_MEDIUM)
);
}
if ($current_group['work_state'] == GroupManager::TOOL_PUBLIC) {
// Link to the works area of this group
$actions_array[] = array(
'url' => '../work/work.php?'.api_get_cidreq(),
'content' => Display::return_icon('work.png', get_lang('GroupWork'), array(), ICON_SIZE_MEDIUM)
'url' => '../work/work.php?'.api_get_cidreq(),
'content' => Display::return_icon('work.png', get_lang('GroupWork'), array(), ICON_SIZE_MEDIUM)
);
}
if ($current_group['announcements_state'] == GroupManager::TOOL_PUBLIC) {
// Link to a group-specific part of announcements
$actions_array[] = array(
'url' => '../announcements/announcements.php?'.api_get_cidreq(),
'content' => Display::return_icon('announce.png', get_lang('GroupAnnouncements'), array(), ICON_SIZE_MEDIUM)
'url' => '../announcements/announcements.php?'.api_get_cidreq(),
'content' => Display::return_icon('announce.png', get_lang('GroupAnnouncements'), array(), ICON_SIZE_MEDIUM)
);
}
if ($current_group['wiki_state'] == GroupManager::TOOL_PUBLIC) {
// Link to the wiki area of this group
$actions_array[] = array(
'url' => '../wiki/index.php?'.api_get_cidreq().'&amp;action=show&amp;title=index&amp;session_id='.api_get_session_id().'&amp;group_id='.$current_group['id'],
'content' => Display::return_icon('wiki.png', get_lang('GroupWiki'), array(), 32)
'url' => '../wiki/index.php?'.api_get_cidreq().'&amp;action=show&amp;title=index&amp;session_id='.api_get_session_id().'&amp;group_id='.$current_group['id'],
'content' => Display::return_icon('wiki.png', get_lang('GroupWiki'), array(), 32)
);
}
if ($current_group['chat_state'] == GroupManager::TOOL_PUBLIC ) {
// Link to the chat area of this group
if (api_get_course_setting('allow_open_chat_window')) {
$actions_array[] = array(
'url' => "javascript: void(0);\" onclick=\"window.open('../chat/chat.php?".api_get_cidreq()."&amp;toolgroup=".$current_group['id']."','window_chat_group_".$_SESSION['_cid']."_".$_SESSION['_gid']."','height=380, width=625, left=2, top=2, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no') \"",
'content' => Display::return_icon('chat.png', get_lang('Chat'), array(), 32)
'url' => "javascript: void(0);\" onclick=\"window.open('../chat/chat.php?".api_get_cidreq()."&amp;toolgroup=".$current_group['id']."','window_chat_group_".$_SESSION['_cid']."_".$_SESSION['_gid']."','height=380, width=625, left=2, top=2, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no') \"",
'content' => Display::return_icon('chat.png', get_lang('Chat'), array(), 32)
);
} else {
$actions_array[] = array(
'url' => "../chat/chat.php?".api_get_cidreq()."&amp;toolgroup=".$current_group['id'],
'content' => Display::return_icon('chat.png', get_lang('Chat'), array(), 32)
'url' => "../chat/chat.php?".api_get_cidreq()."&amp;toolgroup=".$current_group['id'],
'content' => Display::return_icon('chat.png', get_lang('Chat'), array(), 32)
);
}
}
@ -473,6 +473,7 @@ function user_icon_filter($user_id) {
$photo = '<center><img src="'.$image_repository.$existing_image.'" alt="'.api_get_person_name($userinfo['firstname'], $userinfo['lastname']).'" width="22" height="22" title="'.api_get_person_name($userinfo['firstname'], $userinfo['lastname']).'" /></center>';
return '<a href="../user/userInfo.php?origin='.$origin.'&amp;uInfo='.$user_id.'">'.$photo;
}
/**
* Return user profile link around the given user name.
*
@ -484,7 +485,6 @@ function user_icon_filter($user_id) {
* @return string HTML link
*/
function user_name_filter($name, $url_params, $row) {
global $origin;
$tab_user_info = Database::get_user_info_from_id($row[0]);
$username = api_htmlentities(sprintf(get_lang('LoginX'), $tab_user_info['username']), ENT_QUOTES);
return '<a href="../user/userInfo.php?uInfo='.$row[0].'&amp;'.$url_params.'" title="'.$username.'">'.$name.'</a>';

@ -55,7 +55,6 @@ if ($form->validate()) {
}
echo $html;
}
}
$form->display();

Loading…
Cancel
Save