From 3c0561cfe71ace6378b1d683fc5ba7dfaf26822a Mon Sep 17 00:00:00 2001 From: moodler Date: Sun, 15 Feb 2004 07:29:55 +0000 Subject: [PATCH] New field in the groups table to "hidepicture" from being displayed in locations like forums etc. Backups done too, Eloy. :-) --- backup/backuplib.php | 1 + backup/restorelib.php | 1 + lib/db/mysql.php | 3 +++ lib/db/mysql.sql | 1 + lib/db/postgres7.php | 4 ++++ lib/db/postgres7.sql | 1 + lib/weblib.php | 46 ++++++++++++++++++++++--------------------- version.php | 2 +- 8 files changed, 36 insertions(+), 23 deletions(-) diff --git a/backup/backuplib.php b/backup/backuplib.php index 6f10741cc1..f6793f484a 100644 --- a/backup/backuplib.php +++ b/backup/backuplib.php @@ -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)); diff --git a/backup/restorelib.php b/backup/restorelib.php index 34d4bfb82e..5b7ffcfed4 100644 --- a/backup/restorelib.php +++ b/backup/restorelib.php @@ -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']['#']); diff --git a/lib/db/mysql.php b/lib/db/mysql.php index fcb57940fe..93a95253d6 100644 --- a/lib/db/mysql.php +++ b/lib/db/mysql.php @@ -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; diff --git a/lib/db/mysql.sql b/lib/db/mysql.sql index 18b59d3140..1796177c53 100644 --- a/lib/db/mysql.sql +++ b/lib/db/mysql.sql @@ -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`), diff --git a/lib/db/postgres7.php b/lib/db/postgres7.php index 664d69f2ed..4c7581e00e 100644 --- a/lib/db/postgres7.php +++ b/lib/db/postgres7.php @@ -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; } diff --git a/lib/db/postgres7.sql b/lib/db/postgres7.sql index ed00389a85..5b1c9e7933 100644 --- a/lib/db/postgres7.sql +++ b/lib/db/postgres7.sql @@ -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' ); diff --git a/lib/weblib.php b/lib/weblib.php index 08a2880035..33fa411b0d 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -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 = "wwwroot/course/groupphp?id=$courseid&group=$group->id\">"; - } - if ($large) { - $file = "f1"; - $size = 100; + if ($link) { + $output = "wwwroot/course/groupphp?id=$courseid&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 .= "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 .= "wwwroot/user/pixgroup.php/$group->id/$file.jpg\"". - " border=\"0\" width=\"$size\" height=\"$size\" alt=\"\" />"; - } else { - $output .= "wwwroot/user/pixgroup.php?file=/$group->id/$file.jpg\"". - " border=\"0\" width=\"$size\" height=\"$size\" alt=\"\" />"; - } - } - if ($link) { - $output .= ""; + $output .= "wwwroot/user/pixgroup.php?file=/$group->id/$file.jpg\"". + " border=\"0\" width=\"$size\" height=\"$size\" alt=\"\" />"; } } + if ($link) { + $output .= ""; + } if ($returnstring) { return $output; diff --git a/version.php b/version.php index db13f02535..7b8273952b 100644 --- a/version.php +++ b/version.php @@ -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 -- 2.39.5