|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00002 00003 // This file is part of Moodle - http://moodle.org/ 00004 // 00005 // Moodle is free software: you can redistribute it and/or modify 00006 // it under the terms of the GNU General Public License as published by 00007 // the Free Software Foundation, either version 3 of the License, or 00008 // (at your option) any later version. 00009 // 00010 // Moodle is distributed in the hope that it will be useful, 00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 // GNU General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU General Public License 00016 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 00017 00034 class mod_forum_renderer extends plugin_renderer_base { 00043 public function subscriber_selection_form(user_selector_base $existinguc, user_selector_base $potentialuc) { 00044 $output = ''; 00045 $formattributes = array(); 00046 $formattributes['id'] = 'subscriberform'; 00047 $formattributes['action'] = ''; 00048 $formattributes['method'] = 'post'; 00049 $output .= html_writer::start_tag('form', $formattributes); 00050 $output .= html_writer::empty_tag('input', array('type'=>'hidden', 'name'=>'sesskey', 'value'=>sesskey())); 00051 00052 $existingcell = new html_table_cell(); 00053 $existingcell->text = $existinguc->display(true); 00054 $existingcell->attributes['class'] = 'existing'; 00055 $actioncell = new html_table_cell(); 00056 $actioncell->text = html_writer::start_tag('div', array()); 00057 $actioncell->text .= html_writer::empty_tag('input', array('type'=>'submit', 'name'=>'subscribe', 'value'=>$this->page->theme->larrow.' '.get_string('add'), 'class'=>'actionbutton')); 00058 $actioncell->text .= html_writer::empty_tag('br', array()); 00059 $actioncell->text .= html_writer::empty_tag('input', array('type'=>'submit', 'name'=>'unsubscribe', 'value'=>$this->page->theme->rarrow.' '.get_string('remove'), 'class'=>'actionbutton')); 00060 $actioncell->text .= html_writer::end_tag('div', array()); 00061 $actioncell->attributes['class'] = 'actions'; 00062 $potentialcell = new html_table_cell(); 00063 $potentialcell->text = $potentialuc->display(true); 00064 $potentialcell->attributes['class'] = 'potential'; 00065 00066 $table = new html_table(); 00067 $table->attributes['class'] = 'subscribertable boxaligncenter'; 00068 $table->data = array(new html_table_row(array($existingcell, $actioncell, $potentialcell))); 00069 $output .= html_writer::table($table); 00070 00071 $output .= html_writer::end_tag('form'); 00072 return $output; 00073 } 00074 00084 public function subscriber_overview($users, $forum , $course) { 00085 $output = ''; 00086 if (!$users || !is_array($users) || count($users)===0) { 00087 $output .= $this->output->heading(get_string("nosubscribers", "forum")); 00088 } else { 00089 $output .= $this->output->heading(get_string("subscribersto","forum", "'".format_string($forum->name)."'")); 00090 $table = new html_table(); 00091 $table->cellpadding = 5; 00092 $table->cellspacing = 5; 00093 $table->tablealign = 'center'; 00094 $table->data = array(); 00095 foreach ($users as $user) { 00096 $table->data[] = array($this->output->user_picture($user, array('courseid'=>$course->id)), fullname($user), $user->email); 00097 } 00098 $output .= html_writer::table($table); 00099 } 00100 return $output; 00101 } 00102 00110 public function subscribed_users(user_selector_base $existingusers) { 00111 $output = $this->output->box_start('subscriberdiv boxaligncenter'); 00112 $output .= html_writer::tag('p', get_string('forcessubscribe', 'forum')); 00113 $output .= $existingusers->display(true); 00114 $output .= $this->output->box_end(); 00115 return $output; 00116 } 00117 00118 00119 }