diff --git a/main/gradebook/gradebook_flatview.php b/main/gradebook/gradebook_flatview.php index 13775af9e0..f628a653dd 100755 --- a/main/gradebook/gradebook_flatview.php +++ b/main/gradebook/gradebook_flatview.php @@ -1,95 +1,77 @@ '; //jQuery -$interbreadcrumb[]= array ( +$interbreadcrumb[] = array ( 'url' => $_SESSION['gradebook_dest'], - 'name' => get_lang('Gradebook' -)); + 'name' => get_lang('Gradebook') +); -$showeval= (isset ($_POST['showeval']) ? '1' : '0'); -$showlink= (isset ($_POST['showlink']) ? '1' : '0'); +$showeval = isset($_POST['showeval']) ? '1' : '0'; +$showlink = isset($_POST['showlink']) ? '1' : '0'; if (($showlink == '0') && ($showeval == '0')) { - $showlink= '1'; - $showeval= '1'; + $showlink = '1'; + $showeval = '1'; } -$cat= Category :: load($_REQUEST['selectcat']); + +$cat = Category::load($_REQUEST['selectcat']); if (isset($_GET['userid'])) { - $userid=Security::remove_XSS($_GET['userid']); + $userid = Security::remove_XSS($_GET['userid']); } else { - $userid=''; + $userid = ''; } if ($showeval) { - $alleval= $cat[0]->get_evaluations($userid, true); + $alleval = $cat[0]->get_evaluations($userid, true); } else { - $alleval=null; + $alleval = null; } if ($showlink) { - $alllinks= $cat[0]->get_links($userid, true); + $alllinks = $cat[0]->get_links($userid, true); } else { - $alllinks=null; + $alllinks = null; } - - -if (isset ($export_flatview_form) && (!$file_type == 'pdf')) { - Display :: display_normal_message($export_flatview_form->toHtml(),false); +if (isset($export_flatview_form) && (!$file_type == 'pdf')) { + Display :: display_normal_message($export_flatview_form->toHtml(), false); } + if (isset($_GET['selectcat'])) { - $category_id=Security::remove_XSS($_GET['selectcat']); + $category_id = Security::remove_XSS($_GET['selectcat']); } else { - $category_id=''; + $category_id = ''; } -$simple_search_form= new UserForm(UserForm :: TYPE_SIMPLE_SEARCH, null, 'simple_search_form', null, api_get_self() . '?selectcat=' .$category_id); -$values= $simple_search_form->exportValues(); +$simple_search_form = new UserForm(UserForm :: TYPE_SIMPLE_SEARCH, null, 'simple_search_form', null, api_get_self() . '?selectcat=' . $category_id); +$values = $simple_search_form->exportValues(); + $keyword = ''; if (isset($_GET['search']) && !empty($_GET['search'])) { $keyword = Security::remove_XSS($_GET['search']); @@ -98,28 +80,28 @@ if ($simple_search_form->validate() && (empty($keyword))) { $keyword = $values['keyword']; } - if (!empty($keyword)) { - $users= find_students($keyword); + $users = find_students($keyword); } else { if (isset($alleval) && isset($alllinks)) { - $users= get_all_users($alleval, $alllinks); - }else { - $users=null; + $users = get_all_users($alleval, $alllinks); + } else { + $users = null; } } + if (isset ($_GET['exportpdf'])) { - $interbreadcrumb[]= array ( - 'url' => api_get_self().'?selectcat=' . Security::remove_XSS($_GET['selectcat']), - 'name' => get_lang('FlatView') + $interbreadcrumb[] = array ( + 'url' => api_get_self().'?selectcat=' . Security::remove_XSS($_GET['selectcat']), + 'name' => get_lang('FlatView') ); - $export_pdf_form= new DataForm(DataForm :: TYPE_EXPORT_PDF, 'export_pdf_form', null, api_get_self() . '?exportpdf=&offset='.$_GET['offset'].'&selectcat=' . $_GET['selectcat'],'_blank'); + $export_pdf_form = new DataForm(DataForm :: TYPE_EXPORT_PDF, 'export_pdf_form', null, api_get_self() . '?exportpdf=&offset='.$_GET['offset'].'&selectcat=' . $_GET['selectcat'],'_blank'); if (!$export_pdf_form->validate()) { Display :: display_header(get_lang('ExportPDF')); } if ($export_pdf_form->validate()) { - $printable_data = get_printable_data ($users,$alleval, $alllinks); - $export= $export_pdf_form->exportValues(); + $printable_data = get_printable_data($users, $alleval, $alllinks); + $export = $export_pdf_form->exportValues(); $format = $export['orientation']; $pdf =& new Cezpdf('a4',$format); //format is 'portrait' or 'landscape' $clear_printable_data=array(); @@ -146,24 +128,24 @@ if (isset ($_GET['print'])) { exit; } -if(!empty($_POST['export_report']) && $_POST['export_report'] == 'export_report'){ - if(api_is_platform_admin() || api_is_course_admin() || api_is_course_coach()) { +if (!empty($_POST['export_report']) && $_POST['export_report'] == 'export_report') { + if (api_is_platform_admin() || api_is_course_admin() || api_is_course_coach()) { $user_id = null; - if(empty($_SESSION['export_user_fields'])) { + if (empty($_SESSION['export_user_fields'])) { $_SESSION['export_user_fields'] = false; } - if(!api_is_allowed_to_edit(false,false) and !api_is_course_tutor()) { + if (!api_is_allowed_to_edit(false, false) and !api_is_course_tutor()) { $user_id = api_get_user_id(); } - require_once('gradebook_result.class.php'); - $printable_data = get_printable_data ($users,$alleval, $alllinks); + require_once 'gradebook_result.class.php'; + $printable_data = get_printable_data($users, $alleval, $alllinks); switch($_POST['export_format']) { case 'xls': $export = new GradeBookResult(); - $export->exportCompleteReportXLS($printable_data ); + $export->exportCompleteReportXLS($printable_data); exit; break; case 'csv': @@ -178,13 +160,13 @@ if(!empty($_POST['export_report']) && $_POST['export_report'] == 'export_report' } } -$addparams= array ('selectcat' => $cat[0]->get_id()); +$addparams = array ('selectcat' => $cat[0]->get_id()); if (isset($_GET['search'])) { $addparams['search'] = $keyword; } -$offset = (isset($_GET['offset'])?$_GET['offset']:'0'); -$flatviewtable= new FlatViewTable($cat[0], $users, $alleval, $alllinks, true, $offset, $addparams); +$offset = isset($_GET['offset']) ? $_GET['offset'] : '0'; +$flatviewtable = new FlatViewTable($cat[0], $users, $alleval, $alllinks, true, $offset, $addparams); if (isset($_GET['exportpdf'])) { echo '