From cf571a73eae868302634078851e20af0aab841d4 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Thu, 14 Nov 2013 11:23:58 +0100 Subject: [PATCH] Minor - cleaning whitespaces. --- main/group/group.php | 11 +- main/group/group_category.php | 2 +- main/group/group_creation.php | 184 +++++++++++++++++----------------- main/group/group_edit.php | 3 +- main/group/group_space.php | 68 ++++++------- main/group/import.php | 1 - 6 files changed, 134 insertions(+), 135 deletions(-) diff --git a/main/group/group.php b/main/group/group.php index 2c61511431..bf93a1a3df 100644 --- a/main/group/group.php +++ b/main/group/group.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).''; if (CourseManager::count_rows_course_table(Database::get_course_table(TABLE_GROUP), api_get_session_id(), api_get_course_int_id()) > 0) { echo ''. - Display::return_icon('group_summary.png', get_lang('GroupOverview'),'',ICON_SIZE_MEDIUM).''; + Display::return_icon('group_summary.png', get_lang('GroupOverview'), '', ICON_SIZE_MEDIUM).''; } if (api_get_setting('allow_group_categories') == 'true') { echo ''. @@ -202,12 +202,15 @@ if (api_get_setting('allow_group_categories') == 'true') { if (api_is_allowed_to_edit(false, true)) { $actions .= ''. Display::return_icon('edit.png', get_lang('EditGroup'),'',ICON_SIZE_SMALL).''; - $actions .= ''.Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_SMALL).''; + $actions .= ''. + Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_SMALL).''; if ($index != 0) { - $actions .= ' '.Display::return_icon('up.png',' ','',ICON_SIZE_SMALL).''; + $actions .= ' '. + Display::return_icon('up.png',' ','',ICON_SIZE_SMALL).''; } if ($index != count($group_cats) - 1) { - $actions .= ' '.Display::return_icon('down.png',' ','',ICON_SIZE_SMALL).''; + $actions .= ' '. + Display::return_icon('down.png',' ','',ICON_SIZE_SMALL).''; } } diff --git a/main/group/group_category.php b/main/group/group_category.php index 4f997c7b2a..12191d503a 100644 --- a/main/group/group_category.php +++ b/main/group/group_category.php @@ -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']; diff --git a/main/group/group_creation.php b/main/group/group_creation.php index bf7cc86f07..cec6a8aa94 100644 --- a/main/group/group_creation.php +++ b/main/group/group_creation.php @@ -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').'

« '.get_lang('Back').'', false); - } else { - $number_of_groups = intval($_POST['number_of_groups']); - if ($number_of_groups > 1) { -?> - -
« '.get_lang('Back').'', false); + } else { + $number_of_groups = intval($_POST['number_of_groups']); + if ($number_of_groups > 1) { + ?> + + display(); echo ''; } - } /* FOOTER */ -Display :: display_footer(); \ No newline at end of file +Display :: display_footer(); diff --git a/main/group/group_edit.php b/main/group/group_edit.php index a531535c43..6bad71076f 100644 --- a/main/group/group_edit.php +++ b/main/group/group_edit.php @@ -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() */ diff --git a/main/group/group_space.php b/main/group/group_space.php index 9865736774..f5225f097a 100644 --- a/main/group/group_space.php +++ b/main/group/group_space.php @@ -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 '
'; echo ''.Display::return_icon('back.png',get_lang('BackToGroupList'),'',ICON_SIZE_MEDIUM).''; @@ -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().'&action=show&title=index&session_id='.api_get_session_id().'&group_id='.$current_group['id'], - 'content' => Display::return_icon('wiki.png', get_lang('GroupWiki'), array(), 32) + 'url' => '../wiki/index.php?'.api_get_cidreq().'&action=show&title=index&session_id='.api_get_session_id().'&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()."&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()."&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()."&toolgroup=".$current_group['id'], - 'content' => Display::return_icon('chat.png', get_lang('Chat'), array(), 32) + 'url' => "../chat/chat.php?".api_get_cidreq()."&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().'&origin='.$origin, - 'content' => Display::return_icon('folder.png', get_lang('GroupDocument'), array(), ICON_SIZE_MEDIUM) + 'url' => '../document/document.php?cidReq='.api_get_course_id().'&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().'&action=show&title=index&session_id='.api_get_session_id().'&group_id='.$current_group['id'], - 'content' => Display::return_icon('wiki.png', get_lang('GroupWiki'), array(), 32) + 'url' => '../wiki/index.php?'.api_get_cidreq().'&action=show&title=index&session_id='.api_get_session_id().'&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()."&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()."&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()."&toolgroup=".$current_group['id'], - 'content' => Display::return_icon('chat.png', get_lang('Chat'), array(), 32) + 'url' => "../chat/chat.php?".api_get_cidreq()."&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 = '
'.api_get_person_name($userinfo['firstname'], $userinfo['lastname']).'
'; return ''.$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 ''.$name.''; diff --git a/main/group/import.php b/main/group/import.php index 993fec8dbf..dd229ca3f5 100644 --- a/main/group/import.php +++ b/main/group/import.php @@ -55,7 +55,6 @@ if ($form->validate()) { } echo $html; } - } $form->display();