mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
MDL-53376 tool_lp: Redirect after creating a new framework
This commit is contained in:
parent
c579c7bb70
commit
49792e9c3d
2 changed files with 19 additions and 24 deletions
|
@ -65,28 +65,25 @@ $form = new \tool_lp\form\competency_framework($url->out(false), array('context'
|
||||||
|
|
||||||
if ($form->is_cancelled()) {
|
if ($form->is_cancelled()) {
|
||||||
redirect($frameworksurl);
|
redirect($frameworksurl);
|
||||||
|
} else if ($data = $form->get_data()) {
|
||||||
|
if (empty($data->id)) {
|
||||||
|
// Create new framework.
|
||||||
|
$data->contextid = $context->id;
|
||||||
|
$framework = \tool_lp\api::create_framework($data);
|
||||||
|
$frameworkmanageurl = new moodle_url('/admin/tool/lp/competencies.php', array(
|
||||||
|
'pagecontextid' => $pagecontextid,
|
||||||
|
'competencyframeworkid' => $framework->get_id()
|
||||||
|
));
|
||||||
|
$messagesuccess = get_string('competencyframeworkcreated', 'tool_lp');
|
||||||
|
redirect($frameworkmanageurl, $messagesuccess, 0, \core\output\notification::NOTIFY_SUCCESS);
|
||||||
|
} else {
|
||||||
|
\tool_lp\api::update_framework($data);
|
||||||
|
$messagesuccess = get_string('competencyframeworkupdated', 'tool_lp');
|
||||||
|
redirect($frameworksurl, $messagesuccess, 0, \core\output\notification::NOTIFY_SUCCESS);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
echo $output->header();
|
echo $output->header();
|
||||||
echo $output->heading($pagetitle);
|
echo $output->heading($pagetitle);
|
||||||
|
$form->display();
|
||||||
$data = $form->get_data();
|
|
||||||
if ($data) {
|
|
||||||
require_sesskey();
|
|
||||||
if (empty($data->id)) {
|
|
||||||
// Create new framework.
|
|
||||||
$data->contextid = $context->id;
|
|
||||||
\tool_lp\api::create_framework($data);
|
|
||||||
echo $output->notification(get_string('competencyframeworkcreated', 'tool_lp'), 'notifysuccess');
|
|
||||||
echo $output->continue_button($frameworksurl);
|
|
||||||
} else {
|
|
||||||
\tool_lp\api::update_framework($data);
|
|
||||||
echo $output->notification(get_string('competencyframeworkupdated', 'tool_lp'), 'notifysuccess');
|
|
||||||
echo $output->continue_button($frameworksurl);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$form->display();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
echo $output->footer();
|
echo $output->footer();
|
||||||
|
|
|
@ -23,12 +23,11 @@ Feature: Manage competency frameworks
|
||||||
And I should see "You must configure the scale by selecting default and proficient values"
|
And I should see "You must configure the scale by selecting default and proficient values"
|
||||||
And "Configure scales" "button" should be visible
|
And "Configure scales" "button" should be visible
|
||||||
And I press "Configure scales"
|
And I press "Configure scales"
|
||||||
And I click on "#tool_lp_scale_default_1" "css_element"
|
And I click on "//input[@data-field='tool_lp_scale_default_1']" "xpath_element"
|
||||||
And I click on "#tool_lp_scale_proficient_1" "css_element"
|
And I click on "//input[@data-field='tool_lp_scale_proficient_1']" "xpath_element"
|
||||||
And I click on "//input[@value='Close']" "xpath_element"
|
And I click on "//input[@value='Close']" "xpath_element"
|
||||||
When I press "Save changes"
|
When I press "Save changes"
|
||||||
Then I should see "Competency framework created"
|
Then I should see "Competency framework created"
|
||||||
And I click on "Continue" "button"
|
|
||||||
And I should see "Science Year-1"
|
And I should see "Science Year-1"
|
||||||
|
|
||||||
Scenario: Read a framework
|
Scenario: Read a framework
|
||||||
|
@ -51,7 +50,6 @@ Feature: Manage competency frameworks
|
||||||
And I set the field "Name" to "Science Year-3 Edited"
|
And I set the field "Name" to "Science Year-3 Edited"
|
||||||
When I press "Save changes"
|
When I press "Save changes"
|
||||||
Then I should see "Competency framework updated"
|
Then I should see "Competency framework updated"
|
||||||
And I click on "Continue" "button"
|
|
||||||
And I should see "Science Year-3 Edited"
|
And I should see "Science Year-3 Edited"
|
||||||
And I should see "sc-y-3"
|
And I should see "sc-y-3"
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue