Minor - format code

1.9.x
Julio Montoya 12 years ago
parent a7c9932e13
commit 05d55b117a
  1. 48
      main/group/group.php
  2. 19
      main/group/group_edit.php
  3. 10
      main/inc/lib/groupmanager.lib.php

@ -44,7 +44,7 @@ if (api_get_setting('allow_group_categories') == 'false') {
$res = Database::query($sql);
$num = Database::num_rows($res);
if ($num == 0) {
$sql = "INSERT INTO ".$cat_table." ( c_id, id , title , description , forum_state, wiki_state, max_student, self_reg_allowed, self_unreg_allowed, groups_per_user, display_order)
$sql = "INSERT INTO ".$cat_table." ( c_id, id , title , description , forum_state, wiki_state, max_student, self_reg_allowed, self_unreg_allowed, groups_per_user, display_order)
VALUES ($course_id, '2', '".lang2db(get_lang('DefaultGroupCategory'))."', '', '1', '1', '8', '0', '0', '0', '0');";
Database::query ($sql);
}
@ -77,25 +77,25 @@ Display::display_introduction_section(TOOL_GROUP);
if (isset($_GET['action'])) {
switch ($_GET['action']) {
case 'self_reg' :
case 'self_reg':
if (GroupManager :: is_self_registration_allowed($_SESSION['_user']['user_id'], $my_group_id)) {
GroupManager :: subscribe_users($_SESSION['_user']['user_id'], $my_group_id);
Display :: display_confirmation_message(get_lang('GroupNowMember'));
}
break;
case 'self_unreg' :
case 'self_unreg':
if (GroupManager :: is_self_unregistration_allowed($_SESSION['_user']['user_id'], $my_group_id)) {
GroupManager :: unsubscribe_users($_SESSION['_user']['user_id'], $my_group_id);
Display :: display_confirmation_message(get_lang('StudentDeletesHimself'));
}
break;
case 'show_msg' :
case 'show_msg':
Display :: display_confirmation_message($my_msg);
break;
case 'warning_message' :
case 'warning_message':
Display :: display_warning_message($my_msg);
break;
case 'success_message' :
case 'success_message':
Display :: display_confirmation_message($my_msg);
break;
}
@ -123,7 +123,7 @@ if (api_is_allowed_to_edit(false, true)) {
}
break;
case 'fill_selected' :
if (is_array($_POST['group'])) {
if (is_array($_POST['group'])) {
GroupManager :: fill_groups($my_group);
Display :: display_confirmation_message(get_lang('SelectedGroupsFilled'));
}
@ -146,7 +146,7 @@ if (api_is_allowed_to_edit(false, true)) {
GroupManager :: unsubscribe_all_users($my_get_id);
Display :: display_confirmation_message(get_lang('GroupEmptied'));
break;
case 'fill_one':
case 'fill_one':
GroupManager :: fill_groups($my_get_id);
Display :: display_confirmation_message(get_lang('GroupFilledGroups'));
break;
@ -161,21 +161,21 @@ if (api_is_allowed_to_edit(false, true)) {
echo '<div class="actions">';
if (api_is_allowed_to_edit(false, true)) {
echo '<a href="group_creation.php?'.api_get_cidreq().'">'.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) {
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>';
}
if (api_get_setting('allow_group_categories') == 'true') {
echo '<a href="group_category.php?'.api_get_cidreq().'&action=add_category">'.Display::return_icon('new_folder.png', get_lang('AddCategory'),'',ICON_SIZE_MEDIUM).'</a>';
} else {
echo '<a href="group_category.php?'.api_get_cidreq().'&id=2">'.Display::return_icon('settings.png', get_lang('PropModify'),'',ICON_SIZE_MEDIUM).'</a>';
}
echo '<a href="group_overview.php?'.api_get_cidreq().'&action=export&type=xls">'.Display::return_icon('export_excel.png', get_lang('ExportAsXLS'),'',ICON_SIZE_MEDIUM).'</a>';
echo '<a href="../user/user.php?'.api_get_cidreq().'">'.Display::return_icon('user.png', get_lang('GoTo').' '.get_lang('Users'),'',ICON_SIZE_MEDIUM).'</a>';
}
echo '<a href="group_overview.php?'.api_get_cidreq().'&action=export&type=xls">'.Display::return_icon('export_excel.png', get_lang('ExportAsXLS'),'',ICON_SIZE_MEDIUM).'</a>';
echo '<a href="../user/user.php?'.api_get_cidreq().'">'.Display::return_icon('user.png', get_lang('GoTo').' '.get_lang('Users'),'',ICON_SIZE_MEDIUM).'</a>';
}
$group_cats = GroupManager :: get_categories(api_get_course_id());
if (api_get_setting('allow_group_categories') == 'true' && count($group_cats) > 1) {
if (api_get_setting('allow_group_categories') == 'true' && count($group_cats) > 1) {
echo ' <a href="?'.api_get_cidreq().'&show_all=1">'.Display::return_icon('group.png',get_lang('ShowAll'),'',ICON_SIZE_MEDIUM).'</a>';
}
echo '</div>';
@ -186,17 +186,9 @@ echo '</div>';
if (api_get_setting('allow_group_categories') == 'true') {
foreach ($group_cats as $index => $category) {
if (isset ($_GET['show_all']) || (isset ($_GET['category']) && $_GET['category'] == $category['id'])) {
//echo '<img src="../img/folder_group_category.gif" alt=""/>';
//echo '<a href="group.php?'.api_get_cidreq().'&origin='.Security::remove_XSS($_GET['origin']).'">'.$category['title'].'</a>';
} else {
//echo '<img src="../img/folder_document.gif" alt=""/>';
//echo '<a href="group.php?'.api_get_cidreq().'&origin='.Security::remove_XSS($_GET['origin']).'&amp;category='.$category['id'].'">'.$category['title'].'</a>';
//echo Display::page_header($category['title']);
}
$group_list = GroupManager :: get_group_list($category['id']);
$label = Display::label(count($group_list).' '.get_lang('ExistingGroups'), 'info');
$actions = null;
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>';
@ -208,15 +200,15 @@ if (api_get_setting('allow_group_categories') == 'true') {
$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>';
}
}
echo Display::page_header($category['title'].' '. $label.' '.$actions);
echo '<p style="margin: 0px;margin-left: 50px;">'.$category['description'].'</p><p/>';
GroupManager ::process_groups($group_list, $category['id']);
GroupManager ::process_groups($group_list, $category['id']);
}
} else {
$group_list = GroupManager :: get_group_list();
$group_list = GroupManager :: get_group_list();
GroupManager ::process_groups($group_list);
}
@ -225,4 +217,4 @@ if (api_get_setting('allow_group_categories') == 'true') {
if (!isset ($_GET['origin']) || $_GET['origin'] != 'learnpath') {
Display::display_footer();
}
$_SESSION['_gid'] = 0;
$_SESSION['_gid'] = 0;

@ -272,7 +272,22 @@ if ($form->validate()) {
}
$self_registration_allowed = isset($values['self_registration_allowed']) ? 1 : 0;
$self_unregistration_allowed = isset($values['self_unregistration_allowed']) ? 1 : 0;
GroupManager :: set_group_properties($current_group['id'], strip_tags($values['name']), strip_tags($values['description']), $max_member, $values['doc_state'], $values['work_state'], $values['calendar_state'], $values['announcements_state'], $values['forum_state'], $values['wiki_state'], $values['chat_state'], $self_registration_allowed, $self_unregistration_allowed);
GroupManager::set_group_properties(
$current_group['id'],
strip_tags($values['name']),
strip_tags($values['description']),
$max_member,
$values['doc_state'],
$values['work_state'],
$values['calendar_state'],
$values['announcements_state'],
$values['forum_state'],
$values['wiki_state'],
$values['chat_state'],
$self_registration_allowed,
$self_unregistration_allowed
);
// Storing the tutors (we first remove all the tutors and then add only those who were selected)
GroupManager :: unsubscribe_all_tutors($current_group['id']);
@ -327,4 +342,4 @@ if (isset($_GET['show_message_sucess'])) {
$form->setDefaults($defaults);
$form->display();
Display :: display_footer();
Display :: display_footer();

@ -82,7 +82,7 @@ class GroupManager
* @param string $course_code Default is current course
* @return array An array with all information about the groups.
*/
public static function get_group_list ($category = null, $course_code = null)
public static function get_group_list($category = null, $course_code = null)
{
$my_user_id = api_get_user_id();
@ -167,8 +167,6 @@ class GroupManager
$rs_session = Database::query($sql_session);
if (Database::num_rows($rs_session)>0) {
$thisGroup['session_name'] = Database::result($rs_session,0,0);
} else {
//the session has probably been removed, so the group is now orphaned
}
}
$groups[] = $thisGroup;
@ -541,7 +539,7 @@ class GroupManager
* Get all categories
* @param string $course_code The cours (default = current course)
*/
public static function get_categories ($course_code = null) {
public static function get_categories($course_code = null) {
$course_info = api_get_course_info($course_code);
$course_id = $course_info['real_id'];
$table_group_cat = Database :: get_course_table(TABLE_GROUP_CATEGORY);
@ -558,7 +556,7 @@ class GroupManager
* @param int $id The category id
* @param string $course_code The course (default = current course)
*/
public static function get_category ($id, $course_code = null) {
public static function get_category($id, $course_code = null) {
if (empty($id)) {
return array();
}
@ -706,7 +704,7 @@ class GroupManager
$maximum_number_of_students,
$groups_per_user
) {
$table_group_category = Database :: get_course_table(TABLE_GROUP_CATEGORY);
$table_group_category = Database::get_course_table(TABLE_GROUP_CATEGORY);
$id = Database::escape_string($id);
$course_id = api_get_course_int_id();

Loading…
Cancel
Save