diff --git a/grade/edit/letter/edit.php b/grade/edit/letter/edit.php
index f586be25de4..bd163209a49 100644
--- a/grade/edit/letter/edit.php
+++ b/grade/edit/letter/edit.php
@@ -15,14 +15,23 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see .
-require_once '../../../config.php';
-require_once $CFG->libdir.'/gradelib.php';
-require_once $CFG->dirroot.'/grade/lib.php';
-require_once 'edit_form.php';
+/**
+ * Edit form for grade letters.
+ *
+ * @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);
+$PAGE->set_url('grade/edit/letter/edit.php');
+
if (!$context = get_context_instance_by_id($contextid)) {
print_error('invalidcourseid');
}
@@ -131,4 +140,3 @@ if ($admin) {
$mform->display();
echo $OUTPUT->footer();
-?>
diff --git a/grade/edit/letter/index.php b/grade/edit/letter/index.php
index b2d500a8ddd..1de41a6c7c1 100644
--- a/grade/edit/letter/index.php
+++ b/grade/edit/letter/index.php
@@ -15,6 +15,14 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see .
+/**
+ * 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 $CFG->dirroot.'/grade/lib.php';
require_once $CFG->libdir.'/gradelib.php';
@@ -22,10 +30,12 @@ require_once $CFG->libdir.'/gradelib.php';
$courseid = optional_param('id', SITEID, PARAM_INT);
$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))) {
print_error('nocourseid');
}
-require_login($course);
+
$context = get_context_instance(CONTEXT_COURSE, $course->id);
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->width = '30%';
$table->data = $data;
+$table->tablealign = 'center';
echo $OUTPUT->table($table);
-echo $OUTPUT->footer();
-
-?>
+echo $OUTPUT->footer();
diff --git a/grade/edit/tree/index.php b/grade/edit/tree/index.php
index 38edc602c1a..2d1400af2d6 100644
--- a/grade/edit/tree/index.php
+++ b/grade/edit/tree/index.php
@@ -15,6 +15,14 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see .
+/**
+ * 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 $CFG->dirroot.'/grade/lib.php';
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('animation');
$PAGE->requires->js('grade/edit/tree/functions.js');
+$PAGE->requires->css('/grade/edit/tree/tree.css');
$courseid = required_param('id', PARAM_INT);
$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);
$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
if (!$course = $DB->get_record('course', array('id' => $courseid))) {
print_error('nocourseid');
@@ -199,8 +210,6 @@ if ($grade_edit_tree->moving) {
$USER->gradeediting[$course->id] = 0;
}
-$CFG->stylesheets[] = $CFG->wwwroot.'/grade/edit/tree/tree.css';
-
$current_view_str = '';
if ($current_view != '') {
if ($current_view == 'simpleview') {
diff --git a/grade/edit/tree/lib.php b/grade/edit/tree/lib.php
index 9864aae0923..ea4b1068cc4 100755
--- a/grade/edit/tree/lib.php
+++ b/grade/edit/tree/lib.php
@@ -74,9 +74,9 @@ class grade_edit_tree {
* Recursive function for building the table holding the grade categories and items,
* with CSS indentation and styles.
*
- * @param array $element The current tree element being rendered
- * @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 $element The current tree element being rendered
+ * @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)
*
* @return string HTML
*/
@@ -108,13 +108,22 @@ class grade_edit_tree {
if ($element['type'] == 'item' or ($element['type'] == 'category' and $element['depth'] > 1)) {
if ($this->element_deletable($element)) {
- $actions .= '';
+ $actionicon = new moodle_action_icon();
+ $actionicon->link->url = new moodle_url('index.php', array('id' => $COURSE->id, 'action' => 'delete', 'eid' => $eid, 'sesskey' => sesskey()));
+ $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 .= '';
+
+ $actionicon = new moodle_action_icon();
+ $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);
@@ -171,7 +180,7 @@ class grade_edit_tree {
$first = '';
if ($child_el['object']->itemtype == 'course' || $child_el['object']->itemtype == 'category') {
- $first = '&first=1';
+ $first = array('first' => 1);
$child_eid = $eid;
}
@@ -181,9 +190,17 @@ class grade_edit_tree {
$strmovehere = get_string('movehere');
$actions = ''; // no action icons when moving
- $moveto = '
|
';
+ $moveicon = new moodle_action_icon();
+ $moveicon->link->url = new moodle_url('index.php', array('id' => $COURSE->id, 'action' => 'move', 'eid' => $this->moving, 'moveafter' => $child_eid, 'sesskey' => sesskey()));
+ 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 = ''.$OUTPUT->action_icon($moveicon) .' |
';
}
$newparents = $parents;
@@ -314,6 +331,8 @@ class grade_edit_tree {
* @return string HTML
*/
function get_weight_input($item, $type) {
+ global $OUTPUT;
+
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)');
return false;
@@ -323,18 +342,30 @@ class grade_edit_tree {
return '';
}
+ $weightfield = new html_field();
+
$parent_category = $item->get_parent_category();
$parent_category->apply_forced_settings();
$aggcoef = $item->get_coefstring();
if ((($aggcoef == 'aggregationcoefweight' || $aggcoef == 'aggregationcoef') && $type == 'weight') ||
($aggcoef == 'aggregationcoefextra' && $type == 'extra')) {
- return '';
+ $weightfield->type = 'text';
+ $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') {
$checked = ($item->aggregationcoef > 0) ? 'checked="checked"' : '';
- return '
- \n";
+ $weightfield->type = 'hidden';
+ $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 {
return '';
}
@@ -673,7 +704,7 @@ class grade_edit_tree_column_range extends grade_edit_tree_column {
}
public function get_item_cell($item, $params) {
- global $DB;
+ global $DB, $OUTPUT;
// If the parent aggregation is Sum of Grades, this cannot be changed
$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()) {
$grademax = format_float($item->grademax, $item->get_decimals());
} else {
- $grademax = '';
+ $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 ''.$grademax.' | ';
@@ -715,15 +749,22 @@ class grade_edit_tree_column_aggregateonlygraded extends grade_edit_tree_column_
}
public function get_category_cell($category, $levelclass, $params) {
- $onlygradedcheck = ($category->aggregateonlygraded == 1) ? 'checked="checked"' : '';
- $hidden = '';
- $aggregateonlygraded ='';
+ global $OUTPUT;
+
+ $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) {
$aggregateonlygraded = ($category->aggregateonlygraded) ? get_string('yes') : get_string('no');
}
- return ''.$hidden.$aggregateonlygraded.' | ';
+ return ''.$OUTPUT->field($hidden).$OUTPUT->checkbox($aggregateonlygraded).' | ';
}
public function get_item_cell($item, $params) {
diff --git a/grade/lib.php b/grade/lib.php
index 49222a49cc0..3327da83159 100644
--- a/grade/lib.php
+++ b/grade/lib.php
@@ -309,7 +309,7 @@ function print_graded_users_selector($course, $actionpage, $userid=0, $groupid=0
}
$nextuser = $gui->next_user();
-
+
while ($userdata = $gui->next_user()) {
$user = $userdata->user;
$menu[$user->id] = fullname($user);
@@ -361,7 +361,7 @@ function print_grade_plugin_selector($plugin_info, $return=false) {
if ($count > 1) {
$select = html_select::make_popup_form('', '', $menu, 'choosepluginreport', '');
$select->override_option_values($menu);
-
+
if ($return) {
return $OUTPUT->select($select);
} 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) {
global $CFG, $COURSE;
-
+
if (!isset($currenttab)) {
$currenttab = '';
}
@@ -815,7 +815,7 @@ function print_grade_page_head($courseid, $active_type, $active_plugin=null,
global $CFG, $COURSE, $OUTPUT;
$strgrades = get_string('grades');
$plugin_info = grade_get_plugin_info($courseid, $active_type, $active_plugin);
-
+
// Determine the string of the active plugin
$stractive_plugin = ($active_plugin) ? $plugin_info['strings']['active_plugin_str'] : $heading;
$stractive_type = $plugin_info['strings'][$active_type];
@@ -1063,35 +1063,31 @@ class grade_plugin_return {
/**
* Add return tracking params into url
*
- * @param string $url A URL
+ * @param moodle_url $url A URL
*
* @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)) {
return $url;
}
- if (strpos($url, '?') === false) {
- $url .= '?gpr_type='.$this->type;
- } else {
- $url .= '&gpr_type='.$this->type;
- }
+ $url->param('gpr_type', $this->type);
if (!empty($this->plugin)) {
- $url .= '&gpr_plugin='.$this->plugin;
+ $url->param('gpr_plugin', $this->plugin);
}
if (!empty($this->courseid)) {
- $url .= '&gpr_courseid='.$this->courseid;
+ $url->param('gpr_courseid' ,$this->courseid);
}
if (!empty($this->userid)) {
- $url .= '&gpr_userid='.$this->userid;
+ $url->param('gpr_userid', $this->userid);
}
if (!empty($this->page)) {
- $url .= '&gpr_page='.$this->page;
+ $url->param('gpr_page', $this->page);
}
return $url;
@@ -1267,7 +1263,7 @@ class grade_structure {
} else if ($element['object']->itemtype == 'mod') {
$strmodname = get_string('modulename', $element['object']->itemmodule);
- return 'mod_icon_url('icon',
$element['object']->itemmodule) . '" ' .
'class="icon itemicon" title="' .s($strmodname).
'" alt="' .s($strmodname).'"/>';
@@ -1436,8 +1432,6 @@ class grade_structure {
}
$strparams = $this->get_params_for_iconstr($element);
- if ($element['type'] == 'item' or $element['type'] == 'category') {
- }
$object = $element['object'];
@@ -1447,32 +1441,29 @@ class grade_structure {
case 'courseitem':
$stredit = get_string('editverbose', 'grades', $strparams);
if (empty($object->outcomeid) || empty($CFG->enableoutcomes)) {
- $url = $CFG->wwwroot.'/grade/edit/tree/item.php?courseid='.
- $this->courseid.'&id='.$object->id;
+ $url = new moodle_url($CFG->wwwroot.'/grade/edit/tree/item.php',
+ array('courseid' => $this->courseid, 'id' => $object->id));
} else {
- $url = $CFG->wwwroot.'/grade/edit/tree/outcomeitem.php?courseid='.
- $this->courseid.'&id='.$object->id;
+ $url = new moodle_url($CFG->wwwroot.'/grade/edit/tree/outcomeitem.php',
+ array('courseid' => $this->courseid, 'id' => $object->id));
}
- $url = $gpr->add_url_params($url);
break;
case 'category':
$stredit = get_string('editverbose', 'grades', $strparams);
- $url = $CFG->wwwroot.'/grade/edit/tree/category.php?courseid='.
- $this->courseid.'&id='.$object->id;
- $url = $gpr->add_url_params($url);
+ $url = new moodle_url($CFG->wwwroot.'/grade/edit/tree/category.php',
+ array('courseid' => $this->courseid, 'id' => $object->id));
break;
case 'grade':
$stredit = $streditgrade;
if (empty($object->id)) {
- $url = $CFG->wwwroot.'/grade/edit/tree/grade.php?courseid='.
- $this->courseid.'&itemid='.$object->itemid.'&userid='.$object->userid;
+ $url = new moodle_url($CFG->wwwroot.'/grade/edit/tree/grade.php',
+ array('courseid' => $this->courseid, 'itemid' => $object->itemid, 'userid' => $object->userid));
} else {
- $url = $CFG->wwwroot.'/grade/edit/tree/grade.php?courseid='.
- $this->courseid.'&id='.$object->id;
+ $url = new moodle_url($CFG->wwwroot.'/grade/edit/tree/grade.php',
+ array('courseid' => $this->courseid, 'id' => $object->id));
}
- $url = $gpr->add_url_params($url);
if (!empty($object->feedback)) {
$feedback = addslashes_js(trim(format_string($object->feedback, $object->feedbackformat)));
}
@@ -1483,8 +1474,14 @@ class grade_structure {
}
if ($url) {
- return '';
+ $url = $gpr->add_url_params($url);
+ $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 {
return '';
@@ -1511,6 +1508,12 @@ class grade_structure {
$strshow = get_string('showverbose', '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()) {
$icon = 'show';
$tooltip = $strshow;
@@ -1522,24 +1525,20 @@ class grade_structure {
userdate($element['object']->get_hidden()));
}
- $url = $CFG->wwwroot.'/grade/edit/tree/action.php?id=' .
- $this->courseid.'&action=show&sesskey='.sesskey() .
- '&eid='.$element['eid'];
-
- $url = $gpr->add_url_params($url);
- $action = '';
+ $hideicon->link->url->param('action', 'show');
+ $hideicon->image->src = $OUTPUT->old_icon_url('t/' . $icon);
+ $hideicon->image->alt = $strshow;
+ $hideicon->image->title = $tooltip;
} else {
- $url = $CFG->wwwroot.'/grade/edit/tree/action.php?id='.
- $this->courseid.'&action=hide&sesskey='.sesskey()
- . '&eid='.$element['eid'];
- $url = $gpr->add_url_params($url);
- $action = '';
+ $hideicon->link->url->param('action', 'hide');
+ $hideicon->image->src = $OUTPUT->old_icon_url('t/hide');
+ $hideicon->image->alt = $strhide;
+ $hideicon->image->title = $strhide;
}
- 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);
$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
if ($element['type'] == 'grade' && $element['object']->grade_item->is_locked()) {
$strparamobj = new stdClass();
$strparamobj->itemname = $element['object']->grade_item->itemname;
$strnonunlockable = get_string('nonunlockableverbose', 'grades', $strparamobj);
- $action = '';
+
+ $lockicon = new html_image();
+ $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()) {
$icon = 'unlock';
$tooltip = $strunlock;
@@ -1580,27 +1591,25 @@ class grade_structure {
!has_capability('moodle/grade:unlock', $this->context)) {
return '';
}
- $url = $CFG->wwwroot.'/grade/edit/tree/action.php?id='.
- $this->courseid.'&action=unlock&sesskey='.sesskey() .
- '&eid='.$element['eid'];
-
- $url = $gpr->add_url_params($url);
- $action = '';
+ $lockicon->link->url->param('action', 'unlock');
+ $lockicon->link->add_class('lock');
+ $lockicon->image->src = $OUTPUT->old_icon_url('t/'.$icon);
+ $lockicon->image->alt = $strunlock;
+ $lockicon->image->title = $tooltip;
+ $action = $OUTPUT->action_icon($lockicon);
} else {
if (!has_capability('moodle/grade:manage', $this->context) and
!has_capability('moodle/grade:lock', $this->context)) {
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);
- $action = '';
+ $lockicon->link->url->param('action', 'lock');
+ $lockicon->link->add_class('lock');
+ $lockicon->image->src = $OUTPUT->old_icon_url('t/lock');
+ $lockicon->image->alt = $strlock;
+ $lockicon->image->title = $strlock;
+ $action = $OUTPUT->action_icon($lockicon);
}
return $action;
}
@@ -1619,12 +1628,9 @@ class grade_structure {
return '';
}
- $calculation_icon = '';
-
$type = $element['type'];
$object = $element['object'];
-
if ($type == 'item' or $type == 'courseitem' or $type == 'categoryitem') {
$strparams = $this->get_params_for_iconstr($element);
$streditcalculation = get_string('editcalculationverbose', 'grades', $strparams);
@@ -1640,16 +1646,20 @@ class grade_structure {
$icon = 't/calc_off';
}
- $url = $CFG->wwwroot.'/grade/edit/tree/calculation.php?courseid='.
- $this->courseid.'&id='.$object->id;
- $url = $gpr->add_url_params($url);
- $calculation_icon = '' .
- ''. "\n";
+ $calcicon = new moodle_action_icon();
+ $calcicon->link->url = new moodle_url($CFG->wwwroot.'/grade/edit/tree/calculation.php',
+ array('courseid' => $this->courseid, 'id' => $object->id));
+
+ $calcicon->link->url = $gpr->add_url_params($calcicon->link->url);
+ $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 {
- /**
- * 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
*/
@@ -1686,7 +1690,6 @@ class grade_seq extends grade_structure {
global $USER, $CFG;
$this->courseid = $courseid;
- $this->commonvars = "&sesskey=".sesskey()."&id=$this->courseid";
$this->context = get_context_instance(CONTEXT_COURSE, $courseid);
// get course grade tree
@@ -1813,12 +1816,6 @@ class grade_tree extends grade_structure {
*/
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
* @var array $levels
@@ -1846,7 +1843,6 @@ class grade_tree extends grade_structure {
global $USER, $CFG;
$this->courseid = $courseid;
- $this->commonvars = "&sesskey=".sesskey()."&id=$this->courseid";
$this->levels = array();
$this->context = get_context_instance(CONTEXT_COURSE, $courseid);
diff --git a/grade/report/grader/index.php b/grade/report/grader/index.php
index 31d4ef2ba44..09ef890dc5e 100644
--- a/grade/report/grader/index.php
+++ b/grade/report/grader/index.php
@@ -35,6 +35,7 @@ $toggle = optional_param('toggle', NULL, PARAM_INT);
$toggle_type = optional_param('toggle_type', 0, PARAM_ALPHANUM);
$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
if (!$course = $DB->get_record('course', array('id' => $courseid))) {
@@ -110,13 +111,14 @@ $reportname = get_string('modulename', 'gradereport_grader');
// Initialise the grader report object
$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('json')->in_head();
-$PAGE->requires->yui_lib('connection')->in_head();
-$PAGE->requires->yui_lib('dragdrop')->in_head();
-$PAGE->requires->yui_lib('element')->in_head();
-$PAGE->requires->yui_lib('container')->in_head();
-$PAGE->requires->js('grade/report/grader/functions.js')->in_head();
+$PAGE->requires->yui_lib('event');
+$PAGE->requires->yui_lib('json');
+$PAGE->requires->yui_lib('connection');
+$PAGE->requires->yui_lib('dragdrop');
+$PAGE->requires->yui_lib('element');
+$PAGE->requires->yui_lib('container');
+$PAGE->requires->js('grade/report/grader/functions.js');
+$PAGE->requires->js('grade/report/grader/grader.js');
if ($report->get_pref('enableajax')) {
$report = new grade_report_grader_ajax($courseid, $gpr, $context, $page, $sortitemid);
@@ -206,161 +208,4 @@ echo 'tooltip panel
';
if ($report->get_pref('enableajax')) {
require_once 'ajax.php';
}
-
-// Print YUI tooltip code
-?>
-
-footer();
-
-?>
+echo $OUTPUT->footer();
diff --git a/grade/report/grader/lib.php b/grade/report/grader/lib.php
index 7a8480bfd97..87afb84ba93 100644
--- a/grade/report/grader/lib.php
+++ b/grade/report/grader/lib.php
@@ -932,7 +932,7 @@ class grade_report_grader extends grade_report {
}
function get_studentnameshtml() {
- global $CFG, $USER;
+ global $CFG, $USER, $OUTPUT;
$studentshtml = '';
$showuserimage = $this->get_pref('showuserimage');
diff --git a/grade/report/grader/styles.php b/grade/report/grader/styles.php
index 559447de257..5502e6d375f 100644
--- a/grade/report/grader/styles.php
+++ b/grade/report/grader/styles.php
@@ -218,7 +218,6 @@ vertical-align:middle;
.grade-report-grader table {
border-collapse:collapse;
background-color:#fff;
-font-size:10px;
border-color:#cecece;
}
@@ -387,7 +386,7 @@ padding-top:20px;
.grade-report-grader .right_scroller {
width:auto;
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 {
@@ -442,37 +441,6 @@ white-space:nowrap;
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 {
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 {
-height:4em;
+height:4.5em;
font-size:10px;
}
@@ -558,12 +526,6 @@ vertical-align:middle;
text-align: left;
}
-
-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(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(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(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 {
margin-top: -3px;
}
@@ -572,4 +534,34 @@ vertical-align:middle;
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;
+}
diff --git a/lib/outputcomponents.php b/lib/outputcomponents.php
index 815e209af74..79627eecc10 100644
--- a/lib/outputcomponents.php
+++ b/lib/outputcomponents.php
@@ -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
* @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();
if (empty($alt)) {
$alt = get_string('textfield');
@@ -1605,7 +1605,7 @@ class moodle_paging_bar extends moodle_html_component {
* @return void
*/
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.');
}
if (!isset($this->page) || is_null($this->page)) {
diff --git a/lib/outputrenderers.php b/lib/outputrenderers.php
index 322f0ef9664..3a75051ba46 100644
--- a/lib/outputrenderers.php
+++ b/lib/outputrenderers.php
@@ -1802,23 +1802,31 @@ class moodle_core_renderer extends moodle_renderer_base {
* @return string the HTML for the
*/
public function textfield($field) {
+ return $this->output_tag('span', array('class' => "textfield $field->name"), $this->field($field));
+ }
+
+ /**
+ * Output an element
+ *
+ * @param html_field $field a html_field object
+ * @return string the HTML for the
+ */
+ public function field($field) {
$field = clone($field);
$field->prepare();
$this->prepare_event_handlers($field);
- $output = $this->output_start_tag('span', array('class' => "textfield $field->name"));
- if (!empty($field->label)) {
+ if (!empty($field->label->text)) {
$output .= $this->label($field->label);
}
- $output .= $this->output_empty_tag('input', array(
- 'type' => 'text',
+ return $this->output_empty_tag('input', array(
+ 'type' => $field->type,
'name' => $field->name,
'id' => $field->id,
'value' => $field->value,
'style' => $field->style,
'alt' => $field->alt,
+ 'title' => $field->title,
'maxlength' => $field->maxlength));
- $output .= $this->output_end_tag('span');
- return $output;
}
/**