Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
<?php
2
// This file is part of Moodle - http://moodle.org/
3
//
4
// Moodle is free software: you can redistribute it and/or modify
5
// it under the terms of the GNU General Public License as published by
6
// the Free Software Foundation, either version 3 of the License, or
7
// (at your option) any later version.
8
//
9
// Moodle is distributed in the hope that it will be useful,
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
// GNU General Public License for more details.
13
//
14
// You should have received a copy of the GNU General Public License
15
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
16
 
17
/**
18
 * Plans to review renderable.
19
 *
20
 * @package    block_lp
21
 * @copyright  2016 Frédéric Massart - FMCorz.net
22
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
23
 */
24
namespace block_lp\output;
25
defined('MOODLE_INTERNAL') || die();
26
 
27
use renderable;
28
use templatable;
29
use renderer_base;
30
use stdClass;
31
use moodle_url;
32
use core_competency\api;
33
use core_competency\external\plan_exporter;
34
use core_user\external\user_summary_exporter;
35
 
36
/**
37
 * Plans to review renderable class.
38
 *
39
 * @package    block_lp
40
 * @copyright  2016 Frédéric Massart - FMCorz.net
41
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
42
 */
43
class plans_to_review_page implements renderable, templatable {
44
 
45
    /** @var array Plans to review. */
46
    protected $planstoreview;
47
 
48
    /**
49
     * Constructor.
50
     */
51
    public function __construct() {
52
        $this->planstoreview = api::list_plans_to_review(0, 1000);
53
    }
54
 
55
    /**
56
     * Export the data.
57
     *
58
     * @param renderer_base $output
59
     * @return stdClass
60
     */
61
    public function export_for_template(renderer_base $output) {
62
        $data = new stdClass();
63
 
64
        $planstoreview = array();
65
        foreach ($this->planstoreview['plans'] as $plandata) {
66
            $planexporter = new plan_exporter($plandata->plan, array('template' => $plandata->template));
67
            $userexporter = new user_summary_exporter($plandata->owner);
68
            $planstoreview[] = array(
69
                'plan' => $planexporter->export($output),
70
                'user' => $userexporter->export($output),
71
            );
72
        }
73
 
74
        $data = array(
75
            'plans' => $planstoreview,
76
            'pluginbaseurl' => (new moodle_url('/blocks/lp'))->out(false),
77
        );
78
 
79
        return $data;
80
    }
81
 
82
}