New field in the groups table to "hidepicture" from being displayed

in locations like forums etc.

Backups done too, Eloy.  :-)
This commit is contained in:
moodler 2004-02-15 07:29:55 +00:00
parent ac0024f9f4
commit 3c0561cfe7
8 changed files with 36 additions and 23 deletions

View File

@ -986,6 +986,7 @@
fwrite ($bf,full_tag("DESCRIPTION",4,false,$group->description));
fwrite ($bf,full_tag("LANG",4,false,$group->lang));
fwrite ($bf,full_tag("PICTURE",4,false,$group->picture));
fwrite ($bf,full_tag("HIDEPICTURE",4,false,$group->hidepicture));
fwrite ($bf,full_tag("TIMECREATED",4,false,$group->timecreated));
fwrite ($bf,full_tag("TIMEMODIFIED",4,false,$group->timemodified));

View File

@ -847,6 +847,7 @@
$gro->description = backup_todb($info['GROUP']['#']['DESCRIPTION']['0']['#']);
$gro->lang = backup_todb($info['GROUP']['#']['LANG']['0']['#']);
$gro->picture = backup_todb($info['GROUP']['#']['PICTURE']['0']['#']);
$gro->hidepicture = backup_todb($info['GROUP']['#']['HIDEPICTURE']['0']['#']);
$gro->timecreated = backup_todb($info['GROUP']['#']['TIMECREATED']['0']['#']);
$gro->timemodified = backup_todb($info['GROUP']['#']['TIMEMODIFIED']['0']['#']);

View File

@ -684,6 +684,9 @@ function main_upgrade($oldversion=0) {
) TYPE=MyISAM COMMENT='For keeping information about cached data';");
}
if ($oldversion < 2004021500) {
table_column("groups", "", "hidepicture", "integer", "2", "unsigned", "0", "", "picture");
}
return $result;

View File

@ -201,6 +201,7 @@ CREATE TABLE `prefix_groups` (
`description` text NOT NULL,
`lang` varchar(10) NOT NULL default 'en',
`picture` int(10) unsigned NOT NULL default '0',
`hidepicture` int(2) unsigned NOT NULL default '0',
`timecreated` int(10) unsigned NOT NULL default '0',
`timemodified` int(10) unsigned NOT NULL default '0',
PRIMARY KEY (`id`),

View File

@ -429,6 +429,10 @@ function main_upgrade($oldversion=0) {
modify_database("", "CREATE INDEX prefix_cache_text_md5key_idx ON prefix_cache_text (md5key);");
}
if ($oldversion < 2004021500) {
table_column("groups", "", "hidepicture", "integer", "2", "unsigned", "0", "", "picture");
}
return $result;
}

View File

@ -106,6 +106,7 @@ CREATE TABLE prefix_groups (
description text,
lang varchar(10) NOT NULL default '',
picture integer NOT NULL default '0',
hidepicture integer NOT NULL default '0',
timecreated integer NOT NULL default '0',
timemodified integer NOT NULL default '0'
);

View File

@ -1222,32 +1222,34 @@ function print_user($user, $course) {
function print_group_picture($group, $courseid, $large=false, $returnstring=false, $link=true) {
global $CFG;
$output = '';
if ($group->hidepicture) {
return '';
}
if ($group->showpicture) {
if ($link) {
$output = "<a href=\"$CFG->wwwroot/course/groupphp?id=$courseid&amp;group=$group->id\">";
}
if ($large) {
$file = "f1";
$size = 100;
if ($link) {
$output = "<a href=\"$CFG->wwwroot/course/groupphp?id=$courseid&amp;group=$group->id\">";
} else {
$output = '';
}
if ($large) {
$file = "f1";
$size = 100;
} else {
$file = "f2";
$size = 35;
}
if ($group->picture) { // Print custom group picture
if ($CFG->slasharguments) { // Use this method if possible for better caching
$output .= "<img align=\"absmiddle\" src=\"$CFG->wwwroot/user/pixgroup.php/$group->id/$file.jpg\"".
" border=\"0\" width=\"$size\" height=\"$size\" alt=\"\" />";
} else {
$file = "f2";
$size = 35;
}
if ($group->picture) { // Print custom group picture
if ($CFG->slasharguments) { // Use this method if possible for better caching
$output .= "<img align=\"absmiddle\" src=\"$CFG->wwwroot/user/pixgroup.php/$group->id/$file.jpg\"".
" border=\"0\" width=\"$size\" height=\"$size\" alt=\"\" />";
} else {
$output .= "<img align=\"absmiddle\" src=\"$CFG->wwwroot/user/pixgroup.php?file=/$group->id/$file.jpg\"".
" border=\"0\" width=\"$size\" height=\"$size\" alt=\"\" />";
}
}
if ($link) {
$output .= "</a>";
$output .= "<img align=\"absmiddle\" src=\"$CFG->wwwroot/user/pixgroup.php?file=/$group->id/$file.jpg\"".
" border=\"0\" width=\"$size\" height=\"$size\" alt=\"\" />";
}
}
if ($link) {
$output .= "</a>";
}
if ($returnstring) {
return $output;

View File

@ -5,7 +5,7 @@
// database to determine whether upgrades should
// be performed (see lib/db/*.php)
$version = 2004021400; // The current version is a date (YYYYMMDDXX)
$version = 2004021500; // The current version is a date (YYYYMMDDXX)
$release = "1.2 development"; // User-friendly version number