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