blocks editing: MDL-19889 edit tag_youtube form.

This commit is contained in:
tjhunt 2009-07-21 09:23:29 +00:00
parent a60bdd8cfd
commit 5f3d8dd52b
2 changed files with 63 additions and 51 deletions

View File

@ -1,51 +0,0 @@
<table cellpadding="9" cellspacing="0">
<tr valign="top">
<td align="right"><?php print_string('configtitle', 'block_tag_youtube'); ?>:</td>
<td><input type="text" name="title" size="30" value="<?php echo isset($this->config->title)?p($this->config->title):''; ?>" /></td>
</tr>
<tr valign="top">
<td align="right"><?php print_string('numberofvideos', 'block_tag_youtube'); ?>:</td>
<td>
<input type="text" name="numberofvideos" size="5" value="<?php echo isset($this->config->numberofvideos)?p($this->config->numberofvideos):''; ?>" />
</td>
</tr>
<tr valign="top">
<td align="right"><?php print_string('category', 'block_tag_youtube'); ?>:</td>
<td>
<?php
if (isset($this->config) && isset($this->config->category)) {
$selected = $this->config->category;
} else {
$selected = 0;
}
/* http://youtube.com/dev_api_ref?m=youtube.videos.list_by_category_and_tag */
$options = array ( 0 => get_string('anycategory', 'block_tag_youtube'),
1 => get_string('filmsanimation', 'block_tag_youtube'),
2 => get_string('autosvehicles', 'block_tag_youtube'),
23 => get_string('comedy', 'block_tag_youtube'),
24 => get_string('entertainment', 'block_tag_youtube'),
10 => get_string('music', 'block_tag_youtube'),
25 => get_string('newspolitics', 'block_tag_youtube'),
22 => get_string('peopleblogs', 'block_tag_youtube'),
15 => get_string('petsanimals', 'block_tag_youtube'),
26 => get_string('howtodiy', 'block_tag_youtube'),
17 => get_string('sports', 'block_tag_youtube'),
19 => get_string('travel', 'block_tag_youtube'),
20 => get_string('gadgetsgames', 'block_tag_youtube'),
);
choose_from_menu ($options, 'category', $selected);
?>
</td>
</tr>
<tr valign="top">
<td align="right">
<?php print_string('includeonlyvideosfromplaylist', 'block_tag_youtube'); ?>
</td>
<td><input type="text" name="playlist" size="20" value="<?php echo isset($this->config->playlist)?p($this->config->playlist):''; ?>" /></td>
</tr>
<tr>
<td colspan="3" align="center">
<input type="submit" value="<?php print_string('savechanges') ?>" /></td>
</tr>
</table>

View File

@ -0,0 +1,63 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Form for editing tag_youtube block instances.
*
* @package moodlecore
* @copyright 2009 Tim Hunt
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
/**
* Form for editing tag_youtube block instances.
*
* @copyright 2009 Tim Hunt
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class block_tag_youtube_edit_form extends block_edit_form {
protected function specific_definition($mform) {
$mform->addElement('header', 'configheader', get_string('blocksettings', 'block'));
$mform->addElement('text', 'config_title', get_string('configtitle', 'block_tag_youtube'));
$mform->setType('config_title', PARAM_MULTILANG);
$mform->addElement('text', 'config_numberofvideos', get_string('numberofvideos', 'block_tag_youtube'), array('size' => 5));
$mform->setType('config_numberofvideos', PARAM_INTEGER);
$categorychoices = array(
0 => get_string('anycategory', 'block_tag_youtube'),
1 => get_string('filmsanimation', 'block_tag_youtube'),
2 => get_string('autosvehicles', 'block_tag_youtube'),
23 => get_string('comedy', 'block_tag_youtube'),
24 => get_string('entertainment', 'block_tag_youtube'),
10 => get_string('music', 'block_tag_youtube'),
25 => get_string('newspolitics', 'block_tag_youtube'),
22 => get_string('peopleblogs', 'block_tag_youtube'),
15 => get_string('petsanimals', 'block_tag_youtube'),
26 => get_string('howtodiy', 'block_tag_youtube'),
17 => get_string('sports', 'block_tag_youtube'),
19 => get_string('travel', 'block_tag_youtube'),
20 => get_string('gadgetsgames', 'block_tag_youtube'),
);
$mform->addElement('select', 'config_category', get_string('category', 'block_tag_youtube'), $categorychoices);
$mform->setDefault('config_category', 0);
$mform->addElement('text', 'config_playlist', get_string('includeonlyvideosfromplaylist', 'block_tag_youtube'));
$mform->setType('config_playlist', PARAM_ALPHANUM);
}
}