hub MDL-19309 new site registration form + course publication + community block
[moodle.git] / blocks / community / block_community.php
CommitLineData
07ab0c80 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 * @package blocks
19 * @subpackage community
20 * @author Jerome Mouneyrac <jerome@mouneyrac.com>
21 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL
22 * @copyright (C) 1999 onwards Martin Dougiamas http://dougiamas.com
23 *
24 * The community block
25*/
26
27require_once('locallib.php');
28
29class block_community extends block_list {
30 function init() {
31 $this->title = get_string('pluginname', 'block_community');
32 $this->version = 2010042701;
33 }
34
35 function get_content() {
36
37 global $CFG, $OUTPUT, $USER;
38
39 $this->content = new stdClass();
40 $this->content->items = array();
41 $this->content->icons = array();
42 $this->content->footer = '';
43
44 $this->content->items[] = '<a href='.$CFG->wwwroot.'/blocks/community/communitycourse.php?add=true>'.get_string('addcourse', 'block_community').'</a>';
45 $this->content->icons[] = '<img src="'.$OUTPUT->pix_url('i/group') . '" class="icon" alt="" />';
46
47 $community = new community();
48 $courses = $community->get_community_courses($USER->id);
49 $this->content->items[] = '';
50 $this->content->icons[] = '';
51 $this->content->items[] = get_string('mycommunities', 'block_community');
52 $this->content->icons[] = '';
53 foreach ($courses as $course) {
54 $this->content->items[] = '<a href='.$course->courseurl.'>'.$course->coursename.'</a>';
55 $this->content->icons[] = '';
56 }
57
58 return $this->content;
59 }
60
61 function applicable_formats() {
62 return array('all' => true);
63 }
64
65}
66