Improving Gradebook UI

skala
Julio Montoya 14 years ago
parent 88422b345e
commit a2b79395af
  1. 6
      main/gradebook/gradebook_edit_cat.php
  2. 30
      main/gradebook/index.php
  3. 3
      main/gradebook/lib/fe/catform.class.php
  4. 41
      main/gradebook/lib/fe/displaygradebook.php
  5. 5
      main/gradebook/lib/fe/gradebooktable.class.php
  6. BIN
      main/img/icons/32/ranking.png

@ -1,13 +1,15 @@
<?php // $Id:$
<?php
/* For licensing terms, see /license.txt */
$language_file = 'gradebook';
//$cidReset = true;
require_once '../inc/global.inc.php';
require_once 'lib/be.inc.php';
require_once 'lib/gradebook_functions.inc.php';
require_once 'lib/fe/catform.class.php';
api_block_anonymous_users();
block_students();
$edit_cat= isset($_GET['editcat']) ? $_GET['editcat'] : '';
$catedit = Category :: load($edit_cat);
$form = new CatForm(CatForm :: TYPE_EDIT, $catedit[0], 'edit_cat_form');

@ -811,25 +811,9 @@ if ($category != '0') {
$show_message = $cat->show_message_resource_delete($course_id);
if ($show_message=='') {
//hack for inside courses menu cat
if (api_is_allowed_to_edit()) {
$op_cat_weight= '<strong>'.get_lang('TotalWeight').'</strong>'.': '.((intval($cats[0]->get_weight())>0) ? $cats[0]->get_weight() : 0);
$opt_cat_cert_min= '<strong>'.get_lang('CertificateMinScore').'</strong>'.': '.(intval($cats[0]->get_certificate_min_score()>0) ? $cats[0]->get_certificate_min_score() : 0);
$opt_cat_descrip= '<strong>'.get_lang('GradebookDescriptionLog').'</strong>'.': '.(($cats[0]->get_description() == "" || is_null($cats[0]->get_description())) ? get_lang('None') : $cats[0]->get_description());
$visibility_icon= ($cats[0]->is_visible() == 0) ? 'invisible' : 'visible';
$visibility_command= ($cats[0]->is_visible() == 0) ? 'set_visible' : 'set_invisible';
echo '<div class="actions" align="right">';
$modify_icons= '<a href="gradebook_edit_cat.php?editcat=' . $cats[0]->get_id() . ' &amp;cidReq='.$cats[0]->get_course_code().'">'.Display::return_icon('edit.png', get_lang('EditCategory'),'','22').'</a>';
$modify_icons .= '&nbsp;<a href="' . api_get_self() . '?deletecat=' . $cats[0]->get_id() . '&amp;selectcat=0&amp;cidReq='.$cats[0]->get_course_code().'" onclick="return confirmation();">'.Display::return_icon('delete.png', get_lang('DeleteAll'),'','22').'</a>';
$modify_icons .= '&nbsp;<a href="' . api_get_self() . '?visiblecat=' . $cats[0]->get_id() . '&amp;' . $visibility_command . '=&amp;selectcat=0 ">'.Display::return_icon($visibility_icon.'.png', get_lang('Visible'),'','22').'</a>';
$opt_cat_descrip1 = strip_tags($opt_cat_descrip);
echo '<div align="left" style="float:left">'.Display::return_icon('info.png', $opt_cat_descrip1,'','22').'</a>';
echo $op_cat_weight.' '.'&nbsp;&nbsp;'.$opt_cat_cert_min.'&nbsp;&nbsp;'.$opt_cat_descrip.'</div>';
echo $modify_icons;
echo '</div>';
} else {
//student
if (!api_is_allowed_to_edit()) {
// generating the total score for a course
$stud_id = api_get_user_id();
$cats_course = Category :: load ($category_id, null, null, null, null, null, false);
@ -852,13 +836,7 @@ if ($category != '0') {
$cattotal = Category :: load($category_id);
$scoretotal= $cattotal[0]->calc_score(api_get_user_id());
/*
//Overwritten the old total with the real total of the gradebook if the line below is deleted, then when a user doesn't finish a test the total will be different from the real total
$scoretotal[1] = $item_total;
//$scoretotal_display = (isset($scoretotal)? round($scoretotal[0],2).'/'.round($scoretotal[1],2).' ('.round(($scoretotal[0] / $scoretotal[1]) * 100,2) . ' %)': '-');
*/
//Do not remove this the gradebook/lib/fe/gradebooktable.class.php file load this variable as a global
$my_score_in_gradebook = round($scoretotal[0],2);

@ -120,8 +120,7 @@ class CatForm extends FormValidator {
private function build_basic_form() {
$this->addElement('hidden', 'zero', 0);
$this->add_textfield('name', get_lang('CategoryName'),true,array('size'=>'54','maxlength'=>'50'));
//$this->add_textfield('name', get_lang('CategoryName'),true,array('size'=>'54','maxlength'=>'50'));
$this->add_textfield('weight', get_lang('TotalWeight'),true,array('size'=>'4','maxlength'=>'5'));
$this->addElement('static', null, null, '<i>'.get_lang('TotalSumOfWeights').'</i>');

@ -238,8 +238,8 @@ class DisplayGradebook
Display :: display_normal_message($scoreinfo, false);
}
// show navigation tree and buttons?
$header='';
$header .= '<div class="actions"><table border=0 >';
$header = '<div class="actions"><table border=0>';
if (($showtree == '1') || (isset ($_GET['studentoverview']))) {
$header .= '<tr>';
if (!$selectcat == '0') {
@ -251,6 +251,7 @@ class DisplayGradebook
$tree= $cats[0]->get_tree();
unset ($cats);
foreach ($tree as $cat) {
for ($i= 0; $i < $cat[2]; $i++) {
$line .= '&mdash;';
@ -287,10 +288,12 @@ class DisplayGradebook
// for course admin & platform admin add item buttons are added to the header
$header .= '<div class="actions">';
$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);
$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);
if (api_is_allowed_to_edit(null, true)) {
if ($selectcat == '0') {
if ($show_add_qualification === true) {
@ -327,10 +330,20 @@ class DisplayGradebook
$my_file= substr($_SESSION['gradebook_dest'],0,5);
if (api_is_allowed_to_edit(null, true)) {
$header .= '<td style="vertical-align: top;"><a href="gradebook_scoring_system.php?'.$my_api_cidreq.'&selectcat=' . $catobj->get_id() .'">'.Display::return_icon('settings.png', get_lang('ScoreEdit'),'','32').'</a>';
$header .= '<td style="vertical-align: top;"><a href="gradebook_flatview.php?'.$my_api_cidreq.'&selectcat=' . $catobj->get_id() . '">'.Display::return_icon('stats.png', get_lang('FlatView'),'','32').'</a>';
$header .= '<td style="vertical-align: top;"><a href="../document/document.php?curdirpath=/certificates&'.$my_api_cidreq.'&origin=gradebook&selectcat=' . $catobj->get_id() . '">'.Display::return_icon('certificate.png', get_lang('AttachCertificate'),'','32').'</a>';
$header .= '<td style="vertical-align: top;"><a href="gradebook_display_certificate.php?'.$my_api_cidreq.'&amp;cat_id='.(int)$_GET['selectcat'].'">'.Display::return_icon('certificate_list.png', get_lang('GradebookSeeListOfStudentsCertificates'),'','32').'</a>';
$visibility_icon = ($catobj->is_visible() == 0) ? 'invisible' : 'visible';
$visibility_command = ($catobj->is_visible() == 0) ? 'set_visible' : 'set_invisible';
$modify_icons = '<a href="gradebook_edit_cat.php?editcat=' . $catobj->get_id() . ' &amp;cidReq='.$catobj->get_course_code().'">'.Display::return_icon('edit.png', get_lang('Edit'),'','32').'</a>';
$modify_icons .= '<a href="gradebook_scoring_system.php?'.$my_api_cidreq.'&selectcat=' . $catobj->get_id() .'">'.Display::return_icon('ranking.png', get_lang('ScoreEdit'),'','32').'</a>';
$modify_icons .= '&nbsp;<a href="' . api_get_self() . '?visiblecat=' . $catobj->get_id() . '&amp;' . $visibility_command . '=&amp;selectcat=0 ">'.Display::return_icon($visibility_icon.'.png', get_lang('Visible'),'','32').'</a>';
$modify_icons .= '&nbsp;<a href="' . api_get_self() . '?deletecat=' . $catobj->get_id() . '&amp;selectcat=0&amp;cidReq='.$catobj->get_course_code().'" onclick="return confirmation();">'.Display::return_icon('delete.png', get_lang('DeleteAll'),'','32').'</a>';
$header .= Display::div($modify_icons, array('class'=>'right'));
}
}
}
@ -339,6 +352,20 @@ class DisplayGradebook
}
$header .= '</div>';
echo $header;
if (api_is_allowed_to_edit(null, true)) {
$weight = ((intval($catobj->get_weight())>0) ? $catobj->get_weight() : 0);
$weight = Display::tag('h3', get_lang('TotalWeight').' : '.$weight);
$min_certification = (intval($catobj->get_certificate_min_score()>0) ? $catobj->get_certificate_min_score() : 0);
$min_certification = Display::tag('h3', get_lang('CertificateMinScore').' : '.$min_certification);
//@todo show description
$description = (($catobj->get_description() == "" || is_null($catobj->get_description())) ? '' : '<strong>'.get_lang('GradebookDescriptionLog').'</strong>'.': '.$catobj->get_description());
Display::display_normal_message($weight.$min_certification, 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) {

@ -244,6 +244,11 @@ class GradebookTable extends SortableTable
$warning_message = get_lang('TotalWeightMustNotBeMoreThan').'&nbsp;'.$weight_category;
Display::display_warning_message($warning_message,false);
}
if ($weight_total_links < $weight_category) {
$warning_message = sprintf(get_lang('TotalWeightMustBeX'), $weight_category);
Display::display_warning_message($warning_message,false);
}
$content_html = DocumentManager::replace_user_info_into_html(api_get_user_id(), $course_code);

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Loading…
Cancel
Save