'; //jQuery $interbreadcrumb[] = array ('url' => $_SESSION['gradebook_dest'].'?selectcat=1', 'name' => get_lang('ToolGradebook')); $showeval = isset($_POST['showeval']) ? '1' : '0'; $showlink = isset($_POST['showlink']) ? '1' : '0'; if (($showlink == '0') && ($showeval == '0')) { $showlink = '1'; $showeval = '1'; } $cat = Category::load($_REQUEST['selectcat']); if (isset($_GET['userid'])) { $userid = Security::remove_XSS($_GET['userid']); } else { $userid = ''; } if ($showeval) { $alleval = $cat[0]->get_evaluations($userid, true); } else { $alleval = null; } if ($showlink) { $alllinks = $cat[0]->get_links($userid, true); } else { $alllinks = null; } 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']); } else { $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(); $keyword = ''; if (isset($_GET['search']) && !empty($_GET['search'])) { $keyword = Security::remove_XSS($_GET['search']); } if ($simple_search_form->validate() && (empty($keyword))) { $keyword = $values['keyword']; } if (!empty($keyword)) { $users = find_students($keyword); } else { if (isset($alleval) && isset($alllinks)) { $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') ); $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()) { // Beginning of PDF report creation $printable_data = get_printable_data($users, $alleval, $alllinks); $export = $export_pdf_form->exportValues(); // Reading report's CSS //$css_file = api_get_path(TO_SYS, WEB_CSS_PATH).api_get_setting('stylesheets').'/print.css'; $css_file = api_get_path(SYS_CODE_PATH).'gradebook/print.css'; $css = file_exists($css_file) ? @file_get_contents($css_file) : ''; // HTML report creation first $time = time(); $cat_name = trim($cat[0]->get_name()); $course_code = trim($cat[0]->get_course_code()); $report_name = $course_code; if (!empty($cat_name) && $report_name != $cat_name) { $report_name .= ' - '.$cat_name; } $organization = api_get_setting('Institution'); $creator = api_get_person_name($GLOBALS['_user']['firstName'], $GLOBALS['_user']['lastName']); $html = ''; if (!empty($organization)) { $html .= '
'.$report_name.'
'; $html .= ''.api_convert_and_format_date(date('Y-m-d', time()), 2).'
'; $html .= ''.get_lang('By').': '.$creator.'
'; $columns = count($printable_data[0]); $has_data = is_array($printable_data[1]) && count($printable_data[1]) > 0; if (api_is_western_name_order()) { // Choosing the right person name order according to the current language. list($printable_data[0][0], $printable_data[0][1]) = array($printable_data[0][1], $printable_data[0][0]); if ($has_data) { foreach ($printable_data[1] as &$printable_data_row) { list($printable_data_row[0], $printable_data_row[1]) = array($printable_data_row[1], $printable_data_row[0]); } } } $table = new HTML_Table(array('class' => 'data_table')); $row = 0; $column = 0; foreach ($printable_data[0] as $printable_data_cell) { $table->setHeaderContents($row, $column, $printable_data_cell); $column++; } $row++; if ($has_data) { foreach ($printable_data[1] as &$printable_data_row) { $column = 0; foreach ($printable_data_row as &$printable_data_cell) { $table->setCellContents($row, $column, $printable_data_cell); $table->updateCellAttributes($row, $column, 'align="center"'); $column++; } $table->updateRowAttributes($row, $row % 2 ? 'class="row_even"' : 'class="row_odd"', true); $row++; } } else { $column = 0; $table->setCellContents($row, $column, get_lang('NoResults')); $table->updateCellAttributes($row, $column, 'colspan="'.$columns.'" align="center" class="row_odd"'); } $html .= $table->toHtml(); $html .= '