'; if ($page != 'statistics') { $header .= ''. Display::return_icon(('back.png'), get_lang('FolderView'), '', ICON_SIZE_MEDIUM).''; if (($evalobj->get_course_code() != null) && !$evalobj->has_results()) { $header .= ' ' . Display::return_icon('evaluation_rate.png', get_lang('AddResult'), '', ICON_SIZE_MEDIUM).''; } if (api_is_platform_admin() || $evalobj->is_locked() == false) { $header .= ''. Display::return_icon('import_evaluation.png', get_lang('ImportResult'), '', ICON_SIZE_MEDIUM).''; } if ($evalobj->has_results()) { $header .= ''. Display::return_icon('export_evaluation.png', get_lang('ExportResult'), '', ICON_SIZE_MEDIUM).''; if (api_is_platform_admin() || $evalobj->is_locked() == false) { $header .= ''. Display::return_icon('edit.png', get_lang('EditResult'), '', ICON_SIZE_MEDIUM).''; $header .= ''. Display::return_icon('delete.png', get_lang('DeleteResult'), '', ICON_SIZE_MEDIUM).''; } } $header .= ''. Display::return_icon('printer.png', get_lang('Print'), '', ICON_SIZE_MEDIUM).''; } else { $header .= ' '. Display::return_icon(('back.png'), get_lang('FolderView'), '', ICON_SIZE_MEDIUM).''; } $header .= ''; } if ($evalobj->is_visible() == '1') { $visible = get_lang('Yes'); } else { $visible = get_lang('No'); } $scoredisplay = ScoreDisplay::instance(); $student_score = ''; $average = ''; if (($evalobj->has_results())) { // TODO this check needed ? $score = $evalobj->calc_score(); if ($score != null) { $average = get_lang('Average').' : '.$scoredisplay->display_score($score, SCORE_AVERAGE).''; $student_score = $evalobj->calc_score(api_get_user_id()); $student_score = Display::tag( 'h3', get_lang('Score').': '.$scoredisplay->display_score($student_score, SCORE_DIV_PERCENT) ); } } $description = ""; if (!$evalobj->get_description() == '') { $description = get_lang('Description').' : '.$evalobj->get_description().'
'; } if ($evalobj->get_course_code() == null) { $course = get_lang('CourseIndependent'); } else { $course = CourseManager::getCourseNameFromCode($evalobj->get_course_code()); } $evalinfo = '
'; $evalinfo .= '

'.$evalobj->get_name().'


'; $evalinfo .= $description; $evalinfo .= get_lang('Course').' : '.$course.'
'; $evalinfo .= get_lang('QualificationNumeric').' : '.$evalobj->get_max().'
'.$average; if (!api_is_allowed_to_edit()) { $evalinfo .= $student_score; } if (!$evalobj->has_results()) { $evalinfo .= '
'.get_lang('NoResultsInEvaluation').''; } /* Code comment without reason elseif ($scoredisplay->is_custom() && api_get_self() != '/main/gradebook/gradebook_statistics.php') { if (api_is_allowed_to_edit(null, true)) { if ($page != 'statistics') { //$evalinfo .= '

'.Display::return_icon(('evaluation_rate.png'),get_lang('ViewResult'),'',ICON_SIZE_MEDIUM) . ''; } } } */ if ($page != 'statistics') { if (api_is_allowed_to_edit(null, true)) { $evalinfo .= '
'. Display::return_icon('statistics.png', get_lang('ViewStatistics'), '', ICON_SIZE_MEDIUM).''; } } $evalinfo .= '
'.Display::return_icon('tutorial.gif', '', ['style' => 'float:right; position:relative;']).'
'; echo $evalinfo; echo $header; } /** * Displays the header for the flatview page containing filters * @param $catobj * @param $showeval * @param $showlink */ public static function display_header_reduce_flatview($catobj, $showeval, $showlink, $simple_search_form) { $header = '
'; if ($catobj->get_parent_id() == 0) { $select_cat = $catobj->get_id(); $url = Security::remove_XSS($_SESSION['gradebook_dest']); } else { $select_cat = $catobj->get_parent_id(); $url = 'gradebook_flatview.php'; } $header .= ''. Display::return_icon('back.png', get_lang('FolderView'), '', ICON_SIZE_MEDIUM).''; $pageNum = isset($_GET['flatviewlist_page_nr']) ? intval($_GET['flatviewlist_page_nr']) : null; $perPage = isset($_GET['flatviewlist_per_page']) ? intval($_GET['flatviewlist_per_page']) : null; $offset = isset($_GET['offset']) ? $_GET['offset'] : '0'; $exportCsvUrl = api_get_self().'?'.api_get_cidreq().'&'.http_build_query([ 'export_format' => 'csv', 'export_report' => 'export_report', 'selectcat' => $catobj->get_id() ]); $header .= Display::url( Display::return_icon('export_csv.png', get_lang('ExportAsCSV'), '', ICON_SIZE_MEDIUM), $exportCsvUrl ); $exportXlsUrl = api_get_self().'?'.api_get_cidreq().'&'.http_build_query([ 'export_format' => 'xls', 'export_report' => 'export_report', 'selectcat' => $catobj->get_id() ]); $header .= Display::url( Display::return_icon('export_excel.png', get_lang('ExportAsXLS'), '', ICON_SIZE_MEDIUM), $exportXlsUrl ); $exportDocUrl = api_get_self().'?'.api_get_cidreq().'&'.http_build_query([ 'export_format' => 'doc', 'export_report' => 'export_report', 'selectcat' => $catobj->get_id() ]); $header .= Display::url( Display::return_icon('export_doc.png', get_lang('ExportAsDOC'), '', ICON_SIZE_MEDIUM), $exportDocUrl ); $exportPrintUrl = api_get_self().'?'.api_get_cidreq().'&'.http_build_query([ 'print' => '', 'selectcat' => $catobj->get_id(), ]); $header .= Display::url( Display::return_icon('printer.png', get_lang('Print'), '', ICON_SIZE_MEDIUM), $exportPrintUrl, ['target' => '_blank'] ); $exportPdfUrl = api_get_self().'?'.api_get_cidreq().'&'.http_build_query([ 'exportpdf' => '', 'selectcat' => $catobj->get_id(), 'offset' => $offset, 'flatviewlist_page_nr' => $pageNum, 'flatviewlist_per_page' => $perPage ]); $header .= Display::url( Display::return_icon('pdf.png', get_lang('ExportToPDF'), '', ICON_SIZE_MEDIUM), $exportPdfUrl ); $header .= '
'; echo $header; } /** * Displays the header for the gradebook containing the navigation tree and links * @param Category $catobj * @param int $showtree '1' will show the browse tree and naviation buttons * @param boolean $is_course_admin * @param boolean $is_platform_admin * @param boolean Whether to show or not the link to add a new qualification * (we hide it in case of the course-embedded tool where we have only one * calification per course or session) * @param boolean Whether to show or not the link to add a new item inside * the qualification (we hide it in case of the course-embedded tool * where we have only one calification per course or session) * @return void Everything is printed on screen upon closing */ public static function header( $catobj, $showtree, $selectcat, $is_course_admin, $is_platform_admin, $simple_search_form, $show_add_qualification = true, $show_add_link = true, $certificateLinkInfo = null ) { $userId = api_get_user_id(); $courseId = api_get_course_int_id(); $sessionId = api_get_session_id(); // Student. $status = CourseManager::getUserInCourseStatus($userId, $courseId); $sessionStatus = 0; if (!empty($sessionId)) { $sessionStatus = SessionManager::get_user_status_in_course_session( $userId, $courseId, $sessionId ); } $objcat = new Category(); $course_id = CourseManager::get_course_by_category($selectcat); $message_resource = $objcat->show_message_resource_delete($course_id); $grade_model_id = $catobj->get_grade_model_id(); $header = null; if (isset($catobj) && !empty($catobj)) { $categories = Category::load( null, null, null, $catobj->get_id(), null, $sessionId ); } if (!$is_course_admin && ($status <> 1 || $sessionStatus == 0) && $selectcat <> 0) { $catcourse = Category::load($catobj->get_id()); /** @var Category $category */ $category = $catcourse[0]; $main_weight = $category->get_weight(); $scoredisplay = ScoreDisplay::instance(); $allevals = $category->get_evaluations($userId, true); $alllinks = $category->get_links($userId, true); $allEvalsLinks = array_merge($allevals, $alllinks); $item_value_total = 0; $scoreinfo = null; for ($count = 0; $count < count($allEvalsLinks); $count++) { $item = $allEvalsLinks[$count]; $score = $item->calc_score($userId); if (!empty($score)) { $divide = $score[1] == 0 ? 1 : $score[1]; $item_value = $score[0] / $divide * $item->get_weight(); $item_value_total += $item_value; } } $item_total = $main_weight; $total_score = array($item_value_total, $item_total); $scorecourse_display = $scoredisplay->display_score($total_score, SCORE_DIV_PERCENT); if ((!$catobj->get_id() == '0') && (!isset($_GET['studentoverview'])) && (!isset($_GET['search']))) { $aditionalButtons = null; if (!empty($certificateLinkInfo)) { $aditionalButtons .= '
'; $aditionalButtons .= isset($certificateLinkInfo['certificate_link']) ? $certificateLinkInfo['certificate_link'] : ''; $aditionalButtons .= isset($certificateLinkInfo['badge_link']) ? $certificateLinkInfo['badge_link'] : ''; $aditionalButtons .= '
'; } $scoreinfo .= ''.sprintf(get_lang('TotalX'), $scorecourse_display.$aditionalButtons).''; } echo Display::return_message($scoreinfo, 'normal', false); } // show navigation tree and buttons? if ($showtree == '1' || isset($_GET['studentoverview'])) { $header = '
'; $header .= ''; if (!$selectcat == '0') { $header .= ''; } $header .= ''. ''; if (!empty($simple_search_form) && $message_resource === false) { $header .= ''; } else { $header .= ''; } if (!($is_course_admin && $message_resource === false && isset($_GET['selectcat']) && $_GET['selectcat'] != 0 ) && isset($_GET['studentoverview'])) { $header .= ''; $header .= '
'. Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('RootCat'), '', ICON_SIZE_MEDIUM).''.get_lang('CurrentCategory').'
'.$simple_search_form->toHtml().' '.Display::return_icon('pdf.png', get_lang('ExportPDF'), [], ICON_SIZE_MEDIUM).' ' . get_lang('ExportPDF').''; } $header .= '
'; } // for course admin & platform admin add item buttons are added to the header $actionsLeft = ''; $my_api_cidreq = api_get_cidreq(); if (api_is_allowed_to_edit(null, true)) { if (empty($grade_model_id) || $grade_model_id == -1) { $actionsLeft .= ''. Display::return_icon('new_folder.png', get_lang('AddGradebook'), array(), ICON_SIZE_MEDIUM).''; } if ($selectcat != '0') { $my_category = $catobj->shows_all_information_an_category($catobj->get_id()); if ($my_api_cidreq == '') { $my_api_cidreq = 'cidReq='.$my_category['course_code']; } if ($show_add_link && !$message_resource) { $actionsLeft .= ''. Display::return_icon('new_evaluation.png', get_lang('NewEvaluation'), '', ICON_SIZE_MEDIUM).''; $cats = Category::load($selectcat); if ($cats[0]->get_course_code() != null && !$message_resource) { $actionsLeft .= ''. Display::return_icon('new_online_evaluation.png', get_lang('MakeLink'), '', ICON_SIZE_MEDIUM).''; } else { $actionsLeft .= ''. Display::return_icon('new_online_evaluation.png', get_lang('MakeLink'), '', ICON_SIZE_MEDIUM).''; } } if (!$message_resource) { $actionsLeft .= ''. Display::return_icon('stats.png', get_lang('FlatView'), '', ICON_SIZE_MEDIUM).''; if ($my_category['generate_certificates'] == 1) { $actionsLeft .= Display::url( Display::return_icon( 'certificate_list.png', get_lang('GradebookSeeListOfStudentsCertificates'), '', ICON_SIZE_MEDIUM ), "gradebook_display_certificate.php?$my_api_cidreq&cat_id=".$selectcat ); } $actionsLeft .= Display::url( Display::return_icon( 'user.png', get_lang('GradebookListOfStudentsReports'), '', ICON_SIZE_MEDIUM ), "gradebook_display_summary.php?$my_api_cidreq&selectcat=".$selectcat ); // Right icons $actionsRight = ''. Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_MEDIUM).''; $actionsRight .= ''. Display::return_icon('certificate.png', get_lang('AttachCertificate'), '', ICON_SIZE_MEDIUM).''; if (empty($categories)) { $actionsRight .= ''. Display::return_icon('percentage.png', get_lang('EditAllWeights'), '', ICON_SIZE_MEDIUM).''; } $score_display_custom = api_get_setting('gradebook_score_display_custom'); if (api_get_setting('teachers_can_change_score_settings') == 'true' && $score_display_custom['my_display_custom'] == 'true') { $actionsRight .= ''. Display::return_icon('ranking.png', get_lang('ScoreEdit'), '', ICON_SIZE_MEDIUM).''; } } } } elseif (isset($_GET['search'])) { echo $header = ''.get_lang('SearchResults').' :'; } $isDrhOfCourse = CourseManager::isUserSubscribedInCourseAsDrh( api_get_user_id(), api_get_course_info() ); if ($isDrhOfCourse) { $$actionsLeft .= ''. Display::return_icon('stats.png', get_lang('FlatView'), '', ICON_SIZE_MEDIUM).''; } if (api_is_allowed_to_edit(null, true)) { echo $toolbar = Display::toolbarAction('gradebook-actions', array($actionsLeft, $actionsRight)); } if (api_is_allowed_to_edit(null, true)) { $weight = intval($catobj->get_weight()) > 0 ? $catobj->get_weight() : 0; $weight = ''.get_lang('TotalWeight').' : '.$weight; $min_certification = (intval($catobj->get_certificate_min_score() > 0) ? $catobj->get_certificate_min_score() : 0); $min_certification = get_lang('CertificateMinScore').' : '.$min_certification; $edit_icon = ''. Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL).''; //$msg = Display::tag('h3', $weight.' - '.$min_certification); $msg = $weight.' - '.$min_certification.$edit_icon; //@todo show description $description = (($catobj->get_description() == "" || is_null($catobj->get_description())) ? '' : ''.get_lang('GradebookDescriptionLog').''.': '.$catobj->get_description()); echo Display::return_message($msg, 'normal', false); if (!empty($description)) { echo Display::div($description, array()); } } } /** * @param Category $catobj * @param $is_course_admin * @param $is_platform_admin * @param $simple_search_form * @param bool $show_add_qualification * @param bool $show_add_link */ public function display_reduce_header_gradebook( $catobj, $is_course_admin, $is_platform_admin, $simple_search_form, $show_add_qualification = true, $show_add_link = true ) { //student if (!$is_course_admin) { $user = api_get_user_info(api_get_user_id()); $catcourse = Category::load($catobj->get_id()); $scoredisplay = ScoreDisplay::instance(); $scorecourse = $catcourse[0]->calc_score(api_get_user_id()); $scorecourse_display = (isset($scorecourse) ? $scoredisplay->display_score($scorecourse, SCORE_AVERAGE) : get_lang('NoResultsAvailable')); $cattotal = Category::load(0); $scoretotal = $cattotal[0]->calc_score(api_get_user_id()); $scoretotal_display = (isset($scoretotal) ? $scoredisplay->display_score($scoretotal, SCORE_PERCENT) : get_lang('NoResultsAvailable')); $scoreinfo = get_lang('StatsStudent').' : '.$user['complete_name'].'
'; if ((!$catobj->get_id() == '0') && (!isset($_GET['studentoverview'])) && (!isset($_GET['search']))) $scoreinfo .= '
'.get_lang('TotalForThisCategory').' : '.$scorecourse_display.''; $scoreinfo .= '
'.get_lang('Total').' : '.$scoretotal_display.''; Display::addFlash(Display::return_message($scoreinfo, 'normal', false)); } // show navigation tree and buttons? $header = '
'; if ($is_course_admin) { $header .= ''.Display::return_icon('stats.png', get_lang('FlatView'), '', ICON_SIZE_MEDIUM).''; $header .= ''.Display::return_icon('settings.png', get_lang('ScoreEdit'), '', ICON_SIZE_MEDIUM).''; } elseif (!(isset($_GET['studentoverview']))) { $header .= ''.Display::return_icon('view_list.gif', get_lang('FlatView')).' '.get_lang('FlatView').''; } else { $header .= ''.Display::return_icon('pdf.png', get_lang('ExportPDF'), '', ICON_SIZE_MEDIUM).''; } $header .= '
'; echo $header; } /** * @param $userId * @param $categoryId * @return string */ public static function display_header_user($userId, $categoryId) { $user = api_get_user_info($userId); if (empty($user)) { return ''; } $catcourse = Category::load($categoryId); $scoredisplay = ScoreDisplay::instance(); // generating the total score for a course $allevals = $catcourse[0]->get_evaluations($userId, true, api_get_course_id()); $alllinks = $catcourse[0]->get_links($userId, true, api_get_course_id()); $evals_links = array_merge($allevals, $alllinks); $item_value = 0; $item_total = 0; for ($count = 0; $count < count($evals_links); $count++) { $item = $evals_links[$count]; $score = $item->calc_score($userId); $my_score_denom = ($score[1] == 0) ? 1 : $score[1]; $item_value += $score[0] / $my_score_denom * $item->get_weight(); $item_total += $item->get_weight(); } $item_value = api_number_format($item_value, 2); $total_score = array($item_value, $item_total); $scorecourse_display = $scoredisplay->display_score($total_score, SCORE_DIV_PERCENT); $info = '
'; $info .= '
'; $info .= '
'; $info .= '
'; $info .= get_lang('Name').' : '. $user['complete_name'].'
'; if (api_get_setting('show_email_addresses') == 'true') { $info .= get_lang('Email').' : '.$user['email'].'
'; } $info .= get_lang('TotalUser').' : '.$scorecourse_display.''; $info .= '
'; $info .= '
'; echo $info; } }