MDL-23502 fixing headers, navigation and form submit buttons

This commit is contained in:
Petr Skoda 2010-08-01 19:59:25 +00:00
parent 8725605d7a
commit 684784c81c
10 changed files with 27 additions and 7 deletions

View File

@ -37,7 +37,9 @@ require_login($course);
require_capability('moodle/course:enrolconfig', $context);
$PAGE->set_url('/enrol/cohort/addinstance.php', array('id'=>$course->id));
$PAGE->set_pagelayout('standard');
$PAGE->set_pagelayout('admin');
navigation_node::override_active_url(new moodle_url('/enrol/instances.php', array('id'=>$course->id)));
// Try and make the manage instances node on the navigation active
$courseadmin = $PAGE->settingsnav->get('courseadmin');

View File

@ -68,7 +68,7 @@ class enrol_cohort_addinstance_form extends moodleform {
$mform->addElement('hidden', 'id', null);
$mform->setType('id', PARAM_INT);
$this->add_action_buttons();
$this->add_action_buttons(true, get_string('addinstance', 'enrol'));
$this->set_data(array('id'=>$course->id));
}

View File

@ -57,6 +57,7 @@ if ($instances = $DB->get_records('enrol', array('courseid'=>$course->id, 'enrol
} else {
require_capability('moodle/course:enrolconfig', $context);
// no instance yet, we have to add new instance
navigation_node::override_active_url(new moodle_url('/enrol/instances.php', array('id'=>$course->id)));
$instance = new object();
$instance->id = null;
$instance->courseid = $course->id;
@ -83,6 +84,9 @@ if ($mform->is_cancelled()) {
redirect($return);
}
$PAGE->set_title(get_string('pluginname', 'enrol_manual'));
$PAGE->set_heading($course->fullname);
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('pluginname', 'enrol_manual'));
$mform->display();

View File

@ -57,7 +57,7 @@ class enrol_manual_edit_form extends moodleform {
$mform->addElement('hidden', 'courseid');
$this->add_action_buttons();
$this->add_action_buttons(true, ($instance->id ? null : get_string('addinstance', 'enrol')));
$this->set_data($instance);
}

View File

@ -33,6 +33,11 @@ $id = required_param('id', PARAM_INT); // course id
$course = $DB->get_record('course', array('id'=>$id), '*', MUST_EXIST);
$context = get_context_instance(CONTEXT_COURSE, $course->id, MUST_EXIST);
$PAGE->set_url('/enrol/meta/addinstance.php', array('id'=>$course->id));
$PAGE->set_pagelayout('admin');
navigation_node::override_active_url(new moodle_url('/enrol/instances.php', array('id'=>$course->id)));
require_login($course);
require_capability('moodle/course:enrolconfig', $context);
@ -52,7 +57,8 @@ if ($mform->is_cancelled()) {
redirect(new moodle_url('/enrol/instances.php', array('id'=>$course->id)));
}
$PAGE->set_url('/enrol/meta/addinstance.php', array('id'=>$course->id));
$PAGE->set_heading($course->fullname);
$PAGE->set_title(get_string('pluginname', 'enrol_meta'));
echo $OUTPUT->header();

View File

@ -66,7 +66,7 @@ class enrol_meta_addinstance_form extends moodleform {
$mform->addElement('hidden', 'id', null);
$mform->setType('id', PARAM_INT);
$this->add_action_buttons();
$this->add_action_buttons(true, get_string('addinstance', 'enrol'));
$this->set_data(array('id'=>$course->id));
}

View File

@ -52,6 +52,7 @@ if ($instanceid) {
} else {
require_capability('moodle/course:enrolconfig', $context);
// no instance yet, we have to add new instance
navigation_node::override_active_url(new moodle_url('/enrol/instances.php', array('id'=>$course->id)));
$instance = new object();
$instance->id = null;
$instance->courseid = $course->id;
@ -84,6 +85,9 @@ if ($mform->is_cancelled()) {
redirect($return);
}
$PAGE->set_heading($course->fullname);
$PAGE->set_title(get_string('pluginname', 'enrol_paypal'));
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('pluginname', 'enrol_paypal'));
$mform->display();

View File

@ -81,7 +81,7 @@ class enrol_paypal_edit_form extends moodleform {
$mform->addElement('hidden', 'id');
$mform->addElement('hidden', 'courseid');
$this->add_action_buttons();
$this->add_action_buttons(true, ($instance->id ? null : get_string('addinstance', 'enrol')));
$this->set_data($instance);
}

View File

@ -52,6 +52,7 @@ if ($instanceid) {
} else {
require_capability('moodle/course:enrolconfig', $context);
// no instance yet, we have to add new instance
navigation_node::override_active_url(new moodle_url('/enrol/instances.php', array('id'=>$course->id)));
$instance = new object();
$instance->id = null;
$instance->courseid = $course->id;
@ -84,6 +85,9 @@ if ($mform->is_cancelled()) {
redirect($return);
}
$PAGE->set_heading($course->fullname);
$PAGE->set_title(get_string('pluginname', 'enrol_self'));
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('pluginname', 'enrol_self'));
$mform->display();

View File

@ -78,7 +78,7 @@ class enrol_self_edit_form extends moodleform {
$mform->addElement('hidden', 'id');
$mform->addElement('hidden', 'courseid');
$this->add_action_buttons();
$this->add_action_buttons(true, ($instance->id ? null : get_string('addinstance', 'enrol')));
$this->set_data($instance);
}