diff --git a/main/gradebook/lib/fe/displaygradebook.php b/main/gradebook/lib/fe/displaygradebook.php index a48e8a8081..7dc08f0c85 100644 --- a/main/gradebook/lib/fe/displaygradebook.php +++ b/main/gradebook/lib/fe/displaygradebook.php @@ -1,99 +1,103 @@ '; - if ($page != 'statistics') { - $header .= ''. Display::return_icon(('back.png'),get_lang('FolderView'),'',ICON_SIZE_MEDIUM).''; - if ($evalobj->get_course_code() == null) { + + /** + * Displays the header for the result page containing the navigation tree and links + * @param $evalobj + * @param $selectcat + * @param $shownavbar 1=show navigation bar + * @param $forpdf only output for pdf file + */ + static function display_header_result($evalobj, $selectcat, $page) + { + if (api_is_allowed_to_edit(null, true)) { + $header = '
' . get_lang('AddStudent') . '';
- } elseif (!$evalobj->has_results()) {
- $header .= '
- '.Display::return_icon('evaluation_rate.png',get_lang('AddResult'),'',ICON_SIZE_MEDIUM) . '';
- }
+ //$header .= '
' . get_lang('AddStudent') . '';
+ } elseif (!$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) . '';
+ $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 ($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('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 .= '';
- $evalinfo .= ''.$evalobj->get_name().''; - $evalinfo .= $description; - $evalinfo .= get_lang('Course') . ' : ' . $course . ' '; - //' ' . get_lang('Weight') . ' : ' . $evalobj->get_weight() . ' ' . get_lang('Visible') . ' : ' . $visible . ' - $evalinfo .= get_lang('QualificationNumeric') . ' : ' . $evalobj->get_max() . ' '.$average; + $evalinfo = '
';
+ echo $evalinfo;
+ echo $header;
+ }
+
+ /**
+ * Displays the header for the flatview page containing filters
+ * @param $catobj
+ * @param $showeval
+ * @param $showlink
+ */
+ function display_header_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']);
@@ -167,210 +173,203 @@ class DisplayGradebook
$select_cat = $catobj->get_parent_id();
$url = 'gradebook_flatview.php';
}
- $header .= ''. Display::return_icon('back.png',get_lang('FolderView'),'',ICON_SIZE_MEDIUM).'';
-
-
- // this MUST be a GET variable not a POST
- if (isset($_GET['show'])) {
- $show=Security::remove_XSS($_GET['show']);
- } else {
- $show='';
- }
- $header .= ''.Display::return_icon('export_csv.png', get_lang('ExportAsCSV'),'',ICON_SIZE_MEDIUM).'';
- $header .= ''.Display::return_icon('export_excel.png', get_lang('ExportAsXLS'),'',ICON_SIZE_MEDIUM).'';
- $header .= ''.Display::return_icon('export_doc.png', get_lang('ExportAsDOC'),'',ICON_SIZE_MEDIUM).'';
- $header .= ''.Display::return_icon('printer.png', get_lang('Print'),'',ICON_SIZE_MEDIUM).'';
- $header .= ''.Display::return_icon('pdf.png', get_lang('ExportToPDF'),'',ICON_SIZE_MEDIUM).'';
- $header .= ' ';
- 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) {
- // Student
- $status = CourseManager::get_user_in_course_status(api_get_user_id(), api_get_course_id());
- $objcat = new Category();
- $course_id = Database::get_course_by_category($selectcat);
- $message_resource=$objcat->show_message_resource_delete($course_id);
-
- if (!$is_course_admin && $status<>1 && $selectcat<>0) {
- $user_id = api_get_user_id();
- $user= get_user_info_from_id($user_id);
-
- $catcourse= Category :: load($catobj->get_id());
- $scoredisplay = ScoreDisplay :: instance();
- $scorecourse = $catcourse[0]->calc_score($user_id);
-
- // generating the total score for a course
- $allevals= $catcourse[0]->get_evaluations($user_id,true);
- $alllinks= $catcourse[0]->get_links($user_id,true);
- $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($user_id);
- $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 = number_format($item_value, 2, '.', ' ');
- $total_score=array($item_value,$item_total);
- $scorecourse_display = $scoredisplay->display_score($total_score, SCORE_DIV_PERCENT);
-
- $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']).''; - if ((!$catobj->get_id() == '0') && (!isset ($_GET['studentoverview'])) && (!isset ($_GET['search']))) { - $scoreinfo.= ' '.get_lang('Total') . ' : ' . $scorecourse_display . ''; - } - Display :: display_normal_message($scoreinfo, false); - } - - // show navigation tree and buttons? - $header = '
| ';
-
- if (api_is_allowed_to_edit(null, true)) {
- if ($selectcat == '0') {
- if ($show_add_qualification === true) {
- }
- if ($show_add_link) {
- //$header .= ' ' . get_lang('NewEvaluation') . '';
- }
- } else {
- if ($show_add_qualification === true && $message_resource===false) {
- //$header .= ' ' . get_lang('NewSubCategory') . ' | ';
- }
- $my_category=$catobj->shows_all_information_an_category($catobj->get_id());
- $my_api_cidreq = api_get_cidreq();
- if ($my_api_cidreq=='') {
- $my_api_cidreq='cidReq='.$my_category['course_code'];
- }
- if ($show_add_link && !$message_resource) {
- //$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') . '';
- //$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).''; - } - } - - 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).'';
- //$modify_icons .= ''.
- //Display::return_icon('certificate.png', get_lang('AttachCertificate'),'',ICON_SIZE_MEDIUM).'';
-
- //hide or delete are not options available
- //$modify_icons .= ' '.Display::return_icon($visibility_icon.'.png', get_lang('Visible'),'',ICON_SIZE_MEDIUM).'';
- if ($catobj->get_name() != api_get_course_id()) {
- $modify_icons .= ' '.Display::return_icon('delete.png', get_lang('DeleteAll'),'',ICON_SIZE_MEDIUM).'';
- }
- $header .= Display::div($modify_icons, array('class'=>'right'));
-
- }
- }
- } elseif (isset ($_GET['search'])) {
- $header .= ''.get_lang('SearchResults').' :';
- }
- $header .= '';
- echo $header;
- }
-
- /**
- * Displays the header for the gradebook containing the navigation tree and links
- * @param category_object $currentcat
- * @param int $showtree '1' will show the browse tree and naviation buttons
- * @param boolean $is_course_admin
- * @param boolean $is_platform_admin
+ $header .= '' . Display::return_icon('back.png', get_lang('FolderView'), '', ICON_SIZE_MEDIUM) . '';
+
+
+ // this MUST be a GET variable not a POST
+ if (isset($_GET['show'])) {
+ $show = Security::remove_XSS($_GET['show']);
+ } else {
+ $show = '';
+ }
+ $header .= '' . Display::return_icon('export_csv.png', get_lang('ExportAsCSV'), '', ICON_SIZE_MEDIUM) . '';
+ $header .= '' . Display::return_icon('export_excel.png', get_lang('ExportAsXLS'), '', ICON_SIZE_MEDIUM) . '';
+ $header .= '' . Display::return_icon('export_doc.png', get_lang('ExportAsDOC'), '', ICON_SIZE_MEDIUM) . '';
+ $header .= '' . Display::return_icon('printer.png', get_lang('Print'), '', ICON_SIZE_MEDIUM) . '';
+ $header .= '' . Display::return_icon('pdf.png', get_lang('ExportToPDF'), '', ICON_SIZE_MEDIUM) . '';
+ $header .= '';
+ 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)
+ {
+ // Student
+ $status = CourseManager::get_user_in_course_status(api_get_user_id(), api_get_course_id());
+ $objcat = new Category();
+ $course_id = Database::get_course_by_category($selectcat);
+ $message_resource = $objcat->show_message_resource_delete($course_id);
+
+ if (!$is_course_admin && $status <> 1 && $selectcat <> 0) {
+ $user_id = api_get_user_id();
+ $user = get_user_info_from_id($user_id);
+
+ $catcourse = Category :: load($catobj->get_id());
+ $scoredisplay = ScoreDisplay :: instance();
+ $scorecourse = $catcourse[0]->calc_score($user_id);
+
+ // generating the total score for a course
+ $allevals = $catcourse[0]->get_evaluations($user_id, true);
+ $alllinks = $catcourse[0]->get_links($user_id, true);
+ $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($user_id);
+ $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 = number_format($item_value, 2, '.', ' ');
+ $total_score = array($item_value, $item_total);
+ $scorecourse_display = $scoredisplay->display_score($total_score, SCORE_DIV_PERCENT);
+
+ $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']) . ' '; + if ((!$catobj->get_id() == '0') && (!isset($_GET['studentoverview'])) && (!isset($_GET['search']))) { + $scoreinfo.= ' ' . get_lang('Total') . ' : ' . $scorecourse_display . ''; + } + Display :: display_normal_message($scoreinfo, false); + } + + // show navigation tree and buttons? + $header = '
| ';
+
+ if (api_is_allowed_to_edit(null, true)) {
+ if ($selectcat == '0') {
+ if ($show_add_qualification === true) {
+
+ }
+ if ($show_add_link) {
+ //$header .= ' ' . get_lang('NewEvaluation') . '';
+ }
+ } else {
+ if ($show_add_qualification === true && $message_resource === false) {
+ //$header .= ' ' . get_lang('NewSubCategory') . ' | ';
+ }
+ $my_category = $catobj->shows_all_information_an_category($catobj->get_id());
+ $my_api_cidreq = api_get_cidreq();
+ if ($my_api_cidreq == '') {
+ $my_api_cidreq = 'cidReq=' . $my_category['course_code'];
+ }
+ if ($show_add_link && !$message_resource) {
+ //$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') . '';
+ //$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).''; + } + } + + 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) . '';
+ //$modify_icons .= ''.
+ //Display::return_icon('certificate.png', get_lang('AttachCertificate'),'',ICON_SIZE_MEDIUM).'';
+ //hide or delete are not options available
+ //$modify_icons .= ' '.Display::return_icon($visibility_icon.'.png', get_lang('Visible'),'',ICON_SIZE_MEDIUM).'';
+ if ($catobj->get_name() != api_get_course_id()) {
+ $modify_icons .= ' ' . Display::return_icon('delete.png', get_lang('DeleteAll'), '', ICON_SIZE_MEDIUM) . '';
+ }
+ $header .= Display::div($modify_icons, array('class' => 'right'));
+ }
+ }
+ } elseif (isset($_GET['search'])) {
+ $header .= '' . get_lang('SearchResults') . ' :';
+ }
+ $header .= '';
+ echo $header;
+ }
+
+ /**
+ * Displays the header for the gradebook containing the navigation tree and links
+ * @param category_object $currentcat
+ * @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
- */
- static function display_header_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());
- $objcat = new Category();
- $course_id = Database::get_course_by_category($selectcat);
- $message_resource = $objcat->show_message_resource_delete($course_id);
+ */
+ static function display_header_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());
+ $objcat = new Category();
+ $course_id = Database::get_course_by_category($selectcat);
+ $message_resource = $objcat->show_message_resource_delete($course_id);
$grade_model_id = $catobj->get_grade_model_id();
$header = null;
@@ -387,279 +386,279 @@ class DisplayGradebook
}
}
- if (!$is_course_admin && $status<>1 && $selectcat<>0) {
- $user_id = api_get_user_id();
- $catcourse = Category::load($catobj->get_id());
+ if (!$is_course_admin && $status <> 1 && $selectcat <> 0) {
+ $user_id = api_get_user_id();
+ $catcourse = Category::load($catobj->get_id());
$main_weight = $catcourse[0]->get_weight();
- $scoredisplay = ScoreDisplay :: instance();
+ $scoredisplay = ScoreDisplay :: instance();
- // generating the total score for a course
- $allevals= $catcourse[0]->get_evaluations($user_id,true);
- $alllinks= $catcourse[0]->get_links($user_id,true);
- $evals_links = array_merge($allevals, $alllinks);
+ // generating the total score for a course
+ $allevals = $catcourse[0]->get_evaluations($user_id, true);
+ $alllinks = $catcourse[0]->get_links($user_id, true);
+ $evals_links = array_merge($allevals, $alllinks);
- $item_value =0;
- $item_total = 0;
+ $item_value = 0;
+ $item_total = 0;
$item_total_value = 0;
- for ($count=0; $count < count($evals_links); $count++) {
- $item = $evals_links[$count];
- $score = $item->calc_score($user_id);
- $divide = ( ($score[1])==0 ) ? 1 : $score[1];
+ for ($count = 0; $count < count($evals_links); $count++) {
+ $item = $evals_links[$count];
+ $score = $item->calc_score($user_id);
+ $divide = ( ($score[1]) == 0 ) ? 1 : $score[1];
$sub_cat_percentage = $sum_categories_weight_array[$item->get_category_id()];
//$item_value = $score[0]/$divide;
- $item_value = $score[0]/$divide*$item->get_weight()*$sub_cat_percentage/$main_weight;
+ $item_value = $score[0] / $divide * $item->get_weight() * $sub_cat_percentage / $main_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);
+ $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']))) {
- $scoreinfo.= ''.get_lang('Total') . ' : ' . $scorecourse_display . ''; - } - Display :: display_normal_message($scoreinfo, false); - } + if ((!$catobj->get_id() == '0') && (!isset($_GET['studentoverview'])) && (!isset($_GET['search']))) { + $scoreinfo.= '' . get_lang('Total') . ' : ' . $scorecourse_display . ''; + } + Display :: display_normal_message($scoreinfo, false); + } - // show navigation tree and buttons? - if (($showtree == '1') || (isset ($_GET['studentoverview']))) { + // show navigation tree and buttons? + if (($showtree == '1') || (isset($_GET['studentoverview']))) { $header = '
';
+ // for course admin & platform admin add item buttons are added to the header
+ $header .= ' ';
- $my_category = $catobj->shows_all_information_an_category($catobj->get_id());
- $user_id = api_get_user_id();
+ $my_category = $catobj->shows_all_information_an_category($catobj->get_id());
+ $user_id = api_get_user_id();
- //$course_code = $my_category['course_code'];
- //$status_user = api_get_status_of_user_in_course ($user_id,$course_code);
+ //$course_code = $my_category['course_code'];
+ //$status_user = api_get_status_of_user_in_course ($user_id,$course_code);
- if (api_is_allowed_to_edit(null, true)) {
+ if (api_is_allowed_to_edit(null, true)) {
if (empty($grade_model_id) || $grade_model_id == -1) {
- $header .= ''.Display::return_icon('new_folder.png', get_lang('AddGradebook'), array(), ICON_SIZE_MEDIUM).' | ';
+ $header .= '' . Display::return_icon('new_folder.png', get_lang('AddGradebook'), array(), ICON_SIZE_MEDIUM) . '';
}
- if ($selectcat == '0') {
+ if ($selectcat == '0') {
if ($show_add_qualification === true) {
+
}
if ($show_add_link) {
- //$header .= ' ' . get_lang('NewEvaluation') . '';
+ //$header .= ' | ' . get_lang('NewEvaluation') . '';
}
- } else {
- if ($show_add_qualification === true && $message_resource===false) {
- //$header .= ' ' . get_lang('NewSubCategory') . ' | ';
+ } else {
+ if ($show_add_qualification === true && $message_resource === false) {
+ //$header .= ''.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') . '';
- $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); + //$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).''; + $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';
+ //$visibility_icon = ($catobj->is_visible() == 0) ? 'invisible' : 'visible';
+ //$visibility_command = ($catobj->is_visible() == 0) ? 'set_visible' : 'set_invisible';
+ //Right icons
- //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).'';
+ $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).'';
+ $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) . '';
}
- $header .= Display::div($modify_icons, array('class'=>'right'));
+ $header .= Display::div($modify_icons, array('class' => 'right'));
}
- }
- } elseif (isset ($_GET['search'])) {
- $header .= ''.get_lang('SearchResults').' :';
- }
- $header .= '';
+ }
+ } elseif (isset($_GET['search'])) {
+ $header .= '' . get_lang('SearchResults') . ' :';
+ }
+ $header .= '';
- echo $header;
+ echo $header;
- if (api_is_allowed_to_edit(null, true)) {
- $weight = ((intval($catobj->get_weight())>0) ? $catobj->get_weight() : 0);
- $weight = get_lang('TotalWeight').' : '.$weight;
+ 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).'';
+ $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 = Display::tag('h4', $weight.' - '.$min_certification.$edit_icon);
- //@todo show description
- $description = (($catobj->get_description() == "" || is_null($catobj->get_description())) ? '' : ''.get_lang('GradebookDescriptionLog').''.': '.$catobj->get_description());
- Display::display_normal_message($msg, false);
- if (!empty($description)) {
- echo Display::div($description, array());
- }
- }
- }
-
- 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());
- $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') . ' : '.api_get_person_name($user['firstname'], $user['lastname']).' '; - if ((!$catobj->get_id() == '0') && (!isset ($_GET['studentoverview'])) && (!isset ($_GET['search']))) - $scoreinfo.= ' '.get_lang('TotalForThisCategory') . ' : ' . $scorecourse_display . ''; - $scoreinfo.= ' '.get_lang('Total') . ' : ' . $scoretotal_display . ''; - Display :: display_normal_message($scoreinfo,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;
- }
-
- function display_header_user($userid) {
- $select_cat = intval($_GET['selectcat']);
- $user_id = $userid;
- $user = get_user_info_from_id($user_id);
-
- $catcourse = Category :: load($select_cat);
- $scoredisplay = ScoreDisplay :: instance();
- $scorecourse = $catcourse[0]->calc_score($user_id);
-
- // generating the total score for a course
- $allevals= $catcourse[0]->get_evaluations($user_id,true);
- $alllinks= $catcourse[0]->get_links($user_id,true);
- $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($user_id);
- $my_score_denom=($score[1]==0) ? 1 : $score[1];
- $item_value+=$score[0]/$my_score_denom*$item->get_weight();
- $item_total+=$item->get_weight();
- //$row[] = $scoredisplay->display_score($score,SCORE_DIV_PERCENT);
- }
- $item_value = number_format($item_value, 2, '.', ' ');
- $total_score=array($item_value,$item_total);
- $scorecourse_display = $scoredisplay->display_score($total_score,SCORE_DIV_PERCENT);
-
- //$scorecourse_display = (isset($scorecourse) ? $scoredisplay->display_score($scorecourse,SCORE_AVERAGE) : get_lang('NoResultsAvailable'));
- $cattotal = Category :: load(0);
- $scoretotal= $cattotal[0]->calc_score($user_id);
- $scoretotal_display = (isset($scoretotal) ? $scoredisplay->display_score($scoretotal,SCORE_PERCENT) : get_lang('NoResultsAvailable'));
-
- $image_syspath = UserManager::get_user_picture_path_by_id($userid,'system',false,true);
- $image_size = getimagesize($image_syspath['dir'].$image_syspath['file']);
+ $msg = Display::tag('h4', $weight . ' - ' . $min_certification . $edit_icon);
+ //@todo show description
+ $description = (($catobj->get_description() == "" || is_null($catobj->get_description())) ? '' : '' . get_lang('GradebookDescriptionLog') . '' . ': ' . $catobj->get_description());
+ Display::display_normal_message($msg, false);
+ if (!empty($description)) {
+ echo Display::div($description, array());
+ }
+ }
+ }
+
+ 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());
+ $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') . ' : ' . api_get_person_name($user['firstname'], $user['lastname']) . ''; + if ((!$catobj->get_id() == '0') && (!isset($_GET['studentoverview'])) && (!isset($_GET['search']))) + $scoreinfo.= ' ' . get_lang('TotalForThisCategory') . ' : ' . $scorecourse_display . ''; + $scoreinfo.= ' ' . get_lang('Total') . ' : ' . $scoretotal_display . ''; + Display :: display_normal_message($scoreinfo, 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;
+ }
+
+ function display_header_user($userid)
+ {
+ $select_cat = intval($_GET['selectcat']);
+ $user_id = $userid;
+ $user = get_user_info_from_id($user_id);
+
+ $catcourse = Category :: load($select_cat);
+ $scoredisplay = ScoreDisplay :: instance();
+ $scorecourse = $catcourse[0]->calc_score($user_id);
+
+ // generating the total score for a course
+ $allevals = $catcourse[0]->get_evaluations($user_id, true);
+ $alllinks = $catcourse[0]->get_links($user_id, true);
+ $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($user_id);
+ $my_score_denom = ($score[1] == 0) ? 1 : $score[1];
+ $item_value+=$score[0] / $my_score_denom * $item->get_weight();
+ $item_total+=$item->get_weight();
+ //$row[] = $scoredisplay->display_score($score,SCORE_DIV_PERCENT);
+ }
+ $item_value = number_format($item_value, 2, '.', ' ');
+ $total_score = array($item_value, $item_total);
+ $scorecourse_display = $scoredisplay->display_score($total_score, SCORE_DIV_PERCENT);
+
+ //$scorecourse_display = (isset($scorecourse) ? $scoredisplay->display_score($scorecourse,SCORE_AVERAGE) : get_lang('NoResultsAvailable'));
+ $cattotal = Category :: load(0);
+ $scoretotal = $cattotal[0]->calc_score($user_id);
+ $scoretotal_display = (isset($scoretotal) ? $scoredisplay->display_score($scoretotal, SCORE_PERCENT) : get_lang('NoResultsAvailable'));
+
+ $image_syspath = UserManager::get_user_picture_path_by_id($userid, 'system', false, true);
+ $image_size = getimagesize($image_syspath['dir'] . $image_syspath['file']);
//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']) . '" ';
- if ($image_size[0] > 200) {
- //limit display width to 200px
- $img_attributes .= 'width="200" ';
- }
- $info = '';
+ $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']) . '" ';
+ if ($image_size[0] > 200) {
+ //limit display width to 200px
+ $img_attributes .= 'width="200" ';
+ }
+ $info = ' ';
- //$scoreinfo = get_lang('StatsStudent') . ' : '.api_get_person_name($user['lastname'], $user['firstname']).'';
$info .= ' ';
$info .= '';
- $info .= get_lang('Name') . ' : ' . api_get_person_name($user['firstname'], $user['lastname']) . ' ';
+ $info .= get_lang('TotalUser') . ' : ' . $scorecourse_display . '';
+ $info .= ''; + $info .= get_lang('Name') . ' : ' . api_get_person_name($user['firstname'], $user['lastname']) . ' '; - if (api_get_setting('show_email_addresses') == 'true') { + if (api_get_setting('show_email_addresses') == 'true') { $info .= get_lang('Email') . ' : ' . $user['email'] . ' '; } - $info .= get_lang('TotalUser') . ' : ' . $scorecourse_display . ''; - $info .= ' '; - //$scoreinfo.= ' '.get_lang('Total') . ' : ' . $scorecourse_display . ''; - - //$scoreinfo.= ' '.get_lang('Total') . ' : ' . $scoretotal_display . ''; + //$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; - } + } + } |