#154 Don't display 'Add page' link for unsaved templates
This commit is contained in:
parent
7f592e332f
commit
6070185a61
1 changed files with 14 additions and 12 deletions
|
@ -80,18 +80,20 @@ class edit_form extends \moodleform {
|
||||||
$this->add_customcert_page_elements($page);
|
$this->add_customcert_page_elements($page);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Link to add another page.
|
// Link to add another page, only display it when the template has been created.
|
||||||
$addpagelink = new \moodle_url('/mod/customcert/edit.php',
|
if (isset($this->_customdata['tid'])) {
|
||||||
array(
|
$addpagelink = new \moodle_url('/mod/customcert/edit.php',
|
||||||
'tid' => $this->tid,
|
array(
|
||||||
'aid' => 1,
|
'tid' => $this->tid,
|
||||||
'action' => 'addpage',
|
'aid' => 1,
|
||||||
'sesskey' => sesskey()
|
'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'));
|
$icon = $OUTPUT->pix_icon('t/switch_plus', get_string('addcertpage', 'customcert'));
|
||||||
$mform->addElement('html', \html_writer::tag('div', $addpagehtml, array('class' => 'addpage')));
|
$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.
|
// Add the submit buttons.
|
||||||
$group = array();
|
$group = array();
|
||||||
|
|
Loading…
Reference in a new issue