Skip to content
Snippets Groups Projects
Commit 24e67e0d authored by Brett Bieber's avatar Brett Bieber
Browse files

Add column to remember if the prototype's alternate view was sent to the client.

parent 11f7636f
No related branches found
No related tags found
No related merge requests found
...@@ -13,6 +13,7 @@ class DesignSurvey_Prototype_sent extends DB_DataObject ...@@ -13,6 +13,7 @@ class DesignSurvey_Prototype_sent extends DB_DataObject
var $id; // int(11) not_null primary_key auto_increment var $id; // int(11) not_null primary_key auto_increment
var $voter_id; // int(11) not_null multiple_key var $voter_id; // int(11) not_null multiple_key
var $prototype_id; // int(11) not_null var $prototype_id; // int(11) not_null
var $viewed_alt; // int(1) not_null
/* ZE2 compatibility trick*/ /* ZE2 compatibility trick*/
function __clone() { return $this;} function __clone() { return $this;}
......
...@@ -48,6 +48,7 @@ id = N ...@@ -48,6 +48,7 @@ id = N
id = 129 id = 129
voter_id = 129 voter_id = 129
prototype_id = 129 prototype_id = 129
viewed_alt = 17
[prototype_sent__keys] [prototype_sent__keys]
id = N id = N
......
...@@ -122,10 +122,12 @@ CREATE TABLE IF NOT EXISTS `prototype_sent` ( ...@@ -122,10 +122,12 @@ CREATE TABLE IF NOT EXISTS `prototype_sent` (
`id` int(11) NOT NULL auto_increment, `id` int(11) NOT NULL auto_increment,
`voter_id` int(11) NOT NULL default '0', `voter_id` int(11) NOT NULL default '0',
`prototype_id` int(11) NOT NULL default '0', `prototype_id` int(11) NOT NULL default '0',
`viewed_alt` tinyint(1) NOT NULL default '0',
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `voter_id` (`voter_id`) KEY `voter_id` (`voter_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1; ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-- -------------------------------------------------------- -- --------------------------------------------------------
-- --
......
...@@ -27,11 +27,12 @@ if ($prototype->get($_GET['id'])) { ...@@ -27,11 +27,12 @@ if ($prototype->get($_GET['id'])) {
break; break;
case 'alt': case 'alt':
$format = 'alt_image'; $format = 'alt_image';
$voter = new Voting_System();
break; break;
} }
header('Content-type: image/png'); header('Content-type: image/png');
echo file_get_contents($image_path.$prototype->$format); echo file_get_contents($image_path.$prototype->$format);
if ($format=='splash_image') { if ($format=='splash_image' || $format == 'alt_image') {
flush(); flush();
$prototype_sent = DB_DataObject::factory('prototype_sent'); $prototype_sent = DB_DataObject::factory('prototype_sent');
$prototype_sent->voter_id = $voter->getVoterId(); $prototype_sent->voter_id = $voter->getVoterId();
...@@ -40,6 +41,12 @@ if ($prototype->get($_GET['id'])) { ...@@ -40,6 +41,12 @@ if ($prototype->get($_GET['id'])) {
$prototype_sent->voter_id = $voter->getVoterId(); $prototype_sent->voter_id = $voter->getVoterId();
$prototype_sent->prototype_id = $prototype->id; $prototype_sent->prototype_id = $prototype->id;
$prototype_sent->insert(); $prototype_sent->insert();
} else {
$prototype_sent->fetch();
}
if ($format == 'alt_image') {
$prototype_sent->viewed_alt = 1;
$prototype_sent->update();
} }
} }
} }
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment