add functions toolbar actions for pages

1.10.x
aragonc 9 years ago
parent 10e8ff1ed2
commit 666cb686fb
  1. 34
      main/group/group.php
  2. 24
      main/inc/lib/display.lib.php
  3. 32
      main/mySpace/student.php
  4. 18
      main/mySpace/teachers.php
  5. 16
      main/mySpace/users.php

@ -161,50 +161,48 @@ Display::display_header(get_lang('Groups'));
// Tool introduction
Display::display_introduction_section(TOOL_GROUP);
echo '<div class="actions">';
$actionsLeft = '';
echo '<div class="row">';
echo '<div class="col-md-6">';
if (api_is_allowed_to_edit(false, true)) {
echo '<a href="group_creation.php?'.api_get_cidreq().'">'.
$actionsLeft .= '<a href="group_creation.php?'.api_get_cidreq().'">'.
Display::return_icon('add.png', get_lang('NewGroupCreate'), '', ICON_SIZE_MEDIUM).'</a>';
if (api_get_setting('allow_group_categories') == 'true') {
echo '<a href="group_category.php?'.api_get_cidreq().'&action=add_category">'.
$actionsLeft .= '<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">'.
$actionsLeft .= '<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="import.php?'.api_get_cidreq().'&action=import">'.
$actionsLeft .= '<a href="import.php?'.api_get_cidreq().'&action=import">'.
Display::return_icon('import_csv.png', get_lang('Import'), '', ICON_SIZE_MEDIUM).'</a>';
echo '<a href="group_overview.php?'.api_get_cidreq().'&action=export_all&type=csv">'.
$actionsLeft .= '<a href="group_overview.php?'.api_get_cidreq().'&action=export_all&type=csv">'.
Display::return_icon('export_csv.png', get_lang('ExportAsCSV'), '', ICON_SIZE_MEDIUM).'</a>';
echo '<a href="group_overview.php?'.api_get_cidreq().'&action=export_all&type=xls">'.
$actionsLeft .= '<a href="group_overview.php?'.api_get_cidreq().'&action=export_all&type=xls">'.
Display::return_icon('export_excel.png', get_lang('ExportAsXLS'), '', ICON_SIZE_MEDIUM).'</a>';
echo '<a href="group_overview.php?'.api_get_cidreq().'&action=export_pdf">'.
$actionsLeft .= '<a href="group_overview.php?'.api_get_cidreq().'&action=export_pdf">'.
Display::return_icon('pdf.png', get_lang('ExportToPDF'), '', ICON_SIZE_MEDIUM).'</a>';
echo '<a href="group_overview.php?'.api_get_cidreq().'">'.
$actionsLeft .= '<a href="group_overview.php?'.api_get_cidreq().'">'.
Display::return_icon('group_summary.png', get_lang('GroupOverview'), '', ICON_SIZE_MEDIUM).'</a>';
}
echo '</div>';
echo '<div class="col-md-6">';
echo '<div class="pull-right">';
echo GroupManager::getSearchForm();
echo '</div>';
echo '</div>';
echo '</div>';
$actionsRight = GroupManager::getSearchForm();
$toolbar = Display::toolbarAction('toolbar-groups', $content = array( 0 => $actionsLeft, 1 => $actionsRight ));
$group_cats = GroupManager::get_categories(api_get_course_id());
echo '</div>';
echo $toolbar;
echo UserManager::getUserSubscriptionTab(3);
/* List all categories */

@ -2105,4 +2105,28 @@ class Display
return self::url("$icon $text", $url, $attributes);
}
public static function toolbarAction($id, $content = array(), $col = 2){
$columns = 12/$col;
$html = '';
$html .= '<div id="' . $id . '" class="actions">';
$html .= '<div class="row">';
if ($col > 4){
$html = '<div class="alert alert-warning" role="alert">Not exceeding four columns</div>';
}else{
for($i = 0; $i < $col; $i++){
$html .= '<div class="col-md-' . $columns . '">';
if ( $col == 2 && $i == 1 ) {
$html .= '<div class="pull-right">';
$html .= $content[$i];
$html .= '</div>';
} else {
$html .= $content[$i];
}
$html .= '</div>';
}
}
$html .= '</div>';
$html .= '</div>';
return $html;
}
}

@ -176,9 +176,7 @@ if ($export_csv) {
}
$sort_by_first_name = api_sort_by_first_name();
$actions = '<div class="actions">';
$actions .= '<div class="row">';
$actions .= '<div class="col-md-6">';
$actionsLeft = '';
if (api_is_drh()) {
$menu_items = array(
@ -196,23 +194,23 @@ if (api_is_drh()) {
$nb_menu_items = count($menu_items);
if ($nb_menu_items > 1) {
foreach ($menu_items as $key => $item) {
$actions .= $item;
$actionsLeft .= $item;
}
}
} else if (api_is_student_boss()) {
$actions .= Display::url(
$actionsLeft .= Display::url(
Display::return_icon('stats.png', get_lang('MyStats'), '', ICON_SIZE_MEDIUM),
api_get_path(WEB_CODE_PATH)."auth/my_progress.php"
);
$actions .= Display::url(
$actionsLeft .= Display::url(
Display::return_icon('user_na.png', get_lang('Students'), array(), ICON_SIZE_MEDIUM),
'#'
);
$actions .= Display::url(
$actionsLeft .= Display::url(
Display::return_icon("statistics.png", get_lang("CompanyReport"), array(), ICON_SIZE_MEDIUM),
api_get_path(WEB_CODE_PATH) . "mySpace/company_reports.php"
);
$actions .= Display::url(
$actionsLeft .= Display::url(
Display::return_icon(
"certificate_list.png",
get_lang("GradebookSeeListOfStudentsCertificates"),
@ -222,21 +220,19 @@ if (api_is_drh()) {
api_get_path(WEB_CODE_PATH) . "gradebook/certificate_report.php"
);
}
$actions .= '</div>';
$actions .= '<div class="col-md-6">';
$actions .= '<div class="pull-right">';
$actions .= Display::url(
$actionsRight = '';
$actionsRight .= Display::url(
Display::return_icon('printer.png', get_lang('Print'), array(), ICON_SIZE_MEDIUM), 'javascript: void(0);',
array('onclick'=>'javascript: window.print();')
);
$actions .= Display::url(
$actionsRight .= Display::url(
Display::return_icon('export_csv.png', get_lang('ExportAsCSV'), array(), ICON_SIZE_MEDIUM),
api_get_self().'?export=csv&keyword='.$keyword
);
$actions .= '</div>';
$actions .= '</div>';
$actions .= '</div>';
$actions .= '</div>';
$toolbar = Display::toolbarAction('toolbar-student', $content = array( 0 => $actionsLeft, 1 => $actionsRight ));
$table = new SortableTable(
'tracking_student',
@ -300,7 +296,7 @@ if ($export_csv) {
exit;
} else {
Display::display_header($nameTools);
echo $actions;
echo $toolbar;
$page_title = get_lang('Students');
echo Display::page_subheader($page_title);
if (isset($active)) {

@ -178,8 +178,7 @@ if ($export_csv) {
}
$sort_by_first_name = api_sort_by_first_name();
$actions = '<div class="actions">';
$actionsLeft = '';
if (api_is_drh()) {
$menu_items = array(
Display::url(Display::return_icon('stats.png', get_lang('MyStats'), '', ICON_SIZE_MEDIUM), api_get_path(WEB_CODE_PATH)."auth/my_progress.php" ),
@ -192,23 +191,24 @@ if (api_is_drh()) {
$nb_menu_items = count($menu_items);
if ($nb_menu_items > 1) {
foreach ($menu_items as $key => $item) {
$actions .= $item;
$actionsLeft .= $item;
}
}
}
$actions .= '&nbsp;<span style="float:right">';
$actions .= Display::url(
$actionsRight = '';
$actionsRight .= Display::url(
Display::return_icon('printer.png', get_lang('Print'), array(), ICON_SIZE_MEDIUM),
'javascript: void(0);',
array('onclick'=>'javascript: window.print();')
);
$actions .= Display::url(
$actionsRight .= Display::url(
Display::return_icon('export_csv.png', get_lang('ExportAsCSV'), array(), ICON_SIZE_MEDIUM),
api_get_self().'?export=csv&keyword='.$keyword
);
$actions .= '</span>';
$actions .= '</div>';
$toolbar = Display::toolbarAction('toolbar-teachers', $content = array( 0 => $actionsLeft, 1 => $actionsRight ));
$table = new SortableTable(
'tracking_teachers',
@ -271,7 +271,7 @@ if ($export_csv) {
exit;
} else {
Display::display_header($nameTools);
echo $actions;
echo $toolbar;
$page_title = get_lang('Teachers');
echo Display::page_subheader($page_title);
if (isset($active)) {

@ -179,7 +179,7 @@ if ($export_csv) {
}
$sort_by_first_name = api_sort_by_first_name();
$actions = '<div class="actions">&nbsp;';
$actionsLeft = '';
if (api_is_drh()) {
$menu_items = array(
@ -193,16 +193,16 @@ if (api_is_drh()) {
$nb_menu_items = count($menu_items);
if ($nb_menu_items > 1) {
foreach ($menu_items as $key => $item) {
$actions .= $item;
$actionsLeft .= $item;
}
}
}
$actions .= '<span style="float:right">';
$actions .= Display::url(Display::return_icon('printer.png', get_lang('Print'), array(), ICON_SIZE_MEDIUM), 'javascript: void(0);', array('onclick'=>'javascript: window.print();'));
$actions .= Display::url(Display::return_icon('export_csv.png', get_lang('ExportAsCSV'), array(), ICON_SIZE_MEDIUM), api_get_self().'?export=csv&keyword='.$keyword);
$actions .= '</span>';
$actions .= '</div>';
$actionsRight = Display::url(Display::return_icon('printer.png', get_lang('Print'), array(), ICON_SIZE_MEDIUM), 'javascript: void(0);', array('onclick'=>'javascript: window.print();'));
$actionsRight .= Display::url(Display::return_icon('export_csv.png', get_lang('ExportAsCSV'), array(), ICON_SIZE_MEDIUM), api_get_self().'?export=csv&keyword='.$keyword);
$toolbar = Display::toolbarAction('toolbar-user', $content = array( 0 => $actionsLeft, 1 => $actionsRight ));
$table = new SortableTable(
'tracking_student',
@ -274,7 +274,7 @@ if ($export_csv) {
exit;
} else {
Display::display_header(get_lang('Users'));
echo $actions;
echo $toolbar;
$page_title = get_lang('Users');
echo Display::page_subheader($page_title);
if (isset($active)) {

Loading…
Cancel
Save