Browse Source

icons actions toolbar in assistance CT#7539

aragonc 9 years ago
parent
commit
da161f1474

+ 31 - 11
main/attendance/attendance_sheet.php

@@ -27,7 +27,7 @@ if (api_is_allowed_to_edit(null, true) ||
 
     $groupId = isset($_REQUEST['group_id']) ? intval($_REQUEST['group_id']) : null;
 
-    $form = new FormValidator(
+    /* $form = new FormValidator(
         'filter',
         'post',
         'index.php?action=attendance_sheet_list&' . api_get_cidreq() . $param_gradebook . '&attendance_id=' . $attendance_id,
@@ -35,7 +35,18 @@ if (api_is_allowed_to_edit(null, true) ||
         array(),
         FormValidator::LAYOUT_INLINE
     );
-
+    */
+     
+    
+    $form = new FormValidator(
+            'filter',
+            'post',
+            'index.php?action=attendance_sheet_list&' . api_get_cidreq() . $param_gradebook . '&attendance_id=' . $attendance_id,
+            null,
+            array(),
+            'inline'
+        );
+    
     $values = array(
         'all' => get_lang('All'),
         'today' => get_lang('Today'),
@@ -72,8 +83,15 @@ if (api_is_allowed_to_edit(null, true) ||
     if (!$exists_attendance_today) {
         Display::display_warning_message(get_lang('ThereIsNoClassScheduledTodayTryPickingAnotherDay'));
     }
-
-    $form->addElement('select', 'filter', get_lang('Filter'), $values, array('id' => 'filter_id'));
+    
+    $form->addSelect(
+            'filter',
+            get_lang('Filter'),
+            $values,
+            ['id' => 'filter_id', 'onchange' => 'submit();']
+    );
+    
+    //$form->addElement('select', 'filter', get_lang('Filter'), $values, array('id' => 'filter_id'));
 
     $groupList = GroupManager::get_group_list(null, null, 1);
     $groupIdList = array('--');
@@ -85,7 +103,7 @@ if (api_is_allowed_to_edit(null, true) ||
         $form->addSelect('group_id', get_lang('Group'), $groupIdList);
     }
 
-    $form->addButtonFilter(get_lang('Filter'));
+    //$form->addButtonFilter(get_lang('Filter'));
 
     if (isset($_REQUEST['filter'])) {
         if (in_array($_REQUEST['filter'], array_keys($values))) {
@@ -96,7 +114,7 @@ if (api_is_allowed_to_edit(null, true) ||
     }
 
     $renderer = $form->defaultRenderer();
-    $renderer->setCustomElementTemplate('{label} {element} ');
+    $renderer->setCustomElementTemplate('<div class="col-md-2">{label}</div><div class="col-md-10"> {element} </div>');
 
     $form->setDefaults(
         array(
@@ -106,15 +124,17 @@ if (api_is_allowed_to_edit(null, true) ||
     );
 
     if (!$is_locked_attendance || api_is_platform_admin()) {
-        echo '<div class="actions">';
-        echo '<a style="float:left;" href="index.php?'.api_get_cidreq().'&action=calendar_list&attendance_id='.$attendance_id.$param_gradebook.'">'.
+        
+        $actionsLeft = '<a style="float:left;" href="index.php?'.api_get_cidreq().'&action=calendar_list&attendance_id='.$attendance_id.$param_gradebook.'">'.
             Display::return_icon('attendance_calendar.png',get_lang('AttendanceCalendar'),'',ICON_SIZE_MEDIUM).'</a>';
-        echo '<a id="pdf_export" style="float:left;"  href="index.php?'.api_get_cidreq().'&action=attendance_sheet_export_to_pdf&attendance_id='.$attendance_id.$param_gradebook.'&filter='.$default_filter.'&group_id='.$groupId.'">'.
+        $actionsLeft .= '<a id="pdf_export" style="float:left;"  href="index.php?'.api_get_cidreq().'&action=attendance_sheet_export_to_pdf&attendance_id='.$attendance_id.$param_gradebook.'&filter='.$default_filter.'&group_id='.$groupId.'">'.
             Display::return_icon('pdf.png',get_lang('ExportToPDF'),'',ICON_SIZE_MEDIUM).'</a>';
         //if (count($users_in_course) > 0) {
-        $form->display();
+        $actionsRight = $form->returnForm();
         //}
-        echo '</div>';
+        
+        $toolbar = Display::toolbarAction('toolbar-attendance', array(0 => $actionsLeft, 1 => $actionsRight), 2 , false);
+        echo $toolbar;
     }
 
     $message_information = get_lang('AttendanceSheetDescription');

+ 8 - 4
main/inc/lib/display.lib.php

@@ -2104,7 +2104,7 @@ class Display
 
         return self::url("$icon $text", $url, $attributes);
     }
-    public static function toolbarAction($id, $content = array(), $col = 2)
+    public static function toolbarAction($id, $content = array(), $col = 2, $rigth = true)
     {
         $columns = 12/$col;
         $html = '';
@@ -2116,9 +2116,13 @@ class Display
             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>';
+                    if($rigth === true){
+                        $html .= '<div class="pull-right">';
+                        $html .= $content[$i];
+                        $html .= '</div>';
+                    } else {
+                        $html .= $content[$i];
+                    }
                 } else {
                     $html .= $content[$i];
                 }

+ 1 - 1
main/template/default/auth/courses_categories.php

@@ -139,7 +139,7 @@ $code = isset($code) ? $code : null;
             $form .= '<input type="hidden" name="pageLength" value="' . $pageLength . '">';
             $form .= '<div class="form-group">';
             $form .= '<div class="col-sm-12">';
-            $form .= '<select name="category_code" onchange="submit();" class="chzn-select form-control">';
+            $form .= '<select name="category_code" onchange="submit();" class="selectpicker show-tick form-control">';
             $codeType = isset($_REQUEST['category_code']) ? Security::remove_XSS($_REQUEST['category_code']) : '';
             foreach ($browse_course_categories[0] as $category) {
                 $categoryCode = $category['code'];