Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 1441
Línea 43... Línea 43...
43
     * @var string
43
     * @var string
44
     */
44
     */
45
    protected $title = null;
45
    protected $title = null;
Línea 46... Línea 46...
46
 
46
 
-
 
47
    /**
-
 
48
     * The feed's channel link.
-
 
49
     *
-
 
50
     * @var string|null
-
 
51
     */
-
 
52
    protected ?string $channellink;
-
 
53
 
47
    /**
54
    /**
48
     * An array of renderable feed items
55
     * An array of renderable feed items
49
     *
56
     *
50
     * @var array
57
     * @var array
51
     */
58
     */
Línea 76... Línea 83...
76
     * Contructor
83
     * Contructor
77
     *
84
     *
78
     * @param string $title The title of the RSS feed
85
     * @param string $title The title of the RSS feed
79
     * @param boolean $showtitle Whether to show the title
86
     * @param boolean $showtitle Whether to show the title
80
     * @param boolean $showimage Whether to show the channel image
87
     * @param boolean $showimage Whether to show the channel image
-
 
88
     * @param string|null $channellink The channel link of the RSS feed
81
     */
89
     */
82
    public function __construct($title, $showtitle = true, $showimage = true) {
90
    public function __construct($title, $showtitle = true, $showimage = true, ?string $channellink = null) {
83
        $this->title = $title;
91
        $this->title = $title;
84
        $this->showtitle = $showtitle;
92
        $this->showtitle = $showtitle;
85
        $this->showimage = $showimage;
93
        $this->showimage = $showimage;
-
 
94
        $this->channellink = $channellink;
86
    }
95
    }
Línea 87... Línea 96...
87
 
96
 
88
    /**
97
    /**
89
     * Export this for use in a mustache template context.
98
     * Export this for use in a mustache template context.
Línea 95... Línea 104...
95
    public function export_for_template(\renderer_base $output) {
104
    public function export_for_template(\renderer_base $output) {
96
        $data = array(
105
        $data = array(
97
            'title' => $this->showtitle ? $this->title : null,
106
            'title' => $this->showtitle ? $this->title : null,
98
            'image' => null,
107
            'image' => null,
99
            'items' => array(),
108
            'items' => array(),
-
 
109
            'channellink' => $this->channellink ?? null,
100
        );
110
        );
Línea 101... Línea 111...
101
 
111
 
102
        if ($this->showimage && $this->image) {
112
        if ($this->showimage && $this->image) {
103
            $data['image'] = $this->image->export_for_template($output);
113
            $data['image'] = $this->image->export_for_template($output);
Línea 130... Línea 140...
130
    public function get_title() {
140
    public function get_title() {
131
        return $this->title;
141
        return $this->title;
132
    }
142
    }
Línea 133... Línea 143...
133
 
143
 
-
 
144
    /**
-
 
145
     * Set the feed channel link.
-
 
146
     *
-
 
147
     * @param \moodle_url|null $channellink the URL to the channel website.
-
 
148
     */
-
 
149
    public function set_channellink(?\moodle_url $channellink) {
-
 
150
        $this->channellink = $channellink;
-
 
151
    }
-
 
152
 
134
    /**
153
    /**
135
     * Add an RSS item
154
     * Add an RSS item
136
     *
155
     *
137
     * @param \block_rss_client\output\item $item
156
     * @param \block_rss_client\output\item $item
138
     */
157
     */