3 ///////////////////////////////////////////////////////////////////////////
5 // This file is part of Moodle - http://moodle.org/ //
6 // Moodle - Modular Object-Oriented Dynamic Learning Environment //
8 // Moodle is free software: you can redistribute it and/or modify //
9 // it under the terms of the GNU General Public License as published by //
10 // the Free Software Foundation, either version 3 of the License, or //
11 // (at your option) any later version. //
13 // Moodle is distributed in the hope that it will be useful, //
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of //
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
16 // GNU General Public License for more details. //
18 // You should have received a copy of the GNU General Public License //
19 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. //
21 ///////////////////////////////////////////////////////////////////////////
24 * Registration renderer.
26 * @subpackage registration
27 * @copyright 2010 Moodle Pty Ltd (http://moodle.com)
28 * @author Jerome Mouneyrac
29 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
31 class core_register_renderer
extends plugin_renderer_base
{
34 * Display a box message confirming a site registration (add or update)
35 * @param string $confirmationmessage
38 public function registration_confirmation($confirmationmessage) {
39 $linktositelist = html_writer
::tag('a', get_string('sitelist', 'hub'),
40 array('href' => new moodle_url('/local/hub/index.php')));
41 $message = $confirmationmessage . html_writer
::empty_tag('br') . $linktositelist;
42 return $this->output
->box($message);
46 * Display the page to register on Moodle.org or on a specific hub
48 public function registrationselector($updatemoodleorg = false) {
50 $table = new html_table();
51 $table->head
= array(get_string('moodleorg', 'hub'), get_string('specifichub', 'hub'));
52 $table->size
= array('50%', '50%');
53 //$table->attributes['class'] = 'registerindextable';
54 //Moodle.org information cell
55 $moodleorgcell = get_string('moodleorgregistrationdetail', 'hub');
56 $moodleorgcell .= html_writer
::empty_tag('br') . html_writer
::empty_tag('br');
57 $moodleorgcell = html_writer
::tag('div', $moodleorgcell, array('class' => 'justifytext'));
59 //Specific hub information cell
60 $specifichubcell = get_string('specifichubregistrationdetail', 'hub');
61 $specifichubcell .= html_writer
::empty_tag('br') . html_writer
::empty_tag('br');
62 $specifichubcell = html_writer
::tag('div', $specifichubcell, array('class' => 'justifytext'));
64 //add information cells
65 $cells = array($moodleorgcell, $specifichubcell);
66 $row = new html_table_row($cells);
67 $table->data
[] = $row;
69 //Moodle.org button cell
70 $registeronmoodleorgurl = new moodle_url("/" . $CFG->admin
. "/registration/register.php",
71 array('sesskey' => sesskey(), 'huburl' => HUB_MOODLEORGHUBURL
72 , 'hubname' => 'Moodle.org'));
73 $registeronmoodleorgbutton = new single_button($registeronmoodleorgurl,
74 $updatemoodleorg ?
get_string('updatesite', 'hub', 'Moodle.org') : get_string('registeronmoodleorg', 'hub'));
75 $registeronmoodleorgbutton->class = 'centeredbutton';
76 $registeronmoodleorgbuttonhtml = $this->output
->render($registeronmoodleorgbutton);
77 $moodleorgcell = $registeronmoodleorgbuttonhtml;
79 //Specific hub button cell
80 $registeronspecifichuburl = new moodle_url("/" . $CFG->admin
. "/registration/hubselector.php",
81 array('sesskey' => sesskey()));
82 $registeronspecifichubbutton = new single_button($registeronspecifichuburl,
83 get_string('registeronspecifichub', 'hub'));
84 $registeronspecifichubbutton->class = 'centeredbutton';
85 $registeronspecifichubbuttonhtml = $this->output
->render($registeronspecifichubbutton);
86 $specifichubcell = $registeronspecifichubbuttonhtml;
89 $cells = array($moodleorgcell, $specifichubcell);
90 $row = new html_table_row($cells);
91 $table->data
[] = $row;
93 return html_writer
::table($table);
97 * Display the listing of registered on hub
99 public function registeredonhublisting($hubs) {
101 $table = new html_table();
102 $table->head
= array(get_string('hub', 'hub'), get_string('operation', 'hub'));
103 $table->size
= array('80%', '20%');
105 foreach ($hubs as $hub) {
106 if ($hub->huburl
== HUB_MOODLEORGHUBURL
) {
107 $hub->hubname
= get_string('registeredmoodleorg', 'hub', $hub->hubname
);
109 $hublink = html_writer
::tag('a', $hub->hubname
, array('href' => $hub->huburl
));
110 $hublinkcell = html_writer
::tag('div', $hublink, array('class' => 'registeredhubrow'));
112 $unregisterhuburl = new moodle_url("/" . $CFG->admin
. "/registration/index.php",
113 array('sesskey' => sesskey(), 'huburl' => $hub->huburl
,
114 'unregistration' => 1));
115 $unregisterbutton = new single_button($unregisterhuburl,
116 get_string('unregister', 'hub'));
117 $unregisterbutton->class = 'centeredbutton';
118 $unregisterbuttonhtml = $this->output
->render($unregisterbutton);
121 $cells = array($hublinkcell, $unregisterbuttonhtml);
122 $row = new html_table_row($cells);
123 $table->data
[] = $row;
126 return html_writer
::table($table);