MDL-10437 moved editing forms to grade/edit/ directory - these should be shared by all reports, there were too many files in grader directory anyway

This commit is contained in:
skodak 2007-07-12 19:40:28 +00:00
parent 95d6df779c
commit 920a0fb2eb
15 changed files with 67 additions and 63 deletions

View File

@ -0,0 +1,6 @@
<?php //$Id$
echo "not implemented yet";
?>

View File

View File

@ -1,6 +1,6 @@
<?php //$Id$
require_once '../../../config.php';
require_once '../../config.php';
require_once $CFG->libdir.'/gradelib.php';
require_once 'edit_category_form.php';
@ -17,7 +17,7 @@ $context = get_context_instance(CONTEXT_COURSE, $course->id);
//require_capability() here!!
// default return url
$returnurl = 'category.php?id='.$course->id;
$returnurl = 'edit_tree.php?id='.$course->id;
$mform = new edit_category_form();
@ -50,7 +50,6 @@ $strgraderreport = get_string('graderreport', 'grades');
$strcategoriesedit = get_string('categoriesedit', 'grades');
$nav = array(array('name'=>$strgrades,'link'=>$CFG->wwwroot.'/grade/index.php?id='.$courseid, 'type'=>'misc'),
array('name'=>$strgraderreport, 'link'=>$CFG->wwwroot.'/grade/report.php?id='.$courseid.'&amp;report=grader', 'type'=>'misc'),
array('name'=>$strcategoriesedit, 'link'=>'', 'type'=>'misc'));
$navigation = build_navigation($nav);

View File

@ -1,6 +1,6 @@
<?php //$Id$
require_once '../../../config.php';
require_once '../../config.php';
require_once $CFG->libdir.'/gradelib.php';
require_once 'edit_grade_form.php';
@ -18,6 +18,7 @@ $context = get_context_instance(CONTEXT_COURSE, $course->id);
require_capability('gradereport/grader:manage', $context);
// default return url
//TODO: implement proper return support
$returnurl = $CFG->wwwroot.'/grade/report.php?report=grader&amp;id='.$course->id;
$grade_grades = get_record('grade_grades', 'id', $id);
@ -26,9 +27,9 @@ $gradeitem = get_record('grade_items', 'id', $grade_grades->itemid);
$mform = new edit_grade_form(qualified_me(), array('gradeitem'=>$gradeitem));
if ($grade_grades = get_record('grade_grades', 'id', $id)) {
if ($grade_text = get_record('grade_grades_text', 'gradeid', $id)) {
$mform->set_data($grade_text);
}
$mform->set_data($grade_text);
}
$grade_grades->locked = $grade_grades->locked > 0 ? 1:0;
$grade_grades->courseid = $courseid;
$mform->set_data($grade_grades);
@ -41,16 +42,16 @@ if ($mform->is_cancelled()) {
redirect($returnurl);
// form processing
} else if ($data = $mform->get_data()) {
$grade_grades = new grade_grades(array('id'=>$id));
$grade_item = new grade_item(array('id'=>$grade_grades->itemid));
$grade_item->update_final_grade($grade_grades->userid, $data->finalgrade, NULL, NULL, $data->feedback);
// set locked
$grade_grades->set_locked($data->locked);
// set hidden
$grade_grades->set_hidden($data->hidden);
// set locktime
$grade_grades->set_locktime($data->locktime);
@ -95,7 +96,6 @@ if (!empty($action) && $action == 'view' && !empty($grade_text->feedback)) {
}
$nav = array(array('name'=>$strgrades,'link'=>$CFG->wwwroot.'/grade/index.php?id='.$courseid, 'type'=>'misc'),
array('name'=>$strgraderreport, 'link'=>$CFG->wwwroot.'/grade/report.php?id='.$courseid.'&amp;report=grader', 'type'=>'misc'),
array('name'=>$heading, 'link'=>'', 'type'=>'misc'));
$navigation = build_navigation($nav);

View File

@ -7,9 +7,9 @@ class edit_grade_form extends moodleform {
global $CFG, $USER;
$mform =& $this->_form;
$gradeitem = $this->_customdata['gradeitem'];
$gradeitem = $this->_customdata['gradeitem'];
/// actual grade - numeric or scale
if ($gradeitem->gradetype == 1) {
// numeric grade
@ -17,7 +17,7 @@ class edit_grade_form extends moodleform {
} else if ($gradeitem->gradetype == 2) {
// scale grade
$scaleopt[-1] = get_string('nograde');
$i = 1;
if ($scale = get_record('scale', 'id', $gradeitem->scaleid)) {
foreach (split(",", $scale->scale) as $option) {
@ -25,13 +25,13 @@ class edit_grade_form extends moodleform {
$i++;
}
}
$mform->addElement('select', 'finalgrade', get_string('finalgrade', 'grades'), $scaleopt);
}
/// hidden
$mform->addElement('advcheckbox', 'hidden', get_string('hidden', 'grades'));
$mform->addElement('advcheckbox', 'hidden', get_string('hidden', 'grades'));
/// locked
$mform->addElement('advcheckbox', 'locked', get_string('locked', 'grades'));
@ -39,7 +39,7 @@ class edit_grade_form extends moodleform {
$mform->addElement('date_time_selector', 'locktime', get_string('locktime', 'grades'), array('optional'=>true));
$mform->disabledIf('locktime', 'gradetype', 'eq', GRADE_TYPE_NONE);
/// hidden/visible
/// feedback
$feedbackformat = get_user_preferences('grade_report_feedbackformat', $CFG->grade_report_feedbackformat);

View File

@ -1,5 +1,5 @@
<?php //$Id$
require_once '../../../config.php';
require_once '../../config.php';
require_once $CFG->libdir.'/gradelib.php';
require_once 'edit_item_form.php';
@ -16,7 +16,7 @@ $context = get_context_instance(CONTEXT_COURSE, $course->id);
//require_capability() here!!
// default return url
$returnurl = 'category.php?id='.$course->id;
$returnurl = 'edit_tree.php?id='.$course->id;
$mform = new edit_item_form();
if ($item = get_record('grade_items', 'id', $id, 'courseid', $course->id)) {
@ -54,7 +54,6 @@ $strgraderreport = get_string('graderreport', 'grades');
$stritemsedit = get_string('itemsedit', 'grades');
$nav = array(array('name'=>$strgrades,'link'=>$CFG->wwwroot.'/grade/index.php?id='.$courseid, 'type'=>'misc'),
array('name'=>$strgraderreport, 'link'=>$CFG->wwwroot.'/grade/report.php?id='.$courseid.'&amp;report=grader', 'type'=>'misc'),
array('name'=>$stritemsedit, 'link'=>'', 'type'=>'misc'));
$navigation = build_navigation($nav);

View File

@ -24,7 +24,7 @@
// //
///////////////////////////////////////////////////////////////////////////
require_once '../../../config.php';
require_once '../../config.php';
require_once $CFG->libdir.'/gradelib.php';
$courseid = required_param('id', PARAM_INT);
@ -44,7 +44,7 @@ $context = get_context_instance(CONTEXT_COURSE, $course->id);
//require_capability() here!!
// default return url
$returnurl = 'category.php?id='.$course->id;
$returnurl = 'edit_tree.php?id='.$course->id;
// get the grading tree object
// note: total must be first for moving to work correctly, if you want it last moving code must be rewritten!
@ -67,7 +67,6 @@ $strgraderreport = get_string('graderreport', 'grades');
$strcategoriesedit = get_string('categoriesedit', 'grades');
$nav = array(array('name'=>$strgrades,'link'=>$CFG->wwwroot.'/grade/index.php?id='.$courseid, 'type'=>'misc'),
array('name'=>$strgraderreport, 'link'=>$CFG->wwwroot.'/grade/report.php?id='.$courseid.'&amp;report=grader', 'type'=>'misc'),
array('name'=>$strcategoriesedit, 'link'=>'', 'type'=>'misc'));
$navigation = build_navigation($nav);
@ -97,7 +96,7 @@ switch ($action) {
$strdeletecheckfull = get_string('deletecheck', '', $object->get_name());
$optionsyes = array('eid'=>$eid, 'confirm'=>1, 'sesskey'=>sesskey(), 'id'=>$course->id, 'action'=>'delete');
$optionsno = array('id'=>$course->id);
notice_yesno($strdeletecheckfull, 'category.php', 'category.php', $optionsyes, $optionsno, 'post', 'get');
notice_yesno($strdeletecheckfull, 'edit_tree.php', 'edit_tree.php', $optionsyes, $optionsno, 'post', 'get');
print_footer($course);
die;
}
@ -173,8 +172,9 @@ print_header_simple($strgrades . ': ' . $strgraderreport, ': ' . $strcategoriese
print_heading(get_string('categoriesedit', 'grades'));
// Add tabs
$currenttab = 'editcategory';
include('tabs.php');
// TODO: implement return support - use tabs from the report plugin
/*$currenttab = 'editcategory';
include('tabs.php');*/
print_box_start('gradetreebox generalbox');
echo '<ul id="grade_tree">';
@ -184,12 +184,12 @@ print_box_end();
echo '<div class="buttons">';
if ($moving) {
print_single_button('category.php', array('id'=>$course->id), get_string('cancel'), 'get');
print_single_button('edit_tree.php', array('id'=>$course->id), get_string('cancel'), 'get');
} else {
print_single_button('edit_category.php', array('courseid'=>$course->id), get_string('addcategory', 'grades'), 'get');
print_single_button('edit_item.php', array('courseid'=>$course->id), get_string('additem', 'grades'), 'get'); // TODO: localize
print_single_button('category.php', array('id'=>$course->id, 'action'=>'autosort'), get_string('autosort', 'grades'), 'get'); //TODO: localize
print_single_button('category.php', array('id'=>$course->id, 'action'=>'synclegacy'), get_string('synclegacygrades', 'grades'), 'get'); //TODO: localize
print_single_button('edit_item.php', array('courseid'=>$course->id), get_string('additem', 'grades'), 'get');
print_single_button('edit_tree.php', array('id'=>$course->id, 'action'=>'autosort'), get_string('autosort', 'grades'), 'get');
print_single_button('edit_tree.php', array('id'=>$course->id, 'action'=>'synclegacy'), get_string('synclegacygrades', 'grades'), 'get');
}
echo '</div>';
print_footer($course);
@ -215,25 +215,25 @@ function print_grade_tree($element, $moving) {
$eid = $element['eid'];
/// prepare actions
$actions = '<a href="category.php?id='.$COURSE->id.'&amp;action=edit&amp;eid='.$eid.'&amp;sesskey='.sesskey().'"><img src="'.$CFG->pixpath.'/t/edit.gif" class="iconsmall" alt="'.$stredit.'" title="'.$stredit.'"/></a>';
$actions = '<a href="edit_tree.php?id='.$COURSE->id.'&amp;action=edit&amp;eid='.$eid.'&amp;sesskey='.sesskey().'"><img src="'.$CFG->pixpath.'/t/edit.gif" class="iconsmall" alt="'.$stredit.'" title="'.$stredit.'"/></a>';
if ($element['type'] == 'item' or ($element['type'] == 'category' and $element['depth'] > 1)) {
$actions .= '<a href="category.php?id='.$COURSE->id.'&amp;action=delete&amp;eid='.$eid.'&amp;sesskey='.sesskey().'"><img src="'.$CFG->pixpath.'/t/delete.gif" class="iconsmall" alt="'.$strdelete.'" title="'.$strdelete.'"/></a>';
$actions .= '<a href="category.php?id='.$COURSE->id.'&amp;action=moveselect&amp;eid='.$eid.'&amp;sesskey='.sesskey().'"><img src="'.$CFG->pixpath.'/t/move.gif" class="iconsmall" alt="'.$strmove.'" title="'.$strmove.'"/></a>';
$actions .= '<a href="edit_tree.php?id='.$COURSE->id.'&amp;action=delete&amp;eid='.$eid.'&amp;sesskey='.sesskey().'"><img src="'.$CFG->pixpath.'/t/delete.gif" class="iconsmall" alt="'.$strdelete.'" title="'.$strdelete.'"/></a>';
$actions .= '<a href="edit_tree.php?id='.$COURSE->id.'&amp;action=moveselect&amp;eid='.$eid.'&amp;sesskey='.sesskey().'"><img src="'.$CFG->pixpath.'/t/move.gif" class="iconsmall" alt="'.$strmove.'" title="'.$strmove.'"/></a>';
}
if ($object->is_locked()) {
$actions .= '<a href="category.php?id='.$COURSE->id.'&amp;action=unlock&amp;eid='.$eid.'&amp;sesskey='.sesskey().'"><img src="'.$CFG->pixpath.'/t/unlock.gif" class="iconsmall" alt="'.$strunlock.'" title="'.$strunlock.'"/></a>';
$actions .= '<a href="edit_tree.php?id='.$COURSE->id.'&amp;action=unlock&amp;eid='.$eid.'&amp;sesskey='.sesskey().'"><img src="'.$CFG->pixpath.'/t/unlock.gif" class="iconsmall" alt="'.$strunlock.'" title="'.$strunlock.'"/></a>';
} else {
$actions .= '<a href="category.php?id='.$COURSE->id.'&amp;action=lock&amp;eid='.$eid.'&amp;sesskey='.sesskey().'"><img src="'.$CFG->pixpath.'/t/lock.gif" class="iconsmall" alt="'.$strlock.'" title="'.$strlock.'"/></a>';
$actions .= '<a href="edit_tree.php?id='.$COURSE->id.'&amp;action=lock&amp;eid='.$eid.'&amp;sesskey='.sesskey().'"><img src="'.$CFG->pixpath.'/t/lock.gif" class="iconsmall" alt="'.$strlock.'" title="'.$strlock.'"/></a>';
}
if ($object->is_hidden()) {
$name = '<span class="dimmed_text">'.$object->get_name().'</span>';
$actions .= '<a href="category.php?id='.$COURSE->id.'&amp;action=show&amp;eid='.$eid.'&amp;sesskey='.sesskey().'"><img src="'.$CFG->pixpath.'/t/show.gif" class="iconsmall" alt="'.$strshow.'" title="'.$strshow.'"/></a>';
$actions .= '<a href="edit_tree.php?id='.$COURSE->id.'&amp;action=show&amp;eid='.$eid.'&amp;sesskey='.sesskey().'"><img src="'.$CFG->pixpath.'/t/show.gif" class="iconsmall" alt="'.$strshow.'" title="'.$strshow.'"/></a>';
} else {
$name = $object->get_name();
$actions .= '<a href="category.php?id='.$COURSE->id.'&amp;action=hide&amp;eid='.$eid.'&amp;sesskey='.sesskey().'"><img src="'.$CFG->pixpath.'/t/hide.gif" class="iconsmall" alt="'.$strhide.'" title="'.$strhide.'"/></a>';
$actions .= '<a href="edit_tree.php?id='.$COURSE->id.'&amp;action=hide&amp;eid='.$eid.'&amp;sesskey='.sesskey().'"><img src="'.$CFG->pixpath.'/t/hide.gif" class="iconsmall" alt="'.$strhide.'" title="'.$strhide.'"/></a>';
}
/// prepare icon
@ -260,7 +260,7 @@ function print_grade_tree($element, $moving) {
$moveto = '';
if ($moving) {
$actions = ''; // no action icons when moving
$moveto = '<li><a href="category.php?id='.$COURSE->id.'&amp;action=move&amp;eid='.$moving.'&amp;moveafter='.$eid.'&amp;sesskey='.sesskey().'"><img class="movetarget" src="'.$CFG->wwwroot.'/pix/movehere.gif" alt="'.$strmovehere.'" title="'.$strmovehere.'" /></a></li>';
$moveto = '<li><a href="edit_tree.php?id='.$COURSE->id.'&amp;action=move&amp;eid='.$moving.'&amp;moveafter='.$eid.'&amp;sesskey='.sesskey().'"><img class="movetarget" src="'.$CFG->wwwroot.'/pix/movehere.gif" alt="'.$strmovehere.'" title="'.$strmovehere.'" /></a></li>';
}
/// print the list items now

View File

@ -390,8 +390,8 @@ class grade_report_grader {
} else { // Print confirmation dialog
$eid = $element['eid'];
$strdeletecheckfull = get_string('deletecheck', '', $element['object']->get_name());
$linkyes = "category.php?target=$eid&amp;action=delete&amp;confirm=1$this->gtree->commonvars";
$linkno = "category.php?$this->gtree->commonvars";
$linkyes = "edit_tree.php?target=$eid&amp;action=delete&amp;confirm=1$this->gtree->commonvars";
$linkno = "edit_tree.php?$this->gtree->commonvars";
notice_yesno($strdeletecheckfull, $linkyes, $linkno);
}
break;
@ -982,11 +982,11 @@ class grade_report_grader {
}
// Prepare image strings
$edit_category_icon = '<a href="report/grader/edit_category.php?courseid='.$object->courseid.'&amp;id='.$object->id.'">'
$edit_category_icon = '<a href="'.$CFG->wwwroot.'/grade/edit/edit_category.php?courseid='.$object->courseid.'&amp;id='.$object->id.'">'
. '<img src="'.$CFG->pixpath.'/t/edit.gif" class="iconsmall" alt="'
. $stredit.'" title="'.$stredit.'" /></a>'. "\n";
$edit_item_icon = '<a href="report/grader/edit_item.php?courseid='.$object->courseid.'&amp;id='.$object->id.'">'
$edit_item_icon = '<a href="'.$CFG->wwwroot.'/grade/edit/edit_item.php?courseid='.$object->courseid.'&amp;id='.$object->id.'">'
. '<img src="'.$CFG->pixpath.'/t/edit.gif" class="iconsmall" alt="'
. $stredit.'" title="'.$stredit.'" /></a>'. "\n";
$overlib = '';
@ -995,7 +995,7 @@ class grade_report_grader {
. $strfeedback.'\');" onmouseout="return nd();"';
}
$edit_grade_icon = '<a href="report/grader/edit_grade.php?courseid='.$object->courseid.'&amp;id='.$object->id.'">'
$edit_grade_icon = '<a href="'.$CFG->wwwroot.'/grade/edit/edit_grade.php?courseid='.$object->courseid.'&amp;id='.$object->id.'">'
. '<img ' . $overlib . ' src="'.$CFG->pixpath.'/t/edit.gif"'
. 'class="iconsmall" alt="' . $stredit.'" title="'.$stredit.'" /></a>'. "\n";
@ -1004,7 +1004,7 @@ class grade_report_grader {
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)) {
$edit_calculation_icon = '<a href="report/grader/edit_calculation.php?courseid='.$object->courseid.'&amp;id='.$object->id.'">'
$edit_calculation_icon = '<a href="'.$CFG->wwwroot.'/grade/edit/edit_calculation.php?courseid='.$object->courseid.'&amp;id='.$object->id.'">'
. '<img src="'.$CFG->pixpath.'/t/calc.gif" class="iconsmall" alt="'
. $streditcalculation.'" title="'.$streditcalculation.'" /></a>'. "\n";
}

View File

@ -5,7 +5,7 @@
get_string('graderreport', 'grades'));
$row[] = new tabobject('editcategory',
$CFG->wwwroot.'/grade/report/grader/category.php?id='.$courseid,
$CFG->wwwroot.'/grade/edit/edit_tree.php?id='.$courseid,
get_string('categoriesedit', 'grades'));
$row[] = new tabobject('preferences',

View File

@ -163,11 +163,11 @@ $numusers = count(get_role_users(@implode(',', $CFG->gradebookroles), $context))
}
$table->add_data($data);
}
//echo "<div><table class='boxaligncenter'><tr><td>asdfas</td></tr></table></div>";
$table->print_html();
} else {
notify(get_string('nogradeitem', 'grades'));
}
?>

View File

@ -225,9 +225,9 @@ class grade_grades extends grade_object {
if ($locktime) {
// if current locktime is before, no need to reset
if ($this->locktime && $this->locktime <= $locktime) {
return true;
return true;
}
/*

View File

@ -1499,11 +1499,11 @@ class grade_item extends grade_object {
} else {
$gis = implode(',', $useditems);
$sql = "SELECT gi.*
FROM {$CFG->prefix}grade_items gi
WHERE gi.id IN ($gis) and gi.courseid={$this->courseid}"; // from the same course only!
if (!$grade_items = get_records_sql($sql)) {
$grade_items = array();
}

View File

@ -2125,7 +2125,7 @@ body#grade-index .grades .weighted {
/* gradebook edit tree */
#grade-report-grader-category .gradetreebox {
#grade-edit-edit_tree .gradetreebox {
width:70%;
margin-left:auto;
margin-right:auto;
@ -2133,40 +2133,40 @@ body#grade-index .grades .weighted {
padding-bottom:15px;
}
#grade-report-grader-category .buttons {
#grade-edit-edit_tree .buttons {
margin: 20px;
text-align:center;
}
#grade-report-grader-category .buttons .singlebutton {
#grade-edit-edit_tree .buttons .singlebutton {
display: inline;
padding: 5px;
}
#grade-report-grader-category .movetarget {
#grade-edit-edit_tree .movetarget {
position: relative;
width: 80px;
height: 16px;
}
#grade-report-grader-category ul#grade_tree {
#grade-edit-edit_tree ul#grade_tree {
width: auto;
}
#grade-report-grader-category ul#grade_tree li {
#grade-edit-edit_tree ul#grade_tree li {
list-style: none;
}
#grade-report-grader-category ul#grade_tree li.category {
#grade-edit-edit_tree ul#grade_tree li.category {
margin-bottom: 6px;
}
#grade-report-grader-category .moving {
#grade-edit-edit_tree .moving {
background-color: #E8EEF7;
}
#grade-report-grader-category .iconsmall {
#grade-edit-edit_tree .iconsmall {
margin-left: 4px;
}