mirror of
https://github.com/moodle/moodle.git
synced 2025-04-22 17:02:03 +02:00
Merge branch 'MDL-83884-master' of https://github.com/ntdat1904/datnguyen_moodle
This commit is contained in:
commit
ffdb7689c2
@ -13,18 +13,21 @@
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* List alignments, skills, or standards are targeted by a BadgeClass.
|
||||
*
|
||||
* @package core
|
||||
* @package core_badges
|
||||
* @subpackage badges
|
||||
* @copyright 2018 Tung Thai
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @author Tung Thai <Tung.ThaiDuc@nashtechglobal.com>
|
||||
*/
|
||||
|
||||
use core_badges\form\alignment;
|
||||
|
||||
require_once(__DIR__ . '/../config.php');
|
||||
require_once($CFG->libdir . '/badgeslib.php');
|
||||
require_once($CFG->dirroot . '/badges/alignment_form.php');
|
||||
|
||||
$badgeid = required_param('id', PARAM_INT);
|
||||
$alignmentid = optional_param('alignmentid', 0, PARAM_INT);
|
||||
@ -37,7 +40,7 @@ if (empty($CFG->enablebadges)) {
|
||||
}
|
||||
$badge = new badge($badgeid);
|
||||
$context = $badge->get_context();
|
||||
$navurl = new moodle_url('/badges/index.php', array('type' => $badge->type));
|
||||
$navurl = new moodle_url('/badges/index.php', ['type' => $badge->type]);
|
||||
require_capability('moodle/badges:configuredetails', $context);
|
||||
|
||||
if ($badge->type == BADGE_TYPE_COURSE) {
|
||||
@ -47,7 +50,7 @@ if ($badge->type == BADGE_TYPE_COURSE) {
|
||||
require_login($badge->courseid);
|
||||
$course = get_course($badge->courseid);
|
||||
$heading = format_string($course->fullname, true, ['context' => $context]);
|
||||
$navurl = new moodle_url('/badges/index.php', array('type' => $badge->type, 'id' => $badge->courseid));
|
||||
$navurl = new moodle_url('/badges/index.php', ['type' => $badge->type, 'id' => $badge->courseid]);
|
||||
$PAGE->set_pagelayout('standard');
|
||||
navigation_node::override_active_url($navurl);
|
||||
} else {
|
||||
@ -56,7 +59,7 @@ if ($badge->type == BADGE_TYPE_COURSE) {
|
||||
navigation_node::override_active_url($navurl, true);
|
||||
}
|
||||
|
||||
$currenturl = new moodle_url('/badges/alignment.php', array('id' => $badge->id));
|
||||
$currenturl = new moodle_url('/badges/alignment.php', ['id' => $badge->id]);
|
||||
$PAGE->set_context($context);
|
||||
$PAGE->set_url($currenturl);
|
||||
$PAGE->set_heading($heading);
|
||||
@ -66,8 +69,8 @@ $PAGE->navbar->add($badge->name);
|
||||
$output = $PAGE->get_renderer('core', 'badges');
|
||||
$msg = optional_param('msg', '', PARAM_TEXT);
|
||||
$emsg = optional_param('emsg', '', PARAM_TEXT);
|
||||
$url = new moodle_url('/badges/alignment.php', array('id' => $badge->id, 'action' => $action, 'alignmentid' => $alignmentid));
|
||||
$mform = new alignment_form($url, array('badge' => $badge, 'action' => $action, 'alignmentid' => $alignmentid));
|
||||
$url = new moodle_url('/badges/alignment.php', ['id' => $badge->id, 'action' => $action, 'alignmentid' => $alignmentid]);
|
||||
$mform = new alignment($url, ['badge' => $badge, 'action' => $action, 'alignmentid' => $alignmentid]);
|
||||
if ($mform->is_cancelled()) {
|
||||
redirect($currenturl);
|
||||
} else if ($mform->is_submitted() && $mform->is_validated() && ($data = $mform->get_data())) {
|
||||
@ -98,7 +101,7 @@ if ($alignmentid || $action == 'add' || $action == 'edit') {
|
||||
$mform->display();
|
||||
} else if (empty($action)) {
|
||||
if (!$badge->is_active() && !$badge->is_locked()) {
|
||||
$urlbutton = new moodle_url('/badges/alignment.php', array('id' => $badge->id, 'action' => 'add'));
|
||||
$urlbutton = new moodle_url('/badges/alignment.php', ['id' => $badge->id, 'action' => 'add']);
|
||||
echo $OUTPUT->box($OUTPUT->single_button($urlbutton, get_string('addalignment', 'badges')), 'clearfix mdl-align');
|
||||
}
|
||||
$alignments = $badge->get_alignments();
|
||||
|
@ -13,15 +13,11 @@
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
/**
|
||||
* Form alignment for editing.
|
||||
*
|
||||
* @package core
|
||||
* @subpackage badges
|
||||
* @copyright 2018 Tung Thai
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @author Tung Thai <Tung.ThaiDuc@nashtechglobal.com>
|
||||
*/
|
||||
|
||||
namespace core_badges\form;
|
||||
use moodleform;
|
||||
use stdClass;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
require_once($CFG->libdir . '/formslib.php');
|
||||
require_once($CFG->libdir . '/badgeslib.php');
|
||||
@ -29,12 +25,12 @@ require_once($CFG->libdir . '/badgeslib.php');
|
||||
/**
|
||||
* Form to edit alignment.
|
||||
*
|
||||
* @package core_badges
|
||||
* @copyright 2018 Tung Thai
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @author Tung Thai <Tung.ThaiDuc@nashtechglobal.com>
|
||||
*/
|
||||
class alignment_form extends moodleform {
|
||||
|
||||
class alignment extends moodleform {
|
||||
/**
|
||||
* Defines the form.
|
||||
*/
|
||||
@ -45,21 +41,21 @@ class alignment_form extends moodleform {
|
||||
$action = $this->_customdata['action'];
|
||||
$alignmentid = $this->_customdata['alignmentid'];
|
||||
$mform->addElement('header', 'alignment', get_string('alignment', 'badges'));
|
||||
$mform->addElement('text', 'targetname', get_string('targetname', 'badges'), array('size' => '70'));
|
||||
$mform->addElement('text', 'targetname', get_string('targetname', 'badges'), ['size' => '70']);
|
||||
$mform->setType('targetname', PARAM_TEXT);
|
||||
$mform->addRule('targetname', get_string('maximumchars', '', 255), 'maxlength', 255, 'client');
|
||||
$mform->addRule('targetname', null, 'required');
|
||||
$mform->addHelpButton('targetname', 'targetname', 'badges');
|
||||
$mform->addElement('text', 'targeturl', get_string('targeturl', 'badges'), array('size' => '70'));
|
||||
$mform->addElement('text', 'targeturl', get_string('targeturl', 'badges'), ['size' => '70']);
|
||||
$mform->setType('targeturl', PARAM_URL);
|
||||
$mform->addRule('targeturl', get_string('maximumchars', '', 255), 'maxlength', 255, 'client');
|
||||
$mform->addRule('targeturl', null, 'required');
|
||||
$mform->addHelpButton('targeturl', 'targeturl', 'badges');
|
||||
$mform->addElement('text', 'targetframework', get_string('targetframework', 'badges'), array('size' => '70'));
|
||||
$mform->addElement('text', 'targetframework', get_string('targetframework', 'badges'), ['size' => '70']);
|
||||
$mform->setType('targetframework', PARAM_TEXT);
|
||||
$mform->addRule('targetframework', get_string('maximumchars', '', 255), 'maxlength', 255, 'client');
|
||||
$mform->addHelpButton('targetframework', 'targetframework', 'badges');
|
||||
$mform->addElement('text', 'targetcode', get_string('targetcode', 'badges'), array('size' => '70'));
|
||||
$mform->addElement('text', 'targetcode', get_string('targetcode', 'badges'), ['size' => '70']);
|
||||
$mform->setType('targetcode', PARAM_TEXT);
|
||||
$mform->addRule('targetcode', get_string('maximumchars', '', 255), 'maxlength', 255, 'client');
|
||||
$mform->addHelpButton('targetcode', 'targetcode', 'badges');
|
||||
@ -68,11 +64,11 @@ class alignment_form extends moodleform {
|
||||
$this->add_action_buttons();
|
||||
if ($action == 'edit' || $alignmentid) {
|
||||
$alignment = new stdClass();
|
||||
$alignment = $DB->get_record_select('badge_alignment', 'id = ?', array($alignmentid));
|
||||
$alignment = $DB->get_record_select('badge_alignment', 'id = ?', [$alignmentid]);
|
||||
$this->set_data($alignment);
|
||||
// Freeze all elements if badge is active or locked.
|
||||
if ($badge->is_active() || $badge->is_locked()) {
|
||||
$mform->hardFreezeAllVisibleExcept(array());
|
||||
$mform->hardFreezeAllVisibleExcept([]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -80,8 +76,8 @@ class alignment_form extends moodleform {
|
||||
/**
|
||||
* Validate the data from the form.
|
||||
*
|
||||
* @param array $data form data
|
||||
* @param array $files form files
|
||||
* @param array $data form data
|
||||
* @param array $files form files
|
||||
* @return array An array of error messages.
|
||||
*/
|
||||
public function validation($data, $files) {
|
@ -13,26 +13,25 @@
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
/**
|
||||
* Form endorsement for editing.
|
||||
*
|
||||
* @package core
|
||||
* @subpackage badges
|
||||
* @copyright 2018 Tung Thai
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @author Tung Thai <Tung.ThaiDuc@nashtechglobal.com>
|
||||
*/
|
||||
|
||||
namespace core_badges\form;
|
||||
|
||||
use moodleform;
|
||||
use stdClass;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
require_once($CFG->libdir . '/formslib.php');
|
||||
require_once($CFG->libdir . '/badgeslib.php');
|
||||
|
||||
/**
|
||||
* Form to edit endorsement.
|
||||
* Form endorsement for editing.
|
||||
*
|
||||
* @package core_badges
|
||||
* @copyright 2018 Tung Thai
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @author Tung Thai
|
||||
*/
|
||||
class endorsement_form extends moodleform {
|
||||
class endorsement extends moodleform {
|
||||
|
||||
/**
|
||||
* Defines the form.
|
||||
@ -41,22 +40,22 @@ class endorsement_form extends moodleform {
|
||||
$mform = $this->_form;
|
||||
$badge = $this->_customdata['badge'];
|
||||
$mform->addElement('header', 'endorsement', get_string('issuerdetails', 'badges'));
|
||||
$mform->addElement('text', 'issuername', get_string('issuername_endorsement', 'badges'), array('size' => '70'));
|
||||
$mform->addElement('text', 'issuername', get_string('issuername_endorsement', 'badges'), ['size' => '70']);
|
||||
$mform->setType('issuername', PARAM_TEXT);
|
||||
$mform->addRule('issuername', null, 'required');
|
||||
$mform->addHelpButton('issuername', 'issuername_endorsement', 'badges');
|
||||
$mform->addElement('text', 'issueremail', get_string('issueremail', 'badges'), array('size' => '70'));
|
||||
$mform->addElement('text', 'issueremail', get_string('issueremail', 'badges'), ['size' => '70']);
|
||||
$mform->addRule('issueremail', null, 'required');
|
||||
$mform->setType('issueremail', PARAM_RAW);
|
||||
$mform->addHelpButton('issueremail', 'issueremail', 'badges');
|
||||
$mform->addElement('text', 'issuerurl', get_string('issuerurl', 'badges'), array('size' => '70'));
|
||||
$mform->addElement('text', 'issuerurl', get_string('issuerurl', 'badges'), ['size' => '70']);
|
||||
$mform->setType('issuerurl', PARAM_URL);
|
||||
$mform->addRule('issuerurl', null, 'required');
|
||||
$mform->addHelpButton('issuerurl', 'issuerurl', 'badges');
|
||||
$mform->addElement('date_time_selector', 'dateissued',
|
||||
get_string('dateawarded', 'badges'));
|
||||
get_string('dateawarded', 'badges'));
|
||||
$mform->addElement('header', 'claim', get_string('claim', 'badges'));
|
||||
$mform->addElement('text', 'claimid', get_string('claimid', 'badges'), array('size' => '70'));
|
||||
$mform->addElement('text', 'claimid', get_string('claimid', 'badges'), ['size' => '70']);
|
||||
$mform->setType('claimid', PARAM_URL);
|
||||
$mform->addRule('claimid', null, 'required');
|
||||
$mform->addElement('textarea', 'claimcomment', get_string('claimcomment', 'badges'), 'wrap="virtual" rows="8" cols="70"');
|
||||
@ -70,7 +69,7 @@ class endorsement_form extends moodleform {
|
||||
$this->add_action_buttons();
|
||||
// Freeze all elements if badge is active or locked.
|
||||
if ($badge->is_active() || $badge->is_locked()) {
|
||||
$mform->hardFreezeAllVisibleExcept(array());
|
||||
$mform->hardFreezeAllVisibleExcept([]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -94,4 +93,4 @@ class endorsement_form extends moodleform {
|
||||
}
|
||||
return $errors;
|
||||
}
|
||||
}
|
||||
}
|
@ -14,23 +14,27 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Form class for editing badges preferences.
|
||||
*
|
||||
* @package core
|
||||
* @subpackage badges
|
||||
* @copyright 2013 onwards Totara Learning Solutions Ltd {@link http://www.totaralms.com/}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @author Yuliya Bozhko <yuliya.bozhko@totaralms.com>
|
||||
*/
|
||||
namespace core_badges\form;
|
||||
|
||||
if (!defined('MOODLE_INTERNAL')) {
|
||||
die('Direct access to this script is forbidden.');
|
||||
}
|
||||
use moodleform;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
require_once($CFG->libdir . '/formslib.php');
|
||||
|
||||
class badges_preferences_form extends moodleform {
|
||||
/**
|
||||
* Form class for editing badges preferences.
|
||||
*
|
||||
* @package core_badges
|
||||
* @copyright 2018 Tung Thai
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @author Yuliya Bozhko <yuliya.bozhko@totaralms.com>
|
||||
* @author Tung Thai <Tung.ThaiDuc@nashtechglobal.com>
|
||||
*/
|
||||
class preferences extends moodleform {
|
||||
/**
|
||||
* Defines the form.
|
||||
*/
|
||||
public function definition() {
|
||||
global $USER, $CFG;
|
||||
|
@ -13,15 +13,11 @@
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
/**
|
||||
* Form related badges.
|
||||
*
|
||||
* @package core
|
||||
* @subpackage badges
|
||||
* @copyright 2018 Tung Thai
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @author Tung Thai <Tung.ThaiDuc@nashtechglobal.com>
|
||||
*/
|
||||
|
||||
namespace core_badges\form;
|
||||
|
||||
use moodleform;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
require_once($CFG->libdir . '/formslib.php');
|
||||
require_once($CFG->libdir . '/badgeslib.php');
|
||||
@ -29,11 +25,12 @@ require_once($CFG->libdir . '/badgeslib.php');
|
||||
/**
|
||||
* Form to edit badge details.
|
||||
*
|
||||
* @package core_badges
|
||||
* @copyright 2018 Tung Thai
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @author Tung Thai <Tung.ThaiDuc@nashtechglobal.com>
|
||||
*/
|
||||
class edit_relatedbadge_form extends moodleform {
|
||||
class related extends moodleform {
|
||||
|
||||
/**
|
||||
* Defines the form.
|
||||
@ -44,10 +41,10 @@ class edit_relatedbadge_form extends moodleform {
|
||||
$badgesarray = $this->get_badges_option($badge);
|
||||
$mform->addElement('header', 'alignment', get_string('relatedbages', 'badges'));
|
||||
if (!$badgesarray) {
|
||||
$badgesarray = array(get_string('none'));
|
||||
$attributes = array('size' => '3', 'disabled' => true, 'style' => 'min-width: 200px');
|
||||
$badgesarray = [get_string('none')];
|
||||
$attributes = ['size' => '3', 'disabled' => true, 'style' => 'min-width: 200px'];
|
||||
} else {
|
||||
$attributes = array('size' => '10');
|
||||
$attributes = ['size' => '10'];
|
||||
}
|
||||
$mform->addElement('select', 'relatedbadgeids', get_string('relatedbages', 'badges'), $badgesarray, $attributes);
|
||||
$mform->getElement('relatedbadgeids')->setMultiple(true);
|
||||
@ -55,7 +52,7 @@ class edit_relatedbadge_form extends moodleform {
|
||||
|
||||
// Freeze all elements if badge is active or locked.
|
||||
if ($badge->is_active() || $badge->is_locked()) {
|
||||
$mform->hardFreezeAllVisibleExcept(array());
|
||||
$mform->hardFreezeAllVisibleExcept([]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -96,7 +93,7 @@ class edit_relatedbadge_form extends moodleform {
|
||||
|
||||
$records = $DB->get_records_sql($sql, $params);
|
||||
$languages = get_string_manager()->get_list_of_languages();
|
||||
$options = array();
|
||||
$options = [];
|
||||
foreach ($records as $record) {
|
||||
$language = isset($languages[$record->language]) ? $languages[$record->language] : '';
|
||||
$options[$record->id] = $record->name .
|
@ -13,18 +13,21 @@
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Endorsement information
|
||||
*
|
||||
* @package core
|
||||
* @package core_badges
|
||||
* @subpackage badges
|
||||
* @copyright 2018 Tung Thai
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @author Tung Thai <Tung.ThaiDuc@nashtechglobal.com>
|
||||
*/
|
||||
|
||||
use core_badges\form\endorsement;
|
||||
|
||||
require_once(__DIR__ . '/../config.php');
|
||||
require_once($CFG->libdir . '/badgeslib.php');
|
||||
require_once($CFG->dirroot . '/badges/endorsement_form.php');
|
||||
|
||||
$badgeid = required_param('id', PARAM_INT);
|
||||
|
||||
@ -36,7 +39,7 @@ if (empty($CFG->enablebadges)) {
|
||||
|
||||
$badge = new badge($badgeid);
|
||||
$context = $badge->get_context();
|
||||
$navurl = new moodle_url('/badges/index.php', array('type' => $badge->type));
|
||||
$navurl = new moodle_url('/badges/index.php', ['type' => $badge->type]);
|
||||
require_capability('moodle/badges:configuredetails', $context);
|
||||
|
||||
if ($badge->type == BADGE_TYPE_COURSE) {
|
||||
@ -46,7 +49,7 @@ if ($badge->type == BADGE_TYPE_COURSE) {
|
||||
require_login($badge->courseid);
|
||||
$course = get_course($badge->courseid);
|
||||
$heading = format_string($course->fullname, true, ['context' => $context]);
|
||||
$navurl = new moodle_url('/badges/index.php', array('type' => $badge->type, 'id' => $badge->courseid));
|
||||
$navurl = new moodle_url('/badges/index.php', ['type' => $badge->type, 'id' => $badge->courseid]);
|
||||
$PAGE->set_pagelayout('standard');
|
||||
navigation_node::override_active_url($navurl);
|
||||
} else {
|
||||
@ -55,7 +58,7 @@ if ($badge->type == BADGE_TYPE_COURSE) {
|
||||
navigation_node::override_active_url($navurl, true);
|
||||
}
|
||||
|
||||
$currenturl = new moodle_url('/badges/endorsement.php', array('id' => $badgeid));
|
||||
$currenturl = new moodle_url('/badges/endorsement.php', ['id' => $badgeid]);
|
||||
$PAGE->set_context($context);
|
||||
$PAGE->set_url($currenturl);
|
||||
$PAGE->set_heading($heading);
|
||||
@ -78,9 +81,9 @@ echo $output->render_tertiary_navigation($actionbar);
|
||||
echo $OUTPUT->heading(print_badge_image($badge, $context, 'small') . ' ' . $badge->name);
|
||||
echo $output->print_badge_status_box($badge);
|
||||
|
||||
$form = new endorsement_form($currenturl, array('badge' => $badge));
|
||||
$form = new endorsement($currenturl, ['badge' => $badge]);
|
||||
if ($form->is_cancelled()) {
|
||||
redirect(new moodle_url('/badges/overview.php', array('id' => $badgeid)));
|
||||
redirect(new moodle_url('/badges/overview.php', ['id' => $badgeid]));
|
||||
} else if ($form->is_submitted() && $form->is_validated() && ($data = $form->get_data())) {
|
||||
$endorsement = new stdClass();
|
||||
$endorsement->badgeid = $badgeid;
|
||||
|
@ -17,7 +17,7 @@
|
||||
/**
|
||||
* Badges user preferences page.
|
||||
*
|
||||
* @package core
|
||||
* @package core_badges
|
||||
* @subpackage badges
|
||||
* @copyright 2013 onwards Totara Learning Solutions Ltd {@link http://www.totaralms.com/}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
@ -25,8 +25,9 @@
|
||||
*/
|
||||
|
||||
require_once(__DIR__ . '/../config.php');
|
||||
require_once('preferences_form.php');
|
||||
require_once($CFG->dirroot.'/user/editlib.php');
|
||||
require_once($CFG->dirroot . '/user/editlib.php');
|
||||
|
||||
use core_badges\form\preferences;
|
||||
|
||||
$url = new moodle_url('/badges/preferences.php');
|
||||
|
||||
@ -39,8 +40,8 @@ if (empty($CFG->enablebadges)) {
|
||||
throw new \moodle_exception('badgesdisabled', 'badges');
|
||||
}
|
||||
|
||||
$mform = new badges_preferences_form();
|
||||
$mform->set_data(array('badgeprivacysetting' => get_user_preferences('badgeprivacysetting')));
|
||||
$mform = new preferences();
|
||||
$mform->set_data(['badgeprivacysetting' => get_user_preferences('badgeprivacysetting')]);
|
||||
|
||||
if (!$mform->is_cancelled() && $data = $mform->get_data()) {
|
||||
useredit_update_user_preference(['id' => $USER->id,
|
||||
|
@ -17,16 +17,17 @@
|
||||
/**
|
||||
* Related badges information
|
||||
*
|
||||
* @package core
|
||||
* @package core_badges
|
||||
* @subpackage badges
|
||||
* @copyright 2018 Tung Thai
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @author Tung Thai <Tung.ThaiDuc@nashtechglobal.com>
|
||||
*/
|
||||
|
||||
use core_badges\form\related;
|
||||
|
||||
require_once(__DIR__ . '/../config.php');
|
||||
require_once($CFG->libdir . '/badgeslib.php');
|
||||
require_once($CFG->dirroot . '/badges/related_form.php');
|
||||
|
||||
$badgeid = required_param('id', PARAM_INT);
|
||||
$action = optional_param('action', null, PARAM_TEXT);
|
||||
@ -40,7 +41,7 @@ if (empty($CFG->enablebadges)) {
|
||||
|
||||
$badge = new badge($badgeid);
|
||||
$context = $badge->get_context();
|
||||
$navurl = new moodle_url('/badges/index.php', array('type' => $badge->type));
|
||||
$navurl = new moodle_url('/badges/index.php', ['type' => $badge->type]);
|
||||
require_capability('moodle/badges:configuredetails', $context);
|
||||
|
||||
if ($badge->type == BADGE_TYPE_COURSE) {
|
||||
@ -51,7 +52,7 @@ if ($badge->type == BADGE_TYPE_COURSE) {
|
||||
$course = get_course($badge->courseid);
|
||||
$heading = format_string($course->fullname, true, ['context' => $context]);
|
||||
|
||||
$navurl = new moodle_url('/badges/index.php', array('type' => $badge->type, 'id' => $badge->courseid));
|
||||
$navurl = new moodle_url('/badges/index.php', ['type' => $badge->type, 'id' => $badge->courseid]);
|
||||
$PAGE->set_pagelayout('standard');
|
||||
navigation_node::override_active_url($navurl);
|
||||
} else {
|
||||
@ -60,7 +61,7 @@ if ($badge->type == BADGE_TYPE_COURSE) {
|
||||
navigation_node::override_active_url($navurl, true);
|
||||
}
|
||||
|
||||
$currenturl = new moodle_url('/badges/related.php', array('id' => $badge->id));
|
||||
$currenturl = new moodle_url('/badges/related.php', ['id' => $badge->id]);
|
||||
$PAGE->set_context($context);
|
||||
$PAGE->set_url($currenturl);
|
||||
$PAGE->set_heading($heading);
|
||||
@ -69,9 +70,9 @@ $PAGE->navbar->add($badge->name);
|
||||
$output = $PAGE->get_renderer('core', 'badges');
|
||||
$msg = optional_param('msg', '', PARAM_TEXT);
|
||||
$emsg = optional_param('emsg', '', PARAM_TEXT);
|
||||
$url = new moodle_url('/badges/related.php', array('id' => $badge->id, 'action' => 'add'));
|
||||
$url = new moodle_url('/badges/related.php', ['id' => $badge->id, 'action' => 'add']);
|
||||
|
||||
$mform = new edit_relatedbadge_form($url, array('badge' => $badge));
|
||||
$mform = new related($url, ['badge' => $badge]);
|
||||
if ($mform->is_cancelled()) {
|
||||
redirect($currenturl);
|
||||
} else if ($mform->is_submitted() && $mform->is_validated() && ($data = $mform->get_data())) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user