blocks MDL-19010 Fixed a typo to make the title a string
[moodle.git] / blocks / rss_client / edit_form.php
CommitLineData
f1a34d8f 1<?php
2
3// This file is part of Moodle - http://moodle.org/
4//
5// Moodle is free software: you can redistribute it and/or modify
6// it under the terms of the GNU General Public License as published by
7// the Free Software Foundation, either version 3 of the License, or
8// (at your option) any later version.
9//
10// Moodle is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
17
18/**
19 * Form for editing RSS client block instances.
20 *
21 * @package moodlecore
22 * @copyright 2009 Tim Hunt
23 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
24 */
25
26/**
27 * Form for editing RSS client block instances.
28 *
29 * @copyright 2009 Tim Hunt
30 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
31 */
32class block_rss_client_edit_form extends block_edit_form {
33 protected function specific_definition($mform) {
34 global $CFG, $DB, $USER;
35
e530f3a9 36 // Fields for editing block contents.
f1a34d8f 37 $mform->addElement('header', 'configheader', get_string('blocksettings', 'block'));
38
39 $mform->addElement('selectyesno', 'config_display_description', get_string('displaydescriptionlabel', 'block_rss_client'));
40 $mform->setDefault('config_display_description', 0);
41
42 $mform->addElement('text', 'config_shownumentries', get_string('shownumentrieslabel', 'block_rss_client'), array('size' => 5));
43 $mform->setType('config_text', PARAM_INTEGER);
44 if (!empty($CFG->block_rss_client_num_entries)) {
45 $mform->setDefault('config_text', $CFG->block_rss_client_num_entries);
46 } else {
47 $mform->setDefault('config_text', 5);
48 }
49
50 $rssfeeds = $DB->get_records_sql_menu('
51 SELECT id, CASE WHEN preferredtitle = ? THEN title ELSE preferredtitle END AS acutaltitle
52 FROM {block_rss_client}
53 WHERE userid = ? OR shared = 1
54 ORDER BY acutaltitle',
55 array($DB->sql_empty(), $USER->id));
56 if ($rssfeeds) {
57 $select = $mform->addElement('select', 'config_rssid', get_string('choosefeedlabel', 'block_rss_client'), $rssfeeds);
58 $select->setMultiple(true);
59
60 } else {
61 $mform->addElement('static', 'config_rssid', get_string('choosefeedlabel', 'block_rss_client'),
62 get_string('nofeeds', 'block_rss_client'));
63 }
64
65 if (has_any_capability(array('block/rss_client:manageanyfeeds', 'block/rss_client:manageownfeeds'), $this->block->context)) {
66 $mform->addElement('static', 'nofeedmessage', '',
67 '<a href="' . $CFG->wwwroot . '/blocks/rss_client/managefeeds.php?courseid=' . $this->page->course->id . '">' .
68 get_string('feedsaddedit', 'block_rss_client') . '</a>');
69 }
70
e530f3a9 71 $mform->addElement('text', 'config_title', get_string('uploadlabel'));
f1a34d8f 72 $mform->setType('config_title', PARAM_NOTAGS);
73
74 $mform->addElement('selectyesno', 'config_block_rss_client_show_channel_link', get_string('clientshowchannellinklabel', 'block_rss_client'));
75 $mform->setDefault('config_block_rss_client_show_channel_link', 0);
76
77 $mform->addElement('selectyesno', 'config_block_rss_client_show_channel_image', get_string('clientshowimagelabel', 'block_rss_client'));
78 $mform->setDefault('config_block_rss_client_show_channel_image', 0);
79 }
e530f3a9 80}