diff --git a/mod/choice/backuplib.php b/mod/choice/backuplib.php index 038f8ea8356..bbbb63ae9ff 100644 --- a/mod/choice/backuplib.php +++ b/mod/choice/backuplib.php @@ -63,7 +63,7 @@ fwrite ($bf,full_tag("TEXT",4,false,$choice->text)); fwrite ($bf,full_tag("FORMAT",4,false,$choice->format)); fwrite ($bf,full_tag("PUBLISH",4,false,$choice->publish)); - fwrite ($bf,full_tag("RELEASE",4,false,$choice->release)); + fwrite ($bf,full_tag("SHOWRESULTS",4,false,$choice->showresults)); fwrite ($bf,full_tag("DISPLAY",4,false,$choice->display)); fwrite ($bf,full_tag("ALLOWUPDATE",4,false,$choice->allowupdate)); fwrite ($bf,full_tag("SHOWUNANSWERED",4,false,$choice->showunanswered)); diff --git a/mod/choice/db/mysql.php b/mod/choice/db/mysql.php index 78a93984d54..73bd835352d 100644 --- a/mod/choice/db/mysql.php +++ b/mod/choice/db/mysql.php @@ -119,7 +119,9 @@ function choice_upgrade($oldversion) { table_column('choice', '', 'limitanswers', 'TINYINT', '2', 'unsigned', 0, 'not null', 'showunanswered'); table_column('choice_options', '', 'maxanswers', 'INTEGER', '10', 'unsigned', 0, 'null', 'text'); } - + if ($oldversion < 2006020900) { //rename release column to showanswers - Release is now reserved word in mySql + table_column('choice', 'release', 'showresults', 'TINYINT', '2', 'unsigned', 0, 'not null'); + } return true; } diff --git a/mod/choice/db/mysql.sql b/mod/choice/db/mysql.sql index 88559949141..380b9ea7fb9 100755 --- a/mod/choice/db/mysql.sql +++ b/mod/choice/db/mysql.sql @@ -1,85 +1,85 @@ -# phpMyAdmin MySQL-Dump -# version 2.2.1 -# http://phpwizard.net/phpMyAdmin/ -# http://phpmyadmin.sourceforge.net/ (download page) -# -# Host: localhost -# Generation Time: Nov 14, 2001 at 04:44 PM -# Server version: 3.23.36 -# PHP Version: 4.0.6 -# Database : `moodle` -# -------------------------------------------------------- - -# -# Table structure for table `choice` -# - -CREATE TABLE prefix_choice ( - id int(10) unsigned NOT NULL auto_increment, - course int(10) unsigned NOT NULL default '0', - name varchar(255) NOT NULL default '', - text text NOT NULL default '', - format tinyint(2) unsigned NOT NULL default '0', - publish tinyint(2) unsigned NOT NULL default '0', - `release` tinyint(2) unsigned NOT NULL default '0', - display tinyint(4) unsigned NOT NULL default '0', - allowupdate tinyint(2) unsigned NOT NULL default '0', - showunanswered tinyint(2) unsigned NOT NULL default '0', - limitanswers tinyint(2) unsigned NOT NULL default '0', - timeopen int(10) unsigned NOT NULL default '0', - timeclose int(10) unsigned NOT NULL default '0', - timemodified int(10) unsigned NOT NULL default '0', - PRIMARY KEY (id), - UNIQUE KEY id (id), - KEY course (course) -) TYPE=MyISAM COMMENT='Available choices are stored here.'; - - -# -------------------------------------------------------- - -# -# Table structure for table `choice_answers` -# - -CREATE TABLE prefix_choice_answers ( - id int(10) unsigned NOT NULL auto_increment, - choiceid int(10) unsigned NOT NULL default '0', - userid int(10) unsigned NOT NULL default '0', - optionid int(10) NOT NULL default '0', - timemodified int(10) NOT NULL default '0', - PRIMARY KEY (id), - UNIQUE KEY id (id), - KEY userid (userid), - KEY choiceid (choiceid) -) TYPE=MyISAM; - - -# -------------------------------------------------------- - -# -# Table structure for table `choice_options` -# - -CREATE TABLE prefix_choice_options ( - id int(10) unsigned NOT NULL auto_increment, - choiceid int(10) unsigned NOT NULL default '0', - `text` text default '', - maxanswers int(10) unsigned NULL default '0', - timemodified int(10) NOT NULL default '0', - PRIMARY KEY (id), - UNIQUE KEY id (id), - KEY choiceid (choiceid) -) TYPE=MyISAM; - -# -# Dumping data for table `log_display` -# - -INSERT INTO prefix_log_display VALUES ('choice', 'view', 'choice', 'name'); -INSERT INTO prefix_log_display VALUES ('choice', 'update', 'choice', 'name'); -INSERT INTO prefix_log_display VALUES ('choice', 'add', 'choice', 'name'); -INSERT INTO prefix_log_display VALUES ('choice', 'report', 'choice', 'name'); -INSERT INTO prefix_log_display VALUES ('choice', 'choose', 'choice', 'name'); -INSERT INTO prefix_log_display VALUES ('choice', 'choose again', 'choice', 'name'); - - +# phpMyAdmin MySQL-Dump +# version 2.2.1 +# http://phpwizard.net/phpMyAdmin/ +# http://phpmyadmin.sourceforge.net/ (download page) +# +# Host: localhost +# Generation Time: Nov 14, 2001 at 04:44 PM +# Server version: 3.23.36 +# PHP Version: 4.0.6 +# Database : `moodle` +# -------------------------------------------------------- + +# +# Table structure for table `choice` +# + +CREATE TABLE prefix_choice ( + id int(10) unsigned NOT NULL auto_increment, + course int(10) unsigned NOT NULL default '0', + name varchar(255) NOT NULL default '', + text text NOT NULL default '', + format tinyint(2) unsigned NOT NULL default '0', + publish tinyint(2) unsigned NOT NULL default '0', + showresults tinyint(2) unsigned NOT NULL default '0', + display tinyint(4) unsigned NOT NULL default '0', + allowupdate tinyint(2) unsigned NOT NULL default '0', + showunanswered tinyint(2) unsigned NOT NULL default '0', + limitanswers tinyint(2) unsigned NOT NULL default '0', + timeopen int(10) unsigned NOT NULL default '0', + timeclose int(10) unsigned NOT NULL default '0', + timemodified int(10) unsigned NOT NULL default '0', + PRIMARY KEY (id), + UNIQUE KEY id (id), + KEY course (course) +) TYPE=MyISAM COMMENT='Available choices are stored here.'; + + +# -------------------------------------------------------- + +# +# Table structure for table `choice_answers` +# + +CREATE TABLE prefix_choice_answers ( + id int(10) unsigned NOT NULL auto_increment, + choiceid int(10) unsigned NOT NULL default '0', + userid int(10) unsigned NOT NULL default '0', + optionid int(10) NOT NULL default '0', + timemodified int(10) NOT NULL default '0', + PRIMARY KEY (id), + UNIQUE KEY id (id), + KEY userid (userid), + KEY choiceid (choiceid) +) TYPE=MyISAM; + + +# -------------------------------------------------------- + +# +# Table structure for table `choice_options` +# + +CREATE TABLE prefix_choice_options ( + id int(10) unsigned NOT NULL auto_increment, + choiceid int(10) unsigned NOT NULL default '0', + `text` text default '', + maxanswers int(10) unsigned NULL default '0', + timemodified int(10) NOT NULL default '0', + PRIMARY KEY (id), + UNIQUE KEY id (id), + KEY choiceid (choiceid) +) TYPE=MyISAM; + +# +# Dumping data for table `log_display` +# + +INSERT INTO prefix_log_display VALUES ('choice', 'view', 'choice', 'name'); +INSERT INTO prefix_log_display VALUES ('choice', 'update', 'choice', 'name'); +INSERT INTO prefix_log_display VALUES ('choice', 'add', 'choice', 'name'); +INSERT INTO prefix_log_display VALUES ('choice', 'report', 'choice', 'name'); +INSERT INTO prefix_log_display VALUES ('choice', 'choose', 'choice', 'name'); +INSERT INTO prefix_log_display VALUES ('choice', 'choose again', 'choice', 'name'); + + diff --git a/mod/choice/db/postgres7.php b/mod/choice/db/postgres7.php index 275c00e9de7..57220443357 100644 --- a/mod/choice/db/postgres7.php +++ b/mod/choice/db/postgres7.php @@ -98,7 +98,9 @@ function choice_upgrade($oldversion) { modify_database('','ALTER TABLE prefix_choice_answers ALTER choiceid SET NOT NULL'); modify_database('','ALTER TABLE prefix_choice_answers ALTER optionid SET NOT NULL'); } - + if ($oldversion < 2006020900) { //rename release column to showanswers - Release is now reserved word in mySql + table_column('choice', 'release', 'showresults', 'TINYINT', '2', 'unsigned', 0, 'not null'); + } return true; } diff --git a/mod/choice/db/postgres7.sql b/mod/choice/db/postgres7.sql index 6edac4fcc36..49b940ecc62 100755 --- a/mod/choice/db/postgres7.sql +++ b/mod/choice/db/postgres7.sql @@ -23,7 +23,7 @@ CREATE TABLE prefix_choice ( showunanswered integer NOT NULL default '0', limitanswers integer NOT NULL default '0', publish integer NOT NULL default '0', - release integer NOT NULL default '0', + showresults integer NOT NULL default '0', display integer NOT NULL default '0', allowupdate integer NOT NULL default '0', timeopen integer NOT NULL default '0', diff --git a/mod/choice/lib.php b/mod/choice/lib.php index c34ac6a83ee..3660a1f9c33 100644 --- a/mod/choice/lib.php +++ b/mod/choice/lib.php @@ -5,10 +5,10 @@ $COLUMN_HEIGHT = 300; define('CHOICE_PUBLISH_ANONYMOUS', '0'); define('CHOICE_PUBLISH_NAMES', '1'); -define('CHOICE_RELEASE_NOT', '0'); -define('CHOICE_RELEASE_AFTER_ANSWER', '1'); -define('CHOICE_RELEASE_AFTER_CLOSE', '2'); -define('CHOICE_RELEASE_ALWAYS', '3'); +define('CHOICE_SHOWRESULTS_NOT', '0'); +define('CHOICE_SHOWRESULTS_AFTER_ANSWER', '1'); +define('CHOICE_SHOWRESULTS_AFTER_CLOSE', '2'); +define('CHOICE_SHOWRESULTS_ALWAYS', '3'); define('CHOICE_DISPLAY_HORIZONTAL', '0'); define('CHOICE_DISPLAY_VERTICAL', '1'); @@ -16,10 +16,10 @@ define('CHOICE_DISPLAY_VERTICAL', '1'); $CHOICE_PUBLISH = array (CHOICE_PUBLISH_ANONYMOUS => get_string('publishanonymous', 'choice'), CHOICE_PUBLISH_NAMES => get_string('publishnames', 'choice')); -$CHOICE_RELEASE = array (CHOICE_RELEASE_NOT => get_string('publishnot', 'choice'), - CHOICE_RELEASE_AFTER_ANSWER => get_string('publishafteranswer', 'choice'), - CHOICE_RELEASE_AFTER_CLOSE => get_string('publishafterclose', 'choice'), - CHOICE_RELEASE_ALWAYS => get_string('publishalways', 'choice')); +$CHOICE_SHOWRESULTS = array (CHOICE_SHOWRESULTS_NOT => get_string('publishnot', 'choice'), + CHOICE_SHOWRESULTS_AFTER_ANSWER => get_string('publishafteranswer', 'choice'), + CHOICE_SHOWRESULTS_AFTER_CLOSE => get_string('publishafterclose', 'choice'), + CHOICE_SHOWRESULTS_ALWAYS => get_string('publishalways', 'choice')); $CHOICE_DISPLAY = array (CHOICE_DISPLAY_HORIZONTAL => get_string('displayhorizontal', 'choice'), CHOICE_DISPLAY_VERTICAL => get_string('displayvertical','choice')); diff --git a/mod/choice/mod.html b/mod/choice/mod.html index e76741f0bb9..c4ebcb1b299 100644 --- a/mod/choice/mod.html +++ b/mod/choice/mod.html @@ -23,8 +23,8 @@ if (empty($form->publish)) { $form->publish = 0; } - if (empty($form->release)) { - $form->release = 0; + if (empty($form->showresults)) { + $form->showresults = 0; } if (empty($form->allowupdate)) { $form->allowupdate = 0; @@ -256,7 +256,7 @@ $limitfieldlist = trim($limitfieldlist, ",");