MDL-50439 block_lp: Block to summarise important learning plans objects
This commit is contained in:
@@ -1035,7 +1035,11 @@ class api {
|
||||
$ucfields = user_competency::get_sql_fields('uc');
|
||||
$compfields = competency::get_sql_fields('c');
|
||||
$usercols = array('id') + get_user_fieldnames();
|
||||
$userfields = implode(',', array_map(create_function('$a', 'return "u.".$a." AS usr_".$a;'), $usercols));
|
||||
$userfields = array();
|
||||
foreach ($usercols as $field) {
|
||||
$userfields[] = "u." . $field . " AS usr_" . $field;
|
||||
}
|
||||
$userfields = implode(',', $userfields);
|
||||
|
||||
$select = "SELECT $ucfields, $compfields, $userfields";
|
||||
$countselect = "SELECT COUNT('x')";
|
||||
@@ -1848,7 +1852,11 @@ class api {
|
||||
$planfields = plan::get_sql_fields('p');
|
||||
$tplfields = template::get_sql_fields('t');
|
||||
$usercols = array('id') + get_user_fieldnames();
|
||||
$userfields = implode(',', array_map(create_function('$a', 'return "u.".$a." AS usr_".$a;'), $usercols));
|
||||
$userfields = array();
|
||||
foreach ($usercols as $field) {
|
||||
$userfields[] = "u." . $field . " AS usr_" . $field;
|
||||
}
|
||||
$userfields = implode(',', $userfields);
|
||||
|
||||
$select = "SELECT $planfields, $tplfields, $userfields";
|
||||
$countselect = "SELECT COUNT('x')";
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
<?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;
|
||||
}
|
||||
|
||||
$summary = new \block_lp\output\summary();
|
||||
if (!$summary->has_content()) {
|
||||
return $this->content;
|
||||
}
|
||||
|
||||
$renderer = $this->page->get_renderer('block_lp');
|
||||
$this->content = new stdClass();
|
||||
$this->content->text = $renderer->render($summary);
|
||||
$this->content->footer = '';
|
||||
|
||||
return $this->content;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
<?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 tool_lp\api;
|
||||
use tool_lp\external\competency_exporter;
|
||||
use tool_lp\external\user_competency_exporter;
|
||||
use tool_lp\external\user_summary_exporter;
|
||||
use moodle_url;
|
||||
|
||||
/**
|
||||
* 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,
|
||||
'cbebaseurl' => (new moodle_url('/admin/tool/lp'))->out(false),
|
||||
'pluginbaseurl' => (new moodle_url('/blocks/lp'))->out(false),
|
||||
);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
<?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 tool_lp\api;
|
||||
use tool_lp\external\plan_exporter;
|
||||
use tool_lp\external\user_summary_exporter;
|
||||
use moodle_url;
|
||||
|
||||
/**
|
||||
* 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,
|
||||
'cbebaseurl' => (new moodle_url('/admin/tool/lp'))->out(false),
|
||||
'pluginbaseurl' => (new moodle_url('/blocks/lp'))->out(false),
|
||||
);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
<?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 {
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
public function render_summary(renderable $summary) {
|
||||
$data = $summary->export_for_template($this);
|
||||
return parent::render_from_template('block_lp/summary', $data);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,140 @@
|
||||
<?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 tool_lp\api;
|
||||
use tool_lp\external\competency_exporter;
|
||||
use tool_lp\external\plan_exporter;
|
||||
use tool_lp\external\user_competency_exporter;
|
||||
use tool_lp\external\user_summary_exporter;
|
||||
use renderable;
|
||||
use renderer_base;
|
||||
use templatable;
|
||||
|
||||
/**
|
||||
* 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 {
|
||||
|
||||
protected $activeplans = array();
|
||||
protected $compstoreview = array();
|
||||
protected $planstoreview = array();
|
||||
protected $plans = array();
|
||||
protected $user;
|
||||
|
||||
public function __construct($user = null) {
|
||||
global $USER;
|
||||
if (!$user) {
|
||||
$user = $USER;
|
||||
}
|
||||
$this->user = $user;
|
||||
|
||||
// Get the plans.
|
||||
$this->plans = api::list_user_plans($this->user->id);
|
||||
|
||||
// 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() == \tool_lp\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($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,
|
||||
|
||||
'cbebaseurl' => (new \moodle_url('/admin/tool/lp'))->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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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/>.
|
||||
|
||||
/**
|
||||
* 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->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();
|
||||
@@ -0,0 +1,55 @@
|
||||
<?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()
|
||||
),
|
||||
|
||||
// Whether or not a user can see the block.
|
||||
'block/lp:view' => array(
|
||||
'captype' => 'read',
|
||||
'contextlevel' => CONTEXT_SYSTEM,
|
||||
'archetypes' => array(
|
||||
'user' => CAP_ALLOW
|
||||
),
|
||||
),
|
||||
|
||||
);
|
||||
@@ -0,0 +1,34 @@
|
||||
<?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'] = 'Adding a new block';
|
||||
$string['lp:myaddinstance'] = 'Adding the block on the dashboard';
|
||||
$string['lp:view'] = 'Viewing the block';
|
||||
$string['planstoreview'] = 'Plans to review';
|
||||
$string['pluginname'] = 'Learning plans';
|
||||
$string['viewmore'] = 'View more...';
|
||||
$string['viewotherplans'] = 'View other plans...';
|
||||
@@ -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/>.
|
||||
|
||||
/**
|
||||
* 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->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();
|
||||
@@ -0,0 +1,14 @@
|
||||
.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="{{cbebaseurl}}/user_competency.php?id={{usercompetency.id}}">{{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="{{cbebaseurl}}/plan.php?id={{plan.id}}">{{plan.name}}</a></td>
|
||||
<td>{{user.fullname}}</td>
|
||||
<td>{{plan.statusname}}</td>
|
||||
</tr>
|
||||
{{/plans}}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@@ -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>My plans</h3>
|
||||
<div class="sub-content">
|
||||
{{#hasactiveplans}}
|
||||
<ul>
|
||||
{{#activeplans}}
|
||||
<li><a href="{{cbebaseurl}}/plan.php?id={{id}}">{{name}}</a></li>
|
||||
{{/activeplans}}
|
||||
{{#hasmoreplans}}
|
||||
<li class="more"><a href="{{cbebaseurl}}/plans.php?userid={{userid}}">{{#str}}viewmore, block_lp{{/str}}</a></li>
|
||||
{{/hasmoreplans}}
|
||||
</ul>
|
||||
{{/hasactiveplans}}
|
||||
{{^hasactiveplans}}
|
||||
<p>No active plans at the moment. <a href="{{cbebaseurl}}/plans.php?userid={{userid}}">{{#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="{{cbebaseurl}}/user_competency.php?id={{usercompetency.id}}">{{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>Plans to review</h3>
|
||||
<div class="sub-content">
|
||||
<ul>
|
||||
{{#planstoreview}}
|
||||
<li>
|
||||
<a href="{{cbebaseurl}}/plan.php?id={{plan.id}}">{{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>
|
||||
@@ -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 = 2016011100;
|
||||
$plugin->requires = 2014110400;
|
||||
$plugin->component = 'block_lp';
|
||||
$plugin->dependencies = array(
|
||||
'tool_lp' => 2015111035
|
||||
);
|
||||
Reference in New Issue
Block a user