MDL-57273 persistent: Some more magic __call conversions
I missed all the entry pages when converting from set_abc() and get_abc() to set('abc', ) and get('abc').
Also fixed a wrong namespace for core_competency\external\performance_helper
This commit is contained in:
@@ -41,10 +41,10 @@ if (!\core_competency\competency_framework::can_read_context($context)) {
|
||||
}
|
||||
|
||||
$title = get_string('competencies', 'core_competency');
|
||||
$pagetitle = get_string('competenciesforframework', 'tool_lp', $framework->get_shortname());
|
||||
$pagetitle = get_string('competenciesforframework', 'tool_lp', $framework->get('shortname'));
|
||||
|
||||
// Set up the page.
|
||||
$url = new moodle_url("/admin/tool/lp/competencies.php", array('competencyframeworkid' => $framework->get_id(),
|
||||
$url = new moodle_url("/admin/tool/lp/competencies.php", array('competencyframeworkid' => $framework->get('id'),
|
||||
'pagecontextid' => $pagecontextid));
|
||||
$frameworksurl = new moodle_url('/admin/tool/lp/competencyframeworks.php', array('pagecontextid' => $pagecontextid));
|
||||
|
||||
@@ -52,7 +52,7 @@ $PAGE->navigation->override_active_url($frameworksurl);
|
||||
$PAGE->set_context($pagecontext);
|
||||
$PAGE->set_pagelayout('admin');
|
||||
$PAGE->set_url($url);
|
||||
$PAGE->navbar->add($framework->get_shortname(), $url);
|
||||
$PAGE->navbar->add($framework->get('shortname'), $url);
|
||||
$PAGE->set_title($title);
|
||||
$PAGE->set_heading($title);
|
||||
$output = $PAGE->get_renderer('tool_lp');
|
||||
|
||||
@@ -63,7 +63,7 @@ if ($competency) {
|
||||
// Get page URL.
|
||||
$urloptions = [
|
||||
'id' => $id,
|
||||
'competencyframeworkid' => $competencyframework->get_id(),
|
||||
'competencyframeworkid' => $competencyframework->get('id'),
|
||||
'parentid' => $parentid,
|
||||
'pagecontextid' => $pagecontextid
|
||||
];
|
||||
|
||||
@@ -58,7 +58,7 @@ if ($form->is_cancelled()) {
|
||||
$framework = \core_competency\api::create_framework($data);
|
||||
$frameworkmanageurl = new moodle_url('/admin/tool/lp/competencies.php', array(
|
||||
'pagecontextid' => $pagecontextid,
|
||||
'competencyframeworkid' => $framework->get_id()
|
||||
'competencyframeworkid' => $framework->get('id')
|
||||
));
|
||||
$messagesuccess = get_string('competencyframeworkcreated', 'tool_lp');
|
||||
redirect($frameworkmanageurl, $messagesuccess, 0, \core\output\notification::NOTIFY_SUCCESS);
|
||||
|
||||
@@ -42,7 +42,7 @@ if (empty($id)) {
|
||||
$plan = \core_competency\api::read_plan($id);
|
||||
|
||||
// The userid parameter must be the same as the owner of the plan.
|
||||
if ($userid != $plan->get_userid()) {
|
||||
if ($userid != $plan->get('userid')) {
|
||||
throw new coding_exception('Inconsistency between the userid parameter and the userid of the plan');
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ $data = $form->get_data();
|
||||
if ($data) {
|
||||
if (empty($data->id)) {
|
||||
$plan = \core_competency\api::create_plan($data);
|
||||
$returnurl = new moodle_url('/admin/tool/lp/plan.php', ['id' => $plan->get_id()]);
|
||||
$returnurl = new moodle_url('/admin/tool/lp/plan.php', ['id' => $plan->get('id')]);
|
||||
$returnmsg = get_string('plancreated', 'tool_lp');
|
||||
} else {
|
||||
\core_competency\api::update_plan($data);
|
||||
|
||||
@@ -71,7 +71,7 @@ if ($data) {
|
||||
if (empty($data->id)) {
|
||||
$template = \core_competency\api::create_template($data);
|
||||
$returnurl = new moodle_url('/admin/tool/lp/templatecompetencies.php', [
|
||||
'templateid' => $template->get_id(),
|
||||
'templateid' => $template->get('id'),
|
||||
'pagecontextid' => $pagecontextid
|
||||
]);
|
||||
$returnmsg = get_string('templatecreated', 'tool_lp');
|
||||
|
||||
@@ -183,7 +183,7 @@ function tool_lp_coursemodule_edit_post_actions($data, $course) {
|
||||
|
||||
$existingids = array();
|
||||
foreach ($existing as $cmc) {
|
||||
array_push($existingids, $cmc->get_competencyid());
|
||||
array_push($existingids, $cmc->get('competencyid'));
|
||||
}
|
||||
|
||||
$newids = isset($data->competencies) ? $data->competencies : array();
|
||||
|
||||
@@ -35,7 +35,7 @@ if (isguestuser()) {
|
||||
$plan = \core_competency\api::read_plan($id);
|
||||
$url = new moodle_url('/admin/tool/lp/plan.php', array('id' => $id));
|
||||
|
||||
list($title, $subtitle) = \tool_lp\page_helper::setup_for_plan($plan->get_userid(), $url, $plan);
|
||||
list($title, $subtitle) = \tool_lp\page_helper::setup_for_plan($plan->get('userid'), $url, $plan);
|
||||
|
||||
$output = $PAGE->get_renderer('tool_lp');
|
||||
echo $output->header();
|
||||
|
||||
@@ -34,7 +34,7 @@ $template = \core_competency\api::read_template($id);
|
||||
$context = $template->get_context();
|
||||
$canreadtemplate = $template->can_read();
|
||||
$canmanagetemplate = $template->can_manage();
|
||||
$duedatereached = $template->get_duedate() > 0 && $template->get_duedate() < time();
|
||||
$duedatereached = $template->get('duedate') > 0 && $template->get('duedate') < time();
|
||||
|
||||
if (!$canreadtemplate) {
|
||||
throw new required_capability_exception($context, 'moodle/competency:templateview', 'nopermissions', '');
|
||||
@@ -65,10 +65,10 @@ if ($canmanagetemplate && ($data = $form->get_data()) && !empty($data->cohorts))
|
||||
$relation = \core_competency\api::create_template_cohort($template, $cohortid);
|
||||
|
||||
// Create a plan for each member if template visible, and the due date is not reached, and we didn't reach our limit yet.
|
||||
if ($template->get_visible() && $i < $maxtocreate && !$duedatereached) {
|
||||
if ($template->get('visible') && $i < $maxtocreate && !$duedatereached) {
|
||||
|
||||
// Only create a few plans right now.
|
||||
$tocreate = \core_competency\template_cohort::get_missing_plans($template->get_id(), $cohortid);
|
||||
$tocreate = \core_competency\template_cohort::get_missing_plans($template->get('id'), $cohortid);
|
||||
if ($i + count($tocreate) <= $maxtocreate) {
|
||||
$i += \core_competency\api::create_plans_from_template_cohort($template, $cohortid);
|
||||
} else {
|
||||
@@ -94,7 +94,7 @@ echo $output->header();
|
||||
echo $output->heading($title);
|
||||
echo $output->heading($subtitle, 3);
|
||||
if ($canmanagetemplate) {
|
||||
if ($template->get_visible() == false) {
|
||||
if ($template->get('visible') == false) {
|
||||
// Display message to prevent that cohort will not be synchronzed if the template is hidden.
|
||||
echo $output->notify_message(get_string('templatecohortnotsyncedwhilehidden', 'tool_lp'));
|
||||
} else if ($duedatereached) {
|
||||
|
||||
@@ -51,7 +51,7 @@ $form = new \tool_lp\form\template_plans($url->out(false));
|
||||
if ($canmanagetemplate && ($data = $form->get_data()) && !empty($data->users)) {
|
||||
$i = 0;
|
||||
foreach ($data->users as $userid) {
|
||||
$result = \core_competency\api::create_plan_from_template($template->get_id(), $userid);
|
||||
$result = \core_competency\api::create_plan_from_template($template->get('id'), $userid);
|
||||
if ($result) {
|
||||
$i++;
|
||||
}
|
||||
@@ -74,10 +74,10 @@ echo $output->heading($subtitle, 3);
|
||||
|
||||
// Do not display form when the template is hidden.
|
||||
if ($canmanagetemplate) {
|
||||
if (!$template->get_visible()) {
|
||||
if (!$template->get('visible')) {
|
||||
// Display message that plan can not be created if the template is hidden.
|
||||
echo $output->notify_message(get_string('cannotcreateuserplanswhentemplatehidden', 'tool_lp'));
|
||||
} else if ($template->get_duedate() > 0 && $template->get_duedate() < time() + 900) {
|
||||
} else if ($template->get('duedate') > 0 && $template->get('duedate') < time() + 900) {
|
||||
// Prevent the user from creating plans when the due date is passed, or in less than 15 minutes.
|
||||
echo $output->notify_message(get_string('cannotcreateuserplanswhentemplateduedateispassed', 'tool_lp'));
|
||||
} else {
|
||||
|
||||
@@ -42,7 +42,7 @@ if (!$template->can_read()) {
|
||||
\core_competency\api::template_viewed($template);
|
||||
|
||||
// Set up the page.
|
||||
$url = new moodle_url('/admin/tool/lp/templatecompetencies.php', array('templateid' => $template->get_id(),
|
||||
$url = new moodle_url('/admin/tool/lp/templatecompetencies.php', array('templateid' => $template->get('id'),
|
||||
'pagecontextid' => $pagecontextid));
|
||||
list($title, $subtitle) = \tool_lp\page_helper::setup_for_template($pagecontextid, $url, $template);
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ $uc = \core_competency\api::get_user_competency_by_id($id);
|
||||
$params = array('id' => $id);
|
||||
$url = new moodle_url('/admin/tool/lp/user_competency.php', $params);
|
||||
|
||||
$user = core_user::get_user($uc->get_userid());
|
||||
$user = core_user::get_user($uc->get('userid'));
|
||||
if (!$user || !core_user::is_real_user($user->id)) {
|
||||
throw new moodle_exception('invaliduser', 'error');
|
||||
}
|
||||
@@ -47,7 +47,7 @@ $compexporter = new \core_competency\external\competency_exporter($competency, a
|
||||
|
||||
$PAGE->set_pagelayout('standard');
|
||||
$PAGE->set_url($url);
|
||||
$PAGE->navigation->override_active_url(new moodle_url('/admin/tool/lp/plans.php', array('userid' => $uc->get_userid())));
|
||||
$PAGE->navigation->override_active_url(new moodle_url('/admin/tool/lp/plans.php', array('userid' => $uc->get('userid'))));
|
||||
$PAGE->set_context($uc->get_context());
|
||||
if (!$iscurrentuser) {
|
||||
$PAGE->navigation->extend_for_user($user);
|
||||
|
||||
@@ -66,7 +66,7 @@ $competency = new \core_competency\competency($competencyid);
|
||||
if ($userid > 0) {
|
||||
$usercompetencycourses = \core_competency\api::list_user_competencies_in_course($courseid, $userid);
|
||||
}
|
||||
$subtitle = $competency->get_shortname() . ' <em>' . $competency->get_idnumber() . '</em>';
|
||||
$subtitle = $competency->get('shortname') . ' <em>' . $competency->get('idnumber') . '</em>';
|
||||
|
||||
list($title, $subtitle) = \tool_lp\page_helper::setup_for_course($url, $course, $subtitle);
|
||||
|
||||
|
||||
@@ -54,13 +54,13 @@ echo $output->render($nav);
|
||||
$page = new \tool_lp\output\user_competency_summary_in_plan($competencyid, $planid);
|
||||
echo $output->render($page);
|
||||
// Trigger the viewed event.
|
||||
$pc = \core_competency\api::get_plan_competency($plan, $competency->get_id());
|
||||
if ($plan->get_status() == \core_competency\plan::STATUS_COMPLETE) {
|
||||
$pc = \core_competency\api::get_plan_competency($plan, $competency->get('id'));
|
||||
if ($plan->get('status') == \core_competency\plan::STATUS_COMPLETE) {
|
||||
$usercompetencyplan = $pc->usercompetencyplan;
|
||||
\core_competency\api::user_competency_plan_viewed($usercompetencyplan);
|
||||
} else {
|
||||
$usercompetency = $pc->usercompetency;
|
||||
\core_competency\api::user_competency_viewed_in_plan($usercompetency, $plan->get_id());
|
||||
\core_competency\api::user_competency_viewed_in_plan($usercompetency, $plan->get('id'));
|
||||
}
|
||||
|
||||
echo $output->footer();
|
||||
|
||||
@@ -34,7 +34,7 @@ $id = required_param('id', PARAM_INT);
|
||||
|
||||
$userevidence = \core_competency\api::read_user_evidence($id);
|
||||
$url = new moodle_url('/admin/tool/lp/user_evidence.php', array('id' => $id));
|
||||
list($title, $subtitle) = \tool_lp\page_helper::setup_for_user_evidence($userevidence->get_userid(), $url, $userevidence);
|
||||
list($title, $subtitle) = \tool_lp\page_helper::setup_for_user_evidence($userevidence->get('userid'), $url, $userevidence);
|
||||
|
||||
$output = $PAGE->get_renderer('tool_lp');
|
||||
echo $output->header();
|
||||
|
||||
@@ -46,7 +46,7 @@ if (empty($id)) {
|
||||
$userevidence = \core_competency\api::read_user_evidence($id);
|
||||
|
||||
// The userid parameter must be the same as the owner of the evidence.
|
||||
if ($userid != $userevidence->get_userid()) {
|
||||
if ($userid != $userevidence->get('userid')) {
|
||||
throw new coding_exception('Inconsistency between the userid parameter and the userid of the plan.');
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ if ($form->is_cancelled()) {
|
||||
// Load existing user evidence.
|
||||
$itemid = null;
|
||||
if ($userevidence) {
|
||||
$itemid = $userevidence->get_id();
|
||||
$itemid = $userevidence->get('id');
|
||||
}
|
||||
|
||||
// Massaging the file API.
|
||||
@@ -100,7 +100,7 @@ if ($data = $form->get_data()) {
|
||||
|
||||
if (empty($userevidence)) {
|
||||
$userevidence = \core_competency\api::create_user_evidence($data, $draftitemid);
|
||||
$returnurl = new moodle_url('/admin/tool/lp/user_evidence.php', ['id' => $userevidence->get_id()]);
|
||||
$returnurl = new moodle_url('/admin/tool/lp/user_evidence.php', ['id' => $userevidence->get('id')]);
|
||||
$returnmsg = get_string('userevidencecreated', 'tool_lp');
|
||||
} else {
|
||||
\core_competency\api::update_user_evidence($data, $draftitemid);
|
||||
|
||||
@@ -62,7 +62,7 @@ if ($form->is_cancelled()) {
|
||||
$form->set_import_error($error);
|
||||
} else {
|
||||
$framework = $importer->import();
|
||||
$urlparams = ['competencyframeworkid' => $framework->get_id(), 'pagecontextid' => $context->id];
|
||||
$urlparams = ['competencyframeworkid' => $framework->get('id'), 'pagecontextid' => $context->id];
|
||||
$frameworksurl = new moodle_url('/admin/tool/lp/competencies.php', $urlparams);
|
||||
echo $OUTPUT->notification(get_string('competencyframeworkcreated', 'tool_lp'), 'notifysuccess');
|
||||
echo $OUTPUT->continue_button($frameworksurl);
|
||||
|
||||
@@ -83,7 +83,7 @@ class summary implements renderable, templatable {
|
||||
if (count($plans) >= 3) {
|
||||
break;
|
||||
}
|
||||
if ($plan->get_status() == plan::STATUS_ACTIVE) {
|
||||
if ($plan->get('status') == plan::STATUS_ACTIVE) {
|
||||
$plans[] = $plan;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
use moodle_url;
|
||||
use renderer_base;
|
||||
use core_competency\performance_helper;
|
||||
use core_competency\external\performance_helper;
|
||||
use core_files\external\stored_file_exporter;
|
||||
|
||||
/**
|
||||
|
||||
@@ -254,7 +254,7 @@ abstract class persistent extends moodleform {
|
||||
$data = static::convert_fields($data);
|
||||
|
||||
// Ensure that the ID is set.
|
||||
$data->id = $this->persistent->get_id();
|
||||
$data->id = $this->persistent->get('id');
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user