blocks editing: MDL-19889 edit tags block form.

This commit is contained in:
tjhunt
2009-07-21 09:45:27 +00:00
parent 5f3d8dd52b
commit 7b2b1a915c
3 changed files with 49 additions and 60 deletions
+1 -33
View File
@@ -63,7 +63,7 @@ class block_tags extends block_base {
/// Get a list of tags
require_once($CFG->dirroot.'/tag/lib.php');
require_once($CFG->dirroot.'/tag/locallib.php');
if (empty($CFG->block_tags_showcoursetags) or !$CFG->block_tags_showcoursetags) {
@@ -318,37 +318,5 @@ EOT;
return $this->content;
}
function instance_config_print() {
global $CFG;
/// set up the numberoftags select field
$numberoftags = array();
for($i=1;$i<=200;$i++) $numberoftags[$i] = $i;
if (is_file($CFG->dirroot .'/blocks/'. $this->name() .'/config_instance.html')) {
print_simple_box_start('center', '', '', 5, 'blockconfigglobal');
include($CFG->dirroot .'/blocks/'. $this->name() .'/config_instance.html');
print_simple_box_end();
} else {
notice(get_string('blockconfigbad'), str_replace('blockaction=', 'dummy=', qualified_me()));
}
}
/*
* function removed until rsslib supports dc/cc
*/
/*
function cron() {
global $CFG;
if ($CFG->block_tags_showcoursetags) {
require_once($CFG->dirroot.'/tag/coursetagslib.php');
return coursetag_rss_feeds();
} else {
return TRUE;
}
}
*/
}
?>
-27
View File
@@ -1,27 +0,0 @@
<?php
if (empty($this->config->title)) {
$this->config->title = get_string('blocktagstitle', 'tag');
}
if (empty($this->config->numberoftags)) {
$this->config->numberoftags = 80;
}
?>
<table cellpadding="9" cellspacing="0" class="blockconfigtable">
<tr valign="top">
<td align="right"><?php print_string("blocktitle","blog") ?>:</td>
<td><input type="text" name="title" size="50" value="<?php p($this->config->title) ?>" /></td>
</tr>
<tr valign="top">
<td align="right"><?php print_string("numberoftags","blog") ?>:</td>
<td><?php choose_from_menu($numberoftags,"numberoftags",$this->config->numberoftags) ?></td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" value="<?php print_string("savechanges") ?>" /></td>
</tr>
</table>
+48
View File
@@ -0,0 +1,48 @@
<?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 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 block instances.
*
* @copyright 2009 Tim Hunt
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class block_tags_edit_form extends block_edit_form {
protected function specific_definition($mform) {
// Fields for editing HTML block title and contents.
$mform->addElement('header', 'configheader', get_string('blocksettings', 'block'));
$mform->addElement('text', 'config_title', get_string('blocktagstitle', 'tag'));
$mform->setType('config_title', PARAM_MULTILANG);
$mform->setDefault('config_title', get_string('blocktagstitle', 'tag'));
$numberoftags = array();
for ($i = 1; $i <= 200; $i++) {
$numberoftags[$i] = $i;
}
$mform->addElement('select', 'config_numberoftags', get_string('numberoftags', 'blog'), $numberoftags);
$mform->setDefault('config_numberoftags', 80);
}
}