|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00002 00004 // // 00005 // This file is part of Moodle - http://moodle.org/ // 00006 // Moodle - Modular Object-Oriented Dynamic Learning Environment // 00007 // // 00008 // Moodle is free software: you can redistribute it and/or modify // 00009 // it under the terms of the GNU General Public License as published by // 00010 // the Free Software Foundation, either version 3 of the License, or // 00011 // (at your option) any later version. // 00012 // // 00013 // Moodle is distributed in the hope that it will be useful, // 00014 // but WITHOUT ANY WARRANTY; without even the implied warranty of // 00015 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // 00016 // GNU General Public License for more details. // 00017 // // 00018 // You should have received a copy of the GNU General Public License // 00019 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. // 00020 // // 00022 00031 class core_register_renderer extends plugin_renderer_base { 00032 00038 public function registration_confirmation($confirmationmessage) { 00039 $linktositelist = html_writer::tag('a', get_string('sitelist', 'hub'), 00040 array('href' => new moodle_url('/local/hub/index.php'))); 00041 $message = $confirmationmessage . html_writer::empty_tag('br') . $linktositelist; 00042 return $this->output->box($message); 00043 } 00044 00048 public function registrationselector($updatemoodleorg = false) { 00049 global $CFG; 00050 $table = new html_table(); 00051 $table->head = array(get_string('moodleorg', 'hub'), get_string('specifichub', 'hub')); 00052 $table->size = array('50%', '50%'); 00053 //$table->attributes['class'] = 'registerindextable'; 00054 //Moodle.org information cell 00055 $moodleorgcell = get_string('moodleorgregistrationdetail', 'hub'); 00056 $moodleorgcell .= html_writer::empty_tag('br') . html_writer::empty_tag('br'); 00057 $moodleorgcell = html_writer::tag('div', $moodleorgcell, array('class' => 'justifytext')); 00058 00059 //Specific hub information cell 00060 $specifichubcell = get_string('specifichubregistrationdetail', 'hub'); 00061 $specifichubcell .= html_writer::empty_tag('br') . html_writer::empty_tag('br'); 00062 $specifichubcell = html_writer::tag('div', $specifichubcell, array('class' => 'justifytext')); 00063 00064 //add information cells 00065 $cells = array($moodleorgcell, $specifichubcell); 00066 $row = new html_table_row($cells); 00067 $table->data[] = $row; 00068 00069 //Moodle.org button cell 00070 $registeronmoodleorgurl = new moodle_url("/" . $CFG->admin . "/registration/register.php", 00071 array('sesskey' => sesskey(), 'huburl' => HUB_MOODLEORGHUBURL 00072 , 'hubname' => 'Moodle.org')); 00073 $registeronmoodleorgbutton = new single_button($registeronmoodleorgurl, 00074 $updatemoodleorg ? get_string('updatesite', 'hub', 'Moodle.org') : get_string('registeronmoodleorg', 'hub')); 00075 $registeronmoodleorgbutton->class = 'centeredbutton'; 00076 $registeronmoodleorgbuttonhtml = $this->output->render($registeronmoodleorgbutton); 00077 $moodleorgcell = $registeronmoodleorgbuttonhtml; 00078 00079 //Specific hub button cell 00080 $registeronspecifichuburl = new moodle_url("/" . $CFG->admin . "/registration/hubselector.php", 00081 array('sesskey' => sesskey())); 00082 $registeronspecifichubbutton = new single_button($registeronspecifichuburl, 00083 get_string('registeronspecifichub', 'hub')); 00084 $registeronspecifichubbutton->class = 'centeredbutton'; 00085 $registeronspecifichubbuttonhtml = $this->output->render($registeronspecifichubbutton); 00086 $specifichubcell = $registeronspecifichubbuttonhtml; 00087 00088 //add button cells 00089 $cells = array($moodleorgcell, $specifichubcell); 00090 $row = new html_table_row($cells); 00091 $table->data[] = $row; 00092 00093 return html_writer::table($table); 00094 } 00095 00099 public function registeredonhublisting($hubs) { 00100 global $CFG; 00101 $table = new html_table(); 00102 $table->head = array(get_string('hub', 'hub'), get_string('operation', 'hub')); 00103 $table->size = array('80%', '20%'); 00104 00105 foreach ($hubs as $hub) { 00106 if ($hub->huburl == HUB_MOODLEORGHUBURL) { 00107 $hub->hubname = get_string('registeredmoodleorg', 'hub', $hub->hubname); 00108 } 00109 $hublink = html_writer::tag('a', $hub->hubname, array('href' => $hub->huburl)); 00110 $hublinkcell = html_writer::tag('div', $hublink, array('class' => 'registeredhubrow')); 00111 00112 $unregisterhuburl = new moodle_url("/" . $CFG->admin . "/registration/index.php", 00113 array('sesskey' => sesskey(), 'huburl' => $hub->huburl, 00114 'unregistration' => 1)); 00115 $unregisterbutton = new single_button($unregisterhuburl, 00116 get_string('unregister', 'hub')); 00117 $unregisterbutton->class = 'centeredbutton'; 00118 $unregisterbuttonhtml = $this->output->render($unregisterbutton); 00119 00120 //add button cells 00121 $cells = array($hublinkcell, $unregisterbuttonhtml); 00122 $row = new html_table_row($cells); 00123 $table->data[] = $row; 00124 } 00125 00126 return html_writer::table($table); 00127 } 00128 00129 }