mirror of
https://github.com/moodle/moodle.git
synced 2025-04-20 16:04:25 +02:00
MDL-19797 Optimising output code in gradebook, and fixed bugs in export key management
This commit is contained in:
parent
a906afa36f
commit
eef00ade8f
@ -15,6 +15,14 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Edit page for grade outcomes.
|
||||
*
|
||||
* @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';
|
||||
|
@ -15,14 +15,24 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
require_once '../../../config.php';
|
||||
/**
|
||||
* Listing page for grade outcomes.
|
||||
*
|
||||
* @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->dirroot.'/lib/formslib.php');
|
||||
require_once $CFG->dirroot.'/grade/lib.php';
|
||||
require_once $CFG->libdir.'/gradelib.php';
|
||||
require_once($CFG->dirroot.'/grade/lib.php');
|
||||
require_once($CFG->libdir.'/gradelib.php');
|
||||
|
||||
$courseid = optional_param('id', 0, PARAM_INT);
|
||||
$action = optional_param('action', '', PARAM_ALPHA);
|
||||
|
||||
$PAGE->set_url('grade/edit/outcome/index.php', array('id' => $courseid));
|
||||
|
||||
/// Make sure they can even access this course
|
||||
if ($courseid) {
|
||||
if (!$course = $DB->get_record('course', array('id' => $courseid))) {
|
||||
@ -66,8 +76,6 @@ $strfullname = get_string('fullname');
|
||||
$strscale = get_string('scale');
|
||||
$strstandardoutcome = get_string('outcomesstandard', 'grades');
|
||||
$strcustomoutcomes = get_string('outcomescustom', 'grades');
|
||||
$strdelete = get_string('delete');
|
||||
$stredit = get_string('edit');
|
||||
$strcreatenewoutcome = get_string('outcomecreate', 'grades');
|
||||
$stritems = get_string('items', 'grades');
|
||||
$strcourses = get_string('courses');
|
||||
@ -149,9 +157,7 @@ if ($courseid and $outcomes = grade_outcome::fetch_all_local($courseid)) {
|
||||
$caneditthisscale = has_capability('moodle/course:managescales', $context);
|
||||
}
|
||||
if ($caneditthisscale) {
|
||||
$url = $CFG->wwwroot.'/grade/edit/scale/edit.php?courseid='.$courseid.'&id='.$scale->id;
|
||||
$url = $gpr->add_url_params($url);
|
||||
$line[] = '<a href="'.$url.'">'.$scale->get_name().'</a>';
|
||||
$line[] = grade_print_scale_link($courseid, $scale, $gpr);
|
||||
} else {
|
||||
$line[] = $scale->get_name();
|
||||
}
|
||||
@ -159,12 +165,10 @@ if ($courseid and $outcomes = grade_outcome::fetch_all_local($courseid)) {
|
||||
|
||||
$line[] = $outcome->get_item_uses_count();
|
||||
|
||||
$buttons = "";
|
||||
$buttons .= "<a title=\"$stredit\" href=\"edit.php?courseid=$courseid&id=$outcome->id\"><img".
|
||||
" src=\"" . $OUTPUT->old_icon_url('t/edit') . "\" class=\"iconsmall\" alt=\"$stredit\" /></a> ";
|
||||
$buttons = grade_button('edit', $courseid, $outcome);
|
||||
|
||||
if ($outcome->can_delete()) {
|
||||
$buttons .= "<a title=\"$strdelete\" href=\"index.php?id=$courseid&outcomeid=$outcome->id&action=delete&sesskey=".sesskey()."\"><img".
|
||||
" src=\"" . $OUTPUT->old_icon_url('t/delete') . "\" class=\"iconsmall\" alt=\"$strdelete\" /></a> ";
|
||||
$buttons .= grade_button('delete', $courseid, $outcome);
|
||||
}
|
||||
$line[] = $buttons;
|
||||
|
||||
@ -202,9 +206,7 @@ if ($outcomes = grade_outcome::fetch_all_global()) {
|
||||
$caneditthisscale = has_capability('moodle/course:managescales', $context);
|
||||
}
|
||||
if ($caneditthisscale) {
|
||||
$url = $CFG->wwwroot.'/grade/edit/scale/edit.php?courseid='.$courseid.'&id='.$scale->id;
|
||||
$url = $gpr->add_url_params($url);
|
||||
$line[] = '<a href="'.$url.'">'.$scale->get_name().'</a>';
|
||||
$line[] = grade_print_scale_link($courseid, $scale, $gpr);
|
||||
} else {
|
||||
$line[] = $scale->get_name();
|
||||
}
|
||||
@ -215,12 +217,10 @@ if ($outcomes = grade_outcome::fetch_all_global()) {
|
||||
|
||||
$buttons = "";
|
||||
if (has_capability('moodle/grade:manage', get_context_instance(CONTEXT_SYSTEM))) {
|
||||
$buttons .= "<a title=\"$stredit\" href=\"edit.php?courseid=$courseid&id=$outcome->id\"><img".
|
||||
" src=\"" . $OUTPUT->old_icon_url('t/edit') . "\" class=\"iconsmall\" alt=\"$stredit\" /></a> ";
|
||||
$buttons .= grade_button('edit', $courseid, $outcome);
|
||||
}
|
||||
if (has_capability('moodle/grade:manage', get_context_instance(CONTEXT_SYSTEM)) and $outcome->can_delete()) {
|
||||
$buttons .= "<a title=\"$strdelete\" href=\"index.php?id=$courseid&outcomeid=$outcome->id&action=delete&sesskey=".sesskey()."\"><img".
|
||||
" src=\"" . $OUTPUT->old_icon_url('t/delete') . "\" class=\"iconsmall\" alt=\"$strdelete\" /></a> ";
|
||||
$buttons .= grade_button('delete', $courseid, $outcome);
|
||||
}
|
||||
$line[] = $buttons;
|
||||
|
||||
@ -242,7 +242,7 @@ if ($courseid) {
|
||||
}
|
||||
|
||||
foreach($outcomes_tables as $table) {
|
||||
print($table);
|
||||
echo $table;
|
||||
}
|
||||
|
||||
echo $OUTPUT->container_start('buttons');
|
||||
@ -255,3 +255,19 @@ echo $OUTPUT->container_end();
|
||||
$upload_form->display();
|
||||
|
||||
echo $OUTPUT->footer();
|
||||
|
||||
/**
|
||||
* Local shortcut function for creating a link to a scale.
|
||||
* @param int $courseid The Course ID
|
||||
* @param grade_scale $scale The Scale to link to
|
||||
* @param grade_plugin_return $gpr An object used to identify the page we just came from
|
||||
* @return string html
|
||||
*/
|
||||
function grade_print_scale_link($courseid, $scale, $gpr) {
|
||||
global $CFG, $OUTPUT;
|
||||
$url = new moodle_url($CFG->wwwroot.'/grade/edit/scale/edit.php', array('courseid' => $courseid, 'id' => $scale->id));
|
||||
$url = $gpr->add_url_params($url);
|
||||
$link = html_link::make($url, $scale->get_name());
|
||||
return $OUTPUT->link($link);
|
||||
}
|
||||
|
||||
|
@ -23,6 +23,8 @@ require_once 'edit_form.php';
|
||||
$courseid = optional_param('courseid', 0, PARAM_INT);
|
||||
$id = optional_param('id', 0, PARAM_INT);
|
||||
|
||||
$PAGE->set_url('grade/edit/scale/edit.php', array('id' => $id, 'courseid' => $courseid));
|
||||
|
||||
$systemcontext = get_context_instance(CONTEXT_SYSTEM);
|
||||
$heading = '';
|
||||
|
||||
|
@ -22,6 +22,8 @@ require_once $CFG->libdir.'/gradelib.php';
|
||||
$courseid = optional_param('id', 0, PARAM_INT);
|
||||
$action = optional_param('action', '', PARAM_ALPHA);
|
||||
|
||||
$PAGE->set_url('grade/edit/scale/index.php', array('id' => $courseid));
|
||||
|
||||
/// Make sure they can even access this course
|
||||
if ($courseid) {
|
||||
if (!$course = $DB->get_record('course', array('id' => $courseid))) {
|
||||
@ -68,8 +70,22 @@ switch ($action) {
|
||||
break;
|
||||
}
|
||||
|
||||
//TODO: add confirmation
|
||||
$scale->delete();
|
||||
$deleteconfirmed = optional_param('deleteconfirmed', 0, PARAM_BOOL);
|
||||
|
||||
if (!$deleteconfirmed) {
|
||||
print_header(get_string('scaledelete', 'grades'));
|
||||
$confirmurl = new moodle_url('index.php', array(
|
||||
'id' => $courseid, 'scaleid' => $scale->id,
|
||||
'action'=> 'delete',
|
||||
'sesskey' => sesskey(),
|
||||
'deleteconfirmed'=> 1));
|
||||
|
||||
echo $OUTPUT->confirm(get_string('scaleconfirmdelete', 'grades', $scale->name), $confirmurl, "index.php?id={$courseid}");
|
||||
echo $OUTPUT->footer();
|
||||
die;
|
||||
} else {
|
||||
$scale->delete();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@ -93,11 +109,9 @@ if ($courseid and $scales = grade_scale::fetch_all_local($courseid)) {
|
||||
$line[] = $used ? get_string('yes') : get_string('no');
|
||||
|
||||
$buttons = "";
|
||||
$buttons .= "<a title=\"$stredit\" href=\"edit.php?courseid=$courseid&id=$scale->id\"><img".
|
||||
" src=\"" . $OUTPUT->old_icon_url('t/edit') . "\" class=\"iconsmall\" alt=\"$stredit\" /></a> ";
|
||||
$buttons .= grade_button('edit', $courseid, $scale);
|
||||
if (!$used) {
|
||||
$buttons .= "<a title=\"$strdelete\" href=\"index.php?id=$courseid&scaleid=$scale->id&action=delete&sesskey=".sesskey()."\"><img".
|
||||
" src=\"" . $OUTPUT->old_icon_url('t/delete') . "\" class=\"iconsmall\" alt=\"$strdelete\" /></a> ";
|
||||
$buttons .= grade_button('delete', $courseid, $scale);
|
||||
}
|
||||
$line[] = $buttons;
|
||||
$data[] = $line;
|
||||
@ -122,12 +136,10 @@ if ($scales = grade_scale::fetch_all_global()) {
|
||||
|
||||
$buttons = "";
|
||||
if (has_capability('moodle/course:managescales', get_context_instance(CONTEXT_SYSTEM))) {
|
||||
$buttons .= "<a title=\"$stredit\" href=\"edit.php?courseid=$courseid&id=$scale->id\"><img".
|
||||
" src=\"" . $OUTPUT->old_icon_url('t/edit') . "\" class=\"iconsmall\" alt=\"$stredit\" /></a> ";
|
||||
$buttons .= grade_button('edit', $courseid, $scale);
|
||||
}
|
||||
if (!$used and has_capability('moodle/course:managescales', get_context_instance(CONTEXT_SYSTEM))) {
|
||||
$buttons .= "<a title=\"$strdelete\" href=\"index.php?id=$courseid&scaleid=$scale->id&action=delete&sesskey=".sesskey()."\"><img".
|
||||
" src=\"" . $OUTPUT->old_icon_url('t/delete') . "\" class=\"iconsmall\" alt=\"$strdelete\" /></a> ";
|
||||
$buttons .= grade_button('delete', $courseid, $scale);
|
||||
}
|
||||
$line[] = $buttons;
|
||||
$data[] = $line;
|
||||
@ -150,5 +162,5 @@ echo $OUTPUT->heading($strstandardscale, 3, 'main');
|
||||
echo $OUTPUT->table($table2);
|
||||
echo $OUTPUT->container_start('buttons');
|
||||
echo $OUTPUT->button(html_form::make_button('edit.php', array('courseid'=>$courseid), $srtcreatenewscale));
|
||||
echo $OUTPUT->container_end();
|
||||
echo $OUTPUT->footer();
|
||||
echo $OUTPUT->container_end();
|
||||
echo $OUTPUT->footer();
|
||||
|
@ -15,15 +15,25 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Grade export key edit page.
|
||||
*
|
||||
* @package moodlecore
|
||||
* @copyright 2008 Petr Skoda
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
require_once('../../config.php');
|
||||
require_once('key_form.php');
|
||||
|
||||
/// get url variables
|
||||
$courseid = optional_param('courseid', 0, PARAM_INT);
|
||||
$id = optional_param('id', 0, PARAM_INT);
|
||||
$id = optional_param('id', 0, PARAM_INT); // The key's id
|
||||
$delete = optional_param('delete', 0, PARAM_BOOL);
|
||||
$confirm = optional_param('confirm', 0, PARAM_BOOL);
|
||||
|
||||
$PAGE->set_url('grade/export/key.php', array('id' => $id, 'courseid' => $courseid));
|
||||
|
||||
if ($id) {
|
||||
if (!$key = $DB->get_record('user_private_key', array('id' => $id))) {
|
||||
print_error('invalidgroupid');
|
||||
@ -35,12 +45,12 @@ if ($id) {
|
||||
print_error('invalidcourseid');
|
||||
}
|
||||
|
||||
if (!$course = $DB->get_record('course', array('id'=>$id))) {
|
||||
if (!$course = $DB->get_record('course', array('id'=>$courseid))) {
|
||||
print_error('invalidcourseid');
|
||||
}
|
||||
|
||||
} else {
|
||||
if (!$course = $DB->get_record('course', array('id'=>$id))) {
|
||||
if (!$course = $DB->get_record('course', array('id'=>$courseid))) {
|
||||
print_error('invalidcourseid');
|
||||
}
|
||||
$key = new object();
|
||||
|
@ -15,6 +15,13 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Grade export key management form.
|
||||
*
|
||||
* @package moodlecore
|
||||
* @copyright 2008 Petr Skodak
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
require_once($CFG->dirroot.'/lib/formslib.php');
|
||||
|
||||
@ -42,5 +49,3 @@ class key_form extends moodleform {
|
||||
$this->add_action_buttons();
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
@ -15,11 +15,20 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Grade export key management page.
|
||||
*
|
||||
* @package moodlecore
|
||||
* @copyright 2008 Petr Skoda
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
require_once '../../config.php';
|
||||
require_once $CFG->dirroot.'/grade/export/lib.php';
|
||||
|
||||
$id = required_param('id', PARAM_INT); // course id
|
||||
$id = required_param('id', PARAM_INT); // course id
|
||||
|
||||
$PAGE->set_url('grade/export/keymanager.php', array('id' => $id));
|
||||
|
||||
if (!$course = $DB->get_record('course', array('id'=>$id))) {
|
||||
print_error('nocourseid');
|
||||
@ -32,8 +41,8 @@ require_capability('moodle/grade:export', $context);
|
||||
|
||||
print_grade_page_head($course->id, 'export', 'keymanager', get_string('keymanager', 'grades'));
|
||||
|
||||
$stredit = get_string('edit');
|
||||
$strdelete = get_string('delete');
|
||||
$stredit = get_string('edit');
|
||||
$strdelete = get_string('delete');
|
||||
|
||||
$data = array();
|
||||
$keys = $DB->get_records_select('user_private_key', "script='grade/export' AND instance=? AND userid=?", array($course->id, $USER->id));
|
||||
@ -44,10 +53,26 @@ if ($keys) {
|
||||
$line[1] = $key->iprestriction;
|
||||
$line[2] = empty($key->validuntil) ? get_string('always') : userdate($key->validuntil);
|
||||
|
||||
$buttons = "<a title=\"$stredit\" href=\"key.php?id=$key->id\"><img".
|
||||
" src=\"" . $OUTPUT->old_icon_url('t/edit') . "\" class=\"iconsmall\" alt=\"$stredit\" /></a> ";
|
||||
$buttons .= "<a title=\"$strdelete\" href=\"key.php?id=$key->id&delete=1\"><img".
|
||||
" src=\"" . $OUTPUT->old_icon_url('t/delete') . "\" class=\"iconsmall\" alt=\"$strdelete\" /></a> ";
|
||||
$icon = new moodle_action_icon();
|
||||
$icon->link->url = new moodle_url('key.php');
|
||||
if (!empty($key->id)) {
|
||||
$icon->link->url->param('id', $key->id);
|
||||
}
|
||||
$icon->image->add_class('iconsmall');
|
||||
|
||||
$editicon = clone($icon);
|
||||
$editicon->image->src = $OUTPUT->old_icon_url('t/edit');
|
||||
$editicon->image->title = $stredit;
|
||||
$editicon->image->alt = $stredit;
|
||||
$buttons = $OUTPUT->action_icon($editicon);
|
||||
|
||||
$deleteicon = clone($icon);
|
||||
$deleteicon->image->src = $OUTPUT->old_icon_url('t/delete');
|
||||
$deleteicon->image->title = $strdelete;
|
||||
$deleteicon->image->alt = $strdelete;
|
||||
$deleteicon->link->url->param('delete', 1);
|
||||
$deleteicon->link->url->param('sesskey', sesskey());
|
||||
$buttons .= $OUTPUT->action_icon($deleteicon);
|
||||
|
||||
$line[3] = $buttons;
|
||||
$data[] = $line;
|
||||
@ -61,7 +86,7 @@ $table->width = '90%';
|
||||
$table->data = $data;
|
||||
echo $OUTPUT->table($table);
|
||||
|
||||
echo $OUTPUT->container_start('buttons');
|
||||
echo $OUTPUT->container_start('buttons mdl-align');
|
||||
echo $OUTPUT->button(html_form::make_button('key.php', array('courseid'=>$course->id), get_string('newuserkey', 'userkey')));
|
||||
echo $OUTPUT->container_end();
|
||||
|
||||
|
@ -130,4 +130,3 @@ class grade_import_mapping_form extends moodleform {
|
||||
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -15,6 +15,14 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Import key management.
|
||||
*
|
||||
* @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('key_form.php');
|
||||
|
||||
@ -24,6 +32,8 @@ $id = optional_param('id', 0, PARAM_INT);
|
||||
$delete = optional_param('delete', 0, PARAM_BOOL);
|
||||
$confirm = optional_param('confirm', 0, PARAM_BOOL);
|
||||
|
||||
$PAGE->set_url('grade/import/key.php', array('courseid' => $courseid, 'id' => $id));
|
||||
|
||||
if ($id) {
|
||||
if (!$key = $DB->get_record('user_private_key', array('id' => $id))) {
|
||||
print_error('invalidgroupid');
|
||||
@ -118,4 +128,3 @@ print_header_simple($strkeys, ': '.$strkeys, $navigation, '', '', true, '', navm
|
||||
|
||||
$editform->display();
|
||||
echo $OUTPUT->footer();
|
||||
?>
|
||||
|
@ -15,6 +15,14 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Grade import key management form.
|
||||
*
|
||||
* @package moodlecore
|
||||
* @copyright 2008 Petr Skodak
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
require_once($CFG->dirroot.'/lib/formslib.php');
|
||||
|
||||
class key_form extends moodleform {
|
||||
@ -41,5 +49,3 @@ class key_form extends moodleform {
|
||||
$this->add_action_buttons();
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
@ -15,10 +15,20 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
require_once '../../config.php';
|
||||
require_once $CFG->dirroot.'/grade/lib.php';
|
||||
/**
|
||||
* Grade import key management page.
|
||||
*
|
||||
* @package moodlecore
|
||||
* @copyright 2008 Petr Skoda
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
$id = required_param('id', PARAM_INT); // course id
|
||||
require_once(dirname(__FILE__).'/../../config.php');
|
||||
require_once($CFG->dirroot.'/grade/lib.php');
|
||||
|
||||
$id = required_param('id', PARAM_INT); // course id
|
||||
|
||||
$PAGE->set_url('grade/import/keymanager.php', array('id' => $id));
|
||||
|
||||
if (!$course = $DB->get_record('course', array('id'=>$id))) {
|
||||
print_error('nocourseid');
|
||||
@ -31,8 +41,8 @@ require_capability('moodle/grade:import', $context);
|
||||
|
||||
print_grade_page_head($course->id, 'import', 'keymanager', get_string('keymanager', 'grades'));
|
||||
|
||||
$stredit = get_string('edit');
|
||||
$strdelete = get_string('delete');
|
||||
$stredit = get_string('edit');
|
||||
$strdelete = get_string('delete');
|
||||
|
||||
$data = array();
|
||||
$params = array($course->id, $USER->id);
|
||||
@ -42,11 +52,24 @@ if ($keys = $DB->get_records_select('user_private_key', "script='grade/import' A
|
||||
$line[0] = format_string($key->value);
|
||||
$line[1] = $key->iprestriction;
|
||||
$line[2] = empty($key->validuntil) ? get_string('always') : userdate($key->validuntil);
|
||||
|
||||
$icon = new moodle_action_icon();
|
||||
$icon->link->url = new moodle_url('key.php', array('id' => $key->id));
|
||||
$icon->image->add_class('iconsmall');
|
||||
|
||||
$buttons = "<a title=\"$stredit\" href=\"key.php?id=$key->id\"><img".
|
||||
" src=\"" . $OUTPUT->old_icon_url('t/edit') . "\" class=\"iconsmall\" alt=\"$stredit\" /></a> ";
|
||||
$buttons .= "<a title=\"$strdelete\" href=\"key.php?id=$key->id&delete=1\"><img".
|
||||
" src=\"" . $OUTPUT->old_icon_url('t/delete') . "\" class=\"iconsmall\" alt=\"$strdelete\" /></a> ";
|
||||
$editicon = clone($icon);
|
||||
$editicon->image->src = $OUTPUT->old_icon_url('t/edit');
|
||||
$editicon->image->title = $stredit;
|
||||
$editicon->image->alt = $stredit;
|
||||
$buttons = $OUTPUT->action_icon($editicon);
|
||||
|
||||
$deleteicon = clone($icon);
|
||||
$deleteicon->image->src = $OUTPUT->old_icon_url('t/delete');
|
||||
$deleteicon->image->title = $strdelete;
|
||||
$deleteicon->image->alt = $strdelete;
|
||||
$deleteicon->link->url->param('delete', 1);
|
||||
$deleteicon->link->url->param('sesskey', sesskey());
|
||||
$buttons .= $OUTPUT->action_icon($deleteicon);
|
||||
|
||||
$line[3] = $buttons;
|
||||
$data[] = $line;
|
||||
@ -60,7 +83,7 @@ $table->width = '90%';
|
||||
$table->data = $data;
|
||||
echo $OUTPUT->table($table);
|
||||
|
||||
echo $OUTPUT->container_start('buttons');
|
||||
echo $OUTPUT->container_start('buttons mdl-align');
|
||||
echo $OUTPUT->button(html_form::make_button('key.php', array('courseid'=>$course->id), get_string('newuserkey', 'userkey')));
|
||||
echo $OUTPUT->container_end();
|
||||
|
||||
|
@ -132,13 +132,12 @@ function grade_import_commit($courseid, $importcode, $importfeedback=true, $verb
|
||||
echo $OUTPUT->notification(get_string('importsuccess', 'grades'), 'notifysuccess');
|
||||
$unenrolledusers = get_unenrolled_users_in_import($importcode, $courseid);
|
||||
if ($unenrolledusers) {
|
||||
$list = "<ul>\n";
|
||||
$list = new html_list();
|
||||
foreach ($unenrolledusers as $u) {
|
||||
$u->fullname = fullname($u);
|
||||
$list .= '<li>' . get_string('usergrade', 'grades', $u) . '</li>';
|
||||
$list->add_item(get_string('usergrade', 'grades', $u));
|
||||
}
|
||||
$list .= "</ul>\n";
|
||||
echo $OUTPUT->notification(get_string('unenrolledusersinimport', 'grades', $list), 'notifysuccess');
|
||||
echo $OUTPUT->notification(get_string('unenrolledusersinimport', 'grades', $OUTPUT->htmllist($list)), 'notifysuccess');
|
||||
}
|
||||
echo $OUTPUT->continue_button($CFG->wwwroot.'/grade/index.php?id='.$courseid);
|
||||
}
|
||||
|
@ -2258,3 +2258,38 @@ class grade_tree extends grade_structure {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Local shortcut function for creating an edit/delete button for a grade_* object.
|
||||
* @param strong $type 'edit' or 'delete'
|
||||
* @param int $courseid The Course ID
|
||||
* @param grade_* $object The grade_* object
|
||||
* @return string html
|
||||
*/
|
||||
function grade_button($type, $courseid, $object) {
|
||||
global $CFG, $OUTPUT;
|
||||
if (preg_match('/grade_(.*)/', get_class($object), $matches)) {
|
||||
$objectidstring = $matches[1] . 'id';
|
||||
} else {
|
||||
throw new coding_exception('grade_button() only accepts grade_* objects as third parameter!');
|
||||
}
|
||||
|
||||
$strdelete = get_string('delete');
|
||||
$stredit = get_string('edit');
|
||||
|
||||
$icon = new moodle_action_icon();
|
||||
|
||||
if ($type == 'delete') {
|
||||
$icon->link->url = new moodle_url('index.php', array('id' => $courseid, $objectidstring => $object->id, 'action' => 'delete', 'sesskey' => sesskey()));
|
||||
} else if ($type == 'edit') {
|
||||
$icon->link->url = new moodle_url('edit.php', array('courseid' => $courseid, 'id' => $object->id));
|
||||
}
|
||||
|
||||
$icon->image->src = $OUTPUT->old_icon_url('t/'.$type);
|
||||
$icon->image->add_class('iconsmall');
|
||||
$icon->image->title = ${'str'.$type};
|
||||
$icon->image->alt = ${'str'.$type};
|
||||
|
||||
return $OUTPUT->action_icon($icon);
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user