mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 22:08:20 +01:00
MDL-19797 Optimising output code and JS/CSS requires. Also improved CSS for grader report
This commit is contained in:
parent
8f3b787b1d
commit
1c1f64a2a6
@ -15,14 +15,23 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
require_once '../../../config.php';
|
/**
|
||||||
require_once $CFG->libdir.'/gradelib.php';
|
* Edit form for grade letters.
|
||||||
require_once $CFG->dirroot.'/grade/lib.php';
|
*
|
||||||
require_once 'edit_form.php';
|
* @package moodlecore
|
||||||
|
* @copyright 2008 Nicolas Connault
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||||
|
*/
|
||||||
|
|
||||||
|
require_once(dirname(__FILE__).'/../../../config.php');
|
||||||
|
require_once($CFG->libdir.'/gradelib.php');
|
||||||
|
require_once($CFG->dirroot.'/grade/lib.php');
|
||||||
|
require_once('edit_form.php');
|
||||||
|
|
||||||
$contextid = optional_param('id', SYSCONTEXTID, PARAM_INT);
|
$contextid = optional_param('id', SYSCONTEXTID, PARAM_INT);
|
||||||
|
|
||||||
|
$PAGE->set_url('grade/edit/letter/edit.php');
|
||||||
|
|
||||||
if (!$context = get_context_instance_by_id($contextid)) {
|
if (!$context = get_context_instance_by_id($contextid)) {
|
||||||
print_error('invalidcourseid');
|
print_error('invalidcourseid');
|
||||||
}
|
}
|
||||||
@ -131,4 +140,3 @@ if ($admin) {
|
|||||||
$mform->display();
|
$mform->display();
|
||||||
|
|
||||||
echo $OUTPUT->footer();
|
echo $OUTPUT->footer();
|
||||||
?>
|
|
||||||
|
@ -15,6 +15,14 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List of grade letters.
|
||||||
|
*
|
||||||
|
* @package moodlecore
|
||||||
|
* @copyright 2008 Nicolas Connault
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||||
|
*/
|
||||||
|
|
||||||
require_once '../../../config.php';
|
require_once '../../../config.php';
|
||||||
require_once $CFG->dirroot.'/grade/lib.php';
|
require_once $CFG->dirroot.'/grade/lib.php';
|
||||||
require_once $CFG->libdir.'/gradelib.php';
|
require_once $CFG->libdir.'/gradelib.php';
|
||||||
@ -22,10 +30,12 @@ require_once $CFG->libdir.'/gradelib.php';
|
|||||||
$courseid = optional_param('id', SITEID, PARAM_INT);
|
$courseid = optional_param('id', SITEID, PARAM_INT);
|
||||||
$action = optional_param('action', '', PARAM_ALPHA);
|
$action = optional_param('action', '', PARAM_ALPHA);
|
||||||
|
|
||||||
|
$PAGE->set_url('grade/edit/letter/index.php', array('id' => $courseid));
|
||||||
|
|
||||||
if (!$course = $DB->get_record('course', array('id' => $courseid))) {
|
if (!$course = $DB->get_record('course', array('id' => $courseid))) {
|
||||||
print_error('nocourseid');
|
print_error('nocourseid');
|
||||||
}
|
}
|
||||||
require_login($course);
|
|
||||||
$context = get_context_instance(CONTEXT_COURSE, $course->id);
|
$context = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||||
|
|
||||||
if (!has_capability('moodle/grade:manage', $context) and !has_capability('moodle/grade:manageletters', $context)) {
|
if (!has_capability('moodle/grade:manage', $context) and !has_capability('moodle/grade:manageletters', $context)) {
|
||||||
@ -59,8 +69,7 @@ $table->size = array('30%', '30%', '40%');
|
|||||||
$table->align = array('left', 'left', 'left');
|
$table->align = array('left', 'left', 'left');
|
||||||
$table->width = '30%';
|
$table->width = '30%';
|
||||||
$table->data = $data;
|
$table->data = $data;
|
||||||
|
$table->tablealign = 'center';
|
||||||
echo $OUTPUT->table($table);
|
echo $OUTPUT->table($table);
|
||||||
|
|
||||||
echo $OUTPUT->footer();
|
echo $OUTPUT->footer();
|
||||||
|
|
||||||
?>
|
|
||||||
|
@ -15,6 +15,14 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Edit and review page for grade categories and items.
|
||||||
|
*
|
||||||
|
* @package moodlecore
|
||||||
|
* @copyright 2008 Nicolas Connault
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||||
|
*/
|
||||||
|
|
||||||
require_once '../../../config.php';
|
require_once '../../../config.php';
|
||||||
require_once $CFG->dirroot.'/grade/lib.php';
|
require_once $CFG->dirroot.'/grade/lib.php';
|
||||||
require_once $CFG->dirroot.'/grade/report/lib.php'; // for preferences
|
require_once $CFG->dirroot.'/grade/report/lib.php'; // for preferences
|
||||||
@ -28,6 +36,7 @@ $PAGE->requires->yui_lib('element');
|
|||||||
$PAGE->requires->yui_lib('container');
|
$PAGE->requires->yui_lib('container');
|
||||||
$PAGE->requires->yui_lib('animation');
|
$PAGE->requires->yui_lib('animation');
|
||||||
$PAGE->requires->js('grade/edit/tree/functions.js');
|
$PAGE->requires->js('grade/edit/tree/functions.js');
|
||||||
|
$PAGE->requires->css('/grade/edit/tree/tree.css');
|
||||||
|
|
||||||
$courseid = required_param('id', PARAM_INT);
|
$courseid = required_param('id', PARAM_INT);
|
||||||
$action = optional_param('action', 0, PARAM_ALPHA);
|
$action = optional_param('action', 0, PARAM_ALPHA);
|
||||||
@ -36,6 +45,8 @@ $category = optional_param('category', null, PARAM_INT);
|
|||||||
$aggregationtype = optional_param('aggregationtype', null, PARAM_INT);
|
$aggregationtype = optional_param('aggregationtype', null, PARAM_INT);
|
||||||
$showadvanced = optional_param('showadvanced', -1, PARAM_BOOL); // sticky editting mode
|
$showadvanced = optional_param('showadvanced', -1, PARAM_BOOL); // sticky editting mode
|
||||||
|
|
||||||
|
$PAGE->set_url('grade/edit/tree/index.php', array('id' => $courseid));
|
||||||
|
|
||||||
/// Make sure they can even access this course
|
/// Make sure they can even access this course
|
||||||
if (!$course = $DB->get_record('course', array('id' => $courseid))) {
|
if (!$course = $DB->get_record('course', array('id' => $courseid))) {
|
||||||
print_error('nocourseid');
|
print_error('nocourseid');
|
||||||
@ -199,8 +210,6 @@ if ($grade_edit_tree->moving) {
|
|||||||
$USER->gradeediting[$course->id] = 0;
|
$USER->gradeediting[$course->id] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$CFG->stylesheets[] = $CFG->wwwroot.'/grade/edit/tree/tree.css';
|
|
||||||
|
|
||||||
$current_view_str = '';
|
$current_view_str = '';
|
||||||
if ($current_view != '') {
|
if ($current_view != '') {
|
||||||
if ($current_view == 'simpleview') {
|
if ($current_view == 'simpleview') {
|
||||||
|
@ -74,9 +74,9 @@ class grade_edit_tree {
|
|||||||
* Recursive function for building the table holding the grade categories and items,
|
* Recursive function for building the table holding the grade categories and items,
|
||||||
* with CSS indentation and styles.
|
* with CSS indentation and styles.
|
||||||
*
|
*
|
||||||
* @param array $element The current tree element being rendered
|
* @param array $element The current tree element being rendered
|
||||||
* @param boolean $totals Whether or not to print category grade items (category totals)
|
* @param boolean $totals Whether or not to print category grade items (category totals)
|
||||||
* @param array $parents An array of parent categories for the current element (used for indentation and row classes)
|
* @param array $parents An array of parent categories for the current element (used for indentation and row classes)
|
||||||
*
|
*
|
||||||
* @return string HTML
|
* @return string HTML
|
||||||
*/
|
*/
|
||||||
@ -108,13 +108,22 @@ class grade_edit_tree {
|
|||||||
|
|
||||||
if ($element['type'] == 'item' or ($element['type'] == 'category' and $element['depth'] > 1)) {
|
if ($element['type'] == 'item' or ($element['type'] == 'category' and $element['depth'] > 1)) {
|
||||||
if ($this->element_deletable($element)) {
|
if ($this->element_deletable($element)) {
|
||||||
$actions .= '<a href="index.php?id='.$COURSE->id.'&action=delete&eid='
|
$actionicon = new moodle_action_icon();
|
||||||
. $eid.'&sesskey='.sesskey().'"><img src="'.$OUTPUT->old_icon_url('t/delete') . '" class="iconsmall" alt="'
|
$actionicon->link->url = new moodle_url('index.php', array('id' => $COURSE->id, 'action' => 'delete', 'eid' => $eid, 'sesskey' => sesskey()));
|
||||||
. get_string('delete').'" title="'.get_string('delete').'"/></a>';
|
$actionicon->image->src = $OUTPUT->old_icon_url('t/delete');
|
||||||
|
$actionicon->image->alt = get_string('delete');
|
||||||
|
$actionicon->image->title = get_string('delete');
|
||||||
|
$actionicon->image->add_class('iconsmall');
|
||||||
|
$actions .= $OUTPUT->action_icon($actionicon);
|
||||||
}
|
}
|
||||||
$actions .= '<a href="index.php?id='.$COURSE->id.'&action=moveselect&eid='
|
|
||||||
. $eid.'&sesskey='.sesskey().'"><img src="'.$OUTPUT->old_icon_url('t/move') . '" class="iconsmall" alt="'
|
$actionicon = new moodle_action_icon();
|
||||||
. get_string('move').'" title="'.get_string('move').'"/></a>';
|
$actionicon->link->url = new moodle_url('index.php', array('id' => $COURSE->id, 'action' => 'moveselect', 'eid' => $eid, 'sesskey' => sesskey()));
|
||||||
|
$actionicon->image->src = $OUTPUT->old_icon_url('t/move');
|
||||||
|
$actionicon->image->alt = get_string('move');
|
||||||
|
$actionicon->image->title = get_string('move');
|
||||||
|
$actionicon->image->add_class('iconsmall');
|
||||||
|
$actions .= $OUTPUT->action_icon($actionicon);
|
||||||
}
|
}
|
||||||
|
|
||||||
$actions .= $this->gtree->get_hiding_icon($element, $this->gpr);
|
$actions .= $this->gtree->get_hiding_icon($element, $this->gpr);
|
||||||
@ -171,7 +180,7 @@ class grade_edit_tree {
|
|||||||
$first = '';
|
$first = '';
|
||||||
|
|
||||||
if ($child_el['object']->itemtype == 'course' || $child_el['object']->itemtype == 'category') {
|
if ($child_el['object']->itemtype == 'course' || $child_el['object']->itemtype == 'category') {
|
||||||
$first = '&first=1';
|
$first = array('first' => 1);
|
||||||
$child_eid = $eid;
|
$child_eid = $eid;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -181,9 +190,17 @@ class grade_edit_tree {
|
|||||||
$strmovehere = get_string('movehere');
|
$strmovehere = get_string('movehere');
|
||||||
$actions = ''; // no action icons when moving
|
$actions = ''; // no action icons when moving
|
||||||
|
|
||||||
$moveto = '<tr><td colspan="12"><a href="index.php?id='.$COURSE->id.'&action=move&eid='.$this->moving.'&moveafter='
|
$moveicon = new moodle_action_icon();
|
||||||
. $child_eid.'&sesskey='.sesskey().$first.'"><img class="movetarget" src="'.$CFG->wwwroot.'/pix/movehere.gif" alt="'
|
$moveicon->link->url = new moodle_url('index.php', array('id' => $COURSE->id, 'action' => 'move', 'eid' => $this->moving, 'moveafter' => $child_eid, 'sesskey' => sesskey()));
|
||||||
. s($strmovehere).'" title="'.s($strmovehere).'" /></a></td></tr>';
|
if ($first) {
|
||||||
|
$moveicon->link->url->params($first);
|
||||||
|
}
|
||||||
|
$moveicon->image->add_class('movetarget');
|
||||||
|
$moveicon->image->src = $OUTPUT->old_icon_url('movehere');
|
||||||
|
$moveicon->image->alt = $strmovehere;
|
||||||
|
$moveicon->image->title = $strmovehere;
|
||||||
|
|
||||||
|
$moveto = '<tr><td colspan="12">'.$OUTPUT->action_icon($moveicon) .'</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$newparents = $parents;
|
$newparents = $parents;
|
||||||
@ -314,6 +331,8 @@ class grade_edit_tree {
|
|||||||
* @return string HTML
|
* @return string HTML
|
||||||
*/
|
*/
|
||||||
function get_weight_input($item, $type) {
|
function get_weight_input($item, $type) {
|
||||||
|
global $OUTPUT;
|
||||||
|
|
||||||
if (!is_object($item) || get_class($item) !== 'grade_item') {
|
if (!is_object($item) || get_class($item) !== 'grade_item') {
|
||||||
throw new Exception('grade_edit_tree::get_weight_input($item) was given a variable that is not of the required type (grade_item object)');
|
throw new Exception('grade_edit_tree::get_weight_input($item) was given a variable that is not of the required type (grade_item object)');
|
||||||
return false;
|
return false;
|
||||||
@ -323,18 +342,30 @@ class grade_edit_tree {
|
|||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$weightfield = new html_field();
|
||||||
|
|
||||||
$parent_category = $item->get_parent_category();
|
$parent_category = $item->get_parent_category();
|
||||||
$parent_category->apply_forced_settings();
|
$parent_category->apply_forced_settings();
|
||||||
$aggcoef = $item->get_coefstring();
|
$aggcoef = $item->get_coefstring();
|
||||||
|
|
||||||
if ((($aggcoef == 'aggregationcoefweight' || $aggcoef == 'aggregationcoef') && $type == 'weight') ||
|
if ((($aggcoef == 'aggregationcoefweight' || $aggcoef == 'aggregationcoef') && $type == 'weight') ||
|
||||||
($aggcoef == 'aggregationcoefextra' && $type == 'extra')) {
|
($aggcoef == 'aggregationcoefextra' && $type == 'extra')) {
|
||||||
return '<input type="text" size="6" id="aggregationcoef_'.$item->id.'" name="aggregationcoef_'.$item->id.'"
|
$weightfield->type = 'text';
|
||||||
value="'.format_float($item->aggregationcoef, 4).'" />';
|
$weightfield->id = "aggregationcoef_$item->id";
|
||||||
|
$weightfield->name = "aggregationcoef_$item->id";
|
||||||
|
$weightfield->value = format_float($item->aggregationcoef, 4);
|
||||||
|
|
||||||
|
return $OUTPUT->field($weightfield);;
|
||||||
} elseif ($aggcoef == 'aggregationcoefextrasum' && $type == 'extra') {
|
} elseif ($aggcoef == 'aggregationcoefextrasum' && $type == 'extra') {
|
||||||
$checked = ($item->aggregationcoef > 0) ? 'checked="checked"' : '';
|
$checked = ($item->aggregationcoef > 0) ? 'checked="checked"' : '';
|
||||||
return '<input type="hidden" name="extracredit_'.$item->id.'" value="0" />
|
$weightfield->type = 'hidden';
|
||||||
<input type="checkbox" id="extracredit_'.$item->id.'" name="extracredit_'.$item->id.'" value="1" '."$checked />\n";
|
$weightfield->name = "extracredit_$item->id";
|
||||||
|
$weightfield->value = 0;
|
||||||
|
|
||||||
|
$extracredit = html_select_option::make_checkbox(1, ($item->aggregationcoef > 0), ' ');
|
||||||
|
$extracredit->id = "extracredit_$item->id";
|
||||||
|
$extracredit->name = "extracredit_$item->id";
|
||||||
|
return $OUTPUT->field($weightfield) . $OUTPUT->checkbox($extracredit);
|
||||||
} else {
|
} else {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
@ -673,7 +704,7 @@ class grade_edit_tree_column_range extends grade_edit_tree_column {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function get_item_cell($item, $params) {
|
public function get_item_cell($item, $params) {
|
||||||
global $DB;
|
global $DB, $OUTPUT;
|
||||||
|
|
||||||
// If the parent aggregation is Sum of Grades, this cannot be changed
|
// If the parent aggregation is Sum of Grades, this cannot be changed
|
||||||
$parent_cat = $item->get_parent_category();
|
$parent_cat = $item->get_parent_category();
|
||||||
@ -686,7 +717,10 @@ class grade_edit_tree_column_range extends grade_edit_tree_column {
|
|||||||
} elseif ($item->is_external_item()) {
|
} elseif ($item->is_external_item()) {
|
||||||
$grademax = format_float($item->grademax, $item->get_decimals());
|
$grademax = format_float($item->grademax, $item->get_decimals());
|
||||||
} else {
|
} else {
|
||||||
$grademax = '<input type="text" size="4" id="grademax'.$item->id.'" name="grademax_'.$item->id.'" value="'.format_float($item->grademax, $item->get_decimals()).'" />';
|
$grademaxinput = html_field::make_text("grademax_$item->id", format_float($item->grademax, $item->get_decimals()), get_string('grademax', 'grades'));
|
||||||
|
$grademaxinput->id = "grademax_$item->id";
|
||||||
|
$grademaxinput->title = get_string('grademax', 'grades');
|
||||||
|
$grademax = $OUTPUT->field($grademaxinput);
|
||||||
}
|
}
|
||||||
|
|
||||||
return '<td class="cell">'.$grademax.'</td>';
|
return '<td class="cell">'.$grademax.'</td>';
|
||||||
@ -715,15 +749,22 @@ class grade_edit_tree_column_aggregateonlygraded extends grade_edit_tree_column_
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function get_category_cell($category, $levelclass, $params) {
|
public function get_category_cell($category, $levelclass, $params) {
|
||||||
$onlygradedcheck = ($category->aggregateonlygraded == 1) ? 'checked="checked"' : '';
|
global $OUTPUT;
|
||||||
$hidden = '<input type="hidden" name="aggregateonlygraded_'.$category->id.'" value="0" />';
|
|
||||||
$aggregateonlygraded ='<input type="checkbox" id="aggregateonlygraded_'.$category->id.'" name="aggregateonlygraded_'.$category->id.'" value="1" '.$onlygradedcheck . ' />';
|
$hidden = new html_field();
|
||||||
|
$hidden->type = 'hidden';
|
||||||
|
$hidden->name = "aggregateonlygraded_$category->id";
|
||||||
|
$hidden->value = 0;
|
||||||
|
|
||||||
|
$aggregateonlygraded = html_select_option::make_checkbox(1, ($category->aggregateonlygraded == 1), ' ');
|
||||||
|
$aggregateonlygraded->id = "aggregateonlygraded_$category->id";
|
||||||
|
$aggregateonlygraded->name = "aggregateonlygraded_$category->id";
|
||||||
|
|
||||||
if ($this->forced) {
|
if ($this->forced) {
|
||||||
$aggregateonlygraded = ($category->aggregateonlygraded) ? get_string('yes') : get_string('no');
|
$aggregateonlygraded = ($category->aggregateonlygraded) ? get_string('yes') : get_string('no');
|
||||||
}
|
}
|
||||||
|
|
||||||
return '<td class="cell '.$levelclass.'">'.$hidden.$aggregateonlygraded.'</td>';
|
return '<td class="cell '.$levelclass.'">'.$OUTPUT->field($hidden).$OUTPUT->checkbox($aggregateonlygraded).'</td>';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function get_item_cell($item, $params) {
|
public function get_item_cell($item, $params) {
|
||||||
|
174
grade/lib.php
174
grade/lib.php
@ -309,7 +309,7 @@ function print_graded_users_selector($course, $actionpage, $userid=0, $groupid=0
|
|||||||
}
|
}
|
||||||
|
|
||||||
$nextuser = $gui->next_user();
|
$nextuser = $gui->next_user();
|
||||||
|
|
||||||
while ($userdata = $gui->next_user()) {
|
while ($userdata = $gui->next_user()) {
|
||||||
$user = $userdata->user;
|
$user = $userdata->user;
|
||||||
$menu[$user->id] = fullname($user);
|
$menu[$user->id] = fullname($user);
|
||||||
@ -361,7 +361,7 @@ function print_grade_plugin_selector($plugin_info, $return=false) {
|
|||||||
if ($count > 1) {
|
if ($count > 1) {
|
||||||
$select = html_select::make_popup_form('', '', $menu, 'choosepluginreport', '');
|
$select = html_select::make_popup_form('', '', $menu, 'choosepluginreport', '');
|
||||||
$select->override_option_values($menu);
|
$select->override_option_values($menu);
|
||||||
|
|
||||||
if ($return) {
|
if ($return) {
|
||||||
return $OUTPUT->select($select);
|
return $OUTPUT->select($select);
|
||||||
} else {
|
} else {
|
||||||
@ -385,7 +385,7 @@ function print_grade_plugin_selector($plugin_info, $return=false) {
|
|||||||
*/
|
*/
|
||||||
function grade_print_tabs($active_type, $active_plugin, $plugin_info, $return=false) {
|
function grade_print_tabs($active_type, $active_plugin, $plugin_info, $return=false) {
|
||||||
global $CFG, $COURSE;
|
global $CFG, $COURSE;
|
||||||
|
|
||||||
if (!isset($currenttab)) {
|
if (!isset($currenttab)) {
|
||||||
$currenttab = '';
|
$currenttab = '';
|
||||||
}
|
}
|
||||||
@ -815,7 +815,7 @@ function print_grade_page_head($courseid, $active_type, $active_plugin=null,
|
|||||||
global $CFG, $COURSE, $OUTPUT;
|
global $CFG, $COURSE, $OUTPUT;
|
||||||
$strgrades = get_string('grades');
|
$strgrades = get_string('grades');
|
||||||
$plugin_info = grade_get_plugin_info($courseid, $active_type, $active_plugin);
|
$plugin_info = grade_get_plugin_info($courseid, $active_type, $active_plugin);
|
||||||
|
|
||||||
// Determine the string of the active plugin
|
// Determine the string of the active plugin
|
||||||
$stractive_plugin = ($active_plugin) ? $plugin_info['strings']['active_plugin_str'] : $heading;
|
$stractive_plugin = ($active_plugin) ? $plugin_info['strings']['active_plugin_str'] : $heading;
|
||||||
$stractive_type = $plugin_info['strings'][$active_type];
|
$stractive_type = $plugin_info['strings'][$active_type];
|
||||||
@ -1063,35 +1063,31 @@ class grade_plugin_return {
|
|||||||
/**
|
/**
|
||||||
* Add return tracking params into url
|
* Add return tracking params into url
|
||||||
*
|
*
|
||||||
* @param string $url A URL
|
* @param moodle_url $url A URL
|
||||||
*
|
*
|
||||||
* @return string $url with erturn tracking params
|
* @return string $url with erturn tracking params
|
||||||
*/
|
*/
|
||||||
public function add_url_params($url) {
|
public function add_url_params(moodle_url $url) {
|
||||||
if (empty($this->type)) {
|
if (empty($this->type)) {
|
||||||
return $url;
|
return $url;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strpos($url, '?') === false) {
|
$url->param('gpr_type', $this->type);
|
||||||
$url .= '?gpr_type='.$this->type;
|
|
||||||
} else {
|
|
||||||
$url .= '&gpr_type='.$this->type;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($this->plugin)) {
|
if (!empty($this->plugin)) {
|
||||||
$url .= '&gpr_plugin='.$this->plugin;
|
$url->param('gpr_plugin', $this->plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($this->courseid)) {
|
if (!empty($this->courseid)) {
|
||||||
$url .= '&gpr_courseid='.$this->courseid;
|
$url->param('gpr_courseid' ,$this->courseid);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($this->userid)) {
|
if (!empty($this->userid)) {
|
||||||
$url .= '&gpr_userid='.$this->userid;
|
$url->param('gpr_userid', $this->userid);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($this->page)) {
|
if (!empty($this->page)) {
|
||||||
$url .= '&gpr_page='.$this->page;
|
$url->param('gpr_page', $this->page);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $url;
|
return $url;
|
||||||
@ -1267,7 +1263,7 @@ class grade_structure {
|
|||||||
|
|
||||||
} else if ($element['object']->itemtype == 'mod') {
|
} else if ($element['object']->itemtype == 'mod') {
|
||||||
$strmodname = get_string('modulename', $element['object']->itemmodule);
|
$strmodname = get_string('modulename', $element['object']->itemmodule);
|
||||||
return '<img src="'.$OUTPUT->mod_icon_url('icon',
|
return '<img src="'.$OUTPUT->mod_icon_url('icon',
|
||||||
$element['object']->itemmodule) . '" ' .
|
$element['object']->itemmodule) . '" ' .
|
||||||
'class="icon itemicon" title="' .s($strmodname).
|
'class="icon itemicon" title="' .s($strmodname).
|
||||||
'" alt="' .s($strmodname).'"/>';
|
'" alt="' .s($strmodname).'"/>';
|
||||||
@ -1436,8 +1432,6 @@ class grade_structure {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$strparams = $this->get_params_for_iconstr($element);
|
$strparams = $this->get_params_for_iconstr($element);
|
||||||
if ($element['type'] == 'item' or $element['type'] == 'category') {
|
|
||||||
}
|
|
||||||
|
|
||||||
$object = $element['object'];
|
$object = $element['object'];
|
||||||
|
|
||||||
@ -1447,32 +1441,29 @@ class grade_structure {
|
|||||||
case 'courseitem':
|
case 'courseitem':
|
||||||
$stredit = get_string('editverbose', 'grades', $strparams);
|
$stredit = get_string('editverbose', 'grades', $strparams);
|
||||||
if (empty($object->outcomeid) || empty($CFG->enableoutcomes)) {
|
if (empty($object->outcomeid) || empty($CFG->enableoutcomes)) {
|
||||||
$url = $CFG->wwwroot.'/grade/edit/tree/item.php?courseid='.
|
$url = new moodle_url($CFG->wwwroot.'/grade/edit/tree/item.php',
|
||||||
$this->courseid.'&id='.$object->id;
|
array('courseid' => $this->courseid, 'id' => $object->id));
|
||||||
} else {
|
} else {
|
||||||
$url = $CFG->wwwroot.'/grade/edit/tree/outcomeitem.php?courseid='.
|
$url = new moodle_url($CFG->wwwroot.'/grade/edit/tree/outcomeitem.php',
|
||||||
$this->courseid.'&id='.$object->id;
|
array('courseid' => $this->courseid, 'id' => $object->id));
|
||||||
}
|
}
|
||||||
$url = $gpr->add_url_params($url);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'category':
|
case 'category':
|
||||||
$stredit = get_string('editverbose', 'grades', $strparams);
|
$stredit = get_string('editverbose', 'grades', $strparams);
|
||||||
$url = $CFG->wwwroot.'/grade/edit/tree/category.php?courseid='.
|
$url = new moodle_url($CFG->wwwroot.'/grade/edit/tree/category.php',
|
||||||
$this->courseid.'&id='.$object->id;
|
array('courseid' => $this->courseid, 'id' => $object->id));
|
||||||
$url = $gpr->add_url_params($url);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'grade':
|
case 'grade':
|
||||||
$stredit = $streditgrade;
|
$stredit = $streditgrade;
|
||||||
if (empty($object->id)) {
|
if (empty($object->id)) {
|
||||||
$url = $CFG->wwwroot.'/grade/edit/tree/grade.php?courseid='.
|
$url = new moodle_url($CFG->wwwroot.'/grade/edit/tree/grade.php',
|
||||||
$this->courseid.'&itemid='.$object->itemid.'&userid='.$object->userid;
|
array('courseid' => $this->courseid, 'itemid' => $object->itemid, 'userid' => $object->userid));
|
||||||
} else {
|
} else {
|
||||||
$url = $CFG->wwwroot.'/grade/edit/tree/grade.php?courseid='.
|
$url = new moodle_url($CFG->wwwroot.'/grade/edit/tree/grade.php',
|
||||||
$this->courseid.'&id='.$object->id;
|
array('courseid' => $this->courseid, 'id' => $object->id));
|
||||||
}
|
}
|
||||||
$url = $gpr->add_url_params($url);
|
|
||||||
if (!empty($object->feedback)) {
|
if (!empty($object->feedback)) {
|
||||||
$feedback = addslashes_js(trim(format_string($object->feedback, $object->feedbackformat)));
|
$feedback = addslashes_js(trim(format_string($object->feedback, $object->feedbackformat)));
|
||||||
}
|
}
|
||||||
@ -1483,8 +1474,14 @@ class grade_structure {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($url) {
|
if ($url) {
|
||||||
return '<a href="'.$url.'"><img src="'.$OUTPUT->old_icon_url('t/edit') . '" ' .
|
$url = $gpr->add_url_params($url);
|
||||||
'class="iconsmall" alt="'.s($stredit).'" title="'.s($stredit).'"/></a>';
|
$editicon = new moodle_action_icon();
|
||||||
|
$editicon->link->url = $url;
|
||||||
|
$editicon->image->src = $OUTPUT->old_icon_url('t/edit');
|
||||||
|
$editicon->image->alt = $stredit;
|
||||||
|
$editicon->image->title = $stredit;
|
||||||
|
$editicon->image->add_class('iconsmall');
|
||||||
|
return $OUTPUT->action_icon($editicon);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
return '';
|
return '';
|
||||||
@ -1511,6 +1508,12 @@ class grade_structure {
|
|||||||
$strshow = get_string('showverbose', 'grades', $strparams);
|
$strshow = get_string('showverbose', 'grades', $strparams);
|
||||||
$strhide = get_string('hideverbose', 'grades', $strparams);
|
$strhide = get_string('hideverbose', 'grades', $strparams);
|
||||||
|
|
||||||
|
$hideicon = new moodle_action_icon();
|
||||||
|
$hideicon->image->add_class('iconsmall');
|
||||||
|
$hideicon->link->add_class('hide');
|
||||||
|
$hideicon->link->url = new moodle_url($CFG->wwwroot.'/grade/edit/tree/action.php',
|
||||||
|
array('id' => $this->courseid, 'sesskey' => sesskey(), 'eid' => $element['eid']));
|
||||||
|
|
||||||
if ($element['object']->is_hidden()) {
|
if ($element['object']->is_hidden()) {
|
||||||
$icon = 'show';
|
$icon = 'show';
|
||||||
$tooltip = $strshow;
|
$tooltip = $strshow;
|
||||||
@ -1522,24 +1525,20 @@ class grade_structure {
|
|||||||
userdate($element['object']->get_hidden()));
|
userdate($element['object']->get_hidden()));
|
||||||
}
|
}
|
||||||
|
|
||||||
$url = $CFG->wwwroot.'/grade/edit/tree/action.php?id=' .
|
$hideicon->link->url->param('action', 'show');
|
||||||
$this->courseid.'&action=show&sesskey='.sesskey() .
|
$hideicon->image->src = $OUTPUT->old_icon_url('t/' . $icon);
|
||||||
'&eid='.$element['eid'];
|
$hideicon->image->alt = $strshow;
|
||||||
|
$hideicon->image->title = $tooltip;
|
||||||
$url = $gpr->add_url_params($url);
|
|
||||||
$action = '<a href="'.$url.'" class="hide"><img alt="'.s($strshow).
|
|
||||||
'" src="'.$OUTPUT->old_icon_url('t/' . $icon) . '" ' .
|
|
||||||
'class="iconsmall" title="'.s($tooltip).'"/></a>';
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$url = $CFG->wwwroot.'/grade/edit/tree/action.php?id='.
|
$hideicon->link->url->param('action', 'hide');
|
||||||
$this->courseid.'&action=hide&sesskey='.sesskey()
|
$hideicon->image->src = $OUTPUT->old_icon_url('t/hide');
|
||||||
. '&eid='.$element['eid'];
|
$hideicon->image->alt = $strhide;
|
||||||
$url = $gpr->add_url_params($url);
|
$hideicon->image->title = $strhide;
|
||||||
$action = '<a href="'.$url.'" class="hide"><img src="'.
|
|
||||||
$OUTPUT->old_icon_url('t/hide') . '" class="iconsmall" alt="'.s($strhide).'" title="'.s($strhide).'"/></a>';
|
|
||||||
}
|
}
|
||||||
return $action;
|
|
||||||
|
$hideicon->link->url = $gpr->add_url_params($hideicon->link->url);
|
||||||
|
return $OUTPUT->action_icon($hideicon);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1557,14 +1556,26 @@ class grade_structure {
|
|||||||
$strunlock = get_string('unlockverbose', 'grades', $strparams);
|
$strunlock = get_string('unlockverbose', 'grades', $strparams);
|
||||||
$strlock = get_string('lockverbose', 'grades', $strparams);
|
$strlock = get_string('lockverbose', 'grades', $strparams);
|
||||||
|
|
||||||
|
$lockicon = new moodle_action_icon();
|
||||||
|
$lockicon->link->url = new moodle_url($CFG->wwwroot.'/grade/edit/tree/action.php', array(
|
||||||
|
'id' => $this->courseid,
|
||||||
|
'sesskey' => sesskey(),
|
||||||
|
'eid' => $element['eid']));
|
||||||
|
$lockicon->link->url = $gpr->add_url_params($lockicon->link->url);
|
||||||
|
$lockicon->image->add_class('iconsmall');
|
||||||
|
|
||||||
// Don't allow an unlocking action for a grade whose grade item is locked: just print a state icon
|
// Don't allow an unlocking action for a grade whose grade item is locked: just print a state icon
|
||||||
if ($element['type'] == 'grade' && $element['object']->grade_item->is_locked()) {
|
if ($element['type'] == 'grade' && $element['object']->grade_item->is_locked()) {
|
||||||
$strparamobj = new stdClass();
|
$strparamobj = new stdClass();
|
||||||
$strparamobj->itemname = $element['object']->grade_item->itemname;
|
$strparamobj->itemname = $element['object']->grade_item->itemname;
|
||||||
$strnonunlockable = get_string('nonunlockableverbose', 'grades', $strparamobj);
|
$strnonunlockable = get_string('nonunlockableverbose', 'grades', $strparamobj);
|
||||||
$action = '<img src="'.$OUTPUT->old_icon_url('t/unlock_gray') . '" alt="'.
|
|
||||||
s($strnonunlockable).'" class="iconsmall" title="'.
|
$lockicon = new html_image();
|
||||||
s($strnonunlockable).'"/>';
|
$lockicon->image->src = $OUTPUT->old_icon_url('t/unlock_gray');
|
||||||
|
$lockicon->image->alt = s($strnonunlockable);
|
||||||
|
$lockicon->image->title = s($strnonunlockable);
|
||||||
|
$lockicon->image->add_class('iconsmall');
|
||||||
|
$action = $OUTPUT->image($lockicon);
|
||||||
} else if ($element['object']->is_locked()) {
|
} else if ($element['object']->is_locked()) {
|
||||||
$icon = 'unlock';
|
$icon = 'unlock';
|
||||||
$tooltip = $strunlock;
|
$tooltip = $strunlock;
|
||||||
@ -1580,27 +1591,25 @@ class grade_structure {
|
|||||||
!has_capability('moodle/grade:unlock', $this->context)) {
|
!has_capability('moodle/grade:unlock', $this->context)) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
$url = $CFG->wwwroot.'/grade/edit/tree/action.php?id='.
|
$lockicon->link->url->param('action', 'unlock');
|
||||||
$this->courseid.'&action=unlock&sesskey='.sesskey() .
|
$lockicon->link->add_class('lock');
|
||||||
'&eid='.$element['eid'];
|
$lockicon->image->src = $OUTPUT->old_icon_url('t/'.$icon);
|
||||||
|
$lockicon->image->alt = $strunlock;
|
||||||
$url = $gpr->add_url_params($url);
|
$lockicon->image->title = $tooltip;
|
||||||
$action = '<a href="'.$url.'" class="lock"><img src="'.$OUTPUT->old_icon_url('t/'.$icon).'" alt="'.s($strunlock).
|
$action = $OUTPUT->action_icon($lockicon);
|
||||||
'" class="iconsmall" title="'.s($tooltip).'"/></a>';
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (!has_capability('moodle/grade:manage', $this->context) and
|
if (!has_capability('moodle/grade:manage', $this->context) and
|
||||||
!has_capability('moodle/grade:lock', $this->context)) {
|
!has_capability('moodle/grade:lock', $this->context)) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
$url = $CFG->wwwroot.'/grade/edit/tree/action.php?id='.
|
|
||||||
$this->courseid.'&action=lock&sesskey='.sesskey() .
|
|
||||||
'&eid='.$element['eid'];
|
|
||||||
|
|
||||||
$url = $gpr->add_url_params($url);
|
$lockicon->link->url->param('action', 'lock');
|
||||||
$action = '<a href="'.$url.'" class="lock"><img src="'.
|
$lockicon->link->add_class('lock');
|
||||||
$OUTPUT->old_icon_url('t/lock') . '" class="iconsmall" alt="'.
|
$lockicon->image->src = $OUTPUT->old_icon_url('t/lock');
|
||||||
s($strlock).'" title="' . s($strlock).'"/></a>';
|
$lockicon->image->alt = $strlock;
|
||||||
|
$lockicon->image->title = $strlock;
|
||||||
|
$action = $OUTPUT->action_icon($lockicon);
|
||||||
}
|
}
|
||||||
return $action;
|
return $action;
|
||||||
}
|
}
|
||||||
@ -1619,12 +1628,9 @@ class grade_structure {
|
|||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$calculation_icon = '';
|
|
||||||
|
|
||||||
$type = $element['type'];
|
$type = $element['type'];
|
||||||
$object = $element['object'];
|
$object = $element['object'];
|
||||||
|
|
||||||
|
|
||||||
if ($type == 'item' or $type == 'courseitem' or $type == 'categoryitem') {
|
if ($type == 'item' or $type == 'courseitem' or $type == 'categoryitem') {
|
||||||
$strparams = $this->get_params_for_iconstr($element);
|
$strparams = $this->get_params_for_iconstr($element);
|
||||||
$streditcalculation = get_string('editcalculationverbose', 'grades', $strparams);
|
$streditcalculation = get_string('editcalculationverbose', 'grades', $strparams);
|
||||||
@ -1640,16 +1646,20 @@ class grade_structure {
|
|||||||
$icon = 't/calc_off';
|
$icon = 't/calc_off';
|
||||||
}
|
}
|
||||||
|
|
||||||
$url = $CFG->wwwroot.'/grade/edit/tree/calculation.php?courseid='.
|
$calcicon = new moodle_action_icon();
|
||||||
$this->courseid.'&id='.$object->id;
|
$calcicon->link->url = new moodle_url($CFG->wwwroot.'/grade/edit/tree/calculation.php',
|
||||||
$url = $gpr->add_url_params($url);
|
array('courseid' => $this->courseid, 'id' => $object->id));
|
||||||
$calculation_icon = '<a href="'. $url.'" class="calculation">' .
|
|
||||||
'<img src="'.$OUTPUT->old_icon_url($icon).'" class="iconsmall" alt="' .
|
$calcicon->link->url = $gpr->add_url_params($calcicon->link->url);
|
||||||
s($streditcalculation).'" title="'.s($streditcalculation).'" /></a>'. "\n";
|
$calcicon->image->src = $OUTPUT->old_icon_url($icon);
|
||||||
|
$calcicon->add_class('iconsmall');
|
||||||
|
$calcicon->alt = $streditcalculation;
|
||||||
|
$calcicon->title = $streditcalculation;
|
||||||
|
return $OUTPUT->action_icon($calcicon) . "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $calculation_icon;
|
return '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1663,12 +1673,6 @@ class grade_structure {
|
|||||||
*/
|
*/
|
||||||
class grade_seq extends grade_structure {
|
class grade_seq extends grade_structure {
|
||||||
|
|
||||||
/**
|
|
||||||
* A string of GET URL variables, namely courseid and sesskey, used in most URLs built by this class.
|
|
||||||
* @var string $commonvars
|
|
||||||
*/
|
|
||||||
public $commonvars;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 1D array of elements
|
* 1D array of elements
|
||||||
*/
|
*/
|
||||||
@ -1686,7 +1690,6 @@ class grade_seq extends grade_structure {
|
|||||||
global $USER, $CFG;
|
global $USER, $CFG;
|
||||||
|
|
||||||
$this->courseid = $courseid;
|
$this->courseid = $courseid;
|
||||||
$this->commonvars = "&sesskey=".sesskey()."&id=$this->courseid";
|
|
||||||
$this->context = get_context_instance(CONTEXT_COURSE, $courseid);
|
$this->context = get_context_instance(CONTEXT_COURSE, $courseid);
|
||||||
|
|
||||||
// get course grade tree
|
// get course grade tree
|
||||||
@ -1813,12 +1816,6 @@ class grade_tree extends grade_structure {
|
|||||||
*/
|
*/
|
||||||
public $top_element;
|
public $top_element;
|
||||||
|
|
||||||
/**
|
|
||||||
* A string of GET URL variables, namely courseid and sesskey, used in most URLs built by this class.
|
|
||||||
* @var string $commonvars
|
|
||||||
*/
|
|
||||||
public $commonvars;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 2D array of grade items and categories
|
* 2D array of grade items and categories
|
||||||
* @var array $levels
|
* @var array $levels
|
||||||
@ -1846,7 +1843,6 @@ class grade_tree extends grade_structure {
|
|||||||
global $USER, $CFG;
|
global $USER, $CFG;
|
||||||
|
|
||||||
$this->courseid = $courseid;
|
$this->courseid = $courseid;
|
||||||
$this->commonvars = "&sesskey=".sesskey()."&id=$this->courseid";
|
|
||||||
$this->levels = array();
|
$this->levels = array();
|
||||||
$this->context = get_context_instance(CONTEXT_COURSE, $courseid);
|
$this->context = get_context_instance(CONTEXT_COURSE, $courseid);
|
||||||
|
|
||||||
|
@ -35,6 +35,7 @@ $toggle = optional_param('toggle', NULL, PARAM_INT);
|
|||||||
$toggle_type = optional_param('toggle_type', 0, PARAM_ALPHANUM);
|
$toggle_type = optional_param('toggle_type', 0, PARAM_ALPHANUM);
|
||||||
|
|
||||||
$PAGE->set_url('grade/report/grader/index.php', compact('courseid', 'page', 'perpageurl', 'edit', 'sortitemid'));
|
$PAGE->set_url('grade/report/grader/index.php', compact('courseid', 'page', 'perpageurl', 'edit', 'sortitemid'));
|
||||||
|
$PAGE->requires->css('lib/yui/container/assets/skins/sam/container.css');
|
||||||
|
|
||||||
/// basic access checks
|
/// basic access checks
|
||||||
if (!$course = $DB->get_record('course', array('id' => $courseid))) {
|
if (!$course = $DB->get_record('course', array('id' => $courseid))) {
|
||||||
@ -110,13 +111,14 @@ $reportname = get_string('modulename', 'gradereport_grader');
|
|||||||
// Initialise the grader report object
|
// Initialise the grader report object
|
||||||
$report = new grade_report_grader($courseid, $gpr, $context, $page, $sortitemid);
|
$report = new grade_report_grader($courseid, $gpr, $context, $page, $sortitemid);
|
||||||
|
|
||||||
$PAGE->requires->yui_lib('event')->in_head(); // TODO change the JS so we can remove the ->in_head()
|
$PAGE->requires->yui_lib('event');
|
||||||
$PAGE->requires->yui_lib('json')->in_head();
|
$PAGE->requires->yui_lib('json');
|
||||||
$PAGE->requires->yui_lib('connection')->in_head();
|
$PAGE->requires->yui_lib('connection');
|
||||||
$PAGE->requires->yui_lib('dragdrop')->in_head();
|
$PAGE->requires->yui_lib('dragdrop');
|
||||||
$PAGE->requires->yui_lib('element')->in_head();
|
$PAGE->requires->yui_lib('element');
|
||||||
$PAGE->requires->yui_lib('container')->in_head();
|
$PAGE->requires->yui_lib('container');
|
||||||
$PAGE->requires->js('grade/report/grader/functions.js')->in_head();
|
$PAGE->requires->js('grade/report/grader/functions.js');
|
||||||
|
$PAGE->requires->js('grade/report/grader/grader.js');
|
||||||
|
|
||||||
if ($report->get_pref('enableajax')) {
|
if ($report->get_pref('enableajax')) {
|
||||||
$report = new grade_report_grader_ajax($courseid, $gpr, $context, $page, $sortitemid);
|
$report = new grade_report_grader_ajax($courseid, $gpr, $context, $page, $sortitemid);
|
||||||
@ -206,161 +208,4 @@ echo '<div id="hiddentooltiproot">tooltip panel</div>';
|
|||||||
if ($report->get_pref('enableajax')) {
|
if ($report->get_pref('enableajax')) {
|
||||||
require_once 'ajax.php';
|
require_once 'ajax.php';
|
||||||
}
|
}
|
||||||
|
echo $OUTPUT->footer();
|
||||||
// Print YUI tooltip code
|
|
||||||
?>
|
|
||||||
<script type="text/javascript">
|
|
||||||
//<![CDATA[
|
|
||||||
|
|
||||||
YAHOO.namespace("graderreport");
|
|
||||||
|
|
||||||
function init() {
|
|
||||||
// Adjust height of header c0
|
|
||||||
var rows = document.getElementsByClassName('heading_name_row');
|
|
||||||
var header_cell_region = YAHOO.util.Dom.getRegion(rows[rows.length-1].firstChild);
|
|
||||||
var height = header_cell_region.bottom - header_cell_region.top;
|
|
||||||
YAHOO.util.Dom.setStyle('studentheader', 'height', height + 'px');
|
|
||||||
|
|
||||||
// attach event listener to the table for mouseover and mouseout
|
|
||||||
var table = document.getElementById('user-grades');
|
|
||||||
YAHOO.util.Event.on(table, 'mouseover', YAHOO.graderreport.mouseoverHandler);
|
|
||||||
YAHOO.util.Event.on(table, 'mouseout', YAHOO.graderreport.mouseoutHandler);
|
|
||||||
|
|
||||||
// Make single panel that can be dynamically re-rendered wit the right data.
|
|
||||||
YAHOO.graderreport.panelEl = new YAHOO.widget.Panel("tooltipPanel", {
|
|
||||||
|
|
||||||
draggable: false,
|
|
||||||
visible: false,
|
|
||||||
close: false,
|
|
||||||
preventcontextoverlap: true,
|
|
||||||
underlay: 'none'
|
|
||||||
});
|
|
||||||
|
|
||||||
YAHOO.graderreport.panelEl.render(table);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
YAHOO.graderreport.mouseoverHandler = function (e) {
|
|
||||||
|
|
||||||
var tempNode = '';
|
|
||||||
var searchString = '';
|
|
||||||
var tooltipNode = '';
|
|
||||||
|
|
||||||
// get the element that we just moved the mouse over
|
|
||||||
var elTarget = YAHOO.util.Event.getTarget(e);
|
|
||||||
|
|
||||||
|
|
||||||
// if it was part of the yui panel, we don't want to redraw yet
|
|
||||||
searchString = /fullname|itemname|feedback/;
|
|
||||||
if (elTarget.className.search(searchString) > -1) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// move up until we are in the actual cell, not any other child div or span
|
|
||||||
while (elTarget.id != 'user-grades') {
|
|
||||||
if(elTarget.nodeName.toUpperCase() == "TD") {
|
|
||||||
break;
|
|
||||||
} else {
|
|
||||||
elTarget = elTarget.parentNode;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// only make a tooltip for cells with grades
|
|
||||||
if (elTarget.className.search('grade cell') > -1) {
|
|
||||||
|
|
||||||
// each time we go over a new cell, we need to put it's tooltip into a div to stop it from
|
|
||||||
// popping up on top of the panel.
|
|
||||||
|
|
||||||
// don't do anything if we have already made the tooltip div
|
|
||||||
var makeTooltip = true
|
|
||||||
for (var k=0; k < elTarget.childNodes.length; k++) {
|
|
||||||
if (typeof(elTarget.childNodes[k].className) != 'undefined') {
|
|
||||||
if (elTarget.childNodes[k].className.search('tooltipDiv') > -1) {
|
|
||||||
makeTooltip = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// if need to, make the tooltip div and append it to the cell
|
|
||||||
if (makeTooltip) {
|
|
||||||
|
|
||||||
tempNode = document.createElement("div");
|
|
||||||
tempNode.className = "tooltipDiv";
|
|
||||||
tempNode.innerHTML = elTarget.title;
|
|
||||||
elTarget.appendChild(tempNode);
|
|
||||||
elTarget.title = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get the tooltip div
|
|
||||||
elChildren = elTarget.childNodes;
|
|
||||||
for (var m=0; m < elChildren.length; m++) {
|
|
||||||
if (typeof(elChildren[m].className) != 'undefined') {
|
|
||||||
if (elChildren[m].className.search('tooltipDiv') > -1) {
|
|
||||||
tooltipNode = elChildren[m];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//build and show the tooltip
|
|
||||||
YAHOO.graderreport.panelEl.setBody(tooltipNode.innerHTML);
|
|
||||||
YAHOO.graderreport.panelEl.render(elTarget);
|
|
||||||
YAHOO.graderreport.panelEl.show()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// only hide the overlay if the mouse has not moved over it
|
|
||||||
YAHOO.graderreport.mouseoutHandler = function (e) {
|
|
||||||
|
|
||||||
var classVar = '';
|
|
||||||
var searchString = '';
|
|
||||||
var newTargetClass = '';
|
|
||||||
var newTarget = YAHOO.util.Event.getRelatedTarget(e);
|
|
||||||
|
|
||||||
// deals with an error if the mouseout event is over the lower scrollbar
|
|
||||||
try {
|
|
||||||
classVar = newTarget.className;
|
|
||||||
} catch (err) {
|
|
||||||
YAHOO.graderreport.panelEl.hide()
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// if we are over any part of the panel, do not hide
|
|
||||||
// do this by walking up the DOM till we reach table level, looking for panel tag
|
|
||||||
while ((typeof(newTarget.id) == 'undefined') || (newTarget.id != 'user-grades')) {
|
|
||||||
|
|
||||||
try {
|
|
||||||
newTargetClass = newTarget.className;
|
|
||||||
} catch (err) {
|
|
||||||
// we've gone over the scrollbar again
|
|
||||||
YAHOO.graderreport.panelEl.hide()
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
searchString = /yui-panel|grade cell/;
|
|
||||||
if (newTargetClass.search(searchString) > -1) {
|
|
||||||
// we're in the panel so don't hide it
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (newTarget.nodeName.toUpperCase() == "HTML") {
|
|
||||||
// we missed the user-grades table altogether by moving down off screen to read a long one
|
|
||||||
YAHOO.graderreport.panelEl.hide()
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
newTarget = newTarget.parentNode;
|
|
||||||
}
|
|
||||||
|
|
||||||
// no panel so far and we went up to the
|
|
||||||
YAHOO.graderreport.panelEl.hide()
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
YAHOO.util.Event.onDOMReady(init);
|
|
||||||
//]]>
|
|
||||||
</script>
|
|
||||||
<?php
|
|
||||||
|
|
||||||
echo $OUTPUT->footer();
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
@ -932,7 +932,7 @@ class grade_report_grader extends grade_report {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function get_studentnameshtml() {
|
function get_studentnameshtml() {
|
||||||
global $CFG, $USER;
|
global $CFG, $USER, $OUTPUT;
|
||||||
$studentshtml = '';
|
$studentshtml = '';
|
||||||
|
|
||||||
$showuserimage = $this->get_pref('showuserimage');
|
$showuserimage = $this->get_pref('showuserimage');
|
||||||
|
@ -218,7 +218,6 @@ vertical-align:middle;
|
|||||||
.grade-report-grader table {
|
.grade-report-grader table {
|
||||||
border-collapse:collapse;
|
border-collapse:collapse;
|
||||||
background-color:#fff;
|
background-color:#fff;
|
||||||
font-size:10px;
|
|
||||||
border-color:#cecece;
|
border-color:#cecece;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -387,7 +386,7 @@ padding-top:20px;
|
|||||||
.grade-report-grader .right_scroller {
|
.grade-report-grader .right_scroller {
|
||||||
width:auto;
|
width:auto;
|
||||||
clear:none;
|
clear:none;
|
||||||
overflow-x:auto;
|
overflow-x:scroll;
|
||||||
}
|
}
|
||||||
|
|
||||||
.grade-report-grader table tr.avg,.grade-report-grader table tr.groupavg td,.grade-report-grader table tr.avg td,.grade-report-grader table tr.groupavg th,.grade-report-grader table tr.avg th,.grade-report-grader table tr.controls_row,.grade-report-grader table tr.controls_row th,.grade-report-grader table tr.range_row,.grade-report-grader table tr.range_row th,div.right_scroller tr {
|
.grade-report-grader table tr.avg,.grade-report-grader table tr.groupavg td,.grade-report-grader table tr.avg td,.grade-report-grader table tr.groupavg th,.grade-report-grader table tr.avg th,.grade-report-grader table tr.controls_row,.grade-report-grader table tr.controls_row th,.grade-report-grader table tr.range_row,.grade-report-grader table tr.range_row th,div.right_scroller tr {
|
||||||
@ -442,37 +441,6 @@ white-space:nowrap;
|
|||||||
width:2000px;
|
width:2000px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ie .right_scroller {
|
|
||||||
padding-bottom:15px;
|
|
||||||
overflow-y:hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ie table#fixed_column th {
|
|
||||||
height:40.5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ie table#fixed_column tr.avg th {
|
|
||||||
height:21px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ie div.left_scroller td {
|
|
||||||
height:42px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ie6 div.left_scroller {
|
|
||||||
margin-top:40px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ie6 div.right_scroller {
|
|
||||||
margin-top:40px;
|
|
||||||
width:auto;
|
|
||||||
position:absolute;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ie6 .excludedfloater {
|
|
||||||
font-size:7px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.grade_icons img.ajax {
|
.grade_icons img.ajax {
|
||||||
float:right;
|
float:right;
|
||||||
}
|
}
|
||||||
@ -520,7 +488,7 @@ background-color:#f3ead8;
|
|||||||
}
|
}
|
||||||
|
|
||||||
.grade-report-grader div.left_scroller tr,.grade-report-grader div.right_scroller tr,.grade-report-grader div.left_scroller td,.grade-report-grader div.right_scroller td,.grade-report-grader div.left_scroller th,.grade-report-grader div.right_scroller th {
|
.grade-report-grader div.left_scroller tr,.grade-report-grader div.right_scroller tr,.grade-report-grader div.left_scroller td,.grade-report-grader div.right_scroller td,.grade-report-grader div.left_scroller th,.grade-report-grader div.right_scroller th {
|
||||||
height:4em;
|
height:4.5em;
|
||||||
font-size:10px;
|
font-size:10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -558,12 +526,6 @@ vertical-align:middle;
|
|||||||
text-align: left;
|
text-align: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
<?php include($CFG->dirroot.'/lib/yui/container/assets/skins/sam/container.css') ?>
|
|
||||||
.yui-skin-sam .yui-panel .hd{padding:0 10px;font-size:93%;line-height:2;*line-height:1.9;font-weight:bold;color:#000;background:url(<?php echo $CFG->wwwroot."/lib/yui" ?>/assets/skins/sam/sprite.png) repeat-x 0 -200px;}
|
|
||||||
.yui-skin-sam .container-close{border-color: #45c;position:absolute;top:5px;right:6px;width:25px;height:15px;background:url(<?php echo $CFG->wwwroot."/lib/yui" ?>/assets/skins/sam/sprite.png) no-repeat 0 -300px;cursor:pointer;}
|
|
||||||
.yui-skin-sam .yui-simple-dialog .bd .yui-icon{background:url(<?php echo $CFG->wwwroot."/lib/yui" ?>/assets/skins/sam/sprite.png) no-repeat 0 0;width:16px;height:16px;margin-right:10px;float:left;}
|
|
||||||
|
|
||||||
.grade-report-grader .yui-overlay a.container-close {
|
.grade-report-grader .yui-overlay a.container-close {
|
||||||
margin-top: -3px;
|
margin-top: -3px;
|
||||||
}
|
}
|
||||||
@ -572,4 +534,34 @@ vertical-align:middle;
|
|||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.ie .right_scroller {
|
||||||
|
padding-bottom:15px;
|
||||||
|
overflow-y:hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ie table#fixed_column th {
|
||||||
|
height:4.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ie table#fixed_column tr.avg th {
|
||||||
|
height:2.1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ie div.left_scroller td {
|
||||||
|
height:4.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ie div.left_scroller {
|
||||||
|
margin-top:-0.6em;
|
||||||
|
margin-right: -0.6em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ie6 div.right_scroller {
|
||||||
|
margin-top:4em;
|
||||||
|
width:auto;
|
||||||
|
position:absolute;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ie6 .excludedfloater {
|
||||||
|
font-size:7px;
|
||||||
|
}
|
||||||
|
@ -899,7 +899,7 @@ class html_field extends labelled_html_component {
|
|||||||
* @param int $maxlength Sets the maxlength attribute of the field. Not set by default
|
* @param int $maxlength Sets the maxlength attribute of the field. Not set by default
|
||||||
* @return html_field The field component
|
* @return html_field The field component
|
||||||
*/
|
*/
|
||||||
public static function make_text($name='unnamed', $value, $alt, $maxlength=0) {
|
public static function make_text($name='unnamed', $value, $alt='', $maxlength=0) {
|
||||||
$field = new html_field();
|
$field = new html_field();
|
||||||
if (empty($alt)) {
|
if (empty($alt)) {
|
||||||
$alt = get_string('textfield');
|
$alt = get_string('textfield');
|
||||||
@ -1605,7 +1605,7 @@ class moodle_paging_bar extends moodle_html_component {
|
|||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function prepare() {
|
public function prepare() {
|
||||||
if (empty($this->totalcount)) {
|
if (!isset($this->totalcount) || is_null($this->totalcount)) {
|
||||||
throw new coding_exception('moodle_paging_bar requires a totalcount value.');
|
throw new coding_exception('moodle_paging_bar requires a totalcount value.');
|
||||||
}
|
}
|
||||||
if (!isset($this->page) || is_null($this->page)) {
|
if (!isset($this->page) || is_null($this->page)) {
|
||||||
|
@ -1802,23 +1802,31 @@ class moodle_core_renderer extends moodle_renderer_base {
|
|||||||
* @return string the HTML for the <input>
|
* @return string the HTML for the <input>
|
||||||
*/
|
*/
|
||||||
public function textfield($field) {
|
public function textfield($field) {
|
||||||
|
return $this->output_tag('span', array('class' => "textfield $field->name"), $this->field($field));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Output an <input/> element
|
||||||
|
*
|
||||||
|
* @param html_field $field a html_field object
|
||||||
|
* @return string the HTML for the <input>
|
||||||
|
*/
|
||||||
|
public function field($field) {
|
||||||
$field = clone($field);
|
$field = clone($field);
|
||||||
$field->prepare();
|
$field->prepare();
|
||||||
$this->prepare_event_handlers($field);
|
$this->prepare_event_handlers($field);
|
||||||
$output = $this->output_start_tag('span', array('class' => "textfield $field->name"));
|
if (!empty($field->label->text)) {
|
||||||
if (!empty($field->label)) {
|
|
||||||
$output .= $this->label($field->label);
|
$output .= $this->label($field->label);
|
||||||
}
|
}
|
||||||
$output .= $this->output_empty_tag('input', array(
|
return $this->output_empty_tag('input', array(
|
||||||
'type' => 'text',
|
'type' => $field->type,
|
||||||
'name' => $field->name,
|
'name' => $field->name,
|
||||||
'id' => $field->id,
|
'id' => $field->id,
|
||||||
'value' => $field->value,
|
'value' => $field->value,
|
||||||
'style' => $field->style,
|
'style' => $field->style,
|
||||||
'alt' => $field->alt,
|
'alt' => $field->alt,
|
||||||
|
'title' => $field->title,
|
||||||
'maxlength' => $field->maxlength));
|
'maxlength' => $field->maxlength));
|
||||||
$output .= $this->output_end_tag('span');
|
|
||||||
return $output;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user