mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 08:56:36 +02:00
MDL-10544 basic UI for outcome item adding/editing implemented - todo: calculation support, lang strings, bugfixing...
whitespace cleanup
This commit is contained in:
parent
4faf5f99be
commit
f10fac9669
14 changed files with 298 additions and 50 deletions
|
@ -7,21 +7,21 @@
|
|||
|
||||
<?php
|
||||
foreach ($outcomes as $outcome) {
|
||||
|
||||
|
||||
// do not include items already used in course
|
||||
if (in_array($outcome->id, array_keys($courseoutcomes))) {
|
||||
continue;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
echo '<option value="'.$outcome->id.'">'.truncate($outcome->fullname, 150).'</option>';
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
<?php
|
||||
<?php
|
||||
// only show arrows if user has privilages to manage
|
||||
if (has_capability('gradereport/outcomes:manage', get_context_instance(CONTEXT_COURSE, $courseid))) {
|
||||
if (has_capability('gradereport/outcomes:manage', get_context_instance(CONTEXT_COURSE, $courseid))) {
|
||||
?>
|
||||
<p class="arrow_button">
|
||||
<input name="add" id="add" type="submit" value="<?php echo ' '.$THEME->rarrow.' '.get_string('add'); ?>" title="<?php print_string('add'); ?>" />
|
||||
|
|
|
@ -39,8 +39,8 @@ require_capability('gradereport/outcomes:view', get_context_instance(CONTEXT_SYS
|
|||
$navigation = build_navigation($navlinks);
|
||||
|
||||
/// Print header
|
||||
print_header_simple($strgrades.':'.$stroutcomes, ':'.$strgrades, $navigation, '', '', true);
|
||||
|
||||
print_header_simple($strgrades.':'.$stroutcomes, ':'.$strgrades, $navigation, '', '', true);
|
||||
|
||||
$strdeleteoutcomecheck = get_string('deleteoutcomecheck', 'grades');
|
||||
notice_yesno($strdeleteoutcomecheck,
|
||||
'course.php?id='.$courseid.'&deleteid='.$deleteid.'&confirm=1&sesskey='.sesskey(),
|
||||
|
@ -53,17 +53,17 @@ require_capability('gradereport/outcomes:view', get_context_instance(CONTEXT_SYS
|
|||
if ($data = data_submitted()) {
|
||||
require_capability('gradereport/outcomes:manage', get_context_instance(CONTEXT_COURSE, $courseid));
|
||||
if (!empty($data->add) && !empty($data->addoutcomes)) {
|
||||
/// add all selected to course list
|
||||
/// add all selected to course list
|
||||
foreach ($data->addoutcomes as $add) {
|
||||
$goc -> courseid = $courseid;
|
||||
$goc -> outcomeid = $add;
|
||||
insert_record('grade_outcomes_courses', $goc);
|
||||
}
|
||||
} else if (!empty($data->remove) && !empty($data->removeoutcomes)) {
|
||||
/// remove all selected from course outcomes list
|
||||
/// remove all selected from course outcomes list
|
||||
foreach ($data->removeoutcomes as $remove) {
|
||||
delete_records('grade_outcomes_courses', 'courseid', $courseid, 'outcomeid', $remove);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -92,17 +92,17 @@ print_header_simple($strgrades.':'.$stroutcomes, ':'.$strgrades, $navigation, ''
|
|||
FROM '.$CFG->prefix.'grade_outcomes_courses goc,
|
||||
'.$CFG->prefix.'grade_outcomes go
|
||||
WHERE goc.courseid = '.$courseid.'
|
||||
AND goc.outcomeid = go.id');
|
||||
|
||||
AND goc.outcomeid = go.id');
|
||||
|
||||
if (empty($courseoutcomes)) {
|
||||
$courseoutcomes = get_records('grade_outcomes', 'courseid', $courseid);
|
||||
$courseoutcomes = get_records('grade_outcomes', 'courseid', $courseid);
|
||||
} elseif ($mcourseoutcomes = get_records('grade_outcomes', 'courseid', $courseid)) {
|
||||
$courseoutcomes += $mcourseoutcomes;
|
||||
}
|
||||
|
||||
check_theme_arrows();
|
||||
include_once('course.html');
|
||||
|
||||
|
||||
/// interface to add/edit/delete course specific outcomes
|
||||
echo '<p/>';
|
||||
print_string('coursespecoutcome', 'grades'); // course sepcific outcomes
|
||||
|
@ -110,7 +110,7 @@ print_header_simple($strgrades.':'.$stroutcomes, ':'.$strgrades, $navigation, ''
|
|||
$totalcount = count_records('grade_outcomes_courses', 'courseid', $courseid);
|
||||
$baseurl = "course.php";
|
||||
print_paging_bar($totalcount, $page, $perpage, $baseurl);
|
||||
|
||||
|
||||
if ($outcomes = get_recordset('grade_outcomes', 'courseid', $courseid, '', '*', $page * $perpage, $perpage)) {
|
||||
|
||||
$tablecolumns = array('outcome', 'scale', 'edit', 'usedgradeitems');
|
||||
|
@ -138,13 +138,13 @@ print_header_simple($strgrades.':'.$stroutcomes, ':'.$strgrades, $navigation, ''
|
|||
// full name of the scale used by this outcomes
|
||||
$scale= get_record('scale', 'id', $outcome->scaleid);
|
||||
$data[] = $scale->name;
|
||||
|
||||
|
||||
if (has_capability('gradereport/outcomes:manage', get_context_instance(CONTEXT_COURSE, $courseid))) {
|
||||
// add operations
|
||||
$data[] = '<a href="editoutcomes.php?id='.$outcome->id.'&courseid='.$courseid.'&sesskey='.sesskey().'"><img alt="Update" class="iconsmall" src="'.$CFG->wwwroot.'/pix/t/edit.gif"/></a>
|
||||
<a href="course.php?deleteid='.$outcome->id.'&id='.$courseid.'&sesskey='.sesskey().'"><img alt="Delete" class="iconsmall" src="'.$CFG->wwwroot.'/pix/t/delete.gif"/></a>'; // icons and links
|
||||
} else {
|
||||
$data[] = '';
|
||||
$data[] = '';
|
||||
}
|
||||
// num of gradeitems using this
|
||||
$num = count_records('grade_items', 'outcomeid' ,$outcome->id);
|
||||
|
@ -157,11 +157,11 @@ print_header_simple($strgrades.':'.$stroutcomes, ':'.$strgrades, $navigation, ''
|
|||
$table->print_html();
|
||||
}
|
||||
if (has_capability('gradereport/outcomes:manage', get_context_instance(CONTEXT_COURSE, $courseid))) {
|
||||
echo '<a href="editoutcomes.php?courseid='.$courseid.'">Add a new outcome</a>';
|
||||
echo '<a href="editoutcomes.php?courseid='.$courseid.'">Add a new outcome</a>';
|
||||
}
|
||||
print_footer();
|
||||
|
||||
/**
|
||||
|
||||
/**
|
||||
* truncates a string to a length of num
|
||||
* @param string string
|
||||
* @param int num
|
||||
|
|
|
@ -16,7 +16,7 @@ $gradereport_outcomes_capabilities = array(
|
|||
'gradereport/outcomes:manage' => array(
|
||||
'riskbitmask' => RISK_CONFIG,
|
||||
'captype' => 'write',
|
||||
'contextlevel' => CONTEXT_COURSE,
|
||||
'contextlevel' => CONTEXT_COURSE,
|
||||
'legacy' => array(
|
||||
'editingteacher' => CAP_ALLOW,
|
||||
'admin' => CAP_ALLOW
|
||||
|
|
|
@ -48,7 +48,7 @@ if ($courseid = optional_param('courseid', 0, PARAM_INT)) {
|
|||
$returnurl = $CFG->wwwroot."/grade/report/outcomes/course.php?id=$courseid";
|
||||
} else {
|
||||
// admin editting site level outcomes
|
||||
require_capability('gradereport/outcomes:manage', get_context_instance(CONTEXT_SYSTEM));
|
||||
require_capability('gradereport/outcomes:manage', get_context_instance(CONTEXT_SYSTEM));
|
||||
$returnurl = $CFG->wwwroot."/grade/report/outcomes/site.php";
|
||||
}
|
||||
// form processing
|
||||
|
@ -69,9 +69,9 @@ if ($mform->is_cancelled()) {
|
|||
}
|
||||
if ($data = $mform->get_data()) {
|
||||
if ($data->courseid == 0) {
|
||||
$data->courseid = NULL;
|
||||
$data->courseid = NULL;
|
||||
}
|
||||
|
||||
|
||||
if ($data->id) {
|
||||
update_record('grade_outcomes', $data);
|
||||
} else {
|
||||
|
|
|
@ -9,7 +9,7 @@ require_once($CFG->libdir.'/tablelib.php');
|
|||
|
||||
// setting up params
|
||||
$courseid = optional_param('id', SITEID, PARAM_INT); // course id
|
||||
require_capability('gradereport/outcomes:view', get_context_instance(CONTEXT_SYSTEM));
|
||||
require_capability('gradereport/outcomes:view', get_context_instance(CONTEXT_SYSTEM));
|
||||
/// check capability
|
||||
|
||||
$page = optional_param('page', 0, PARAM_INT); // current page
|
||||
|
@ -26,7 +26,7 @@ $perpage = 30;
|
|||
// delete all outcomes used in grade items
|
||||
delete_records('grade_outcomes_courses', 'outcomeid', $deleteid);
|
||||
delete_records('grade_outcomes', 'id', $deleteid);
|
||||
} else {
|
||||
} else {
|
||||
$strgrades = get_string('grades');
|
||||
$stroutcomes = get_string('outcomes', 'grades');
|
||||
$navlinks = array();
|
||||
|
@ -36,7 +36,7 @@ $perpage = 30;
|
|||
$navigation = build_navigation($navlinks);
|
||||
|
||||
/// Print header
|
||||
print_header_simple($strgrades.':'.$stroutcomes, ':'.$strgrades, $navigation, '', '', true);
|
||||
print_header_simple($strgrades.':'.$stroutcomes, ':'.$strgrades, $navigation, '', '', true);
|
||||
// prints confirmation
|
||||
$strdeleteoutcomecheck = get_string('deleteoutcomecheck', 'grades');
|
||||
notice_yesno($strdeleteoutcomecheck,
|
||||
|
@ -99,12 +99,12 @@ $perpage = 30;
|
|||
|
||||
// add operations
|
||||
if (has_capability('gradereport/outcomes:manage', get_context_instance(CONTEXT_SYSTEM))) {
|
||||
|
||||
|
||||
$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="site.php?deleteid='.$outcome->id.'&sesskey='.sesskey().'"><img alt="Delete" class="iconsmall" src="'.$CFG->wwwroot.'/pix/t/delete.gif"/></a>'; // icons and links
|
||||
|
||||
|
||||
} else {
|
||||
$data[] = '';
|
||||
$data[] = '';
|
||||
}
|
||||
// num of gradeitems using this
|
||||
$num = count_records('grade_items', 'outcomeid' ,$outcome->id);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue