2 // This file is part of Moodle - http://moodle.org/
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.
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.
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/>.
18 * Block displaying information about current logged-in user.
20 * This block can be used as anti cheating measure, you
21 * can easily check the logged-in user matches the person
22 * operating the computer.
24 * @package block_myprofile
25 * @copyright 2010 Remote-Learner.net
26 * @author Olav Jordan <olav.jordan@remote-learner.ca>
27 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
30 defined('MOODLE_INTERNAL') ||
die();
33 * Displays the current user's profile information.
35 * @copyright 2010 Remote-Learner.net
36 * @author Olav Jordan <olav.jordan@remote-learner.ca>
37 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
39 class block_myprofile
extends block_base
{
41 * block initializations
43 public function init() {
44 $this->title
= get_string('pluginname', 'block_myprofile');
52 public function get_content() {
54 if ($this->content
!== NULL) {
55 return $this->content
;
58 if (!isloggedin() or isguestuser()) {
59 // Only real users can access myprofile block.
63 $renderable = new \block_myprofile\output\
myprofile($this->config
);
64 $renderer = $this->page
->get_renderer('block_myprofile');
66 $this->content
= new stdClass();
67 $this->content
->text
= $renderer->render($renderable);
68 $this->content
->footer
= '';
70 return $this->content
;
74 * allow the block to have a configuration page
78 public function has_config() {
83 * allow more than one instance of the block on a page
87 public function instance_allow_multiple() {
88 //allow more than one instance on a page
93 * allow instances to have their own configuration
97 function instance_allow_config() {
98 //allow instances to have their own configuration
103 * instance specialisations (must have instance allow config true)
106 public function specialization() {
110 * locations where block can be displayed
114 public function applicable_formats() {
115 return array('all'=>true);
119 * post install configurations
122 public function after_install() {
126 * post delete configurations
129 public function before_delete() {