Differences Between: [Versions 310 and 311] [Versions 310 and 400] [Versions 310 and 401] [Versions 310 and 402] [Versions 310 and 403]
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 * Web service documentation renderer. 19 * @package core_rss 20 * @category rss 21 * @copyright 2010 Andrew Davis 22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 23 */ 24 25 /** 26 * Web service documentation renderer extending the plugin_renderer_base class. 27 * @package core_rss 28 * @category rss 29 * @copyright 2010 Andrew Davis 30 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 31 */ 32 class core_rss_renderer extends plugin_renderer_base { 33 /** 34 * Returns the html for the token reset confirmation box 35 * @return string html 36 */ 37 public function user_reset_rss_token_confirmation() { 38 global $CFG; 39 $managetokenurl = $CFG->wwwroot."/user/managetoken.php?sesskey=" . sesskey(); 40 $optionsyes = array('action' => 'resetrsstoken', 'confirm' => 1, 'sesskey' => sesskey()); 41 $optionsno = array('section' => 'webservicetokens', 'sesskey' => sesskey()); 42 $formcontinue = new single_button(new moodle_url($managetokenurl, $optionsyes), get_string('reset')); 43 $formcancel = new single_button(new moodle_url($managetokenurl, $optionsno), get_string('cancel'), 'get'); 44 $html = $this->output->confirm(get_string('resettokenconfirmsimple', 'webservice'), $formcontinue, $formcancel); 45 return $html; 46 } 47 48 /** 49 * Display a user token with buttons to reset it 50 * @param string $token The token to be displayed 51 * @return string html code 52 */ 53 public function user_rss_token_box($token) { 54 global $CFG; 55 56 // Display strings. 57 $stroperation = get_string('operation', 'webservice'); 58 $strtoken = get_string('key', 'webservice'); 59 60 $return = $this->output->heading(get_string('rss', 'rss'), 3, 'main', true); 61 $return .= $this->output->box_start('generalbox webservicestokenui'); 62 63 $return .= get_string('rsskeyshelp'); 64 65 $table = new html_table(); 66 $table->head = array($strtoken, $stroperation); 67 $table->align = array('left', 'center'); 68 $table->width = '100%'; 69 $table->data = array(); 70 71 if (!empty($token)) { 72 $reset = "<a href=\"".$CFG->wwwroot."/user/managetoken.php?sesskey=".sesskey(). 73 "&action=resetrsstoken\">".get_string('reset')."</a>"; 74 75 $table->data[] = array($token, $reset); 76 77 $return .= html_writer::table($table); 78 } else { 79 $return .= get_string('notoken', 'webservice'); 80 } 81 82 $return .= $this->output->box_end(); 83 return $return; 84 } 85 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body