Updated the two standard blocks that have configuration features to work

with the latest version of the Blocks API.
This commit is contained in:
defacer
2004-11-19 02:36:57 +00:00
parent 833d033623
commit 2456d7c815
4 changed files with 3 additions and 34 deletions
+1 -9
View File
@@ -4,21 +4,13 @@ class CourseBlock_course_list extends MoodleBlock {
function init() {
$this->title = get_string('courses');
$this->content_type = BLOCK_TYPE_LIST;
$this->version = 2004081200;
$this->version = 2004111600;
}
function has_config() {
return true;
}
function print_config() {
global $CFG, $USER, $THEME;
print_simple_box_start('center', '', $THEME->cellheading);
include($CFG->dirroot.'/blocks/'.$this->name().'/config.html');
print_simple_box_end();
return true;
}
function get_content() {
global $THEME, $CFG, $USER;
@@ -1,6 +1,3 @@
<form method="post" action="block.php">
<?php echo "<input type=\"hidden\" name=\"sesskey\" value=\"".$USER->sesskey."\">"; ?>
<table cellpadding="9" cellspacing="0">
<tr valign="top">
<td align="right"><p>block_course_list_adminview:</td>
@@ -27,6 +24,4 @@
<td colspan="3" align="center">
<input type="submit" value="<?php print_string("savechanges") ?>" /></td>
</tr>
</table>
</form>
</table>
+1 -15
View File
@@ -4,25 +4,11 @@ class CourseBlock_online_users extends MoodleBlock {
function init() {
$this->title = get_string('blockname','block_online_users');
$this->content_type = BLOCK_TYPE_TEXT;
$this->version = 2004052700;
$this->version = 2004111600;
}
function has_config() {return true;}
function print_config() {
global $CFG, $USER, $THEME;
print_simple_box_start('center', '', $THEME->cellheading);
include($CFG->dirroot.'/blocks/'.$this->name().'/config.html');
print_simple_box_end();
return true;
}
function handle_config($config) {
foreach ($config as $name => $value) {
set_config($name, $value);
}
return true;
}
function get_content() {
global $USER, $CFG;
@@ -1,6 +1,3 @@
<form method="post" action="block.php">
<?php echo '<input type="hidden" name="sesskey" value="'. $USER->sesskey .'">'; ?>
<table cellpadding="9" cellspacing="0">
<tr valign="top">
<td align="right"><p>block_online_users_timetosee:</td>
@@ -22,4 +19,3 @@
<input type="submit" value="<?php print_string('savechanges') ?>" /></td>
</tr>
</table>
</form>