Commit 40bbc552 authored by Clare Lenihan's avatar Clare Lenihan Committed by Clare Lenihan
Browse files

changed resume/editcomposite so it has standard save and cancel buttons rather...

changed resume/editcomposite so it has standard save and cancel buttons rather than save and back to my resume
parent 45684d28
......@@ -44,8 +44,9 @@ if ($a->get('owner') != $USER->get('id')) {
$elements = call_static_method(generate_artefact_class_name($type), 'get_addform_elements');
$elements['submit'] = array(
'type' => 'submit',
'value' => get_string('save'),
'type' => 'submitcancel',
'value' => array(get_string('save'), get_string('cancel')),
'goto' => get_config('wwwroot') . '/artefact/resume/',
);
$elements['compositetype'] = array(
'type' => 'hidden',
......@@ -55,9 +56,8 @@ $cform = array(
'name' => $type,
'plugintype' => 'artefact',
'pluginname' => 'resume',
'elements' => $elements,
'jsform' => true,
'successcallback' => 'compositeform_submit',
'elements' => $elements,
'successcallback' => 'compositeformedit_submit',
);
$a->populate_form($cform, $id, $type);
......
......@@ -67,6 +67,7 @@ $string['qualdescription'] = 'Qualification Description';
$string['contribution'] = 'Contribution';
$string['compositedeleteconfirm'] = 'Are you sure you want to delete this?';
$string['compositesaved'] = 'Saved successfully';
$string['compositesavefailed'] = 'Save failed';
$string['compositedeleted'] = 'Deleted successfully';
$string['backtoresume'] = 'Back to My Resumé';
$string['personalgoal'] = 'Personal Goals';
......
......@@ -851,6 +851,20 @@ function compositeform_submit(Pieform $form, $values) {
$form->json_reply(PIEFORM_OK, get_string('compositesaved', 'artefact.resume'));
}
function compositeformedit_submit(Pieform $form, $values) {
global $SESSION;
try {
call_static_method(generate_artefact_class_name($values['compositetype']),
'process_compositeform', $form, $values);
}
catch (Exception $e) {
$SESSION->add_error_msg(get_string('compositesavefailed', 'artefact.resume'));
redirect('/artefact/resume/');
}
$SESSION->add_ok_msg(get_string('compositesaved', 'artefact.resume'));
redirect('/artefact/resume/');
}
function goalandskillform_submit(Pieform $form, $values) {
foreach ($values as $key => $value) {
if (!in_array($key, ArtefactTypeResumeGoalAndSkill::get_goalandskill_artefact_types())) {
......
......@@ -5,7 +5,6 @@
</div>
{include file="columnleftstart.tpl"}
<h3>{str tag='editing'}: {str tag=$composite section='artefact.resume'}</h3>
<a href="{$WWWROOT}artefact/resume/">{str tag='backtoresume' section='artefact.resume'}</a>
{$compositeform}
{include file="columnleftend.tpl"}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment