#35 Reworded 'addcertpage' string and changed button to a link
Also added an icon next to the link and moved the location via CSS.
This commit is contained in:
parent
e7dba867ec
commit
d70a693137
4 changed files with 17 additions and 13 deletions
|
@ -55,7 +55,7 @@ class edit_form extends \moodleform {
|
|||
* Form definition.
|
||||
*/
|
||||
public function definition() {
|
||||
global $DB;
|
||||
global $DB, $OUTPUT;
|
||||
|
||||
$mform =& $this->_form;
|
||||
|
||||
|
@ -80,11 +80,11 @@ class edit_form extends \moodleform {
|
|||
$this->add_customcert_page_elements($page);
|
||||
}
|
||||
|
||||
$mform->closeHeaderBefore('addcertpage');
|
||||
|
||||
$mform->addElement('submit', 'addcertpage', get_string('addcertpage', 'customcert'));
|
||||
|
||||
$mform->closeHeaderBefore('submitbtn');
|
||||
// Link to add another page.
|
||||
$addpagelink = new \moodle_url('/mod/customcert/edit.php', array('tid' => $this->tid, 'aid' => 1, 'action' => 'addpage'));
|
||||
$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();
|
||||
|
|
11
edit.php
11
edit.php
|
@ -66,7 +66,6 @@ if ($context->contextlevel == CONTEXT_SYSTEM) {
|
|||
$PAGE->navbar->add(get_string('editcustomcert', 'customcert'));
|
||||
}
|
||||
|
||||
|
||||
// Flag to determine if we are deleting anything.
|
||||
$deleting = false;
|
||||
|
||||
|
@ -84,6 +83,11 @@ if ($tid) {
|
|||
case 'emovedown' :
|
||||
$template->move_item('element', $actionid, 'down');
|
||||
break;
|
||||
case 'addpage' :
|
||||
$template->add_page();
|
||||
$url = new \moodle_url('/mod/customcert/edit.php', array('tid' => $tid));
|
||||
redirect($url);
|
||||
break;
|
||||
case 'deletepage' :
|
||||
if (!empty($confirm)) { // Check they have confirmed the deletion.
|
||||
$template->delete_page($actionid);
|
||||
|
@ -182,11 +186,6 @@ if ($data = $mform->get_data()) {
|
|||
// Save any page data.
|
||||
$template->save_page($data);
|
||||
|
||||
// Check if we are adding a page.
|
||||
if (!empty($data->addcertpage)) {
|
||||
$template->add_page();
|
||||
}
|
||||
|
||||
// Loop through the data.
|
||||
foreach ($data as $key => $value) {
|
||||
// Check if they chose to add an element to a page.
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
$string['addcertpage'] = 'Add another certificate page';
|
||||
$string['addcertpage'] = 'Add page';
|
||||
$string['addelement'] = 'Add element';
|
||||
$string['awardedto'] = 'Awarded to';
|
||||
$string['certificate'] = 'Certificate';
|
||||
|
|
|
@ -2,6 +2,11 @@
|
|||
text-align: right;
|
||||
}
|
||||
|
||||
#page-mod-customcert-edit .addpage {
|
||||
border-top: 1px solid #f4f4f4;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
#page-mod-customcert-edit #id_replace {
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue