Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 1441
Línea 59... Línea 59...
59
     * @return block_rss_client\output\footer|null The renderable footer or null if none should be displayed.
59
     * @return block_rss_client\output\footer|null The renderable footer or null if none should be displayed.
60
     */
60
     */
61
    protected function get_footer($feedrecords) {
61
    protected function get_footer($feedrecords) {
62
        $footer = null;
62
        $footer = null;
Línea 63... Línea -...
63
 
-
 
64
        if ($this->config->block_rss_client_show_channel_link) {
-
 
65
            global $CFG;
-
 
66
            require_once($CFG->libdir.'/simplepie/moodle_simplepie.php');
-
 
67
 
-
 
68
            $feedrecord     = array_pop($feedrecords);
-
 
69
            $feed           = new moodle_simplepie($feedrecord->url);
-
 
70
            $channellink    = new moodle_url($feed->get_link());
-
 
71
 
-
 
72
            if (!empty($channellink)) {
-
 
73
                $footer = new block_rss_client\output\footer($channellink);
-
 
74
            }
-
 
75
        }
-
 
76
 
63
 
77
        if ($this->hasfailedfeeds) {
64
        if ($this->hasfailedfeeds) {
78
            if (has_any_capability(['block/rss_client:manageownfeeds', 'block/rss_client:manageanyfeeds'], $this->context)) {
65
            if (has_any_capability(['block/rss_client:manageownfeeds', 'block/rss_client:manageanyfeeds'], $this->context)) {
79
                if ($footer === null) {
66
                if ($footer === null) {
80
                    $footer = new block_rss_client\output\footer();
67
                    $footer = new block_rss_client\output\footer();
Línea 102... Línea 89...
102
 
89
 
103
        if (empty($this->instance)) {
90
        if (empty($this->instance)) {
104
            return $this->content;
91
            return $this->content;
Línea -... Línea 92...
-
 
92
        }
-
 
93
 
-
 
94
        $managefeedfooterlink = '';
-
 
95
        if (has_any_capability(['block/rss_client:manageanyfeeds', 'block/rss_client:manageownfeeds'], $this->context)) {
-
 
96
            $managefeedfooterlink = html_writer::link(
-
 
97
                new moodle_url('/blocks/rss_client/managefeeds.php', ['courseid' => $this->page->course->id]),
-
 
98
                get_string('managefeeds', 'block_rss_client'),
-
 
99
                ['class' => 'btn btn-primary', 'role' => 'button'],
-
 
100
            );
105
        }
101
        }
106
 
102
 
107
        if (!isset($this->config)) {
103
        if (!isset($this->config)) {
Línea 108... Línea 104...
108
            // The block has yet to be configured - just display configure message in
104
            // The block has yet to be configured - just display configure message in
109
            // the block if user has permission to configure it
105
            // the block if user has permission to configure it
110
 
106
 
Línea -... Línea 107...
-
 
107
            if (has_capability('block/rss_client:manageanyfeeds', $this->context)) {
-
 
108
                $this->content->text = get_string('feedsconfigurenewinstance2', 'block_rss_client');
111
            if (has_capability('block/rss_client:manageanyfeeds', $this->context)) {
109
            }
112
                $this->content->text = get_string('feedsconfigurenewinstance2', 'block_rss_client');
110
 
Línea 113... Línea 111...
113
            }
111
            $this->content->footer = $managefeedfooterlink;
114
 
112
 
Línea 154... Línea 152...
154
        $this->content->text = $renderer->render_block($block);
152
        $this->content->text = $renderer->render_block($block);
155
        if (isset($footer)) {
153
        if (isset($footer)) {
156
            $this->content->footer = $renderer->render_footer($footer);
154
            $this->content->footer = $renderer->render_footer($footer);
157
        }
155
        }
Línea -... Línea 156...
-
 
156
 
-
 
157
        $this->content->footer .= $managefeedfooterlink;
158
 
158
 
159
        return $this->content;
159
        return $this->content;
Línea 160... Línea 160...
160
    }
160
    }
Línea 257... Línea 257...
257
                // exception if the param is an extremely malformed url.
257
                // exception if the param is an extremely malformed url.
258
                debugging($e->getMessage());
258
                debugging($e->getMessage());
259
            }
259
            }
260
        }
260
        }
Línea -... Línea 261...
-
 
261
 
-
 
262
        // Feed channel link.
-
 
263
        if ($this->config->block_rss_client_show_channel_link) {
-
 
264
            $channellink = $simplepiefeed->get_link();
-
 
265
            $feed->set_channellink($channellink ? new moodle_url($channellink) : null);
-
 
266
        }
261
 
267
 
262
        return $feed;
268
        return $feed;
Línea 263... Línea 269...
263
    }
269
    }
264
 
270