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 |
* Class containing data for the Recently accessed courses block.
|
|
|
19 |
*
|
|
|
20 |
* @package block_recentlyaccessedcourses
|
|
|
21 |
* @copyright 2018 Victor Deniz <victor@moodle.com>
|
|
|
22 |
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
|
|
23 |
*/
|
817 |
ariadna |
24 |
|
1 |
efrain |
25 |
namespace block_recentlyaccessedcourses\output;
|
817 |
ariadna |
26 |
|
1 |
efrain |
27 |
defined('MOODLE_INTERNAL') || die();
|
|
|
28 |
|
|
|
29 |
use renderable;
|
|
|
30 |
use renderer_base;
|
|
|
31 |
use templatable;
|
|
|
32 |
|
|
|
33 |
/**
|
|
|
34 |
* Class containing data for Recently accessed courses block.
|
|
|
35 |
*
|
|
|
36 |
* @package block_recentlyaccessedcourses
|
|
|
37 |
* @copyright 2018 Victor Deniz <victor@moodle.com>
|
|
|
38 |
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
|
|
39 |
*/
|
817 |
ariadna |
40 |
class main implements renderable, templatable
|
|
|
41 |
{
|
1 |
efrain |
42 |
/**
|
|
|
43 |
* Export this data so it can be used as the context for a mustache template.
|
|
|
44 |
*
|
|
|
45 |
* @param renderer_base $output
|
|
|
46 |
* @return \stdClass|array
|
|
|
47 |
*/
|
817 |
ariadna |
48 |
public function export_for_template(renderer_base $output)
|
|
|
49 |
{
|
1 |
efrain |
50 |
global $USER;
|
|
|
51 |
|
|
|
52 |
$nocoursesurl = $output->image_url('courses', 'block_recentlyaccessedcourses')->out(false);
|
|
|
53 |
$config = get_config('block_recentlyaccessedcourses');
|
|
|
54 |
|
|
|
55 |
return [
|
|
|
56 |
'userid' => $USER->id,
|
|
|
57 |
'nocoursesimgurl' => $nocoursesurl,
|
|
|
58 |
'pagingbar' => [
|
|
|
59 |
'next' => true,
|
|
|
60 |
'previous' => true
|
|
|
61 |
],
|
817 |
ariadna |
62 |
'hasprogress' => true,
|
1 |
efrain |
63 |
'displaycategories' => !empty($config->displaycategories)
|
|
|
64 |
];
|
|
|
65 |
}
|
|
|
66 |
}
|