#154 Don't display 'Add page' link for unsaved templates

This commit is contained in:
Mark Nelson 2018-07-12 16:12:24 +08:00
parent 7e9414313e
commit 83f337f5c4

View file

@ -80,18 +80,20 @@ class edit_form extends \moodleform {
$this->add_customcert_page_elements($page);
}
// Link to add another page.
$addpagelink = new \moodle_url('/mod/customcert/edit.php',
array(
'tid' => $this->tid,
'aid' => 1,
'action' => 'addpage',
'sesskey' => sesskey()
)
);
$icon = $OUTPUT->pix_icon('t/switch_plus', get_string('addcertpage', 'customcert'));
$addpagehtml = \html_writer::link($addpagelink, $icon . get_string('addcertpage', 'customcert'));
$mform->addElement('html', \html_writer::tag('div', $addpagehtml, array('class' => 'addpage')));
// Link to add another page, only display it when the template has been created.
if (isset($this->_customdata['tid'])) {
$addpagelink = new \moodle_url('/mod/customcert/edit.php',
array(
'tid' => $this->tid,
'aid' => 1,
'action' => 'addpage',
'sesskey' => sesskey()
)
);
$icon = $OUTPUT->pix_icon('t/switch_plus', get_string('addcertpage', 'customcert'));
$addpagehtml = \html_writer::link($addpagelink, $icon . get_string('addcertpage', 'customcert'));
$mform->addElement('html', \html_writer::tag('div', $addpagehtml, array('class' => 'addpage')));
}
// Add the submit buttons.
$group = array();