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 * Contains class block_rss_client\output\channel_image 19 * 20 * @package block_rss_client 21 * @copyright 2016 Howard County Public School System 22 * @author Brendan Anderson <brendan_anderson@hcpss.org> 23 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 24 */ 25 26 namespace block_rss_client\output; 27 28 defined('MOODLE_INTERNAL') || die(); 29 30 /** 31 * Class to display RSS channel images 32 * 33 * @package block_rss_client 34 * @copyright 2016 Howard County Public School System 35 * @author Brendan Anderson <brendan_anderson@hcpss.org> 36 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 37 */ 38 class channel_image implements \renderable, \templatable { 39 40 /** 41 * The URL location of the image 42 * 43 * @var string 44 */ 45 protected $url; 46 47 /** 48 * The title of the image 49 * 50 * @var string 51 */ 52 protected $title; 53 54 /** 55 * The URL of the image link 56 * 57 * @var string 58 */ 59 protected $link; 60 61 /** 62 * Contructor 63 * 64 * @param \moodle_url $url The URL location of the image 65 * @param string $title The title of the image 66 * @param \moodle_url $link The URL of the image link 67 */ 68 public function __construct(\moodle_url $url, $title, \moodle_url $link = null) { 69 $this->url = $url; 70 $this->title = $title; 71 $this->link = $link; 72 } 73 74 /** 75 * Export this for use in a mustache template context. 76 * 77 * @see templatable::export_for_template() 78 * @param renderer_base $output 79 * @return array The data for the template 80 */ 81 public function export_for_template(\renderer_base $output) { 82 return array( 83 'url' => clean_param($this->url, PARAM_URL), 84 'title' => $this->title, 85 'link' => clean_param($this->link, PARAM_URL), 86 ); 87 } 88 89 /** 90 * Set the URL 91 * 92 * @param \moodle_url $url 93 * @return \block_rss_client\output\channel_image 94 */ 95 public function set_url(\moodle_url $url) { 96 $this->url = $url; 97 98 return $this; 99 } 100 101 /** 102 * Get the URL 103 * 104 * @return \moodle_url 105 */ 106 public function get_url() { 107 return $this->url; 108 } 109 110 /** 111 * Set the title 112 * 113 * @param string $title 114 * @return \block_rss_client\output\channel_image 115 */ 116 public function set_title($title) { 117 $this->title = $title; 118 119 return $this; 120 } 121 122 /** 123 * Get the title 124 * 125 * @return string 126 */ 127 public function get_title() { 128 return $this->title; 129 } 130 131 /** 132 * Set the link 133 * 134 * @param \moodle_url $link 135 * @return \block_rss_client\output\channel_image 136 */ 137 public function set_link($link) { 138 $this->link = $link; 139 140 return $this; 141 } 142 143 /** 144 * Get the link 145 * 146 * @return \moodle_url 147 */ 148 public function get_link() { 149 return $this->link; 150 } 151 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body