Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/blocks/rss_client/edit_form.php
Go to the documentation of this file.
00001 <?php
00002 
00003 // This file is part of Moodle - http://moodle.org/
00004 //
00005 // Moodle is free software: you can redistribute it and/or modify
00006 // it under the terms of the GNU General Public License as published by
00007 // the Free Software Foundation, either version 3 of the License, or
00008 // (at your option) any later version.
00009 //
00010 // Moodle is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 // GNU General Public License for more details.
00014 //
00015 // You should have received a copy of the GNU General Public License
00016 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
00017 
00032 class block_rss_client_edit_form extends block_edit_form {
00033     protected function specific_definition($mform) {
00034         global $CFG, $DB, $USER;
00035 
00036         // Fields for editing block contents.
00037         $mform->addElement('header', 'configheader', get_string('blocksettings', 'block'));
00038 
00039         $mform->addElement('selectyesno', 'config_display_description', get_string('displaydescriptionlabel', 'block_rss_client'));
00040         $mform->setDefault('config_display_description', 0);
00041 
00042         $mform->addElement('text', 'config_shownumentries', get_string('shownumentrieslabel', 'block_rss_client'), array('size' => 5));
00043         $mform->setType('config_shownumentries', PARAM_INTEGER);
00044         $mform->addRule('config_shownumentries', null, 'numeric', null, 'client');
00045         if (!empty($CFG->block_rss_client_num_entries)) {
00046             $mform->setDefault('config_shownumentries', $CFG->block_rss_client_num_entries);
00047         } else {
00048             $mform->setDefault('config_shownumentries', 5);
00049         }
00050 
00051         $rssfeeds = $DB->get_records_sql_menu('
00052                 SELECT id,
00053                        CASE WHEN preferredtitle = ? THEN ' . $DB->sql_compare_text('title', 64) .' ELSE preferredtitle END
00054                 FROM {block_rss_client}
00055                 WHERE userid = ? OR shared = 1
00056                 ORDER BY CASE WHEN preferredtitle = ? THEN ' . $DB->sql_compare_text('title', 64) . ' ELSE preferredtitle END ',
00057                 array($DB->sql_empty(), $USER->id, $DB->sql_empty()));
00058         if ($rssfeeds) {
00059             $select = $mform->addElement('select', 'config_rssid', get_string('choosefeedlabel', 'block_rss_client'), $rssfeeds);
00060             $select->setMultiple(true);
00061 
00062         } else {
00063             $mform->addElement('static', 'config_rssid', get_string('choosefeedlabel', 'block_rss_client'),
00064                     get_string('nofeeds', 'block_rss_client'));
00065         }
00066 
00067         if (has_any_capability(array('block/rss_client:manageanyfeeds', 'block/rss_client:manageownfeeds'), $this->block->context)) {
00068             $mform->addElement('static', 'nofeedmessage', '',
00069                     '<a href="' . $CFG->wwwroot . '/blocks/rss_client/managefeeds.php?courseid=' . $this->page->course->id . '">' .
00070                     get_string('feedsaddedit', 'block_rss_client') . '</a>');
00071         }
00072 
00073         $mform->addElement('text', 'config_title', get_string('uploadlabel'));
00074         $mform->setType('config_title', PARAM_NOTAGS);
00075 
00076         $mform->addElement('selectyesno', 'config_block_rss_client_show_channel_link', get_string('clientshowchannellinklabel', 'block_rss_client'));
00077         $mform->setDefault('config_block_rss_client_show_channel_link', 0);
00078 
00079         $mform->addElement('selectyesno', 'config_block_rss_client_show_channel_image', get_string('clientshowimagelabel', 'block_rss_client'));
00080         $mform->setDefault('config_block_rss_client_show_channel_image', 0);
00081     }
00082 }
 All Data Structures Namespaces Files Functions Variables Enumerations