diff --git a/main/forum/viewforum.php b/main/forum/viewforum.php index d21f97c748..0c33094326 100755 --- a/main/forum/viewforum.php +++ b/main/forum/viewforum.php @@ -214,7 +214,7 @@ if ($my_action == 'liststd' && 'url' => $forumUrl.'viewforum.php?'.$url.'&origin='.$origin.'&list=notqualify' ), ); - $table_list .= Display::tabs_only_link($tabs, $active); + $table_list .= Display::tabsOnlyLink($tabs, $active); $icon_qualify = 'blog_new.gif'; $table_list .= '

'; diff --git a/main/group/group.php b/main/group/group.php index 70f5183ebb..f732d29238 100755 --- a/main/group/group.php +++ b/main/group/group.php @@ -186,15 +186,14 @@ if (api_is_allowed_to_edit(false, true)) { echo ''. Display::return_icon('group_summary.png', get_lang('GroupOverview'), '', ICON_SIZE_MEDIUM).''; - echo ''. - Display::return_icon('user.png', get_lang('GoTo').' '.get_lang('Users'), '', ICON_SIZE_MEDIUM).''; - echo GroupManager::getSearchForm(); } $group_cats = GroupManager::get_categories(api_get_course_id()); echo ''; +echo UserManager::getUserSubscriptionTab(4); + /* List all categories */ if (api_get_setting('allow_group_categories') == 'true') { foreach ($group_cats as $index => $category) { diff --git a/main/inc/lib/display.lib.php b/main/inc/lib/display.lib.php index 970f8d2a7b..424af22068 100755 --- a/main/inc/lib/display.lib.php +++ b/main/inc/lib/display.lib.php @@ -1055,21 +1055,31 @@ class Display return $main_div ; } - public static function tabs_only_link($header_list, $selected = null) + /** + * @param $headers + * @param null $selected + * + * @return string + */ + public static function tabsOnlyLink($headers, $selected = null) { $id = uniqid(); $i = 1; $lis = null; - foreach ($header_list as $item) { + foreach ($headers as $item) { $class = null; if ($i == $selected) { $class = 'active'; } - $item =self::tag('a', $item['content'], array('id'=>$id.'-'.$i, 'href' => $item['url'])); - $lis .=self::tag('li', $item, array('class' => $class)); + $item = self::tag( + 'a', + $item['content'], + array('id' => $id.'-'.$i, 'href' => $item['url']) + ); + $lis .= self::tag('li', $item, array('class' => $class)); $i++; } - return self::tag('ul',$lis, array('class' => 'nav nav-tabs')); + return self::tag('ul', $lis, array('class' => 'nav nav-tabs')); } /** diff --git a/main/inc/lib/usermanager.lib.php b/main/inc/lib/usermanager.lib.php index 01fb1d19b0..e3220e73cd 100755 --- a/main/inc/lib/usermanager.lib.php +++ b/main/inc/lib/usermanager.lib.php @@ -5042,4 +5042,43 @@ SQL; return $users; } + /** + * @param int $optionSelected + * @return string + */ + public static function getUserSubscriptionTab($optionSelected = 1) + { + + if (api_get_setting('allow_user_course_subscription_by_course_admin') == 'true' || + api_is_platform_admin() + ) { + $userPath = api_get_path(WEB_CODE_PATH).'user/'; + + $headers = [ + [ + 'url' => $userPath.'user.php?'.api_get_cidreq(), + 'content' => get_lang('Users'), + ], + [ + 'url' => $userPath.'subscribe_user.php?'.api_get_cidreq(), + 'content' => get_lang('Students'), + ], + [ + 'url' => $userPath.'subscribe_user.php?type=teacher&'.api_get_cidreq(), + 'content' => get_lang('Teachers'), + ], + [ + 'url' => api_get_path(WEB_CODE_PATH).'group/group.php?'.api_get_cidreq(), + 'content' => get_lang('Groups'), + ], + [ + 'url' => $userPath.'class.php?'.api_get_cidreq(), + 'content' => get_lang('Classes'), + ], + ]; + + return Display::tabsOnlyLink($headers, $optionSelected); + } + } + } diff --git a/main/user/class.php b/main/user/class.php index 7c75171b11..5b068c9403 100755 --- a/main/user/class.php +++ b/main/user/class.php @@ -39,7 +39,7 @@ if (api_is_allowed_to_edit()) { echo ''; } -echo Display::page_header($tool_name); +echo UserManager::getUserSubscriptionTab(5); if (api_is_allowed_to_edit()) { $action = isset($_GET['action']) ? $_GET['action'] : null; @@ -68,9 +68,9 @@ $columns = array(get_lang('Name'), get_lang('Users'), get_lang('Actions')); //Column config $column_model = array( - array('name'=>'name', 'index'=>'name', 'width'=>'35', 'align'=>'left'), - array('name'=>'users', 'index'=>'users', 'width'=>'15', 'align'=>'left'), - array('name'=>'actions', 'index'=>'actions', 'width'=>'20', 'align'=>'left','sortable'=>'false'), + array('name'=>'name', 'index'=>'name', 'width'=>'35', 'align'=>'left'), + array('name'=>'users', 'index'=>'users', 'width'=>'15', 'align'=>'left'), + array('name'=>'actions', 'index'=>'actions', 'width'=>'20', 'align'=>'left','sortable'=>'false'), ); //Autowidth $extra_params['autowidth'] = 'true'; @@ -80,10 +80,10 @@ $extra_params['height'] = 'auto'; //With this function we can add actions to the jgrid $action_links = 'function action_formatter (cellvalue, options, rowObject) { - return \'' - .' ' - .' \'; - }'; + return \'' + .' ' + .' \'; +}'; ?> display_teacher_view(); Display :: display_footer(); diff --git a/main/user/subscribe_user.php b/main/user/subscribe_user.php index e71b0ff490..d4f755c276 100755 --- a/main/user/subscribe_user.php +++ b/main/user/subscribe_user.php @@ -55,6 +55,7 @@ if (api_get_setting('ProfilingFilterAddingUsers') == 'true') { display_extra_profile_fields_filter(); } + // Build search-form $form = new FormValidator('search_user', 'get', '', '', null, false); $renderer = $form->defaultRenderer(); @@ -66,6 +67,10 @@ $form->addElement('static', 'additionalactions', null, $actions); $form->display(); echo ''; + +$option = $type == 'teacher' ? 3 : 2; +echo UserManager::getUserSubscriptionTab($option); + /* MAIN SECTION */ diff --git a/main/user/user.php b/main/user/user.php index 14e6f92c42..ad7c435b6c 100755 --- a/main/user/user.php +++ b/main/user/user.php @@ -7,8 +7,6 @@ * * - show users registered in courses; * - - * @todo display table functions need support for align and valign (e.g. to center text in cells) (this is now possible) * @author Roan Embrechts * @author Julio Montoya Armas, Several fixes * @package chamilo.user @@ -447,82 +445,9 @@ if (!$is_allowed_in_course) { api_not_allowed(true); } -/* Header */ -if (isset($origin) && $origin == 'learnpath') { - Display::display_reduced_header(); -} else { - - if (isset($_GET['keyword']) && !empty($_GET['keyword'])) { - $interbreadcrumb[] = array ("url" => "user.php", "name" => get_lang("Users")); - $tool_name = get_lang('SearchResults'); - } else { - $tool_name = get_lang('Users'); - $origin = 'users'; - } - Display::display_header($tool_name, "User"); -} - // Statistics Event::event_access_tool(TOOL_USER); -/* Setting the permissions for this page */ -$is_allowed_to_track = ($is_courseAdmin || $is_courseTutor); - -// Tool introduction -Display::display_introduction_section(TOOL_USER, 'left'); -$actions = ''; -if (api_is_allowed_to_edit(null, true)) { - echo '
'; - - // the action links - if (api_get_setting('allow_user_course_subscription_by_course_admin') == 'true' or - api_is_platform_admin() - ) { - $actions .= ''. - Display::return_icon('user_subscribe_course.png',get_lang("SubscribeUserToCourse"),'',ICON_SIZE_MEDIUM).' '; - $actions .= "". - Display::return_icon('teacher_subscribe_course.png', get_lang("SubscribeUserToCourseAsTeacher"),'',ICON_SIZE_MEDIUM)." "; - } - $actions .= ''. - Display::return_icon('export_csv.png', get_lang('ExportAsCSV'),'',ICON_SIZE_MEDIUM).' '; - $actions .= ''. - Display::return_icon('export_excel.png', get_lang('ExportAsXLS'),'',ICON_SIZE_MEDIUM).' '; - - if (api_get_setting('allow_user_course_subscription_by_course_admin') == 'true' or - api_is_platform_admin() - ) { - $actions .= ''. - Display::return_icon('import_csv.png', get_lang('ImportUsersToACourse'),'',ICON_SIZE_MEDIUM).' '; - } - - $actions .= ''. - Display::return_icon('pdf.png', get_lang('ExportToPDF'),'',ICON_SIZE_MEDIUM).' '; - $actions .= "". - Display::return_icon('group.png', get_lang("GroupUserManagement"),'',ICON_SIZE_MEDIUM).""; - - if (api_get_setting('allow_user_course_subscription_by_course_admin') == 'true' or - api_is_platform_admin() - ) { - $actions .= ' '.get_lang('Classes').''; - } - - $allowTutors = api_get_setting('allow_tutors_to_assign_students_to_session'); - if (api_is_allowed_to_edit() && $allowTutors == 'true') { - $actions .= ' '.get_lang('Sessions').''; - } - - // Build search-form - $form = new FormValidator('search_user', 'get', '', '', null, FormValidator::LAYOUT_INLINE); - $form->addText('keyword', '', false); - $form->addButtonSearch(get_lang('SearchButton')); - $form->display(); - echo $actions; - echo '
'; -} - -if (isset($message)) { - Display::display_confirmation_message($message); -} /** * Get the users to display on the current page. @@ -954,6 +879,68 @@ if (api_is_allowed_to_edit(null, true)) { } } + +/* Header */ +if (isset($origin) && $origin == 'learnpath') { + Display::display_reduced_header(); +} else { + + if (isset($_GET['keyword']) && !empty($_GET['keyword'])) { + $interbreadcrumb[] = array ("url" => "user.php", "name" => get_lang("Users")); + $tool_name = get_lang('SearchResults'); + } else { + $tool_name = get_lang('Users'); + $origin = 'users'; + } + Display::display_header($tool_name, "User"); +} + +/* Setting the permissions for this page */ +$is_allowed_to_track = ($is_courseAdmin || $is_courseTutor); + +// Tool introduction +Display::display_introduction_section(TOOL_USER, 'left'); +$actions = ''; +if (api_is_allowed_to_edit(null, true)) { + echo '
'; + + $actions .= ''. + Display::return_icon('export_csv.png', get_lang('ExportAsCSV'),'',ICON_SIZE_MEDIUM).' '; + $actions .= ''. + Display::return_icon('export_excel.png', get_lang('ExportAsXLS'),'',ICON_SIZE_MEDIUM).' '; + + if (api_get_setting('allow_user_course_subscription_by_course_admin') == 'true' || + api_is_platform_admin() + ) { + $actions .= ''. + Display::return_icon('import_csv.png', get_lang('ImportUsersToACourse'),'',ICON_SIZE_MEDIUM).' '; + } + + $actions .= ''. + Display::return_icon('pdf.png', get_lang('ExportToPDF'),'',ICON_SIZE_MEDIUM).' '; + /*$actions .= "". + Display::return_icon('group.png', get_lang("GroupUserManagement"),'',ICON_SIZE_MEDIUM)."";*/ + + $allowTutors = api_get_setting('allow_tutors_to_assign_students_to_session'); + if (api_is_allowed_to_edit() && $allowTutors == 'true') { + $actions .= ' '.get_lang('Sessions').''; + } + + // Build search-form + $form = new FormValidator('search_user', 'get', '', '', null, FormValidator::LAYOUT_INLINE); + $form->addText('keyword', '', false); + $form->addButtonSearch(get_lang('SearchButton')); + $form->display(); + echo $actions; + echo '
'; +} + +echo UserManager::getUserSubscriptionTab(1); + +if (isset($message)) { + Display::display_confirmation_message($message); +} + $table->display(); if (!empty($_GET['keyword']) && !empty($_GET['submit'])) {