diff --git a/main/group/group.php b/main/group/group.php index 270c5455e2..ef3548c017 100755 --- a/main/group/group.php +++ b/main/group/group.php @@ -1,56 +1,31 @@ -'; //jQuery $htmlHeadXtra[] = ''; $nameTools = get_lang('GroupManagement'); -/* ------------------------------------------------------------ - Libraries ------------------------------------------------------------ -*/ -require_once (api_get_path(LIBRARY_PATH).'course.lib.php'); -require_once (api_get_path(LIBRARY_PATH).'groupmanager.lib.php'); +/* Libraries */ -//Create default category if it doesn't exist when group categories aren't allowed -if( api_get_setting('allow_group_categories') == 'false') -{ +require_once api_get_path(LIBRARY_PATH).'course.lib.php'; +require_once api_get_path(LIBRARY_PATH).'groupmanager.lib.php'; + +// Create default category if it doesn't exist when group categories aren't allowed +if (api_get_setting('allow_group_categories') == 'false') { $cat_table = Database::get_course_table(TABLE_GROUP_CATEGORY); $sql = "SELECT * FROM $cat_table WHERE id = '".DEFAULT_GROUP_CATEGORY."'"; $res = Database::query($sql); $num = Database::num_rows($res); - if($num == 0) - { + if ($num == 0) { Database::query("INSERT INTO ".$cat_table." ( id , title , description , forum_state , wiki_state, max_student , self_reg_allowed , self_unreg_allowed , groups_per_user , display_order ) VALUES ('2', '".lang2db($DefaultGroupCategory)."', '', '1', '1', '8', '0', '0', '0', '0');"); } } -/* ------------------------------------------------------------ - Header ------------------------------------------------------------ -*/ -if (!isset ($_GET['origin']) || $_GET['origin'] != 'learnpath') -{ //so we are not in learnpath tool +/* Header */ + +if (!isset ($_GET['origin']) || $_GET['origin'] != 'learnpath') { + // So we are not in learnpath tool event_access_tool(TOOL_GROUP); - if (! $is_allowed_in_course) api_not_allowed(true); + if (!$is_allowed_in_course) { + api_not_allowed(true); + } } Display::display_header(get_lang('Groups')); @@ -109,21 +78,17 @@ Display::display_introduction_section(TOOL_GROUP); $my_get_id2 = Security::remove_XSS($_GET['id2']); $my_get_id = Security::remove_XSS($_GET['id']); -if (isset ($_GET['action'])) -{ - switch ($_GET['action']) - { +if (isset($_GET['action'])) { + switch ($_GET['action']) { 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); + 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' : - if (GroupManager :: is_self_unregistration_allowed($_SESSION['_user']['user_id'], $my_group_id)) - { - GroupManager :: unsubscribe_users($_SESSION['_user']['user_id'],$my_group_id); + 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; @@ -132,62 +97,56 @@ if (isset ($_GET['action'])) break; } } + /* * Group-admin functions */ -if (api_is_allowed_to_edit(false,true)) -{ +if (api_is_allowed_to_edit(false, true)) { // Post-actions - if (isset ($_POST['action'])) - { - switch ($_POST['action']) - { + if (isset($_POST['action'])) { + switch ($_POST['action']) { case 'delete_selected' : - if( is_array($_POST['group'])) - { + if (is_array($_POST['group'])) { GroupManager :: delete_groups($my_group); Display :: display_confirmation_message(get_lang('SelectedGroupsDeleted')); } break; case 'empty_selected' : - if( is_array($_POST['group'])) - { + if (is_array($_POST['group'])) { GroupManager :: unsubscribe_all_users($my_group); Display :: display_confirmation_message(get_lang('SelectedGroupsEmptied')); } 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')); } break; } } + // Get-actions - if (isset ($_GET['action'])) - { - switch ($_GET['action']) - { - case 'swap_cat_order' : - GroupManager :: swap_category_order($my_get_id1,$my_get_id2); + if (isset($_GET['action'])) { + switch ($_GET['action']) { + case 'swap_cat_order': + GroupManager :: swap_category_order($my_get_id1, $my_get_id2); Display :: display_confirmation_message(get_lang('CategoryOrderChanged')); break; - case 'delete_one' : + case 'delete_one': GroupManager :: delete_groups($my_get_id); Display :: display_confirmation_message(get_lang('GroupDel')); break; - case 'empty_one' : + case 'empty_one': 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; - case 'delete_category' : + case 'delete_category': GroupManager :: delete_category($my_get_id); Display :: display_confirmation_message(get_lang('CategoryDeleted')); break; @@ -196,10 +155,9 @@ if (api_is_allowed_to_edit(false,true)) } echo '
'; -if (api_is_allowed_to_edit(false,true)) -{ +if (api_is_allowed_to_edit(false, true)) { echo Display::return_icon('groupadd.gif', get_lang('NewGroupCreate')) . ''.get_lang('NewGroupCreate').' '; - if( Database::count_rows(Database::get_course_table(TABLE_GROUP)) > 0) { + if (Database::count_rows(Database::get_course_table(TABLE_GROUP)) > 0) { //echo ''.Display::return_icon('group_view.gif').' '.get_lang('GroupOverview').' '; echo Display::return_icon('group.gif', get_lang('GroupOverview')) .''.get_lang('GroupOverview').' '; } @@ -214,165 +172,133 @@ if (api_is_allowed_to_edit(false,true)) echo Display::return_icon('excel.gif', get_lang('ExportAsXLS')).' '.get_lang('ExportAsXLS').''; //echo ''.Display::return_icon('group_add_big.gif').' '.get_lang('NewGroupCreate').' '; } + $group_cats = GroupManager :: get_categories(); -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 '

'.get_lang('ShowAll').'

'; echo Display::return_icon('group.gif').' '.get_lang('ShowAll').''; } echo '
'; + /* * List all categories */ -foreach ($group_cats as $index => $category) -{ - global $charset; +foreach ($group_cats as $index => $category) { $group_list = array (); $in_category = false; - if (api_get_setting('allow_group_categories') == 'true') - { - if (isset ($_GET['show_all']) || (isset ($_GET['category']) && $_GET['category'] == $category['id'])) - { + if (api_get_setting('allow_group_categories') == 'true') { + if (isset ($_GET['show_all']) || (isset ($_GET['category']) && $_GET['category'] == $category['id'])) { echo ''; - echo ' '.$category['title'].''; + echo ''.$category['title'].''; $in_category = true; - } - else - { + } else { echo ''; - echo ' '.$category['title'].''; + echo ''.$category['title'].''; } $group_list = GroupManager :: get_group_list($category['id']); echo ' ('.count($group_list).' '.get_lang('ExistingGroups').')'; - if (api_is_allowed_to_edit(false,true)) - { + if (api_is_allowed_to_edit(false, true)) { echo ''.get_lang('Edit').' '; - echo ''.get_lang('Delete').' '; - if ($index != 0) - { + echo ''.get_lang('Delete').' '; + if ($index != 0) { echo ' '; } - if ($index != count($group_cats) - 1) - { + if ($index != count($group_cats) - 1) { echo ' '; } } echo '

'.$category['description'].'

'; + } else { + $group_list = GroupManager :: get_group_list(); + $in_category = true; } - else { - $group_list = GroupManager :: get_group_list(); - $in_category = true; - } //if (count($group_list) > 0 && $in_category) - if ($in_category) - { + if ($in_category) { $totalRegistered = 0; // Determine wether current user is tutor for this course $user_is_tutor = GroupManager :: is_tutor($_user['user_id']); - $group_data = array (); + $group_data = array(); foreach ($group_list as $index => $this_group) { - //validacion when belongs to a session + // Validacion when belongs to a session $session_img = api_get_session_image($this_group['session_id'], $_user['status']); - // all the tutors of this group - $tutorsids_of_group=GroupManager::get_subscribed_tutors($this_group['id'],true); + // All the tutors of this group + $tutorsids_of_group=GroupManager::get_subscribed_tutors($this_group['id'], true); - // create a new table-row + // Create a new table-row $row = array (); - // checkbox - if (api_is_allowed_to_edit(false,true) && count($group_list) > 1) - { + // Checkbox + if (api_is_allowed_to_edit(false,true) && count($group_list) > 1) { $row[] = $this_group['id']; } - // group name - if ((api_is_allowed_to_edit(false,true) || - in_array($_user['user_id'],$tutorsids_of_group) || + // Group name + if ((api_is_allowed_to_edit(false, true) || + in_array($_user['user_id'], $tutorsids_of_group) || $this_group['is_member'] || - GroupManager::user_has_access($_user['user_id'],$this_group['id'],GROUP_TOOL_FORUM) || - GroupManager::user_has_access($_user['user_id'],$this_group['id'],GROUP_TOOL_DOCUMENTS) || - GroupManager::user_has_access($_user['user_id'],$this_group['id'],GROUP_TOOL_CALENDAR) || - GroupManager::user_has_access($_user['user_id'],$this_group['id'],GROUP_TOOL_ANNOUNCEMENT) || - GroupManager::user_has_access($_user['user_id'],$this_group['id'],GROUP_TOOL_WORK) || - GroupManager::user_has_access($_user['user_id'],$this_group['id'],GROUP_TOOL_WIKI)) - && !(api_is_course_coach() && intval($this_group['session_id'])!=intval($_SESSION['id_session']))) - { - isset($origin)?$orig=$origin:$orig=null; + GroupManager::user_has_access($_user['user_id'], $this_group['id'], GROUP_TOOL_FORUM) || + GroupManager::user_has_access($_user['user_id'], $this_group['id'], GROUP_TOOL_DOCUMENTS) || + GroupManager::user_has_access($_user['user_id'], $this_group['id'], GROUP_TOOL_CALENDAR) || + GroupManager::user_has_access($_user['user_id'], $this_group['id'], GROUP_TOOL_ANNOUNCEMENT) || + GroupManager::user_has_access($_user['user_id'], $this_group['id'], GROUP_TOOL_WORK) || + GroupManager::user_has_access($_user['user_id'], $this_group['id'], GROUP_TOOL_WIKI)) + && !(api_is_course_coach() && intval($this_group['session_id']) != intval($_SESSION['id_session']))) { + $orig = isset($origin) ? $origin : null; $group_name = ''.stripslashes($this_group['name']).''; - if (!empty($_SESSION['_user']['user_id']) && !empty($this_group['id_tutor']) && $_SESSION['_user']['user_id'] == $this_group['id_tutor']) - { + if (!empty($_SESSION['_user']['user_id']) && !empty($this_group['id_tutor']) && $_SESSION['_user']['user_id'] == $this_group['id_tutor']) { $group_name .= ' ('.get_lang('OneMyGroups').')'; - } - elseif ($this_group['is_member']) - { + } elseif ($this_group['is_member']) { $group_name .= ' ('.get_lang('MyGroup').')'; } - if(api_is_allowed_to_edit() && !empty($this_group['session_name'])) - { + if (api_is_allowed_to_edit() && !empty($this_group['session_name'])) { $group_name .= ' ('.$this_group['session_name'].')'; } $group_name .= $session_img; - $row[] = $group_name.'
'.stripslashes(trim($this_group['description'])); - } - else - { - $row[] = $this_group['name'].'
'.stripslashes(trim($this_group['description'])); + $row[] = $group_name.'
'.stripslashes(trim($this_group['description'])); + } else { + $row[] = $this_group['name'].'
'.stripslashes(trim($this_group['description'])); } - // self-registration / unregistration - if (!api_is_allowed_to_edit(false,true)) - { - if (GroupManager :: is_self_registration_allowed($_user['user_id'], $this_group['id'])) - { + // Self-registration / unregistration + if (!api_is_allowed_to_edit(false, true)) { + if (GroupManager :: is_self_registration_allowed($_user['user_id'], $this_group['id'])) { $row[] = ''.get_lang('GroupSelfRegInf').''; - } - elseif (GroupManager :: is_self_unregistration_allowed($_user['user_id'], $this_group['id'])) - { + } elseif (GroupManager :: is_self_unregistration_allowed($_user['user_id'], $this_group['id'])) { $row[] = ''.get_lang('GroupSelfUnRegInf').''; - } - else - { + } else { $row[] = '-'; } } - // number of members in group + // Number of members in group $row[] = $this_group['number_of_members']; - // max number of members in group + // Max number of members in group $row[] = ($this_group['maximum_number_of_members'] == MEMBER_PER_GROUP_NO_LIMIT ? '-' : $this_group['maximum_number_of_members']); - // tutor name + // Tutor name $tutor_info = ''; - if(count($tutorsids_of_group)>0) - { - foreach($tutorsids_of_group as $tutor_id){ + if (count($tutorsids_of_group) > 0) { + foreach ($tutorsids_of_group as $tutor_id) { $tutor = api_get_user_info($tutor_id); - if (api_get_setting("show_email_addresses") == "true") - { + if (api_get_setting('show_email_addresses') == 'true') { $tutor_info .= Display::encrypted_mailto_link($tutor['mail'], api_get_person_name($tutor['firstName'], $tutor['lastName'])).', '; - } - else - { - if (api_is_allowed_to_edit()=='true') - { + } else { + if (api_is_allowed_to_edit()) { $tutor_info .= Display::encrypted_mailto_link($tutor['mail'], api_get_person_name($tutor['firstName'], $tutor['lastName'])).', '; - } - else - { + } else { $tutor_info .= api_get_person_name($tutor['firstName'], $tutor['lastName']).', '; } } } } - $tutor_info = api_substr($tutor_info,0,api_strlen($tutor_info)-2); + $tutor_info = api_substr($tutor_info, 0, api_strlen($tutor_info) - 2); $row[] = $tutor_info; - // edit-links - if (api_is_allowed_to_edit(false,true) && !(api_is_course_coach() && intval($this_group['session_id'])!=intval($_SESSION['id_session']))) - { + // Edit-links + if (api_is_allowed_to_edit(false, true) && !(api_is_course_coach() && intval($this_group['session_id']) != intval($_SESSION['id_session']))) { $edit_actions = ''.get_lang('Edit').' '; - $edit_actions .= ''.get_lang('Delete').' '; - $edit_actions .= ''.get_lang('EmptyGroup').' '; - $edit_actions .= ''.get_lang('FillGroup').''; + $edit_actions .= ''.get_lang('Delete').' '; + $edit_actions .= ''.get_lang('EmptyGroup').' '; + $edit_actions .= ''.get_lang('FillGroup').''; $row[] = $edit_actions; } if (!empty($this_group['nbMember'])) { @@ -381,58 +307,46 @@ foreach ($group_cats as $index => $category) $group_data[] = $row; } // while loop - if (isset ($_GET['show_all'])) - { - $paging_options = array ('per_page' => count($group_data)); - } - else - { + if (isset ($_GET['show_all'])) { + $paging_options = array('per_page' => count($group_data)); + } else { $paging_options = array (); } $table = new SortableTableFromArrayConfig($group_data, 1); - isset($_GET['category'])?$my_cat = Security::remove_XSS($_GET['category']): $my_cat = null; - $table->set_additional_parameters(array('category'=>$my_cat)); + $my_cat = isset($_GET['category']) ? Security::remove_XSS($_GET['category']) : null; + $table->set_additional_parameters(array('category' => $my_cat)); $column = 0; - if (api_is_allowed_to_edit(false,true) and count($group_list) > 1) - { - $table->set_header($column++,'', false); + if (api_is_allowed_to_edit(false, true) and count($group_list) > 1) { + $table->set_header($column++, '', false); } - $table->set_header($column++,get_lang('ExistingGroups')); - if (!api_is_allowed_to_edit(false,true)) // If self-registration allowed - { - $table->set_header($column++,get_lang('GroupSelfRegistration')); + $table->set_header($column++, get_lang('ExistingGroups')); + if (!api_is_allowed_to_edit(false, true)) { // If self-registration allowed + $table->set_header($column++, get_lang('GroupSelfRegistration')); } - $table->set_header($column++,get_lang('Registered')); - $table->set_header($column++,get_lang('MaximumOfParticipants')); - $table->set_header($column++,get_lang('GroupTutor')); - if (api_is_allowed_to_edit(false,true)) // only for course administrator - { - $table->set_header($column++,get_lang('Modify'), false); + $table->set_header($column++, get_lang('Registered')); + $table->set_header($column++, get_lang('MaximumOfParticipants')); + $table->set_header($column++, get_lang('GroupTutor')); + if (api_is_allowed_to_edit(false, true)) { // Only for course administrator + $table->set_header($column++, get_lang('Modify'), false); $form_actions = array(); $form_actions['delete_selected'] = get_lang('Delete'); $form_actions['fill_selected'] = get_lang('FillGroup'); $form_actions['empty_selected'] = get_lang('EmptyGroup'); - if (count($group_list) > 1) - { - $table->set_form_actions($form_actions,'group'); + if (count($group_list) > 1) { + $table->set_form_actions($form_actions, 'group'); } } $table->display(); } /* - elseif ($in_category) - { + elseif ($in_category) { echo get_lang('NoGroupsAvailable'); } */ } -/* -============================================================================== - FOOTER -============================================================================== -*/ -if (!isset ($_GET['origin']) || $_GET['origin'] != 'learnpath') -{ + +/* FOOTER */ + +if (!isset ($_GET['origin']) || $_GET['origin'] != 'learnpath') { Display::display_footer(); } -?> diff --git a/main/group/group_category.php b/main/group/group_category.php index 57ae294266..931fb4b72d 100755 --- a/main/group/group_category.php +++ b/main/group/group_category.php @@ -1,160 +1,121 @@ intval($groups_per_user)) - { + if (isset ($_POST['id']) && intval($groups_per_user) != GROUP_PER_MEMBER_NO_LIMIT && GroupManager :: get_current_max_groups_per_user($_POST['id']) > intval($groups_per_user)) { return false; } return true; } -if (api_get_setting('allow_group_categories') == 'true') -{ - if (isset ($_GET['id'])) - { +if (api_get_setting('allow_group_categories') == 'true') { + if (isset ($_GET['id'])) { $category = GroupManager :: get_category($_GET['id']); $nameTools = get_lang('EditGroupCategory').': '.$category['title']; - } - else - { + } else { $nameTools = get_lang('AddCategory'); - // default values for new category + // Default values for new category $category = array ('groups_per_user' => 1, 'doc_state' => TOOL_PRIVATE, 'work_state' => TOOL_PRIVATE, 'wiki_state' => TOOL_PRIVATE , 'chat_state' => TOOL_PRIVATE, 'calendar_state' => TOOL_PRIVATE, 'announcements_state'=> TOOL_PRIVATE, 'forum_state' => TOOL_PRIVATE, 'max_student' => 0); } -} -else -{ +} else { $category = GroupManager :: get_category($_GET['id']); $nameTools = get_lang('PropModify'); } -$interbreadcrumb[] = array ("url" => "group.php", "name" => get_lang('Groups')); + +$interbreadcrumb[] = array ('url' => 'group.php', 'name' => get_lang('Groups')); + // Build the form -if (isset ($_GET['id'])) -{ +if (isset ($_GET['id'])) { // Update settings of existing category $action = 'update_settings'; $form = new FormValidator('group_category', 'post', '?id='.$category['id']); $form->addElement('header','',$nameTools); $form->addElement('hidden', 'id'); -} -else -{ - //Checks if the field was created in the table Category. It creates it if is neccesary +} else { + // Checks if the field was created in the table Category. It creates it if is neccesary $table_category = Database :: get_course_table(TABLE_GROUP_CATEGORY); - if (Database::query("SELECT wiki_state FROM $table_category") == FALSE) { + if (!Database::query("SELECT wiki_state FROM $table_category")) { Database::query("ALTER TABLE $table_category ADD `wiki_state` tinyint(3) UNSIGNED NOT NULL default '1';"); } - - // Create a new category $action = 'add_category'; $form = new FormValidator('group_category'); } - $form->addElement('html', '

'.$nameTools); - $form->addElement('html', '
'); + +$form->addElement('html', '
'.$nameTools); +$form->addElement('html', '
'); // If categories allowed, show title & description field -if (api_get_setting('allow_group_categories') == 'true') -{ +if (api_get_setting('allow_group_categories') == 'true') { $form->add_textfield('title', get_lang('Title')); - $form->addElement('textarea', 'description', get_lang('Description'),array('cols'=>50,'rows'=>6)); -} -else -{ - $form->addElement('hidden','title'); - $form->addElement('hidden','description'); + $form->addElement('textarea', 'description', get_lang('Description'), array('cols' => 50, 'rows' => 6)); +} else { + $form->addElement('hidden', 'title'); + $form->addElement('hidden', 'description'); } + // Action $form->addElement('hidden', 'action'); + // Groups per user $group = array (); $group[] = & $form->createElement('static', null, null, get_lang('QtyOfUserCanSubscribe_PartBeforeNumber')); $possible_values = array (); -for ($i = 1; $i <= 10; $i ++) -{ +for ($i = 1; $i <= 10; $i ++) { $possible_values[$i] = $i; } $possible_values[GROUP_PER_MEMBER_NO_LIMIT] = get_lang('All'); $group[] = & $form->createElement('select', 'groups_per_user', null, $possible_values); $group[] = & $form->createElement('static', null, null, get_lang('QtyOfUserCanSubscribe_PartAfterNumber')); $form->addGroup($group, 'limit_group', get_lang('GroupLimit'), ' ', false); -$form->addRule('limit_group',get_lang('MaxGroupsPerUserInvalid'),'callback','check_groups_per_user'); +$form->addRule('limit_group', get_lang('MaxGroupsPerUserInvalid'), 'callback', 'check_groups_per_user'); // Default settings for new groups //$form->addElement('static', null, ''.get_lang('DefaultSettingsForNewGroups').''); -$form->addElement('html', '

'.get_lang('DefaultSettingsForNewGroups')); +$form->addElement('html', '

'.get_lang('DefaultSettingsForNewGroups')); $form->addElement('html', '
'); // Members per group -$form->addElement('radio', 'max_member_no_limit', get_lang('GroupLimit'), get_lang('NoLimit'),MEMBER_PER_GROUP_NO_LIMIT); +$form->addElement('radio', 'max_member_no_limit', get_lang('GroupLimit'), get_lang('NoLimit'), MEMBER_PER_GROUP_NO_LIMIT); $group = array (); -$group[] = & $form->createElement('radio', 'max_member_no_limit',null,get_lang('MaximumOfParticipants'),1); +$group[] = & $form->createElement('radio', 'max_member_no_limit', null, get_lang('MaximumOfParticipants'), 1); $group[] = & $form->createElement('text', 'max_member', null, array ('size' => 2)); $group[] = & $form->createElement('static', null, null, get_lang('GroupPlacesThis')); -$form->addGroup($group, 'max_member_group', null, '',false); -$form->addRule('max_member_group',get_lang('InvalidMaxNumberOfMembers'),'callback','check_max_number_of_members'); +$form->addGroup($group, 'max_member_group', null, '', false); +$form->addRule('max_member_group', get_lang('InvalidMaxNumberOfMembers'), 'callback', 'check_max_number_of_members'); + // Self registration $form->addElement('checkbox', 'self_reg_allowed', get_lang('GroupSelfRegistration'), get_lang('GroupAllowStudentRegistration'), 1); $form->addElement('checkbox', 'self_unreg_allowed', null, get_lang('GroupAllowStudentUnregistration'), 1); @@ -179,7 +140,7 @@ $form->addElement('radio', 'announcements_state', get_lang('GroupAnnouncements') $form->addElement('radio', 'announcements_state', null, get_lang('Public'), TOOL_PUBLIC); $form->addElement('radio', 'announcements_state', null, get_lang('Private'), TOOL_PRIVATE); -//Forum settings +// Forum settings $form->addElement('radio', 'forum_state', get_lang('GroupForum'), get_lang('NotAvailable'), TOOL_NOT_AVAILABLE); $form->addElement('radio', 'forum_state', null, get_lang('Public'), TOOL_PUBLIC); $form->addElement('radio', 'forum_state', null, get_lang('Private'), TOOL_PRIVATE); @@ -196,54 +157,48 @@ $form->addElement('radio', 'chat_state', null, get_lang('Private'), TOOL_PRIVATE // Submit $form->addElement('style_submit_button', 'submit', get_lang('PropModify'), 'class="save"'); + // If form validates -> save data -if ($form->validate()) -{ +if ($form->validate()) { $values = $form->exportValues(); - if ($values['max_member_no_limit'] == MEMBER_PER_GROUP_NO_LIMIT) - { + if ($values['max_member_no_limit'] == MEMBER_PER_GROUP_NO_LIMIT) { $max_member = MEMBER_PER_GROUP_NO_LIMIT; - } - else - { + } else { $max_member = $values['max_member']; } - $self_reg_allowed = isset ($values['self_reg_allowed']) ? $values['self_reg_allowed'] : 0; - $self_unreg_allowed = isset ($values['self_unreg_allowed']) ? $values['self_unreg_allowed'] : 0; - switch ($values['action']) - { - case 'update_settings' : + $self_reg_allowed = isset($values['self_reg_allowed']) ? $values['self_reg_allowed'] : 0; + $self_unreg_allowed = isset($values['self_unreg_allowed']) ? $values['self_unreg_allowed'] : 0; + switch ($values['action']) { + case 'update_settings': GroupManager :: update_category($values['id'], $values['title'], $values['description'], $values['doc_state'], $values['work_state'], $values['calendar_state'], $values['announcements_state'], $values['forum_state'], $values['wiki_state'], $values['chat_state'], $self_reg_allowed, $self_unreg_allowed, $max_member, $values['groups_per_user']); - $msg = urlencode(get_lang("GroupPropertiesModified")); + $msg = urlencode(get_lang('GroupPropertiesModified')); header('Location: group.php?action=show_msg&msg='.$msg.'&category='.$values['id']); break; - case 'add_category' : + case 'add_category': GroupManager :: create_category($values['title'], $values['description'], $values['doc_state'], $values['work_state'], $values['calendar_state'], $values['announcements_state'], $values['forum_state'], $values['wiki_state'], $values['chat_state'], $self_reg_allowed, $self_unreg_allowed, $max_member, $values['groups_per_user']); - $msg = urlencode(get_lang("CategoryCreated")); + $msg = urlencode(get_lang('CategoryCreated')); header('Location: group.php?action=show_msg&msg='.$msg); break; } } + // Else display the form -Display :: display_header($nameTools, "Group"); +Display :: display_header($nameTools, 'Group'); // actions bar echo '
'; -echo ''.Display::return_icon('back.png',get_lang('BackTo').' '.api_strtolower(get_lang('GroupOverview'))).' '.get_lang('BackTo').' '.api_strtolower(get_lang('GroupOverview')).''; +echo ''.Display::return_icon('back.png', get_lang('BackTo').' '.api_strtolower(get_lang('GroupOverview'))).' '.get_lang('BackTo').' '.api_strtolower(get_lang('GroupOverview')).''; echo '
'; $defaults = $category; $defaults['action'] = $action; -if( $defaults['max_student'] == MEMBER_PER_GROUP_NO_LIMIT) -{ +if ($defaults['max_student'] == MEMBER_PER_GROUP_NO_LIMIT) { $defaults['max_member_no_limit'] = MEMBER_PER_GROUP_NO_LIMIT; -} -else -{ +} else { $defaults['max_member_no_limit'] = 1; $defaults['max_member'] = $defaults['max_student']; } $form->setDefaults($defaults); $form->display(); + Display :: display_footer(); -?> \ No newline at end of file diff --git a/main/group/group_creation.php b/main/group/group_creation.php index 6d8e243baf..c3c588a26d 100755 --- a/main/group/group_creation.php +++ b/main/group/group_creation.php @@ -1,140 +1,91 @@ $group) - { - if (!empty($_POST['same_tutor'])) - { + foreach ($groups as $index => $group) { + if (!empty($_POST['same_tutor'])) { $group['tutor'] = $_POST['group_0_tutor']; } - if (!empty($_POST['same_places'])) - { + if (!empty($_POST['same_places'])) { $group['places'] = $_POST['group_0_places']; } - if (api_get_setting('allow_group_categories') == 'false') - { + if (api_get_setting('allow_group_categories') == 'false') { $group['category'] = DEFAULT_GROUP_CATEGORY; - } - elseif ($_POST['same_category']) - { + } elseif ($_POST['same_category']) { $group['category'] = $_POST['group_0_category']; } - GroupManager :: create_group(strip_tags($group['name']),$group['category'],$group['tutor'] , $group['places']); + GroupManager :: create_group(strip_tags($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' : + 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' : + 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' : + 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; } } + $nameTools = get_lang('GroupCreation'); -$interbreadcrumb[] = array ("url" => "group.php", "name" => get_lang('Groups')); -Display :: display_header($nameTools, "Group"); +$interbreadcrumb[] = array ('url' => 'group.php', 'name' => get_lang('Groups')); +Display :: display_header($nameTools, 'Group'); -if (!api_is_allowed_to_edit(false,true)) -{ +if (!api_is_allowed_to_edit(false, true)) { api_not_allowed(); } -/* -=============================================================================== - MAIN TOOL CODE -=============================================================================== -*/ -/* --------------------------------------- - 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) - { - + +/* MAIN TOOL CODE */ + +/* 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) { ?> - $tutor) - { - $tutor_options[$tutor['user_id']] = api_get_person_name($tutor['firstname'], $tutor['lastname']); - } - $cat_options = array (); - */ - foreach ($group_categories as $index => $category) - { - // Don't allow new groups in the virtual course category! - if ($category['id'] != VIRTUAL_COURSE_CATEGORY) - { - $cat_options[$category['id']] = $category['title']; + $tutor) { + $tutor_options[$tutor['user_id']] = api_get_person_name($tutor['firstname'], $tutor['lastname']); + } + $cat_options = array (); + */ + foreach ($group_categories as $index => $category) { + // Don't allow new groups in the virtual course category! + if ($category['id'] != VIRTUAL_COURSE_CATEGORY) { + $cat_options[$category['id']] = $category['title']; + } + } + $form = new FormValidator('create_groups_step2'); - // Modify the default templates - $renderer = & $form->defaultRenderer(); - $form_template = "
\n
\n\n{content}\n
\n
\n
"; - $renderer->setFormTemplate($form_template); - $element_template = <<defaultRenderer(); + $form_template = "
\n
\n\n{content}\n
\n
\n
"; + $renderer->setFormTemplate($form_template); + $element_template = << * {label} @@ -215,170 +161,147 @@ elseif (isset ($_POST['number_of_groups'])) EOT; - $renderer->setElementTemplate($element_template); - $form->addElement('header', '', $nameTools); + $renderer->setElementTemplate($element_template); + $form->addElement('header', '', $nameTools); - $form->addElement('hidden', 'action'); - $form->addElement('hidden', 'number_of_groups'); - $defaults = array (); - // Table heading - $group_el = array (); - $group_el[] = & $form->createElement('static', null, null, ''.get_lang('GroupName').''); - if (api_get_setting('allow_group_categories') == 'true') - { - $group_el[] = & $form->createElement('static', null, null, ''.get_lang('GroupCategory').''); - } - //$group_el[] = & $form->createElement('static', null, null, ''.get_lang('GroupTutor').''); - $group_el[] = & $form->createElement('static', null, null, ''.get_lang('GroupPlacesThis').''); - $form->addGroup($group_el, 'groups', null, "\n\n\n", false); - // Checkboxes - if ($_POST['number_of_groups'] > 1) - { + $form->addElement('hidden', 'action'); + $form->addElement('hidden', 'number_of_groups'); + $defaults = array (); + // Table heading $group_el = array (); - $group_el[] = & $form->createElement('static', null, null, ' '); - if (api_get_setting('allow_group_categories') == 'true') - { - $group_el[] = & $form->createElement('checkbox', 'same_category', null, get_lang('SameForAll'), array ('onclick' => "javascript:switch_state('category')")); + $group_el[] = & $form->createElement('static', null, null, ''.get_lang('GroupName').''); + if (api_get_setting('allow_group_categories') == 'true') { + $group_el[] = & $form->createElement('static', null, null, ''.get_lang('GroupCategory').''); } - //$group_el[] = & $form->createElement('checkbox', 'same_tutor', null, get_lang('SameForAll'), array ('onclick' => "javascript:switch_state('tutor')")); - $group_el[] = & $form->createElement('checkbox', 'same_places', null, get_lang('SameForAll'), array ('onclick' => "javascript:switch_state('places')")); - $form->addGroup($group_el, 'groups', null, '', false); - } - // Properties for all groups - for ($group_number = 0; $group_number < $_POST['number_of_groups']; $group_number ++) - { - $group_el = array (); - $group_el[] = & $form->createElement('text', 'group_'.$group_number.'_name'); - if (api_get_setting('allow_group_categories') == 'true') - { - $group_el[] = & $form->createElement('select', 'group_'.$group_number.'_category', null, $cat_options, array ('id' => 'category_'.$group_number)); - } - //$group_el[] = & $form->createElement('select', 'group_'.$group_number.'_tutor', null, $tutor_options, array ('id' => 'tutor_'.$group_number)); - $group_el[] = & $form->createElement('text', 'group_'.$group_number.'_places', null, array ('size' => 3, 'id' => 'places_'.$group_number)); - - - if($_POST['number_of_groups']<10000) - { - if ($group_id<10) - { - $prev='000'; - } - elseif ($group_id<100) - { - $prev='00'; + //$group_el[] = & $form->createElement('static', null, null, ''.get_lang('GroupTutor').''); + $group_el[] = & $form->createElement('static', null, null, ''.get_lang('GroupPlacesThis').''); + $form->addGroup($group_el, 'groups', null, "\n\n\n", false); + // Checkboxes + if ($_POST['number_of_groups'] > 1) { + $group_el = array (); + $group_el[] = & $form->createElement('static', null, null, ' '); + if (api_get_setting('allow_group_categories') == 'true') { + $group_el[] = & $form->createElement('checkbox', 'same_category', null, get_lang('SameForAll'), array('onclick' => "javascript: switch_state('category');")); } - elseif ($group_id<1000) - { - $prev='0'; + //$group_el[] = & $form->createElement('checkbox', 'same_tutor', null, get_lang('SameForAll'), array ('onclick' => "javascript: switch_state('tutor');")); + $group_el[] = & $form->createElement('checkbox', 'same_places', null, get_lang('SameForAll'), array ('onclick' => "javascript: switch_state('places');")); + $form->addGroup($group_el, 'groups', null, '', false); + } + // Properties for all groups + for ($group_number = 0; $group_number < $_POST['number_of_groups']; $group_number ++) { + $group_el = array (); + $group_el[] = & $form->createElement('text', 'group_'.$group_number.'_name'); + if (api_get_setting('allow_group_categories') == 'true') { + $group_el[] = & $form->createElement('select', 'group_'.$group_number.'_category', null, $cat_options, array('id' => 'category_'.$group_number)); } - else - { - $prev=''; + //$group_el[] = & $form->createElement('select', 'group_'.$group_number.'_tutor', null, $tutor_options, array('id' => 'tutor_'.$group_number)); + $group_el[] = & $form->createElement('text', 'group_'.$group_number.'_places', null, array('size' => 3, 'id' => 'places_'.$group_number)); + + if ($_POST['number_of_groups'] < 10000) { + if ($group_id < 10) { + $prev = '000'; + } elseif ($group_id < 100) { + $prev = '00'; + } elseif ($group_id<1000) { + $prev = '0'; + } else { + $prev = ''; + } } - } - - $defaults['group_'.$group_number.'_name'] = get_lang('GroupSingle').' '.$prev.$group_id ++; - - $form->addGroup($group_el, 'group_'.$group_number, null, '', false); - } - $defaults['action'] = 'create_groups'; - $defaults['number_of_groups'] = intval($_POST['number_of_groups']); - $form->setDefaults($defaults); - $form->addElement('style_submit_button', 'submit', get_lang('CreateGroup'), 'class="save"'); - $form->display(); + + $defaults['group_'.$group_number.'_name'] = get_lang('GroupSingle').' '.$prev.$group_id ++; + + $form->addGroup($group_el, 'group_'.$group_number, null, '', false); + } + $defaults['action'] = 'create_groups'; + $defaults['number_of_groups'] = intval($_POST['number_of_groups']); + $form->setDefaults($defaults); + $form->addElement('style_submit_button', 'submit', get_lang('CreateGroup'), 'class="save"'); + $form->display(); } -} -else -{ +} else { /* * Show form to generate new groups */ $categories = GroupManager :: get_categories(); //echo '
'; - if (count($categories) > 1 || isset ($categories[0]) && $categories[0]['id'] != VIRTUAL_COURSE_CATEGORY) - { + if (count($categories) > 1 || isset ($categories[0]) && $categories[0]['id'] != VIRTUAL_COURSE_CATEGORY) { $create_groups_form = new FormValidator('create_groups'); $create_groups_form->addElement('header', '', $nameTools); $group_el = array (); $group_el[] = & $create_groups_form->createElement('static', null, null, get_lang('Create')); - $group_el[] = & $create_groups_form->createElement('text', 'number_of_groups', null, array ('size' => 3)); + $group_el[] = & $create_groups_form->createElement('text', 'number_of_groups', null, array('size' => 3)); $group_el[] = & $create_groups_form->createElement('static', null, null, get_lang('NewGroups')); $group_el[] = & $create_groups_form->createElement('style_submit_button', 'submit', get_lang('ProceedToCreateGroup'), 'class="save"'); $create_groups_form->addGroup($group_el, 'create_groups', null, ' ', false); - $defaults = array (); + $defaults = array(); $defaults['number_of_groups'] = 1; $create_groups_form->setDefaults($defaults); $create_groups_form->display(); - } - else - { + } else { echo get_lang('NoCategoriesDefined'); } //echo '
'; + /* * Show form to generate groups from virtual courses */ $virtual_courses = CourseManager :: get_virtual_courses_linked_to_real_course($_course['sysCode']); - if (count($virtual_courses) > 0) - { + if (count($virtual_courses) > 0) { echo ''.get_lang('CreateGroupsFromVirtualCourses').''; echo '
'; echo get_lang('CreateGroupsFromVirtualCoursesInfo'); $create_virtual_groups_form = new FormValidator('create_virtual_groups'); $create_virtual_groups_form->addElement('hidden', 'action'); $create_virtual_groups_form->addElement('submit', 'submit', get_lang('Ok')); - $create_virtual_groups_form->setDefaults(array ('action' => 'create_virtual_groups')); + $create_virtual_groups_form->setDefaults(array('action' => 'create_virtual_groups')); $create_virtual_groups_form->display(); echo '
'; } + /* * Show form to generate subgroups */ - if (api_get_setting('allow_group_categories') == 'true' && count(GroupManager :: get_group_list()) > 0) - { + if (api_get_setting('allow_group_categories') == 'true' && count(GroupManager :: get_group_list()) > 0) { $base_group_options = array (); $groups = GroupManager :: get_group_list(); - foreach ($groups as $index => $group) - { + foreach ($groups as $index => $group) { $number_of_students = GroupManager :: number_of_students($group['id']); - if ($number_of_students > 0) - { + if ($number_of_students > 0) { $base_group_options[$group['id']] = $group['name'].' ('.$number_of_students.' '.get_lang('Users').')'; } } - if (count($base_group_options) > 0) - { + if (count($base_group_options) > 0) { echo ''.get_lang('CreateSubgroups').''; echo '
'; echo '

'.get_lang('CreateSubgroupsInfo').'

'; $create_subgroups_form = new FormValidator('create_subgroups'); $create_subgroups_form->addElement('hidden', 'action'); - $group_el = array (); + $group_el = array(); $group_el[] = & $create_subgroups_form->createElement('static', null, null, get_lang('CreateNumberOfGroups')); - $group_el[] = & $create_subgroups_form->createElement('text', 'number_of_groups', null, array ('size' => 3)); + $group_el[] = & $create_subgroups_form->createElement('text', 'number_of_groups', null, array('size' => 3)); $group_el[] = & $create_subgroups_form->createElement('static', null, null, get_lang('WithUsersFrom')); $group_el[] = & $create_subgroups_form->createElement('select', 'base_group', null, $base_group_options); $group_el[] = & $create_subgroups_form->createElement('submit', 'submit', get_lang('Ok')); $create_subgroups_form->addGroup($group_el, 'create_groups', null, ' ', false); - $defaults = array (); + $defaults = array(); $defaults['action'] = 'create_subgroups'; $create_subgroups_form->setDefaults($defaults); $create_subgroups_form->display(); echo '
'; } } + /* * Show form to generate groups from classes subscribed to the course */ $classes = ClassManager :: get_classes_in_course($_course['sysCode']); - if (count($classes) > 0) - { + if (count($classes) > 0) { echo ''.get_lang('GroupsFromClasses').''; echo '
'; echo '

'.get_lang('GroupsFromClassesInfo').'

'; echo '
    '; - foreach ($classes as $index => $class) - { + foreach ($classes as $index => $class) { $number_of_users = count(ClassManager :: get_users($class['id'])); echo '
  • '; echo $class['name']; @@ -389,22 +312,17 @@ else $create_class_groups_form = new FormValidator('create_class_groups_form'); $create_class_groups_form->addElement('hidden', 'action'); - if (api_get_setting('allow_group_categories') == 'true') - { + if (api_get_setting('allow_group_categories') == 'true') { $group_categories = GroupManager :: get_categories(); $cat_options = array (); - foreach ($group_categories as $index => $category) - { + foreach ($group_categories as $index => $category) { // Don't allow new groups in the virtual course category! - if ($category['id'] != VIRTUAL_COURSE_CATEGORY) - { + if ($category['id'] != VIRTUAL_COURSE_CATEGORY) { $cat_options[$category['id']] = $category['title']; } } $create_class_groups_form->addElement('select', 'group_category', null, $cat_options); - } - else - { + } else { $create_class_groups_form->addElement('hidden', 'group_category'); } $create_class_groups_form->addElement('submit', 'submit', get_lang('Ok')); @@ -415,10 +333,7 @@ else echo '
'; } } -/* -=============================================================================== - DOKEOS FOOTER -=============================================================================== -*/ + +/* FOOTER */ + Display :: display_footer(); -?> diff --git a/main/group/group_edit.php b/main/group/group_edit.php index b939e3ac9c..daa5eb5cf6 100755 --- a/main/group/group_edit.php +++ b/main/group/group_edit.php @@ -1,83 +1,48 @@ "group.php", "name" => get_lang('Groups')); +$interbreadcrumb[] = array ('url' => 'group.php', 'name' => get_lang('Groups')); if (!api_is_allowed_to_edit(false,true)) { api_not_allowed(true); } -/* -============================================================================== - FUNCTIONS -============================================================================== -*/ + +/* FUNCTIONS */ /** * function to sort users after getting the list in the db. Necessary because there are 2 or 3 queries. Called by usort() */ - function sort_users($user_a, $user_b) { if (api_sort_by_first_name()) { $cmp = api_strcmp($user_a['firstname'], $user_b['firstname']); @@ -117,6 +82,7 @@ function check_max_number_of_members($value) { $max_member = $value['max_member']; return is_numeric($max_member); } + /** * Function to check if the number of selected group members is valid */ @@ -129,17 +95,15 @@ function check_group_members($value) { } return true; } -/* -============================================================================== - MAIN CODE -============================================================================== -*/ + +/* MAIN CODE */ // Build form $form = new FormValidator('group_edit'); $form->addElement('header', '', $nameTools); $form->addElement('hidden', 'action'); $form->addElement('hidden', 'referer'); + // Group name $form->add_textfield('name', get_lang('GroupName')); @@ -160,9 +124,9 @@ $form->addElement('textarea', 'description', get_lang('Description'), array ('co // Members per group $form->addElement('radio', 'max_member_no_limit', get_lang('GroupLimit'), get_lang('NoLimit'), MEMBER_PER_GROUP_NO_LIMIT); -$group = array (); +$group = array(); $group[] = & $form->createElement('radio', 'max_member_no_limit', null, get_lang('MaximumOfParticipants'), 1); -$group[] = & $form->createElement('text', 'max_member', null, array ('size' => 2)); +$group[] = & $form->createElement('text', 'max_member', null, array('size' => 2)); $group[] = & $form->createElement('static', null, null, get_lang('GroupPlacesThis')); $form->addGroup($group, 'max_member_group', null, '', false); $form->addRule('max_member_group', get_lang('InvalidMaxNumberOfMembers'), 'callback', 'check_max_number_of_members'); @@ -206,27 +170,25 @@ $form->addElement('radio', 'chat_state', get_lang('Chat'), get_lang('NotAvailabl $form->addElement('radio', 'chat_state', null, get_lang('Public'), TOOL_PUBLIC); $form->addElement('radio', 'chat_state', null, get_lang('Private'), TOOL_PRIVATE); -// getting all the users +// Getting all the users if (isset($_SESSION['id_session'])) { - $complete_user_list = CourseManager :: get_user_list_from_course_code($_course['id'],true,$_SESSION['id_session']); - $complete_user_list2 = CourseManager :: get_coach_list_from_course_code($_course['id'],$_SESSION['id_session']); - $complete_user_list = array_merge($complete_user_list,$complete_user_list2); + $complete_user_list = CourseManager :: get_user_list_from_course_code($_course['id'], true, $_SESSION['id_session']); + $complete_user_list2 = CourseManager :: get_coach_list_from_course_code($_course['id'], $_SESSION['id_session']); + $complete_user_list = array_merge($complete_user_list, $complete_user_list2); } else { $complete_user_list = CourseManager :: get_user_list_from_course_code($_course['id']); } usort($complete_user_list, 'sort_users'); - -$possible_users = array (); +$possible_users = array(); foreach ($complete_user_list as $index => $user) { $possible_users[$user['user_id']] = api_get_person_name($user['firstname'], $user['lastname']).' ('.$user['username'].')'; } -//print_r($complete_user_list2); // Group tutors $group_tutor_list = GroupManager :: get_subscribed_tutors($current_group['id']); -$selected_users = array (); +$selected_users = array(); $selected_tutors = array(); foreach ($group_tutor_list as $index => $user) { //$possible_users[$user['user_id']] = api_get_person_name($user['firstname'], .$user['lastname']); @@ -247,8 +209,8 @@ $group_tutors_element->setElementTemplate(' '); -$group_tutors_element->setButtonAttributes('add',array('class'=>'arrowr')); -$group_tutors_element->setButtonAttributes('remove',array('class'=>'arrowl')); +$group_tutors_element->setButtonAttributes('add', array('class' => 'arrowr')); +$group_tutors_element->setButtonAttributes('remove', array('class' => 'arrowl')); // Group members $group_member_list = GroupManager :: get_subscribed_users($current_group['id']); @@ -272,8 +234,8 @@ $group_members_element->setElementTemplate(' '); -$group_members_element->setButtonAttributes('add',array('class'=>'arrowr')); -$group_members_element->setButtonAttributes('remove',array('class'=>'arrowl')); +$group_members_element->setButtonAttributes('add', array('class' => 'arrowr')); +$group_members_element->setButtonAttributes('remove', array('class' => 'arrowl')); $form->addFormRule('check_group_members'); // submit button @@ -286,31 +248,31 @@ if ($form->validate()) { } else { $max_member = $values['max_member']; } - $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); + $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); - // storing the tutors (we first remove all the tutors and then add only those who were selected) + // Storing the tutors (we first remove all the tutors and then add only those who were selected) GroupManager :: unsubscribe_all_tutors($current_group['id']); if (isset ($_POST['group_tutors']) && count($_POST['group_tutors']) > 0) { GroupManager :: subscribe_tutors($values['group_tutors'], $current_group['id']); } - // storing the users (we first remove all users and then add only those who were selected) + // Storing the users (we first remove all users and then add only those who were selected) GroupManager :: unsubscribe_all_users($current_group['id']); if (isset ($_POST['group_members']) && count($_POST['group_members']) > 0) { GroupManager :: subscribe_users($values['group_members'], $current_group['id']); } - // returning to the group area (note: this is inconsistent with the rest of dokeos) + // Returning to the group area (note: this is inconsistent with the rest of chamilo) $cat = GroupManager :: get_category_from_group($current_group['id']); header('Location: '.$values['referer'].'?action=show_msg&msg='.get_lang('GroupSettingsModified').'&category='.$cat['id']); - } + $defaults = $current_group; $defaults['group_members'] = $selected_users; $defaults['group_tutors'] = $selected_tutors; -isset($_GET['action'])?$action=$_GET['action']:$action=''; +$action = isset($_GET['action']) ? $_GET['action'] : ''; $defaults['action'] = $action; if ($defaults['maximum_number_of_students'] == MEMBER_PER_GROUP_NO_LIMIT) { $defaults['max_member_no_limit'] = MEMBER_PER_GROUP_NO_LIMIT; @@ -324,17 +286,18 @@ if ($referer != 'group_space.php' && $referer != 'group.php') { $referer = 'group.php'; } if (isset($_POST['group_members'])) { - if (count($_POST['group_members'])<=$defaults['max_member']) { + if (count($_POST['group_members']) <= $defaults['max_member']) { // } else { - header('Location:group_edit.php?show_message='.get_lang('GroupTooMuchMembers')); + header('Location:group_edit.php?show_message='.get_lang('GroupTooMuchMembers')); } } -Display :: display_header($nameTools, "Group"); + +Display :: display_header($nameTools, 'Group'); ?>
- +
setDefaults($defaults); $form->display(); -/* -============================================================================== - FOOTER -============================================================================== -*/ + +/* FOOTER */ + Display :: display_footer(); -?> diff --git a/main/group/group_overview.php b/main/group/group_overview.php index d19c160e3e..eba5fa50d7 100755 --- a/main/group/group_overview.php +++ b/main/group/group_overview.php @@ -1,76 +1,43 @@ - $group) - { + foreach ($groups as $index => $group) { $users = GroupManager::get_users($group['id']); - foreach($users as $index => $user) - { + foreach ($users as $index => $user) { $row = array(); $user = api_get_user_info($user); $row[] = $group['name']; @@ -80,7 +47,7 @@ if( isset($_GET['action'])) $data[] = $row; } } - switch($_GET['type']) { + switch ($_GET['type']) { case 'csv': Export::export_table_csv($data); exit; @@ -92,24 +59,24 @@ if( isset($_GET['action'])) } } -/* ------------------------------------------------------------ - Header ------------------------------------------------------------ -*/ -$interbreadcrumb[]=array("url" => "group.php","name" => get_lang('Groups')); -if (!isset ($_GET['origin']) || $_GET['origin'] != 'learnpath') -{ //so we are not in learnpath tool - if (! $is_allowed_in_course) api_not_allowed(true); - if (!api_is_allowed_to_edit(false,true)) api_not_allowed(true); - else Display::display_header($nameTools,"Group"); -} -else -{ -?> 'group.php', 'name' => get_lang('Groups')); +if (!isset ($_GET['origin']) || $_GET['origin'] != 'learnpath') { + // So we are not in learnpath tool + if (!$is_allowed_in_course) { + api_not_allowed(true); + } + if (!api_is_allowed_to_edit(false, true)) { + api_not_allowed(true); + } else { + Display::display_header($nameTools, 'Group'); + } +} else { +?> '; echo Display::return_icon('groupadd.gif', get_lang('NewGroupCreate')) . ''.get_lang('NewGroupCreate').''; echo Display::return_icon('group.gif', get_lang('Groups')) .''.get_lang('Groups').''; @@ -124,22 +91,18 @@ echo Display::return_icon('excel.gif', get_lang('ExportAsXLS')).' "group.php", "name" => get_lang("Groups")); +$this_section = SECTION_COURSES; +$nameTools = get_lang('GroupSpace'); +$interbreadcrumb[] = array ('url' => 'group.php', 'name' => get_lang('Groups')); -/* ------------------------------------------------------------ - Ensure all private groups // Juan Carlos Ra�a Trabado ------------------------------------------------------------ -*/ +/* Ensure all private groups // Juan Carlos Raña Trabado */ $forums_of_groups = get_forums_of_group($current_group['id']); -$forum_state_public=0; +$forum_state_public = 0; if (is_array($forums_of_groups)) { foreach ($forums_of_groups as $key => $value) { if($value['forum_group_public_private'] == 'public') { - $forum_state_public=1; + $forum_state_public = 1; } } } -if ($current_group['doc_state']!=1 and $current_group['calendar_state']!=1 and $current_group['work_state']!=1 and $current_group['announcements_state']!=1 and $current_group['wiki_state']!=1 and $current_group['chat_state']!=1 and $forum_state_public!=1) { - if (!api_is_allowed_to_edit(null,true) and !GroupManager :: is_user_in_group($_user['user_id'], $current_group['id'])) { +if ($current_group['doc_state'] != 1 && $current_group['calendar_state'] != 1 && $current_group['work_state'] != 1 && $current_group['announcements_state'] != 1 && $current_group['wiki_state'] != 1 && $current_group['chat_state'] != 1 && $forum_state_public != 1) { + if (!api_is_allowed_to_edit(null,true) && !GroupManager :: is_user_in_group($_user['user_id'], $current_group['id'])) { echo api_not_allowed($print_headers); } } -/* ------------------------------------------------------------ - Header ------------------------------------------------------------ -*/ -Display::display_header($nameTools.' '.stripslashes($current_group['name']),"Group"); -/* ------------------------------------------------------------ - Introduction section - (editable by course admin) ------------------------------------------------------------ -*/ +/* Header */ + +Display::display_header($nameTools.' '.stripslashes($current_group['name']), 'Group'); + +/* Introduction section (editable by course admin) */ + Display::display_introduction_section(group_space_.$_SESSION['_gid']); -/* ------------------------------------------------------------ - Actions and Action links ------------------------------------------------------------ -*/ +/* Actions and Action links */ + /* * User wants to register in this group */ @@ -124,38 +83,36 @@ echo ''.Display::return_icon('back.png',get_lang('BackToGrou /* * Edit the group */ -if (api_is_allowed_to_edit(false,true) or GroupManager :: is_tutor($_user['user_id'])) { - isset($origin)?$my_origin = $origin:$my_origin=''; - echo Display::return_icon('edit.gif', get_lang("EditGroup"))."".get_lang("EditGroup").""; +if (api_is_allowed_to_edit(false, true) or GroupManager :: is_tutor($_user['user_id'])) { + $my_origin = isset($origin) ? $origin : ''; + echo Display::return_icon('edit.gif', get_lang('EditGroup')).''.get_lang('EditGroup').''; } /* * Register to group */ if (GroupManager :: is_self_registration_allowed($_SESSION['_user']['user_id'], $current_group['id'])) { - echo ''.Display::return_icon('groupadd.gif').get_lang("RegIntoGroup").''; + echo ''.Display::return_icon('groupadd.gif').get_lang("RegIntoGroup").''; } /* * Unregister from group */ if (GroupManager :: is_self_unregistration_allowed($_SESSION['_user']['user_id'], $current_group['id'])) { - echo ''.Display::return_icon('group_delete.gif').get_lang("StudentUnsubscribe").''; + echo ''.Display::return_icon('group_delete.gif').get_lang("StudentUnsubscribe").''; } echo ' 
'; -if( isset($_GET['action'])) { - switch( $_GET['action']) { +if (isset($_GET['action'])) { + switch ($_GET['action']) { case 'show_msg': Display::display_normal_message(Security::remove_XSS($_GET['msg'])); break; } } -/* ------------------------------------------------------------ - Main Display Area ------------------------------------------------------------ -*/ + +/* Main Display Area */ + $course_code = $_course['sysCode']; $is_course_member = CourseManager :: is_user_subscribed_in_real_or_linked_course($_SESSION['_user']['user_id'], $course_code); @@ -167,174 +124,143 @@ $is_course_member = CourseManager :: is_user_subscribed_in_real_or_linked_course if (!empty($current_group['description'])) { echo '
'.stripslashes($current_group['description']).'
'; } + /* * Group Tools */ // If the user is subscribed to the group or the user is a tutor of the group then -if (api_is_allowed_to_edit(false,true) OR GroupManager :: is_user_in_group($_SESSION['_user']['user_id'], $current_group['id'])) { +if (api_is_allowed_to_edit(false, true) OR GroupManager :: is_user_in_group($_SESSION['_user']['user_id'], $current_group['id'])) { $tools = ''; - // link to the forum of this group + // Link to the forum of this group $forums_of_groups = get_forums_of_group($current_group['id']); if (is_array($forums_of_groups)) { - if ( $current_group['forum_state'] != TOOL_NOT_AVAILABLE ) { + if ($current_group['forum_state'] != TOOL_NOT_AVAILABLE ) { foreach ($forums_of_groups as $key => $value) { - if ($value['forum_group_public_private'] == 'public' || (/*!empty($user_subscribe_to_current_group) && */ $value['forum_group_public_private'] == 'private') || !empty($user_is_tutor) || api_is_allowed_to_edit(false,true)) { - - $tools.= Display::return_icon('forum.gif', get_lang("GroupForum")) . ' '.get_lang("Forum").': '.$value['forum_title'].'
'; - - //$tools.= Display::return_icon('forum.gif', get_lang("Forum")) . ' '.get_lang("Forum").': '.$value['forum_title'].'
'; - - } + if ($value['forum_group_public_private'] == 'public' || (/*!empty($user_subscribe_to_current_group) && */ $value['forum_group_public_private'] == 'private') || !empty($user_is_tutor) || api_is_allowed_to_edit(false, true)) { + $tools .= Display::return_icon('forum.gif', get_lang('GroupForum')) . ' '.get_lang('Forum').': '.$value['forum_title'].'
'; + //$tools .= Display::return_icon('forum.gif', get_lang('Forum')) . ' '.get_lang('Forum').': '.$value['forum_title'].'
'; + } } } } - if( $current_group['doc_state'] != TOOL_NOT_AVAILABLE ) - { - // link to the documents area of this group - $tools .= "
".Display::return_icon('folder_document.gif', get_lang("GroupDocument"))." ".get_lang("GroupDocument")."
"; + if ($current_group['doc_state'] != TOOL_NOT_AVAILABLE ) { + // Link to the documents area of this group + $tools .= '
'.Display::return_icon('folder_document.gif', get_lang('GroupDocument')).' '.get_lang('GroupDocument').'
'; } - if ( $current_group['calendar_state'] != TOOL_NOT_AVAILABLE) - { - //link to a group-specific part of agenda - $tools .= "
".Display::return_icon('agenda.gif', get_lang("GroupCalendar"))." ".get_lang("GroupCalendar")."
"; + if ($current_group['calendar_state'] != TOOL_NOT_AVAILABLE) { + // Link to a group-specific part of agenda + $tools .= '
'.Display::return_icon('agenda.gif', get_lang('GroupCalendar')).' '.get_lang('GroupCalendar').'
'; } - if ( $current_group['work_state'] != TOOL_NOT_AVAILABLE) - { - //link to the works area of this group - $tools .= "
".Display::return_icon('works.gif', get_lang("GroupWork"))." ".get_lang("GroupWork")."
"; + if ($current_group['work_state'] != TOOL_NOT_AVAILABLE) { + // Link to the works area of this group + $tools .= '
'.Display::return_icon('works.gif', get_lang('GroupWork')).' '.get_lang('GroupWork').'
'; } - if ( $current_group['announcements_state'] != TOOL_NOT_AVAILABLE) - { - //link to a group-specific part of announcements - $tools .= "
".Display::return_icon('valves.gif', get_lang("GroupAnnouncements"))." ".get_lang("GroupAnnouncements")."
"; + if ($current_group['announcements_state'] != TOOL_NOT_AVAILABLE) { + // Link to a group-specific part of announcements + $tools .= '
'.Display::return_icon('valves.gif', get_lang('GroupAnnouncements')).' '.get_lang('GroupAnnouncements').'
'; } - - if ( $current_group['wiki_state'] != TOOL_NOT_AVAILABLE) - { - //link to the wiki area of this group - $tools .= "
".Display::return_icon('wiki.gif', get_lang("GroupWiki"))." ".get_lang("GroupWiki")."
"; + if ($current_group['wiki_state'] != TOOL_NOT_AVAILABLE) { + // Link to the wiki area of this group + $tools .= '
'.Display::return_icon('wiki.gif', get_lang('GroupWiki')).' '.get_lang('GroupWiki').'
'; } - - if ( $current_group['chat_state'] != TOOL_NOT_AVAILABLE) - { - //link to the chat area of this group - if(api_get_course_setting('allow_open_chat_window')==true) - { - $tools .= "
".Display::return_icon('chat.gif', get_lang("Chat"))." ".get_lang("Chat")."
"; - } - else - { - $tools .= "
".Display::return_icon('chat.gif', get_lang("Chat"))." ".get_lang("Chat")."
"; + if ($current_group['chat_state'] != TOOL_NOT_AVAILABLE) { + // Link to the chat area of this group + if (api_get_course_setting('allow_open_chat_window')) { + $tools .= "
".Display::return_icon('chat.gif', get_lang('Chat'))." ".get_lang('Chat')."
"; + } else { + $tools .= "
".Display::return_icon('chat.gif', get_lang('Chat'))." ".get_lang('Chat')."
"; } } - echo '
'.get_lang("Tools").':
'; - if (!empty($tools)) - { + echo '
'.get_lang('Tools').':
'; + if (!empty($tools)) { echo '
'.$tools.'
'; } } else { $tools = ''; - // link to the forum of this group + // Link to the forum of this group $forums_of_groups = get_forums_of_group($current_group['id']); if (is_array($forums_of_groups)) { if ( $current_group['forum_state'] == TOOL_PUBLIC ) { foreach ($forums_of_groups as $key => $value) { if ($value['forum_group_public_private'] == 'public' ) { - - $tools.= Display::return_icon('forum.gif', get_lang("GroupForum")) . ' '.$value['forum_title'].'
'; - //$tools.= Display::return_icon('forum.gif', get_lang("Forum")) . ' '.get_lang("Forum").': '.$value['forum_title'].'
'; - + $tools.= Display::return_icon('forum.gif', get_lang('GroupForum')) . ' '.$value['forum_title'].'
'; + //$tools.= Display::return_icon('forum.gif', get_lang('Forum')) . ' '.get_lang("Forum").': '.$value['forum_title'].'
'; } } } } - if( $current_group['doc_state'] == TOOL_PUBLIC ) - { - // link to the documents area of this group - $tools .= "".Display::return_icon('folder_document.gif', get_lang("GroupDocument"))." ".get_lang("GroupDocument")."
"; + if ($current_group['doc_state'] == TOOL_PUBLIC) { + // Link to the documents area of this group + $tools .= ''.Display::return_icon('folder_document.gif', get_lang('GroupDocument')).' '.get_lang('GroupDocument').'
'; } - if ( $current_group['calendar_state'] == TOOL_PUBLIC ) - { - //link to a group-specific part of agenda - $tools .= "".Display::return_icon('agenda.gif', get_lang("GroupCalendar"))." ".get_lang("GroupCalendar")."
"; + if ($current_group['calendar_state'] == TOOL_PUBLIC) { + // Link to a group-specific part of agenda + $tools .= ''.Display::return_icon('agenda.gif', get_lang('GroupCalendar')).' '.get_lang('GroupCalendar').'
'; } - if ( $current_group['work_state'] == TOOL_PUBLIC ) - { - //link to the works area of this group - $tools .= "".Display::return_icon('works.gif', get_lang("GroupWork"))." ".get_lang("GroupWork")."
"; + if ($current_group['work_state'] == TOOL_PUBLIC) { + // Link to the works area of this group + $tools .= ''.Display::return_icon('works.gif', get_lang('GroupWork')).' '.get_lang('GroupWork').'
'; } - if ( $current_group['announcements_state'] == TOOL_PUBLIC) - { - //link to a group-specific part of announcements - $tools .= "".Display::return_icon('valves.gif', get_lang("GroupAnnouncements"))." ".get_lang("GroupAnnouncements")."
"; + if ($current_group['announcements_state'] == TOOL_PUBLIC) { + // Link to a group-specific part of announcements + $tools .= ''.Display::return_icon('valves.gif', get_lang('GroupAnnouncements')).' '.get_lang('GroupAnnouncements').'
'; } - - if ( $current_group['wiki_state'] == TOOL_PUBLIC ) - { - //link to the wiki area of this group - $tools .= "".Display::return_icon('wiki.gif', get_lang('GroupWiki'))." ".get_lang('GroupWiki')."
"; + if ($current_group['wiki_state'] == TOOL_PUBLIC) { + // Link to the wiki area of this group + $tools .= ''.Display::return_icon('wiki.gif', get_lang('GroupWiki')).' '.get_lang('GroupWiki').'
'; } - - if ( $current_group['chat_state'] == TOOL_PUBLIC ) - { - //link to the chat area of this group - if(api_get_course_setting('allow_open_chat_window')==true) - { + if ($current_group['chat_state'] == TOOL_PUBLIC ) { + // Link to the chat area of this group + if (api_get_course_setting('allow_open_chat_window')) { $tools .= "
".Display::return_icon('chat.gif', get_lang("Chat"))." ".get_lang("Chat")."
"; - } - else - { + } else { $tools .= "
".Display::return_icon('chat.gif', get_lang("Chat"))." ".get_lang("Chat")."
"; } } - echo '
'; + echo '
'; - echo '
'.get_lang("Tools").':
'; + echo '
'.get_lang('Tools').':
'; if (!empty($tools)) { echo '
'.$tools.'
'; } } /* - * list all the tutors of the current group + * List all the tutors of the current group */ $tutors = GroupManager::get_subscribed_tutors($current_group['id']); $tutor_info = ''; -if (count($tutors) == 0) -{ - $tutor_info = get_lang("GroupNoneMasc"); -} -else -{ +if (count($tutors) == 0) { + $tutor_info = get_lang('GroupNoneMasc'); +} else { isset($origin)?$my_origin = $origin:$my_origin=''; - foreach($tutors as $index => $tutor) - { - $image_path = UserManager::get_user_picture_path_by_id($tutor['user_id'],'web',false, true); + foreach($tutors as $index => $tutor) { + $image_path = UserManager::get_user_picture_path_by_id($tutor['user_id'], 'web', false, true); $image_repository = $image_path['dir']; $existing_image = $image_path['file']; - $photo= ''.api_get_person_name($tutor['firstname'], $tutor['lastname']).''; - $tutor_info .= "
".$photo." ".api_get_person_name($tutor['firstname'], $tutor['lastname'])."
"; + $photo= ''.api_get_person_name($tutor['firstname'], $tutor['lastname']).''; + $tutor_info .= '
'.$photo.' '.api_get_person_name($tutor['firstname'], $tutor['lastname']).'
'; } } -echo '
'.get_lang("GroupTutors").':
'; +echo '
'.get_lang('GroupTutors').':
'; if (!empty($tutor_info)) { echo '
'.$tutor_info.'
'; } -echo '
'; +echo '
'; /* - * list all the members of the current group + * List all the members of the current group */ echo ''.get_lang("GroupMembers").':'; $table = new SortableTable('group_users', 'get_number_of_group_users', 'get_group_user_data', (api_is_western_name_order() xor api_sort_by_first_name()) ? 2 : 1); -$my_cidreq=isset($_GET['cidReq']) ? Security::remove_XSS($_GET['cidReq']) : ''; -$my_origin=isset($_GET['origin']) ? Security::remove_XSS($_GET['origin']) : ''; -$my_gidreq=isset($_GET['gidReq']) ? Security::remove_XSS($_GET['gidReq']) : ''; +$my_cidreq = isset($_GET['cidReq']) ? Security::remove_XSS($_GET['cidReq']) : ''; +$my_origin = isset($_GET['origin']) ? Security::remove_XSS($_GET['origin']) : ''; +$my_gidreq = isset($_GET['gidReq']) ? Security::remove_XSS($_GET['gidReq']) : ''; $parameters = array('cidReq' => $my_cidreq, 'origin'=> $my_origin, 'gidReq' => $my_gidreq); $table->set_additional_parameters($parameters); $table->set_header(0, ''); @@ -346,15 +272,11 @@ if (api_is_western_name_order()) { $table->set_header(2, get_lang('FirstName')); } -if (api_get_setting("show_email_addresses") == "true") -{ +if (api_get_setting('show_email_addresses') == 'true') { $table->set_header(3, get_lang('Email')); $table->set_column_filter(3, 'email_filter'); -} -else -{ - if (api_is_allowed_to_edit()=="true") - { +} else { + if (api_is_allowed_to_edit() == 'true') { $table->set_header(3, get_lang('Email')); $table->set_column_filter(3, 'email_filter'); } @@ -370,14 +292,13 @@ $table->display(); * @author Patrick Cool , Ghent University, Belgium * @version April 2008 */ -function get_number_of_group_users() -{ +function get_number_of_group_users() { global $current_group; // Database table definition $table_group_user = Database :: get_course_table(TABLE_GROUP_USER); - // query + // Query $sql = "SELECT count(id) AS number_of_users FROM ".$table_group_user." WHERE group_id='".Database::escape_string($current_group['id'])."'"; @@ -398,18 +319,15 @@ function get_number_of_group_users() * @author Patrick Cool , Ghent University, Belgium * @version April 2008 */ -function get_group_user_data($from, $number_of_items, $column, $direction) -{ +function get_group_user_data($from, $number_of_items, $column, $direction) { global $current_group; // Database table definition $table_group_user = Database :: get_course_table(TABLE_GROUP_USER); $table_user = Database :: get_main_table(TABLE_MAIN_USER); - // query - - if (api_get_setting("show_email_addresses") == "true") { - + // Query + if (api_get_setting('show_email_addresses') == 'true') { $sql = "SELECT user.user_id AS col0, ".(api_is_western_name_order() ? @@ -425,11 +343,8 @@ function get_group_user_data($from, $number_of_items, $column, $direction) AND group_rel_user.group_id = '".Database::escape_string($current_group['id'])."'"; $sql .= " ORDER BY col$column $direction "; $sql .= " LIMIT $from,$number_of_items"; - } - else - { - if (api_is_allowed_to_edit()=="true") - { + } else { + if (api_is_allowed_to_edit()) { $sql = "SELECT user.user_id AS col0, ".(api_is_western_name_order() ? @@ -445,9 +360,7 @@ function get_group_user_data($from, $number_of_items, $column, $direction) AND group_rel_user.group_id = '".Database::escape_string($current_group['id'])."'"; $sql .= " ORDER BY col$column $direction "; $sql .= " LIMIT $from,$number_of_items"; - } - else - { + } else { $sql = "SELECT user.user_id AS col0, ". (api_is_western_name_order() ? @@ -465,10 +378,9 @@ function get_group_user_data($from, $number_of_items, $column, $direction) } } - $return = array (); + $return = array(); $result = Database::query($sql); - while ($row = Database::fetch_row($result)) - { + while ($row = Database::fetch_row($result)) { $return[] = $row; } return $return; @@ -479,8 +391,7 @@ function get_group_user_data($from, $number_of_items, $column, $direction) * @param string $email An email-address * @return string HTML-code with a mailto-link */ -function email_filter($email) -{ +function email_filter($email) { return Display :: encrypted_mailto_link($email, $email); } @@ -493,22 +404,18 @@ function email_filter($email) * @author Patrick Cool , Ghent University, Belgium * @version April 2008 */ -function user_icon_filter($user_id) -{ +function user_icon_filter($user_id) { global $origin; - - $userinfo=Database::get_user_info_from_id($user_id); - $image_path = UserManager::get_user_picture_path_by_id($user_id,'web',false, true); + $userinfo = Database::get_user_info_from_id($user_id); + $image_path = UserManager::get_user_picture_path_by_id($user_id, 'web', false, true); $image_repository = $image_path['dir']; $existing_image = $image_path['file']; - $photo= '
'.api_get_person_name($userinfo['firstname'], $userinfo['lastname']).'
'; - return "".$photo; + $photo = '
'.api_get_person_name($userinfo['firstname'], $userinfo['lastname']).'
'; + return '
'.$photo; } -// footer -isset($origin)?$orig=$origin:$orig=''; -if ($orig != 'learnpath') -{ +// Footer +$orig = isset($origin) ? $origin : ''; +if ($orig != 'learnpath') { Display::display_footer(); } -?>