[ Index ] |
PHP Cross Reference of moodle-2.8 |
[Summary view] [Print] [Text view]
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 * Form for editing RSS client block instances. 19 * 20 * @package block_rss_client 21 * @copyright 2009 Tim Hunt 22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 23 */ 24 25 /** 26 * Form for editing RSS client block instances. 27 * 28 * @copyright 2009 Tim Hunt 29 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 30 */ 31 class block_rss_client_edit_form extends block_edit_form { 32 protected function specific_definition($mform) { 33 global $CFG, $DB, $USER; 34 35 // Fields for editing block contents. 36 $mform->addElement('header', 'configheader', get_string('blocksettings', 'block')); 37 38 $mform->addElement('selectyesno', 'config_display_description', get_string('displaydescriptionlabel', 'block_rss_client')); 39 $mform->setDefault('config_display_description', 0); 40 41 $mform->addElement('text', 'config_shownumentries', get_string('shownumentrieslabel', 'block_rss_client'), array('size' => 5)); 42 $mform->setType('config_shownumentries', PARAM_INT); 43 $mform->addRule('config_shownumentries', null, 'numeric', null, 'client'); 44 if (!empty($CFG->block_rss_client_num_entries)) { 45 $mform->setDefault('config_shownumentries', $CFG->block_rss_client_num_entries); 46 } else { 47 $mform->setDefault('config_shownumentries', 5); 48 } 49 50 $rssfeeds = $DB->get_records_sql_menu(' 51 SELECT id, 52 CASE WHEN preferredtitle = ? THEN ' . $DB->sql_compare_text('title', 64) .' ELSE preferredtitle END 53 FROM {block_rss_client} 54 WHERE userid = ? OR shared = 1 55 ORDER BY CASE WHEN preferredtitle = ? THEN ' . $DB->sql_compare_text('title', 64) . ' ELSE preferredtitle END ', 56 array('', $USER->id, '')); 57 if ($rssfeeds) { 58 $select = $mform->addElement('select', 'config_rssid', get_string('choosefeedlabel', 'block_rss_client'), $rssfeeds); 59 $select->setMultiple(true); 60 61 } else { 62 $mform->addElement('static', 'config_rssid', get_string('choosefeedlabel', 'block_rss_client'), 63 get_string('nofeeds', 'block_rss_client')); 64 } 65 66 if (has_any_capability(array('block/rss_client:manageanyfeeds', 'block/rss_client:manageownfeeds'), $this->block->context)) { 67 $mform->addElement('static', 'nofeedmessage', '', 68 '<a href="' . $CFG->wwwroot . '/blocks/rss_client/managefeeds.php?courseid=' . $this->page->course->id . '">' . 69 get_string('feedsaddedit', 'block_rss_client') . '</a>'); 70 } 71 72 $mform->addElement('text', 'config_title', get_string('uploadlabel')); 73 $mform->setType('config_title', PARAM_NOTAGS); 74 75 $mform->addElement('selectyesno', 'config_block_rss_client_show_channel_link', get_string('clientshowchannellinklabel', 'block_rss_client')); 76 $mform->setDefault('config_block_rss_client_show_channel_link', 0); 77 78 $mform->addElement('selectyesno', 'config_block_rss_client_show_channel_image', get_string('clientshowimagelabel', 'block_rss_client')); 79 $mform->setDefault('config_block_rss_client_show_channel_image', 0); 80 } 81 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Nov 28 20:29:05 2014 | Cross-referenced by PHPXref 0.7.1 |