diff --git a/main/gradebook/lib/fe/dataform.class.php b/main/gradebook/lib/fe/dataform.class.php index f302764df5..3219bc0379 100755 --- a/main/gradebook/lib/fe/dataform.class.php +++ b/main/gradebook/lib/fe/dataform.class.php @@ -44,8 +44,8 @@ class DataForm extends FormValidator $this->setDefaults(); } - - protected function build_pdf_export_form() { + protected function build_pdf_export_form() + { $renderer =& $this->defaultRenderer(); $renderer->setElementTemplate('{element}'); $this->addElement('header', get_lang('ChooseOrientation')); @@ -57,7 +57,8 @@ class DataForm extends FormValidator )); } - protected function build_export_form() { + protected function build_export_form() + { $this->addElement('header', get_lang('ChooseFormat')); $this->addElement('radio', 'file_type', get_lang('OutputFileType'), 'CSV (Comma-Separated Values)', 'csv'); $this->addElement('radio', 'file_type', null, 'XML (Extensible Markup Language)', 'xml'); @@ -68,7 +69,8 @@ class DataForm extends FormValidator )); } - protected function build_export_form_option($show_pdf=true) { + protected function build_export_form_option($show_pdf=true) + { $this->addElement('header', get_lang('ChooseFormat')); $this->addElement('radio', 'file_type', get_lang('OutputFileType'), 'CSV (Comma-Separated Values)', 'csv'); $this->addElement('radio', 'file_type', null, 'XML (Extensible Markup Language)', 'xml'); @@ -79,7 +81,8 @@ class DataForm extends FormValidator )); } - protected function build_import_form() { + protected function build_import_form() + { $this->addElement('hidden', 'formSent'); $this->addElement('header', get_lang('ImportFileLocation')); $this->addElement('file', 'import_file',get_lang('Location')); @@ -99,11 +102,13 @@ class DataForm extends FormValidator )); } - function display() { + public function display() + { parent :: display(); } - function setDefaults($defaults = array(), $filter = null) { + public function setDefaults($defaults = array(), $filter = null) + { parent :: setDefaults($defaults, $filter); } } diff --git a/main/gradebook/lib/fe/displaygradebook.php b/main/gradebook/lib/fe/displaygradebook.php index 722b2a6827..1688d24dd7 100755 --- a/main/gradebook/lib/fe/displaygradebook.php +++ b/main/gradebook/lib/fe/displaygradebook.php @@ -7,7 +7,6 @@ */ class DisplayGradebook { - /** * Displays the header for the result page containing the navigation tree and links * @param $evalobj @@ -15,13 +14,14 @@ class DisplayGradebook * @param $shownavbar 1=show navigation bar * @param $forpdf only output for pdf file */ - static function display_header_result($evalobj, $selectcat, $page) + public static function display_header_result($evalobj, $selectcat, $page) { $header = null; if (api_is_allowed_to_edit(null, true)) { $header = '
'; if ($page != 'statistics') { - $header .= '' . Display::return_icon(('back.png'), get_lang('FolderView'), '', ICON_SIZE_MEDIUM) . ''; + $header .= '' . + Display::return_icon(('back.png'), get_lang('FolderView'), '', ICON_SIZE_MEDIUM) . ''; if ($evalobj->get_course_code() == null) { //Disabling code when course code is null see issue #2705 //$header .= '' . get_lang('AddStudent') . ' ' . get_lang('AddStudent') . ''; @@ -31,21 +31,26 @@ class DisplayGradebook } if (api_is_platform_admin() || $evalobj->is_locked() == false) { - $header .= '' . Display::return_icon('import_evaluation.png', get_lang('ImportResult'), '', ICON_SIZE_MEDIUM) . ''; + $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) . ''; + $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('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) . ''; + $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 .= ' ' . + Display::return_icon(('back.png'), get_lang('FolderView'), '', ICON_SIZE_MEDIUM) . ''; } $header .= '
'; } @@ -66,7 +71,10 @@ class DisplayGradebook 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)); + $student_score = Display::tag( + 'h3', + get_lang('Score') . ': ' . $scoredisplay->display_score($student_score, SCORE_DIV_PERCENT) + ); } } $description = ""; @@ -116,7 +124,7 @@ class DisplayGradebook * @param $showeval * @param $showlink */ - function display_header_flatview($catobj, $showeval, $showlink, $simple_search_form) + public function display_header_flatview($catobj, $showeval, $showlink, $simple_search_form) { $header = ''; $header .= ''; @@ -159,7 +167,7 @@ class DisplayGradebook * @param $showeval * @param $showlink */ - static function display_header_reduce_flatview($catobj, $showeval, $showlink, $simple_search_form) + public static function display_header_reduce_flatview($catobj, $showeval, $showlink, $simple_search_form) { $header = '
'; if ($catobj->get_parent_id() == 0) { @@ -187,7 +195,17 @@ class DisplayGradebook echo $header; } - function display_header_gradebook_per_gradebook($catobj, $showtree, $selectcat, $is_course_admin, $is_platform_admin, $simple_search_form, $show_add_qualification = true, $show_add_link = true) + /** + * @param Category $catobj + * @param $showtree + * @param $selectcat + * @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_header_gradebook_per_gradebook($catobj, $showtree, $selectcat, $is_course_admin, $is_platform_admin, $simple_search_form, $show_add_qualification = true, $show_add_link = true) { // Student $status = CourseManager::get_user_in_course_status(api_get_user_id(), api_get_course_id()); @@ -448,7 +466,8 @@ class DisplayGradebook $header = '
' . Display::return_icon('gradebook.gif') . get_lang('Gradebook') . '
'; $header .= ''; if (!$selectcat == '0') { - $header .= ''; + $header .= ''; } $header .= '' . ''; + $header .= '' . + Display::return_icon('new_folder.png', get_lang('AddGradebook'), array(), ICON_SIZE_MEDIUM) . ''; } if ($selectcat == '0') { - if ($show_add_qualification === true) { - } - if ($show_add_link) { - //$header .= ''; - } $my_category = $catobj->shows_all_information_an_category($catobj->get_id()); $my_api_cidreq = api_get_cidreq(); @@ -525,38 +537,37 @@ class DisplayGradebook $my_api_cidreq = 'cidReq=' . $my_category['course_code']; } if ($show_add_link && !$message_resource) { - $header .= '
' . Display::return_icon('back.png', get_lang('BackTo') . ' ' . get_lang('RootCat'), '', ICON_SIZE_MEDIUM) . '' . + Display::return_icon('back.png', get_lang('BackTo') . ' ' . get_lang('RootCat'), '', ICON_SIZE_MEDIUM) . '' . get_lang('CurrentCategory') . '
' . get_lang('NewEvaluation') . ' ' . get_lang('NewEvaluation') . ''; - } } else { - if ($show_add_qualification === true && $message_resource === false) { - //$header .= '' . get_lang('NewSubCategory') . ' ' . get_lang('NewSubCategory') . '' . Display::return_icon('new_evaluation.png', get_lang('NewEvaluation'), '', ICON_SIZE_MEDIUM) . ''; + $header .= '' . + 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) { - //$header .= '' . get_lang('MakeLink') . ' ' . get_lang('MakeLink') . ''; - $header .= '' . Display::return_icon('new_online_evaluation.png', get_lang('MakeLink'), '', ICON_SIZE_MEDIUM) . ''; + $header .= '' . + Display::return_icon('new_online_evaluation.png', get_lang('MakeLink'), '', ICON_SIZE_MEDIUM) . ''; } else { - $header .= '' . Display::return_icon('new_online_evaluation.png', get_lang('MakeLink'), '', ICON_SIZE_MEDIUM) . ''; + $header .= '' . + Display::return_icon('new_online_evaluation.png', get_lang('MakeLink'), '', ICON_SIZE_MEDIUM) . ''; } } if (!$message_resource) { - //$myname = $catobj->shows_all_information_an_category($catobj->get_id()); - //$my_course_id=api_get_course_id(); - //$my_file= substr($_SESSION['gradebook_dest'],0,5); - - $header .= '' . Display::return_icon('stats.png', get_lang('FlatView'), '', ICON_SIZE_MEDIUM) . ''; - $header .= '' . Display::return_icon('certificate_list.png', get_lang('GradebookSeeListOfStudentsCertificates'), '', ICON_SIZE_MEDIUM) . ''; - - //$visibility_icon = ($catobj->is_visible() == 0) ? 'invisible' : 'visible'; - //$visibility_command = ($catobj->is_visible() == 0) ? 'set_visible' : 'set_invisible'; - //Right icons - - $modify_icons = '' . Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_MEDIUM) . ''; + $header .= '' . + Display::return_icon('stats.png', get_lang('FlatView'), '', ICON_SIZE_MEDIUM) . ''; + $header .= '' . + Display::return_icon('certificate_list.png', get_lang('GradebookSeeListOfStudentsCertificates'), '', ICON_SIZE_MEDIUM) . ''; + // Right icons + $modify_icons = '' . + Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_MEDIUM) . ''; $modify_icons .= '' . Display::return_icon('certificate.png', get_lang('AttachCertificate'), '', ICON_SIZE_MEDIUM) . ''; if (empty($categories)) { - $modify_icons .= '' . Display::return_icon('percentage.png', get_lang('EditAllWeights'), '', ICON_SIZE_MEDIUM) . ''; + $modify_icons .= '' . + 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') { - $modify_icons .= '' . Display::return_icon('ranking.png', get_lang('ScoreEdit'), '', ICON_SIZE_MEDIUM) . ''; + $modify_icons .= '' . + Display::return_icon('ranking.png', get_lang('ScoreEdit'), '', ICON_SIZE_MEDIUM) . ''; } $header .= Display::div($modify_icons, array('class' => 'right')); } @@ -574,7 +585,8 @@ class DisplayGradebook $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) . ''; + $edit_icon = '' . + Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL) . ''; //$msg = Display::tag('h3', $weight.' - '.$min_certification); $msg = Display::tag('h4', $weight . ' - ' . $min_certification . $edit_icon); //@todo show description @@ -586,11 +598,19 @@ class DisplayGradebook } } - function display_reduce_header_gradebook($catobj, $is_course_admin, $is_platform_admin, $simple_search_form, $show_add_qualification = true, $show_add_link = true) + /** + * @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 = get_user_info_from_id(api_get_user_id()); + $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()); @@ -598,7 +618,7 @@ class DisplayGradebook $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') . ' : ' . api_get_person_name($user['firstname'], $user['lastname']) . '
'; + $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 . ''; @@ -619,11 +639,14 @@ class DisplayGradebook echo $header; } - function display_header_user($userid) + /** + * @param int $userid + */ + public function display_header_user($userid) { $select_cat = intval($_GET['selectcat']); $user_id = $userid; - $user = get_user_info_from_id($user_id); + $user = api_get_user_info($user_id); $catcourse = Category :: load($select_cat); $scoredisplay = ScoreDisplay :: instance(); @@ -657,7 +680,7 @@ class DisplayGradebook //Web path $image_path = UserManager::get_user_picture_path_by_id($userid, 'web', false, true); $image_file = $image_path['dir'] . $image_path['file']; - $img_attributes = 'src="' . $image_file . '?rand=' . time() . '" ' . 'alt="' . api_get_person_name($user['firstname'], $user['lastname']) . '" '; + $img_attributes = 'src="' . $image_file . '?rand=' . time() . '" ' . 'alt="' . $user['complete_name'] . '" '; if ($image_size[0] > 200) { //limit display width to 200px $img_attributes .= 'width="200" '; @@ -666,7 +689,8 @@ class DisplayGradebook $info .= '
'; $info .= ''; $info .= '
'; - $info .= get_lang('Name') . ' : ' . api_get_person_name($user['firstname'], $user['lastname']) . '
'; + $info .= get_lang('Name') . ' : ' . + $user['complete_name'] . '
'; if (api_get_setting('show_email_addresses') == 'true') { $info .= get_lang('Email') . ' : ' . $user['email'] . '
'; @@ -676,9 +700,6 @@ class DisplayGradebook $info .= '
'; $info .= ''; - //$scoreinfo = get_lang('StatsStudent') . ' : '.api_get_person_name($user['lastname'], $user['firstname']).'
'; - //$scoreinfo.= '
'.get_lang('Total') . ' : ' . $scorecourse_display . ''; - //$scoreinfo.= '
'.get_lang('Total') . ' : ' . $scoretotal_display . ''; echo $info; }