|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00003 // // 00004 // This file is part of Moodle - http://moodle.org/ // 00005 // Moodle - Modular Object-Oriented Dynamic Learning Environment // 00006 // // 00007 // Moodle is free software: you can redistribute it and/or modify // 00008 // it under the terms of the GNU General Public License as published by // 00009 // the Free Software Foundation, either version 3 of the License, or // 00010 // (at your option) any later version. // 00011 // // 00012 // Moodle is distributed in the hope that it will be useful, // 00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of // 00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // 00015 // GNU General Public License for more details. // 00016 // // 00017 // You should have received a copy of the GNU General Public License // 00018 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. // 00019 // // 00021 00030 class core_rss_renderer extends plugin_renderer_base { 00036 public function user_reset_rss_token_confirmation() { 00037 global $OUTPUT, $CFG; 00038 $managetokenurl = $CFG->wwwroot."/user/managetoken.php?sesskey=" . sesskey(); 00039 $optionsyes = array('action'=>'resetrsstoken', 'confirm'=>1, 'sesskey'=>sesskey()); 00040 $optionsno = array('section'=>'webservicetokens', 'sesskey'=>sesskey()); 00041 $formcontinue = new single_button(new moodle_url($managetokenurl, $optionsyes), get_string('reset')); 00042 $formcancel = new single_button(new moodle_url($managetokenurl, $optionsno), get_string('cancel'), 'get'); 00043 $html = $OUTPUT->confirm(get_string('resettokenconfirmsimple', 'webservice'), $formcontinue, $formcancel); 00044 return $html; 00045 } 00046 00053 public function user_rss_token_box($token) { 00054 global $OUTPUT, $CFG; 00055 00056 // display strings 00057 $stroperation = get_string('operation', 'webservice'); 00058 $strtoken = get_string('key', 'webservice'); 00059 00060 $return = $OUTPUT->heading(get_string('rss'), 3, 'main', true); 00061 $return .= $OUTPUT->box_start('generalbox webservicestokenui'); 00062 00063 $return .= get_string('rsskeyshelp'); 00064 00065 $table = new html_table(); 00066 $table->head = array($strtoken, $stroperation); 00067 $table->align = array('left', 'center'); 00068 $table->width = '100%'; 00069 $table->data = array(); 00070 00071 if (!empty($token)) { 00072 $reset = "<a href=\"".$CFG->wwwroot."/user/managetoken.php?sesskey=".sesskey(). 00073 "&action=resetrsstoken\">".get_string('reset')."</a>"; 00074 00075 $table->data[] = array($token, $reset); 00076 00077 $return .= html_writer::table($table); 00078 } else { 00079 $return .= get_string('notoken', 'webservice'); 00080 } 00081 00082 $return .= $OUTPUT->box_end(); 00083 return $return; 00084 } 00085 }