first commit

This commit is contained in:
CHIEFSOFT\ameye
2024-09-30 18:11:26 -04:00
commit e592ca6823
27270 changed files with 5002257 additions and 0 deletions
+93
View File
@@ -0,0 +1,93 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Block LP main file.
*
* @package block_lp
* @copyright 2016 Frédéric Massart - FMCorz.net
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
/**
* Block LP class.
*
* @package block_lp
* @copyright 2016 Frédéric Massart - FMCorz.net
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class block_lp extends block_base {
/**
* Applicable formats.
*
* @return array
*/
public function applicable_formats() {
return array('site' => true, 'course' => true, 'my' => true);
}
/**
* Init.
*
* @return void
*/
public function init() {
$this->title = get_string('pluginname', 'block_lp');
}
/**
* Get content.
*
* @return stdClass
*/
public function get_content() {
if (isset($this->content)) {
return $this->content;
}
$this->content = new stdClass();
if (!get_config('core_competency', 'enabled')) {
return $this->content;
}
// Block needs a valid, non-guest user to be logged-in in order to display the user's learning plans.
if (isloggedin() && !isguestuser()) {
$summary = new \block_lp\output\summary();
if (!$summary->has_content()) {
return $this->content;
}
$renderer = $this->page->get_renderer('block_lp');
$this->content->text = $renderer->render($summary);
$this->content->footer = '';
}
return $this->content;
}
/**
* This block shouldn't be added to a page if the competencies advanced feature is disabled.
*
* @param moodle_page $page
* @return bool
*/
public function can_block_be_added(moodle_page $page): bool {
return get_config('core_competency', 'enabled');
}
}
@@ -0,0 +1,87 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Competencies to review renderable.
*
* @package block_lp
* @copyright 2016 Frédéric Massart - FMCorz.net
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace block_lp\output;
defined('MOODLE_INTERNAL') || die();
use renderable;
use templatable;
use renderer_base;
use stdClass;
use moodle_url;
use core_competency\api;
use core_competency\external\competency_exporter;
use core_competency\external\user_competency_exporter;
use core_user\external\user_summary_exporter;
/**
* Competencies to review renderable class.
*
* @package block_lp
* @copyright 2016 Frédéric Massart - FMCorz.net
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class competencies_to_review_page implements renderable, templatable {
/** @var array Competencies to review. */
protected $compstoreview;
/**
* Constructor.
*/
public function __construct() {
$this->compstoreview = api::list_user_competencies_to_review(0, 1000);
}
/**
* Export the data.
*
* @param renderer_base $output
* @return stdClass
*/
public function export_for_template(renderer_base $output) {
$data = new stdClass();
$compstoreview = array();
foreach ($this->compstoreview['competencies'] as $compdata) {
$ucexporter = new user_competency_exporter($compdata->usercompetency,
array('scale' => $compdata->competency->get_scale()));
$compexporter = new competency_exporter($compdata->competency,
array('context' => $compdata->competency->get_context()));
$userexporter = new user_summary_exporter($compdata->user);
$compstoreview[] = array(
'usercompetency' => $ucexporter->export($output),
'competency' => $compexporter->export($output),
'user' => $userexporter->export($output),
);
}
$data = array(
'competencies' => $compstoreview,
'pluginbaseurl' => (new moodle_url('/blocks/lp'))->out(false),
);
return $data;
}
}
@@ -0,0 +1,82 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Plans to review renderable.
*
* @package block_lp
* @copyright 2016 Frédéric Massart - FMCorz.net
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace block_lp\output;
defined('MOODLE_INTERNAL') || die();
use renderable;
use templatable;
use renderer_base;
use stdClass;
use moodle_url;
use core_competency\api;
use core_competency\external\plan_exporter;
use core_user\external\user_summary_exporter;
/**
* Plans to review renderable class.
*
* @package block_lp
* @copyright 2016 Frédéric Massart - FMCorz.net
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class plans_to_review_page implements renderable, templatable {
/** @var array Plans to review. */
protected $planstoreview;
/**
* Constructor.
*/
public function __construct() {
$this->planstoreview = api::list_plans_to_review(0, 1000);
}
/**
* Export the data.
*
* @param renderer_base $output
* @return stdClass
*/
public function export_for_template(renderer_base $output) {
$data = new stdClass();
$planstoreview = array();
foreach ($this->planstoreview['plans'] as $plandata) {
$planexporter = new plan_exporter($plandata->plan, array('template' => $plandata->template));
$userexporter = new user_summary_exporter($plandata->owner);
$planstoreview[] = array(
'plan' => $planexporter->export($output),
'user' => $userexporter->export($output),
);
}
$data = array(
'plans' => $planstoreview,
'pluginbaseurl' => (new moodle_url('/blocks/lp'))->out(false),
);
return $data;
}
}
+70
View File
@@ -0,0 +1,70 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Block LP renderer.
*
* @package block_lp
* @copyright 2016 Frédéric Massart - FMCorz.net
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace block_lp\output;
defined('MOODLE_INTERNAL') || die();
use plugin_renderer_base;
use renderable;
/**
* Block LP renderer class.
*
* @package block_lp
* @copyright 2016 Frédéric Massart - FMCorz.net
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class renderer extends plugin_renderer_base {
/**
* Defer to template.
* @param renderable $page
* @return string
*/
public function render_competencies_to_review_page(renderable $page) {
$data = $page->export_for_template($this);
return parent::render_from_template('block_lp/competencies_to_review_page', $data);
}
/**
* Defer to template.
* @param renderable $page
* @return string
*/
public function render_plans_to_review_page(renderable $page) {
$data = $page->export_for_template($this);
return parent::render_from_template('block_lp/plans_to_review_page', $data);
}
/**
* Defer to template.
* @param renderable $summary
* @return string
*/
public function render_summary(renderable $summary) {
$data = $summary->export_for_template($this);
return parent::render_from_template('block_lp/summary', $data);
}
}
+156
View File
@@ -0,0 +1,156 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Summary renderable.
*
* @package block_lp
* @copyright 2016 Frédéric Massart - FMCorz.net
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace block_lp\output;
defined('MOODLE_INTERNAL') || die();
use core_competency\api;
use core_competency\external\competency_exporter;
use core_competency\external\plan_exporter;
use core_competency\external\user_competency_exporter;
use core_user\external\user_summary_exporter;
use core_competency\plan;
use core_competency\url;
use renderable;
use renderer_base;
use templatable;
use required_capability_exception;
/**
* Summary renderable class.
*
* @package block_lp
* @copyright 2016 Frédéric Massart - FMCorz.net
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class summary implements renderable, templatable {
/** @var array Active plans. */
protected $activeplans = array();
/** @var array Competencies to review. */
protected $compstoreview = array();
/** @var array Plans to review. */
protected $planstoreview = array();
/** @var array Plans. */
protected $plans = array();
/** @var stdClass The user. */
protected $user;
/**
* Constructor.
* @param stdClass $user The user.
*/
public function __construct($user = null) {
global $USER;
if (!$user) {
$user = $USER;
}
$this->user = $user;
// Get the plans.
try {
$this->plans = api::list_user_plans($this->user->id);
} catch (required_capability_exception $e) {
$this->plans = [];
}
// Get the competencies to review.
$this->compstoreview = api::list_user_competencies_to_review(0, 3);
// Get the plans to review.
$this->planstoreview = api::list_plans_to_review(0, 3);
}
public function export_for_template(renderer_base $output) {
$plans = array();
foreach ($this->plans as $plan) {
if (count($plans) >= 3) {
break;
}
if ($plan->get('status') == plan::STATUS_ACTIVE) {
$plans[] = $plan;
}
}
$activeplans = array();
foreach ($plans as $plan) {
$planexporter = new plan_exporter($plan, array('template' => $plan->get_template()));
$activeplans[] = $planexporter->export($output);
}
$compstoreview = array();
foreach ($this->compstoreview['competencies'] as $compdata) {
$ucexporter = new user_competency_exporter($compdata->usercompetency,
array('scale' => $compdata->competency->get_scale()));
$compexporter = new competency_exporter($compdata->competency,
array('context' => $compdata->competency->get_context()));
$userexporter = new user_summary_exporter($compdata->user);
$compstoreview[] = array(
'usercompetency' => $ucexporter->export($output),
'competency' => $compexporter->export($output),
'user' => $userexporter->export($output),
);
}
$planstoreview = array();
foreach ($this->planstoreview['plans'] as $plandata) {
$planexporter = new plan_exporter($plandata->plan, array('template' => $plandata->template));
$userexporter = new user_summary_exporter($plandata->owner);
$planstoreview[] = array(
'plan' => $planexporter->export($output),
'user' => $userexporter->export($output),
);
}
$data = array(
'hasplans' => !empty($this->plans),
'hasactiveplans' => !empty($activeplans),
'hasmoreplans' => count($this->plans) > count($activeplans),
'activeplans' => $activeplans,
'compstoreview' => $compstoreview,
'hascompstoreview' => $this->compstoreview['count'] > 0,
'hasmorecompstoreview' => $this->compstoreview['count'] > 3,
'planstoreview' => $planstoreview,
'hasplanstoreview' => $this->planstoreview['count'] > 0,
'hasmoreplanstoreview' => $this->planstoreview['count'] > 3,
'plansurl' => url::plans($this->user->id)->out(false),
'pluginbaseurl' => (new \moodle_url('/blocks/lp'))->out(false),
'userid' => $this->user->id,
);
return $data;
}
/**
* Returns whether there is content in the summary.
*
* @return boolean
*/
public function has_content() {
return !empty($this->plans) || $this->planstoreview['count'] > 0 || $this->compstoreview['count'] > 0;
}
}
+46
View File
@@ -0,0 +1,46 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Privacy Subsystem implementation for block_lp.
*
* @package block_lp
* @copyright 2018 Zig Tan <zig@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace block_lp\privacy;
defined('MOODLE_INTERNAL') || die();
/**
* Privacy Subsystem for block_lp implementing null_provider.
*
* @copyright 2018 Zig Tan <zig@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class provider implements \core_privacy\local\metadata\null_provider {
/**
* Get the language string identifier with the component's language
* file to explain why this plugin stores no data.
*
* @return string
*/
public static function get_reason(): string {
return 'privacy:metadata';
}
}
+48
View File
@@ -0,0 +1,48 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Competencies to review page.
*
* @package block_lp
* @copyright 2016 Frédéric Massart - FMCorz.net
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require_once(__DIR__ . '/../../config.php');
require_login(null, false);
if (isguestuser()) {
throw new require_login_exception('Guests are not allowed here.');
}
$toreviewstr = get_string('competenciestoreview', 'block_lp');
$url = new moodle_url('/blocks/lp/competencies_to_review.php');
$PAGE->set_context(context_user::instance($USER->id));
$PAGE->set_url($url);
$PAGE->set_title($toreviewstr);
$PAGE->set_pagelayout('standard');
$PAGE->navbar->add($toreviewstr, $url);
$output = $PAGE->get_renderer('block_lp');
echo $output->header();
echo $output->heading($toreviewstr);
$page = new \block_lp\output\competencies_to_review_page();
echo $output->render($page);
echo $output->footer();
+47
View File
@@ -0,0 +1,47 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Block LP capabilities.
*
* @package block_lp
* @copyright 2016 Frédéric Massart - FMCorz.net
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
$capabilities = array(
// Whether or not the user can add the block.
'block/lp:addinstance' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_SYSTEM,
'archetypes' => array(
'manager' => CAP_ALLOW
),
'clonepermissionsfrom' => 'moodle/site:manageblocks'
),
// Whether or not the user can add the block on their dashboard.
'block/lp:myaddinstance' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_SYSTEM,
'archetypes' => array(
'user' => CAP_ALLOW
)
),
);
+36
View File
@@ -0,0 +1,36 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Block LP language strings.
*
* @package block_lp
* @copyright 2016 Frédéric Massart - FMCorz.net
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
$string['competenciestoreview'] = 'Competencies to review';
$string['lp:addinstance'] = 'Add a new learning plans block';
$string['lp:myaddinstance'] = 'Add a new learning plans block to Dashboard';
$string['myplans'] = 'My plans';
$string['noactiveplans'] = 'No active plans at the moment.';
$string['planstoreview'] = 'Plans to review';
$string['pluginname'] = 'Learning plans';
$string['viewmore'] = 'View more...';
$string['viewotherplans'] = 'View other plans...';
$string['privacy:metadata'] = 'The Learning plans block only shows data stored in other locations.';
+48
View File
@@ -0,0 +1,48 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Competencies to review page.
*
* @package block_lp
* @copyright 2016 Frédéric Massart - FMCorz.net
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require_once(__DIR__ . '/../../config.php');
require_login(null, false);
if (isguestuser()) {
throw new require_login_exception('Guests are not allowed here.');
}
$toreviewstr = get_string('planstoreview', 'block_lp');
$url = new moodle_url('/blocks/lp/plans_to_review.php');
$PAGE->set_context(context_user::instance($USER->id));
$PAGE->set_url($url);
$PAGE->set_title($toreviewstr);
$PAGE->set_pagelayout('standard');
$PAGE->navbar->add($toreviewstr, $url);
$output = $PAGE->get_renderer('block_lp');
echo $output->header();
echo $output->heading($toreviewstr);
$page = new \block_lp\output\plans_to_review_page();
echo $output->render($page);
echo $output->footer();
+17
View File
@@ -0,0 +1,17 @@
.block_lp.block .content h3 {
padding: 0;
text-transform: none;
}
.block_lp .sub-content {
padding: 0 15px;
}
.block_lp ul {
list-style: none;
margin: 0;
}
.block_lp ul .more {
padding-top: 10px;
}
@@ -0,0 +1,49 @@
{{!
This file is part of Moodle - http://moodle.org/
Moodle is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Moodle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
Competencies to review.
Classes required for JS:
* -
Data attributes required for JS:
* -
Context variables required for this template:
* competencies
}}
<div data-region="competencies-to-review">
<table class="generaltable fullwidth">
<thead>
<tr>
<th scope="col">{{#str}}shortname, tool_lp{{/str}}</th>
<th scope="col">{{#str}}user{{/str}}</th>
<th scope="col">{{#str}}reviewstatus, tool_lp{{/str}}</th>
</tr>
</thead>
<tbody>
{{#competencies}}
<tr>
<td><a href="{{usercompetency.url}}">{{{competency.shortname}}}</a></td>
<td>{{user.fullname}}</td>
<td>{{usercompetency.statusname}}</td>
</tr>
{{/competencies}}
</tbody>
</table>
</div>
@@ -0,0 +1,49 @@
{{!
This file is part of Moodle - http://moodle.org/
Moodle is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Moodle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
Plans to review.
Classes required for JS:
* -
Data attributes required for JS:
* -
Context variables required for this template:
* plans
}}
<div data-region="plans-to-review">
<table class="generaltable fullwidth">
<thead>
<tr>
<th scope="col">{{#str}}planname, tool_lp{{/str}}</th>
<th scope="col">{{#str}}user{{/str}}</th>
<th scope="col">{{#str}}reviewstatus, tool_lp{{/str}}</th>
</tr>
</thead>
<tbody>
{{#plans}}
<tr>
<td><a href="{{plan.url}}">{{{plan.name}}}</a></td>
<td>{{user.fullname}}</td>
<td>{{plan.statusname}}</td>
</tr>
{{/plans}}
</tbody>
</table>
</div>
+87
View File
@@ -0,0 +1,87 @@
{{!
This file is part of Moodle - http://moodle.org/
Moodle is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Moodle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
Summary.
Classes required for JS:
* None
Data attibutes required for JS:
* None
Context variables required for this template:
* hasplans
* hasactiveplans
* activeplans
* hasmoreplans
* hascompstoreview
* compstoreview
* hasmorecompstoreview
* hasplanstoreview
* planstoreview
* hasmoreplanstoreview
}}
<div>
{{#hasplans}}
<h3>{{#str}}myplans, block_lp{{/str}}</h3>
<div class="sub-content">
{{#hasactiveplans}}
<ul>
{{#activeplans}}
<li><a href="{{url}}">{{{name}}}</a></li>
{{/activeplans}}
{{#hasmoreplans}}
<li class="more"><a href="{{plansurl}}">{{#str}}viewmore, block_lp{{/str}}</a></li>
{{/hasmoreplans}}
</ul>
{{/hasactiveplans}}
{{^hasactiveplans}}
<p>{{#str}}noactiveplans, block_lp{{/str}} <a href="{{plansurl}}">{{#str}}viewotherplans, block_lp{{/str}}</a></p>
{{/hasactiveplans}}
</div>
{{/hasplans}}
{{#hascompstoreview}}
<h3>{{#str}}competenciestoreview, block_lp{{/str}}</h3>
<div class="sub-content">
<ul>
{{#compstoreview}}
<li>
<a href="{{usercompetency.url}}">{{{competency.shortname}}}</a> ({{user.fullname}}) - {{usercompetency.statusname}}
</li>
{{/compstoreview}}
{{#hasmorecompstoreview}}
<li class="more"><a href="{{pluginbaseurl}}/competencies_to_review.php">{{#str}}viewmore, block_lp{{/str}}</a></li>
{{/hasmorecompstoreview}}
</ul>
</div>
{{/hascompstoreview}}
{{#hasplanstoreview}}
<h3>{{#str}}planstoreview, block_lp{{/str}}</h3>
<div class="sub-content">
<ul>
{{#planstoreview}}
<li>
<a href="{{plan.url}}">{{{plan.name}}}</a> ({{user.fullname}}) - {{plan.statusname}}
</li>
{{/planstoreview}}
{{#hasmoreplanstoreview}}
<li class="more"><a href="{{pluginbaseurl}}/plans_to_review.php">{{#str}}viewmore, block_lp{{/str}}</a></li>
{{/hasmoreplanstoreview}}
</ul>
</div>
{{/hasplanstoreview}}
</div>
+26
View File
@@ -0,0 +1,26 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Learning plans block data generator class.
*
* @package block_lp
* @category test
* @copyright 2021 Sara Arjona <sara@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class block_lp_generator extends testing_block_generator {
}
+63
View File
@@ -0,0 +1,63 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
namespace block_lp;
use advanced_testcase;
use block_lp;
use context_course;
/**
* PHPUnit block_lp tests
*
* @package block_lp
* @category test
* @copyright 2021 Sara Arjona (sara@moodle.com)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @coversDefaultClass \block_lp
*/
class lp_test extends advanced_testcase {
public static function setUpBeforeClass(): void {
require_once(__DIR__ . '/../../moodleblock.class.php');
require_once(__DIR__ . '/../block_lp.php');
}
/**
* Test the behaviour of can_block_be_added() method.
*
* @covers ::can_block_be_added
*/
public function test_can_block_be_added(): void {
$this->resetAfterTest();
$this->setAdminUser();
// Create a course and prepare the page where the block will be added.
$course = $this->getDataGenerator()->create_course();
$page = new \moodle_page();
$page->set_context(context_course::instance($course->id));
$page->set_pagelayout('course');
$block = new block_lp();
// If blogs advanced feature is enabled, the method should return true.
set_config('enabled', true, 'core_competency');
$this->assertTrue($block->can_block_be_added($page));
// However, if the blogs advanced feature is disabled, the method should return false.
set_config('enabled', false, 'core_competency');
$this->assertFalse($block->can_block_be_added($page));
}
}
+5
View File
@@ -0,0 +1,5 @@
This file describes API changes in the lp block code.
=== 3.7 ===
* The 'block/lp:view' capability has been removed. It has never been used in code.
+32
View File
@@ -0,0 +1,32 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Block LP version file.
*
* @package block_lp
* @copyright 2016 Frédéric Massart - FMCorz.net
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2024042200;
$plugin->requires = 2024041600;
$plugin->component = 'block_lp';
$plugin->dependencies = [
'tool_lp' => ANY_VERSION,
];