*/
var $levels;
+ /**
+ * Course context
+ */
+ var $context;
+
/**
* Constructor, retrieves and stores a hierarchical array of all grade_category and grade_item
* objects for the given courseid. Full objects are instantiated.
$this->courseid = $courseid;
$this->commonvars = "&sesskey=$USER->sesskey&id=$this->courseid";
$this->levels = array();
+ $this->context = get_context_instance(CONTEXT_COURSE, $courseid);
// get course grade tree
$this->top_element = grade_category::fetch_course_tree($courseid, true);
function get_edit_icon($element, $gpr) {
global $CFG;
- $context = get_context_instance(CONTEXT_COURSE, $this->courseid);
- if (!has_capability('moodle/grade:manage', $context)) {
+ if (!has_capability('moodle/grade:manage', $this->context)) {
return '';
}
+ static $stredit = null;
+ if (is_null($stredit)) {
+ $stredit = get_string('edit');
+ }
+
$object = $element['object'];
+ $overlib = '';
switch ($element['type']) {
case 'item':
//TODO: improve dealing with new grades
$url = $CFG->wwwroot.'/grade/edit/grade.php?courseid='.$this->courseid.'&id='.$object->id;
$url = $gpr->add_url_params($url);
+ if (!empty($object->feedback)) {
+ $feedback = format_text($object->feedback, $object->feedbackformat);
+ $function = "return overlib('".s(ltrim($object->feedback)."', FULLHTML);");
+ $overlib = 'onmouseover="'.$function.'" onmouseout="return nd();"';
+ }
break;
default:
}
if ($url) {
- $stredit = get_string('edit');
- return '<a href="'.$url.'"><img src="'.$CFG->pixpath.'/t/edit.gif" class="iconsmall" alt="'.$stredit.'" title="'.$stredit.'"/></a>';
+ return '<a href="'.$url.'"><img '.$overlib.' src="'.$CFG->pixpath.'/t/edit.gif" class="iconsmall" alt="'.$stredit.'" title="'.$stredit.'"/></a>';
} else {
return '';
function get_hiding_icon($element, $gpr) {
global $CFG;
- $context = get_context_instance(CONTEXT_COURSE, $this->courseid);
- if (!has_capability('moodle/grade:manage', $context) and !has_capability('moodle/grade:hide', $context)) {
+ if (!has_capability('moodle/grade:manage', $this->context) and !has_capability('moodle/grade:hide', $this->context)) {
return '';
}
- if ($element['object']->is_hidden()) {
+ static $strshow = null;
+ static $strhide = null;
+ if (is_null($strshow)) {
$strshow = get_string('show');
+ $strhide = get_string('hide');
+ }
+
+ if ($element['object']->is_hidden()) {
$url = $CFG->wwwroot.'/grade/edit/action.php?id='.$this->courseid.'&action=show&sesskey='.sesskey().'&eid='.$element['eid'];
$url = $gpr->add_url_params($url);
$action = '<a href="'.$url.'"><img src="'.$CFG->pixpath.'/t/show.gif" class="iconsmall" alt="'.$strshow.'" title="'.$strshow.'"/></a>';
} else {
- $strhide = get_string('hide');
$url = $CFG->wwwroot.'/grade/edit/action.php?id='.$this->courseid.'&action=hide&sesskey='.sesskey().'&eid='.$element['eid'];
$url = $gpr->add_url_params($url);
$action = '<a href="'.$url.'"><img src="'.$CFG->pixpath.'/t/hide.gif" class="iconsmall" alt="'.$strhide.'" title="'.$strhide.'"/></a>';
function get_locking_icon($element, $gpr) {
global $CFG;
- $context = get_context_instance(CONTEXT_COURSE, $this->courseid);
+ static $strunlock = null;
+ static $strlock = null;
+ if (is_null($strunlock)) {
+ $strunlock = get_string('unlock', 'grades');
+ $strlock = get_string('lock', 'grades');
+ }
if ($element['object']->is_locked()) {
- if (!has_capability('moodle/grade:manage', $context) and !has_capability('moodle/grade:unlock', $context)) {
+ if (!has_capability('moodle/grade:manage', $this->context) and !has_capability('moodle/grade:unlock', $this->context)) {
return '';
}
- $strunlock = get_string('unlock', 'grades');
$url = $CFG->wwwroot.'/grade/edit/action.php?id='.$this->courseid.'&action=unlock&sesskey='.sesskey().'&eid='.$element['eid'];
$url = $gpr->add_url_params($url);
$action = '<a href="'.$url.'"><img src="'.$CFG->pixpath.'/t/unlock.gif" class="iconsmall" alt="'.$strunlock.'" title="'.$strunlock.'"/></a>';
} else {
- if (!has_capability('moodle/grade:manage', $context) and !has_capability('moodle/grade:lock', $context)) {
+ if (!has_capability('moodle/grade:manage', $this->context) and !has_capability('moodle/grade:lock', $this->context)) {
return '';
}
- $strlock = get_string('lock', 'grades');
$url = $CFG->wwwroot.'/grade/edit/action.php?id='.$this->courseid.'&action=lock&sesskey='.sesskey().'&eid='.$element['eid'];
$url = $gpr->add_url_params($url);
$action = '<a href="'.$url.'"><img src="'.$CFG->pixpath.'/t/lock.gif" class="iconsmall" alt="'.$strlock.'" title="'.$strlock.'"/></a>';
return $action;
}
+ /**
+ * Return calculation icon for given element
+ * @param object $element
+ * @return string
+ */
+ function get_calculation_icon($element, $gpr) {
+ global $CFG;
+ if (!has_capability('moodle/grade:manage', $this->context)) {
+ return '';
+ }
+
+ $calculation_icon = '';
+
+ $type = $element['type'];
+ $object = $element['object'];
+
+ if ($type == 'item' or $type == 'courseitem' or $type == 'categoryitem') {
+ $streditcalculation = get_string('editcalculation', 'grades');
+
+ // show calculation icon only when calculation possible
+ if (!$object->is_normal_item() and ($object->gradetype == GRADE_TYPE_SCALE or $object->gradetype == GRADE_TYPE_VALUE)) {
+ $url = $CFG->wwwroot.'/grade/edit/calculation.php?courseid='.$this->courseid.'&id='.$object->id;
+ $url = $gpr->add_url_params($url);
+ $calculation_icon = '<a href="'. $url.'"><img src="'.$CFG->pixpath.'/t/calc.gif" class="iconsmall" alt="'
+ . $streditcalculation.'" title="'.$streditcalculation.'" /></a>'. "\n";
+ }
+ }
+
+ return $calculation_icon;
+ }
}
?>
}
require_login($course);
$context = get_context_instance(CONTEXT_COURSE, $course->id);
+
require_capability('gradereport/grader:view', $context);
+require_capability('moodle/grade:viewall', $context);
/// return tracking object
$gpr = new grade_plugin_return(array('type'=>'report', 'plugin'=>'grader', 'courseid'=>$courseid, 'page'=>$page));
/// Build editing on/off buttons
if (!isset($USER->gradeediting)) {
- $USER->gradeediting = 0;
+ $USER->gradeediting = array();
}
-if (($edit == 1) and confirm_sesskey()) {
- $USER->gradeediting = 1;
-} else if (($edit == 0) and confirm_sesskey()) {
- $USER->gradeediting = 0;
-}
+if (has_capability('moodle/grade:override', $context)) {
+ if (!isset($USER->gradeediting[$course->id])) {
+ $USER->gradeediting[$course->id] = 0;
+ }
+
+ if (($edit == 1) and confirm_sesskey()) {
+ $USER->gradeediting[$course->id] = 1;
+ } else if (($edit == 0) and confirm_sesskey()) {
+ $USER->gradeediting[$course->id] = 0;
+ }
-// page params for the turn editting on
-$options = $gpr->get_options();
-$options['sesskey'] = sesskey();
+ // page params for the turn editting on
+ $options = $gpr->get_options();
+ $options['sesskey'] = sesskey();
+
+ if ($USER->gradeediting[$course->id]) {
+ $options['edit'] = 0;
+ $string = get_string('turneditingoff');
+ } else {
+ $options['edit'] = 1;
+ $string = get_string('turneditingon');
+ }
+
+ $buttons = print_single_button('index.php', $options, $string, 'get', '_self', true);
-if ($USER->gradeediting) {
- $options['edit'] = 0;
- $string = get_string('turneditingoff');
} else {
- $options['edit'] = 1;
- $string = get_string('turneditingon');
+ $USER->gradeediting[$course->id] = 0;
+ $buttons = '';
}
-$buttons = print_single_button('index.php', $options, $string, 'get', '_self', true);
-
$gradeserror = array();
// Handle toggle change request
$report->user_prefs['studentsperpage'] = $perpageurl;
}
-// Perform actions on categories, items and grades
+// Perform actions
if (!empty($target) && !empty($action) && confirm_sesskey()) {
$report->process_action($target, $action);
}
$reporthtml .= "</table>";
// print submit button
-if ($USER->gradeediting) {
+if ($USER->gradeediting[$course->id]) {
echo '<form action="index.php" method="post">';
echo '<div>';
echo '<input type="hidden" value="'.$courseid.'" name="id" />';
echo $reporthtml;
// print submit button
-if ($USER->gradeediting && ($report->get_pref('quickfeedback') || $report->get_pref('quickgrading'))) {
+if ($USER->gradeediting[$course->id] && ($report->get_pref('quickfeedback') || $report->get_pref('quickgrading'))) {
echo '<div class="submit"><input type="submit" value="'.get_string('update').'" /></div>';
echo '</div></form>';
}
* @return bool Success or Failure (array of errors).
*/
function process_data($data) {
+
+ if (!has_capability('moodle/grade:override', $this->context)) {
+ return false;
+ }
+
// always initialize all arrays
$queue = array();
foreach ($data as $varname => $postedvalue) {
function get_toggles_html() {
global $USER;
$html = '<div id="grade-report-toggles">';
- if ($USER->gradeediting) {
- $html .= $this->print_toggle('eyecons', true);
- $html .= $this->print_toggle('locks', true);
- $html .= $this->print_toggle('calculations', true);
+ if ($USER->gradeediting[$this->courseid]) {
+ if (has_capability('moodle/grade:manage', $this->context) or has_capability('moodle/grade:hide', $this->context)) {
+ $html .= $this->print_toggle('eyecons', true);
+ }
+ if (has_capability('moodle/grade:manage', $this->context)
+ or has_capability('moodle/grade:lock', $this->context)
+ or has_capability('moodle/grade:unlock', $this->context)) {
+ $html .= $this->print_toggle('locks', true);
+ }
+ if (has_capability('moodle/grade:manage', $this->context)) {
+ $html .= $this->print_toggle('calculations', true);
+ }
}
$html .= $this->print_toggle('averages', true);
$headerhtml .= '<th class="category'.$catlevel.'" '.$colspan.'>'.$element['object']->get_name();
// Print icons
- if ($USER->gradeediting) {
+ if ($USER->gradeediting[$this->courseid]) {
$headerhtml .= $this->get_icons($element);
}
$studentshtml .= '<tr><th class="user">' . $user_pic . '<a href="' . $CFG->wwwroot . '/user/view.php?id='
. $user->id . '">' . fullname($user) . '</a></th>';
- foreach ($this->items as $item) {
+ foreach ($this->items as $itemid=>$item) {
// Get the decimal points preference for this item
$decimalpoints = $this->get_pref('decimalpoints', $item->id);
} else {
$gradeval = null;
- $grade = new grade_grade(array('userid' => $userid, 'itemid' => $item->id), false);
+ $grade = new grade_grade(array('userid'=>$userid, 'itemid'=>$item->id), false);
$grade->feedback = '';
}
+ $grade->courseid = $this->courseid;
+ $grade->grade_item =& $this->items[$itemid]; // this speedsup is_hidden() and other grade_grade methods
+
+ // emulate grade element
+ $element = array('eid'=>'g'.$grade->id, 'object'=>$grade, 'type'=>'grade');
+
if ($grade->is_overridden()) {
$studentshtml .= '<td class="overridden">';
} else {
$studentshtml .= get_string('excluded', 'grades'); // TODO: improve visual representation of excluded grades
}
- // emulate grade element
- $grade->courseid = $this->courseid;
- $grade->grade_item = $item; // this may speedup is_hidden() and other grade_grade methods
- $element = array ('eid'=>'g'.$grade->id, 'object'=>$grade, 'type'=>'grade');
-
// Do not show any icons if no grade (no record in DB to match)
// TODO: change edit/hide/etc. links to use itemid and userid to allow creating of new grade objects
- if (!$item->needsupdate and !empty($grade->id) and $USER->gradeediting) {
- $states = array('is_hidden' => $item->hidden,
- 'is_locked' => $item->locked,
- 'is_editable' => $item->gradetype != GRADE_TYPE_NONE && !$grade->locked && !$item->locked);
- $studentshtml .= $this->get_icons($element, null, true, $states);
+ if (!$item->needsupdate and !empty($grade->id) and $USER->gradeediting[$this->courseid]) {
+ $studentshtml .= $this->get_icons($element);
}
// if in editting mode, we need to print either a text box
if ($item->needsupdate) {
$studentshtml .= '<span class="gradingerror">'.get_string('error').'</span>';
- } else if ($USER->gradeediting) {
+ } else if ($USER->gradeediting[$this->courseid]) {
// We need to retrieve each grade_grade object from DB in order to
// know if they are hidden/locked
$decimalpoints = $this->get_pref('decimalpoints', $item->id);
// Determine which display type to use for this average
$gradedisplaytype = $this->get_pref('gradedisplaytype', $item->id);
- if ($USER->gradeediting) {
+ if ($USER->gradeediting[$this->courseid]) {
$displaytype = GRADE_REPORT_GRADE_DISPLAY_TYPE_REAL;
} elseif ($averagesdisplaytype == GRADE_REPORT_PREFERENCE_INHERIT) { // Inherit specific column or general preference
$displaytype = $gradedisplaytype;
// Determine which display type to use for this range
$gradedisplaytype = $this->get_pref('gradedisplaytype', $item->id);
- if ($USER->gradeediting) {
+ if ($USER->gradeediting[$this->courseid]) {
$displaytype = GRADE_REPORT_GRADE_DISPLAY_TYPE_REAL;
} elseif ($rangesdisplaytype == GRADE_REPORT_PREFERENCE_INHERIT) { // Inherit specific column or general preference
$displaytype = $gradedisplaytype;
* with the icons needed for the grader report.
*
* @param object $object
- * @param array $icons An array of icon names that this function is explicitly requested to print, regardless of settings
- * @param bool $limit If true, use the $icons array as the only icons that will be printed. If false, use it to exclude these icons.
- * @param object $states An optional array of states (hidden, locked, editable), shortcuts to increase performance.
* @return string HTML
*/
- function get_icons($element, $icons=null, $limit=true, $states=array()) {
- global $CFG;
- global $USER;
-
- // Load language strings
- $stredit = $this->get_lang_string("edit");
- $streditcalculation= $this->get_lang_string("editcalculation", 'grades');
- $strfeedback = $this->get_lang_string("feedback");
- $strmove = $this->get_lang_string("move");
- $strmoveup = $this->get_lang_string("moveup");
- $strmovedown = $this->get_lang_string("movedown");
- $strmovehere = $this->get_lang_string("movehere");
- $strcancel = $this->get_lang_string("cancel");
- $stredit = $this->get_lang_string("edit");
- $strdelete = $this->get_lang_string("delete");
- $strhide = $this->get_lang_string("hide");
- $strshow = $this->get_lang_string("show");
- $strlock = $this->get_lang_string("lock", 'grades');
- $strswitch_minus = $this->get_lang_string("contract", 'grades');
- $strswitch_plus = $this->get_lang_string("expand", 'grades');
- $strunlock = $this->get_lang_string("unlock", 'grades');
-
- // Prepare container div
- $html = '<div class="grade_icons">';
-
- // Prepare reference variables
- $eid = $element['eid'];
- $object = $element['object'];
- $type = $element['type'];
-
- if (empty($states)) {
- $states['is_hidden'] = $object->is_hidden();
- $states['is_locked'] = $object->is_locked();
- $states['is_editable'] = $object->is_editable();
- }
-
- // Add mock attributes in case the object is not of the right type
- if ($type != 'grade') {
- $object->feedback = '';
- }
-
- $overlib = '';
- if (!empty($object->feedback)) {
- if (empty($object->feedbackformat) || $object->feedbackformat != 1) {
- $function = "return overlib('" . strip_tags($object->feedback) . "', CAPTION, '$strfeedback');";
- } else {
- $function = "return overlib('" . s(ltrim($object->feedback) . "', FULLHTML);");
- }
- $overlib = 'onmouseover="' . $function . '" onmouseout="return nd();"';
- }
+ function get_icons($element) {
+ global $CFG, $USER;
- // Prepare image strings
- $edit_icon = '';
- if ($states['is_editable']) {
- if ($type == 'category') {
- $url = GRADE_EDIT_URL . '/category.php?courseid='.$object->courseid.'&id='.$object->id;
- $url = $this->gpr->add_url_params($url);
- $edit_icon = '<a href="'.$url.'"><img src="'.$CFG->pixpath.'/t/edit.gif" class="iconsmall" alt="'
- . $stredit.'" title="'.$stredit.'" /></a>'. "\n";
- } else if ($type == 'item' or $type == 'categoryitem' or $type == 'courseitem'){
- $url = GRADE_EDIT_URL . '/item.php?courseid='.$object->courseid.'&id='.$object->id;
- $url = $this->gpr->add_url_params($url);
- $edit_icon = '<a href="'.$url.'"><img src="'.$CFG->pixpath.'/t/edit.gif" class="iconsmall" alt="'
- . $stredit.'" title="'.$stredit.'" /></a>'. "\n";
- } else if ($type == 'grade' and ($states['is_editable'] or empty($object->id))) {
- // TODO: change link to use itemid and userid to allow creating of new grade objects
- $url = GRADE_EDIT_URL . '/grade.php?courseid='.$object->courseid.'&id='.$object->id;
- $url = $this->gpr->add_url_params($url);
- $edit_icon = '<a href="'.$url.'"><img ' . $overlib . ' src="'.$CFG->pixpath.'/t/edit.gif"'
- . 'class="iconsmall" alt="' . $stredit.'" title="'.$stredit.'" /></a>'. "\n";
- }
+ if (!$USER->gradeediting[$this->courseid]) {
+ return '<div class="grade_icons" />';
}
+ // Init all icons
+ $edit_icon = $this->gtree->get_edit_icon($element, $this->gpr);
$edit_calculation_icon = '';
- if ($type == 'item' or $type == 'courseitem' or $type == 'categoryitem') {
- // show calculation icon only when calculation possible
- if (!$object->is_normal_item() and ($object->gradetype == GRADE_TYPE_SCALE or $object->gradetype == GRADE_TYPE_VALUE)) {
- $url = GRADE_EDIT_URL . '/calculation.php?courseid='.$object->courseid.'&id='.$object->id;
- $url = $this->gpr->add_url_params($url);
- $edit_calculation_icon = '<a href="'. $url.'"><img src="'.$CFG->pixpath.'/t/calc.gif" class="iconsmall" alt="'
- . $streditcalculation.'" title="'.$streditcalculation.'" /></a>'. "\n";
- }
- }
+ $show_hide_icon = '';
+ $contract_expand_icon = '';
+ $lock_unlock_icon = '';
- // Prepare Hide/Show icon state
- $hide_show = 'hide';
- if ($states['is_hidden']) {
- $hide_show = 'show';
+ if ($this->get_pref('showcalculations')) {
+ $edit_calculation_icon = $this->gtree->get_calculation_icon($element, $this->gpr);
}
- $show_hide_icon = '<a href="index.php?target='.$eid
- . "&action=$hide_show" . $this->gtree->commonvars . "\">\n"
- . '<img src="'.$CFG->pixpath.'/t/'.$hide_show.'.gif" class="iconsmall" alt="'
- . ${'str' . $hide_show}.'" title="'.${'str' . $hide_show}.'" /></a>'. "\n";
-
- // Prepare lock/unlock string
- $lock_unlock = 'lock';
- if ($states['is_locked']) {
- $lock_unlock = 'unlock';
+ if ($this->get_pref('showeyecons')) {
+ $show_hide_icon = $this->gtree->get_hiding_icon($element, $this->gpr);
}
- // Print lock/unlock icon
-
- $lock_unlock_icon = '<a href="index.php?target='.$eid
- . "&action=$lock_unlock" . $this->gtree->commonvars . "\">\n"
- . '<img src="'.$CFG->pixpath.'/t/'.$lock_unlock.'.gif" class="iconsmall" alt="'
- . ${'str' . $lock_unlock}.'" title="'.${'str' . $lock_unlock}.'" /></a>'. "\n";
-
- // Prepare expand/contract string
- $expand_contract = 'switch_minus'; // Default: expanded
- $state = get_user_preferences('grade_category_' . $object->id, GRADE_CATEGORY_EXPANDED);
- if ($state == GRADE_CATEGORY_CONTRACTED) {
- $expand_contract = 'switch_plus';
+ if ($this->get_pref('showlocks')) {
+ $lock_unlock_icon = $this->gtree->get_locking_icon($element, $this->gpr);
}
- $contract_expand_icon = '<a href="index.php?target=' . $eid
+ // If object is a category, display expand/contract icon
+ if ($element['type'] == 'category' && $this->get_pref('aggregationview') == GRADE_REPORT_AGGREGATION_VIEW_COMPACT) {
+ // Load language strings
+ $strswitch_minus = $this->get_lang_string('contract', 'grades');
+ $strswitch_plus = $this->get_lang_string('expand', 'grades');
+ $expand_contract = 'switch_minus'; // Default: expanded
+ $state = get_user_preferences('grade_category_'.$element['object']->id, GRADE_CATEGORY_EXPANDED);
+ if ($state == GRADE_CATEGORY_CONTRACTED) {
+ $expand_contract = 'switch_plus';
+ }
+ $contract_expand_icon = '<a href="index.php?target=' . $element['eid']
. "&action=$expand_contract" . $this->gtree->commonvars . "\">\n"
. '<img src="'.$CFG->pixpath.'/t/'.$expand_contract.'.gif" class="iconsmall" alt="'
. ${'str' . $expand_contract}.'" title="'.${'str' . $expand_contract}.'" /></a>'. "\n";
-
- // If an array of icon names is given, return only these in the order they are given
- if (!empty($icons) && is_array($icons)) {
- $new_html = '';
-
- foreach ($icons as $icon_name) {
- if ($limit) {
- $new_html .= ${$icon_name . '_icon'};
- } else {
- ${'show_' . $icon_name} = false;
- }
- }
- if ($limit) {
- return $new_html;
- } else {
- $html .= $new_html;
- }
- }
-
- // Icons shown when edit mode is on
- if ($USER->gradeediting) {
- // Edit icon (except for grade_grade)
- if ($edit_icon) {
- $html .= $edit_icon;
- }
-
- // Calculation icon for items and categories
- if ($this->get_pref('showcalculations')) {
- $html .= $edit_calculation_icon;
- }
-
- if ($this->get_pref('showeyecons')) {
- $html .= $show_hide_icon;
- }
-
- if ($this->get_pref('showlocks')) {
- $html .= $lock_unlock_icon;
- }
-
- // If object is a category, display expand/contract icon
- if (get_class($object) == 'grade_category' && $this->get_pref('aggregationview') == GRADE_REPORT_AGGREGATION_VIEW_COMPACT) {
- $html .= $contract_expand_icon;
- }
- } else { // Editing mode is off
}
- return $html . '</div>';
+ return '<div class="grade_icons">'.$edit_icon.$edit_calculation_icon.$show_hide_icon.$lock_unlock_icon.$contract_expand_icon.'</div>';
}
}
?>
* @param string $target Sortorder
* @param string $action Which action to take (edit, delete etc...)
* @return
- * TODO Update this, it's quite old and needs a major makeover
*/
function process_action($target, $action) {
- $element = $this->gtree->locate_element($target);
-
- switch ($action) {
- case 'edit':
- break;
- case 'delete':
- if ($confirm == 1) { // Perform the deletion
- //TODO: add proper delete support for grade items and categories
- //$element['object']->delete();
- // Print result message
-
- } else { // Print confirmation dialog
- $eid = $element['eid'];
- $strdeletecheckfull = $this->get_lang_string('deletecheck', '', $element['object']->get_name());
- $linkyes = GRADE_EDIT_URL . "/tree.php?target=$eid&action=delete&confirm=1$this->gtree->commonvars";
- $linkno = GRADE_EDIT_URL . "/tree.php?$this->gtree->commonvars";
- notice_yesno($strdeletecheckfull, $linkyes, $linkno);
- }
- break;
-
- case 'hide':
- // TODO Implement calendar for selection of a date to hide element until
- $element['object']->set_hidden(1);
- $this->gtree = new grade_tree($this->courseid, true, $this->get_pref('aggregationposition'));
- break;
- case 'show':
- $element['object']->set_hidden(0);
- $this->gtree = new grade_tree($this->courseid, true, $this->get_pref('aggregationposition'));
- break;
- case 'lock':
- // TODO Implement calendar for selection of a date to lock element after
- if (!$element['object']->set_locked(1)) {
- debugging("Could not update the element's locked state!");
- }
- $this->gtree = new grade_tree($this->courseid, true, $this->get_pref('aggregationposition'));
- break;
- case 'unlock':
- if (!$element['object']->set_locked(0)) {
- debugging("Could not update the element's locked state!");
- }
- $this->gtree = new grade_tree($this->courseid, true, $this->get_pref('aggregationposition'));
- break;
- default:
- break;
- }
+ //implement if needed
}
/**
<tr>
<td>
<select id="addoutcomes" size="20" name="addoutcomes[]" multiple="multiple">
-
- <?php
+
+ <?php
foreach ($outcomes as $outcome) {
- echo '<option value="'.$outcome->id.'">'.$outcome->shortname.'</option>';
+ echo '<option value="'.$outcome->id.'">'.$outcome->shortname.'</option>';
}
?>
- </select>
- </td>
+ </select>
+ </td>
<td>
<p class="arrow_button">
<input name="add" id="add" type="submit" value="<?php echo ' '.$THEME->larrow.' '.get_string('add'); ?>" title="<?php print_string('add'); ?>" />
<br />
<input name="remove" id="remove" type="submit" value="<?php echo ' '.$THEME->rarrow.' '.get_string('remove'); ?>" title="<?php print_string('remove'); ?>" />
</p>
- </td>
+ </td>
<td>
<select id="removeoutcomes" size="20" name="removeoutcomes[]" multiple="multiple">
- <?php
+ <?php
foreach ($courseoutcomes as $courseoutcome) {
- echo '<option value="'.$courseoutcome->id.'">'.$courseoutcome->shortname.'</option>';
+ echo '<option value="'.$courseoutcome->id.'">'.$courseoutcome->shortname.'</option>';
}
?>
- </select>
+ </select>
</td>
</tr>
</table>
\ No newline at end of file
/// form processing
print_header();
-
+
// Add tabs
$currenttab = 'outcomesettings';
- include('tabs.php');
-
- /// listing of all site outcomes + this course specific outcomes
- $outcomes = get_records_sql('SELECT * FROM '.$CFG->prefix.'grade_outcomes
- WHERE ISNULL(courseid)');
+ include('tabs.php');
+
+ /// listing of all site outcomes + this course specific outcomes
+ $outcomes = get_records_sql('SELECT * FROM '.$CFG->prefix.'grade_outcomes
+ WHERE ISNULL(courseid)');
get_records('grade_outcomes', 'courseid', $courseid);
-
+
check_theme_arrows();
include_once('course.html');
-
+
print_footer();
?>
\ No newline at end of file
$deleteid = optional_param('deleteid', 0, PARAM_INT); // which outcome to delete
$confirm = optional_param('confirm', 0, PARAM_INT);
$perpage = 30;
-
+
// form processing
if ($deleteid && confirm_sesskey()) {
if ($confirm) {
exit;
}
}
-
+
/// display information
admin_externalpage_setup('gradereportoutcomes');
admin_externalpage_print_header();
foreach ($outcomes as $outcome) {
$data = array();
-
+
// full name of the outcome
$data[] = $outcome['fullname'];
-
+
// full name of the scale used by this outcomes
$scale= get_record('scale', 'id', $outcome['scaleid']);
$data[] = $scale->name;
-
+
// get course
if ($outcome['courseid']) {
$course = get_record('course', 'id', $outcome['courseid']);
$data[] = $course->shortname;
} else {
- $data[] = get_string('site');
- }
-
+ $data[] = get_string('site');
+ }
+
// add operations
$data[] = '<a href="editoutcomes.php?id='.$outcome['id'].'&sesskey='.sesskey().'"><img alt="Update" class="iconsmall" src="'.$CFG->wwwroot.'/pix/t/edit.gif"/></a>
<a href="settings.php?deleteid='.$outcome['id'].'&sesskey='.sesskey().'"><img alt="Delete" class="iconsmall" src="'.$CFG->wwwroot.'/pix/t/delete.gif"/></a>'; // icons and links
} else {
$row[] = new tabobject('outcomesettings',
$CFG->wwwroot.'/grade/report/outcomes/site.php?id='.$courseid,
- get_string('settings'));
+ get_string('settings'));
}
$row[] = new tabobject('editoutcomes',
define('GRADE_REPORT_PREFERENCE_INHERIT', 'inherit');
define('GRADE_REPORT_PREFERENCE_UNUSED', -1);
-// Common directories
-define('GRADE_EDIT_DIR', $CFG->dirroot . '/grade/edit');
-define('GRADE_EDIT_URL', $CFG->wwwroot . '/grade/edit');
-
require_once($CFG->libdir . '/grade/grade_category.php');
require_once($CFG->libdir . '/grade/grade_item.php');
require_once($CFG->libdir . '/grade/grade_grade.php');