[virtualcommons-svn] SF.net SVN: virtualcommons:[19] vcweb/trunk/virtualcommons
Status: Beta
Brought to you by:
alllee
From: <al...@us...> - 2008-08-01 01:18:59
|
Revision: 19 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=19&view=rev Author: alllee Date: 2008-08-01 01:19:07 +0000 (Fri, 01 Aug 2008) Log Message: ----------- * adding classes via experiment.inc * student login done * initializing groups + students done TODO: actual experiment in forestry_v2.module and teacher_dashboard Modified Paths: -------------- vcweb/trunk/virtualcommons/experiment/experiment.install vcweb/trunk/virtualcommons/experiment/experiment.module vcweb/trunk/virtualcommons/experiment/student_login/student_login.module vcweb/trunk/virtualcommons/games/teacher_dashboard/teacher_dashboard.info vcweb/trunk/virtualcommons/games/teacher_dashboard/teacher_dashboard.install Added Paths: ----------- vcweb/trunk/virtualcommons/experiment/experiment.inc vcweb/trunk/virtualcommons/experiment/init-experiment.sql vcweb/trunk/virtualcommons/experiment/survey-questions.sql vcweb/trunk/virtualcommons/games/forestry_v2/ vcweb/trunk/virtualcommons/games/forestry_v2/forestry_v2.info vcweb/trunk/virtualcommons/games/forestry_v2/forestry_v2.install vcweb/trunk/virtualcommons/games/forestry_v2/forestry_v2.module vcweb/trunk/virtualcommons/games/rules/rules.install Added: vcweb/trunk/virtualcommons/experiment/experiment.inc =================================================================== --- vcweb/trunk/virtualcommons/experiment/experiment.inc (rev 0) +++ vcweb/trunk/virtualcommons/experiment/experiment.inc 2008-08-01 01:19:07 UTC (rev 19) @@ -0,0 +1,201 @@ +<?php + +class Game +{ + private $game_id; + private $exp_id; + private $game_name; + private $teacher_id; + private $experiment_id; + private $stage_id; + private $round_no; + private $no_of_student; + + // FIXME: perhaps this should return a list of games eventually + public function getGameID() + { + $this->game_id=db_result(db_query("Select max(id) from vc_game where users_id=%d",$this->teacher_id)); + return $this->game_id; + } + + public function setExpId($exp_id) + { + $this->exp_id=$exp_id; + + } + + + public function setTeacherId($teacher_id) + { + $this->teacher_id=$teacher_id; + + } + + public function setStageId($stage_no) + { + $this->stage_id=db_result(db_query("select id from vc_stage where vc_experiment_id =%d and stage_no=%d",$this->exp_id,$stage_no)); + + + } + + public function setNoOfStudent($no_of_student) + { + $this->no_of_student=$no_of_student; + + } + + + public function setRoundNo($round_no) + { + $this->round_no=$round_no; + } + + + public function saveGame() + { + + //$this->exp_id=db_result(db_query("Select id from {vc_experiment} where name LIKE '%s'",$this->game_name)); + + + //insert into game table + drupal_set_message(t('game name:'.$this->game_name)); + db_query("Insert into {vc_game} (users_id, vc_experiment_id, no_of_students,vc_stage_id,current_round_no ) values(%d,%d,%d,%d,%d)",$this->teacher_id,$this->exp_id,$this->no_of_student,$this->stage_id,$this->round_no); + + } + + + public function saveGroupStudent($student_array) + { + $turn=array(1,2,3,4,5); + // $prev_group_no=0; + // $temp=-1; + $i=0; + $this->stage_id=db_result(db_query("select vc_stage_id from vc_game where id =%d",$this->game_id)); + foreach ($student_array as $group=>$value) + { + + //drupal_set_message(t('Group Key is: %key<br>' ,array('%key'=>$key))); + db_query("Insert into {vc_group} (group_no,vc_game_id,vc_stage_id) values(%d,%d,%d)",$group,$this->game_id,$this->stage_id); + $i=0; + foreach ($value as $key=>$student_id) + { + //$turn= (int) $turn[$i]; + db_query("Insert into {vc_student} (id,vc_group_id,start_flag,turn_no) values('%s',LAST_INSERT_ID(),false,%d)",$student_id,$turn[$i]); + drupal_set_message(t('Student ID : %stud Turn is: %key<br>'. gettype($turn[$i]) ,array('%stud'=>$student_id,'%key'=>$turn[$i]))); + $i++; + + } + } + + + } + +// FIXME: figure out if we can move to forestry at some point + public function initForestry() + { + $result_group=db_query(" select count(s.vc_group_id) as cnt, s.vc_group_id as group_id from vc_group g, vc_student s where s.vc_group_id=g.id and g.vc_game_id=%d group by s.vc_group_id;",$this->game_id); + + while($data=db_fetch_object($result_group)) + { + $no_of_student=$data->cnt; + $group_no=$data->group_id; + //drupal_set_message(t($no_of_student.' '. $group_no)); + if($no_of_student == 5) + { + db_query("Insert into {vc_forestry_common_resource_pool} (vc_group_id,common_resource_pool,vc_game_id, harvest_decision,max_harvest_decision) values(%d,%d,%d,%d,%d)",$group_no,100,$this->game_id,0,100); + + } + + else if($no_of_student == 4) + { + db_query("Insert into {vc_forestry_common_resource_pool} (vc_group_id,common_resource_pool,vc_game_id, harvest_decision,max_harvest_decision) values(%d,%d,%d,%d,%d)",$group_no,80,$this->game_id,0,80); + } + + + else if($no_of_student == 3) + { + db_query("Insert into {vc_forestry_common_resource_pool} (vc_group_id,common_resource_pool,vc_game_id,harvest_decision,max_harvest_decision) values(%d,%d,%d,%d,%d)",$group_no,60,$this->game_id,0,60); + } + + } + + + } + + public function updateStartFlag($flag) + { + db_query("update vc_student set start_flag=%d where vc_group_id in (select id from vc_group where vc_game_id=%d)",$flag,$this->game_id); + } + + +}//end of class Game + +class Group { + private $game_id; + private $group_id; + private $group_no; + private $no_of_students; + + public function getNumberOfStudents() { + return $this->no_of_students; + } + + public function getGroupId() { + return $this->group_id; + } + + public function getGameId() { + return $this->game_id; + } + + public function getStartFlag($student_id) { + return db_result(db_query("SELECT start_flag FROM {vc_student} WHERE id='%s'",$student_id)); + } + + public function getCurrentStageNumber() { + return db_result(db_query("SELECT s.stage_no FROM {vc_game g, vc_stage s} WHERE g.vc_stage_id=s.id AND g.id=%d", $this->game_id)); + } + + public function getCurrentRuleNumber() { + return db_result(db_query("SELECT r.rule_no FROM {vc_rules r, vc_group g} WHERE r.id=g.vc_selected_rules_id AND g.id=%d", $this->group_id)); + } + + public static function checkStudentId($studentId) { + $fetch_object = db_fetch_object(db_query("SELECT g.id AS group_id, g.vc_game_id AS game_id from {vc_student s, vc_group g} where s.id='%s' AND s.vc_group_id=g.id",$studentId)); + if ($fetch_object) { + $group = new Group(); + $group->game_id = $fetch_object->game_id; + $group->group_id = $fetch_object->group_id; + $group->no_of_students = db_result(db_query("SELECT count(*) FROM vc_student WHERE vc_group_id=%d", $group->group_id)); + return $group; + } + return false; + } + +} + + + + + +/*class Student + { + private $teacher_id; + private $stud_id; + private $start_flag; + private $group_id; + private $turn_no; + + function public getStartFlag() + { + return $this->start_flag; + } + + function public getTurnNo() + { + return $this->turn_no; + } + + + + }*/ Modified: vcweb/trunk/virtualcommons/experiment/experiment.install =================================================================== --- vcweb/trunk/virtualcommons/experiment/experiment.install 2008-07-30 22:59:46 UTC (rev 18) +++ vcweb/trunk/virtualcommons/experiment/experiment.install 2008-08-01 01:19:07 UTC (rev 19) @@ -25,40 +25,33 @@ no_of_practice_rounds INT DEFAULT 0, vc_experiment_id INT NOT NULL, - PRIMARY KEY(id), - + PRIMARY KEY(id), FOREIGN KEY (vc_experiment_id) REFERENCES vc_experiment(id) ON DELETE CASCADE - ) ENGINE=InnoDB /*!40100 DEFAULT CHARACTER SET UTF8 */"); db_query("CREATE TABLE {vc_rules} ( id INT AUTO_INCREMENT, rule_no INT NOT NULL, vc_stage_id INT NOT NULL, - rule_description TEXT, + description MEDIUMTEXT, name enum('Lottery', 'Rotation', 'Property Rights'), - PRIMARY KEY(id), - + PRIMARY KEY(id), FOREIGN KEY (vc_stage_id) REFERENCES vc_stage(id) ON DELETE CASCADE - ) ENGINE=InnoDB /*!40100 DEFAULT CHARACTER SET UTF8 */"); db_query("CREATE TABLE {vc_game} ( id INT AUTO_INCREMENT, users_id INT NOT NULL, vc_experiment_id INT NOT NULL, - date_created TIMESTAMP NOT NULL, no_of_students INT NOT NULL, vc_stage_id INT NOT NULL, current_round_no INT NOT NULL, + date_created TIMESTAMP NOT NULL, - PRIMARY KEY(id), - + PRIMARY KEY(id), FOREIGN KEY(vc_experiment_id) REFERENCES vc_experiment(id) ON DELETE CASCADE, - FOREIGN KEY(vc_stage_id) REFERENCES vc_stage(id) - ) ENGINE=InnoDB /*!40100 DEFAULT CHARACTER SET UTF8 */"); db_query("CREATE TABLE {vc_group} @@ -69,225 +62,116 @@ vc_stage_id INT NOT NULL, vc_selected_rules_id INT NULL, - PRIMARY KEY(id), - + PRIMARY KEY(id), FOREIGN KEY(vc_game_id) REFERENCES vc_game(id), FOREIGN KEY(vc_stage_id) REFERENCES vc_stage(id), FOREIGN KEY(vc_selected_rules_id) REFERENCES vc_rules(id) - - ) ENGINE=InnoDB /*!40100 DEFAULT CHARACTER SET UTF8 */"); db_query("CREATE TABLE {vc_student} ( id varchar(14), vc_group_id INT NOT NULL, - vc_game_id INT NOT NULL, + start_flag BOOL default false, turn_no INT NOT NULL, PRIMARY KEY(id), + FOREIGN KEY(vc_group_id) REFERENCES vc_group(id) - - FOREIGN KEY(vc_group_id) REFERENCES vc_group(id), - FOREIGN KEY(vc_game_id) REFERENCES vc_game(id) - ) ENGINE=InnoDB /*!40100 DEFAULT CHARACTER SET UTF8 */"); - db_query("CREATE TABLE {vc_forestry_common_resource_pool} - ( - id INT AUTO_INCREMENT, - vc_group_id INT NOT NULL, - common_resource_pool INT NOT NULL, - harvest_decision INT NOT NULL, - vc_game_id INT NOT NULL, - max_harvest_decision INT NOT NULL, + - PRIMARY KEY(id), - FOREIGN KEY(vc_group_id) REFERENCES vc_group(id) - ON DELETE CASCADE, +db_query("insert into {vc_experiment} (name) values('Fishery Game')"); +db_query("insert into {vc_experiment} (name) values('Forestry Game')"); +db_query("insert into {vc_experiment} (name) values('Water Irrigation Game')"); - FOREIGN KEY(vc_game_id) REFERENCES vc_game(id) - ON DELETE CASCADE +db_query("insert into { vc_stage} (stage_no,vc_experiment_id,no_of_rounds,voting,no_of_practice_rounds) values(1,1,10,false,3)"); +db_query("insert into { vc_stage} (stage_no,vc_experiment_id,no_of_rounds,voting,no_of_practice_rounds) values(2,1,10,true,0)"); +db_query("insert into { vc_stage} (stage_no,vc_experiment_id,no_of_rounds,voting,no_of_practice_rounds) values(1,2,10,false,3)"); +db_query("insert into { vc_stage} (stage_no,vc_experiment_id,no_of_rounds,voting,no_of_practice_rounds) values(2,2,10,true,0)"); +db_query("insert into { vc_stage} (stage_no,vc_experiment_id,no_of_rounds,voting,no_of_practice_rounds) values(1,3,10,false,3)"); +db_query("insert into { vc_stage} (stage_no,vc_experiment_id,no_of_rounds,voting,no_of_practice_rounds) values(2,3,10,true,0)"); +db_query("insert into { vc_rules} (vc_stage_id,rule_no,name,description) values(2,1,'Lottery','With this rule the computer draws randomly for each player a location the player is allowed to fish. We throw a virtual dice to see whether an inspector (when a 6 is thrown) come to the region and to check on your locations. When you harvest in a location which you are not allowed to, you have to pay back the harvest points. For example if the player harvests in the place A with 2 effort units when the allowed place to fish is B and the dice yield 6, the player pays back the harvest.')"); +db_query("insert into { vc_rules} (vc_stage_id,rule_no,name,description) values(2,2,'Rotation','Only one location is allowed to be fished in each round. There is a rotation +AABBAABBAABBAA of a ban where you are not allowed to harvest. It means that: +Round 1 ban in A +Round 2 ban in A +Round 3 ban in B +Round 4 ban in B +Round 5 ban in A +Round 6 ban in A +Round 7 ban in B +Round 8 ban in B +Round 9 ban in A +Round 10 ban in A +Thus in the forth round you are not allowed to harvest in location A. When you harvest, but are not allowed to, the throwing of a virtual dice determines whether you need to pay a penalty. If we throw a six, the penalty is to return back the harvest plus.')"); +db_query("insert into { vc_rules} (vc_stage_id,rule_no,name,description) values(2,3,'Property Rights','Each of you can put an effort of 0 or 1 per round. We throw a virtual dice every round. If we throw a six, an inspector comes to the region to check on your effort levels. If a participant writes 2 units of effort on its game card, and the inspector is present, the participant does not get the points it wrote down on its decision sheet.')"); +db_query("insert into { vc_rules} (vc_stage_id,rule_no,name,description) values(4,1,'Lottery','With this rule only two participants can harvest each round. Who is allowed to harvest is determined by drawing two cards with players numbers. The instructor writes down the player numbers who are allowed on the board. When someone harvest, but is not allowed to, this participant may get a penalty. Every round we throw a dice after the decisions are made. If we throw a six an inspector is in the forest and will catch the rule breakers, the participants who harvested in a turn it was not allowed to. In that case the participant has to payback the harvest plus an extra 3 units. If the dice shows any other number everybody keeps its earnings and we pass to the next round.')"); +db_query("insert into { vc_rules} (vc_stage_id,rule_no,name,description) values(4,2,'Rotation','With this rule each participant will have its turn to extract forest unit. Only two participants can harvest each round. In this way it will be a rotation scheme to extract forest units. Each participant will be assigned randomly a turn card to extract forest units: The extraction order is: +Round 1: extracts wood the player A, B +Round 2 extracts wood the player C, D +Round 3: extracts wood the player E, A +Round 4: extracts wood the player B, C +Round 5: extracts wood the player D, E +Round 6: extracts wood the player A, B +Round 7: extracts wood the player C, D +Round 8 extracts wood the player E, A +Round 9: extracts wood the player B, C +Round 10: extracts wood the player D, E +If this rule is chosen, players get randomly a character A, B, C, D or E. player 1 may for example get turn D. - )ENGINE=InnoDB /*!40100 DEFAULT CHARACTER SET UTF8 */"); +When someone harvest, but is not allowed to, this participant may get a penalty. Every round we throw a dice after the decisions are made. If we throw a six an inspector is in the forest and will catch the rule breakers, the participants who harvested in a turn it was not allowed to. In that case the participant has to payback the harvest plus an extra 3 units. So, if participant whose turn is A is writing down on the decision sheet to harvest 3 units when only the player with turn C is allowed to harvest, we throw a dice, and when we throw a six, participant with turn A do not get the points on its decision sheet, and we subtract an extra 3 from the total collected points of player with turn A. If the dice shows any other number everybody keeps its earnings and we pass to the next round. +')"); +db_query("insert into { vc_rules} (vc_stage_id,rule_no,name,description) values(4,3,'Property Rights','Each of you can harvest legally 0, 1 or 2 units per round. If a participant types a higher amount than 2, he or she can be caught by the inspector and has to pay a penalty. In every round we throw a virtual dice. And when we throw a six, and the participants who harvest more than 2 units in that round, do not get the points it wrote down on its game card, and we subtract an extra 3 points from it’s total so far.')"); +db_query("insert into { vc_rules} (vc_stage_id,rule_no,name,description) values(6,1,'Lottery','In this rule we draw for each round, after you have contributed to the maintenance of the irrigation system, the order in which you can take water for irrigation will be assigned randomly.')"); +db_query("insert into { vc_rules} (vc_stage_id,rule_no,name,description) values(6,2,'Rotation','There will be a fixed rotation in which you can collect water. This order is a 5 round rotation system: +Round 1: ABCDE +Round 2: BCDEA +Round 3: CDEAB +Round 4: DEABC +Round 5: EABCD +Round 6: ABCDE +Round 7: BCDEA +Round 8: CDEAB +Round 9: DEABC +Round 10: EABCD')"); +db_query("insert into { vc_rules} (vc_stage_id,rule_no,name,description) values(6,3,'Property Rights','Each of you has a right of 20% of the water of the irrigation system. This amount is calculated after the available water is announced. The order to extract water remains the same for all the rounds: ABCDE. A virtual dice is thrown in each round. When 6 is thrown, an inspector arrives to the irrigation system and will check the water extraction. The player who takes more than the 20% share pays back the extra amount taken, and an extra amount of 6 units.')"); + $flag=TRUE; - - //Forestry Game Harvest Tables. - db_query("CREATE TABLE {vc_forestry_5player_harvest_table} ( - id INT AUTO_INCREMENT, - min_resource_level INT NOT NULL, - max_resource_level INT NOT NULL, - individual_harvest_level INT NOT NULL, + break; + case 'pgsql': + db_query("CREATE TABLE {vc_student} ( - PRIMARY KEY(id) + id varchar(14) NOT NULL, + group_id INT NOT NULL, + vc_game_id INT NOT NULL, - )ENGINE=InnoDB /*!40100 DEFAULT CHARACTER SET UTF8 */"); + PRIMARY KEY(id), + FOREIGN KEY(vc_game_id) REFERENCES vc_game(id) + ON DELETE CASCADE + )"); + $flag=TRUE; - db_query("INSERT INTO {vc_forestry_5player_harvest_table} (min_resource_level,max_resource_level,individual_harvest_level) values(25,100,5)"); - db_query("INSERT INTO {vc_forestry_5player_harvest_table} (min_resource_level,max_resource_level,individual_harvest_level) values(20,24,4)"); - db_query("INSERT INTO {vc_forestry_5player_harvest_table} (min_resource_level,max_resource_level,individual_harvest_level) values(15,19,3)"); - db_query("INSERT INTO {vc_forestry_5player_harvest_table} (min_resource_level,max_resource_level,individual_harvest_level) values(10,14,2)"); - db_query("INSERT INTO {vc_forestry_5player_harvest_table} (min_resource_level,max_resource_level,individual_harvest_level) values(5,9,1)"); - db_query("INSERT INTO {vc_forestry_5player_harvest_table} (min_resource_level,max_resource_level,individual_harvest_level) values(0,4,0)"); - - db_query("CREATE TABLE {vc_forestry_4player_harvest_table} ( - id INT AUTO_INCREMENT, - min_resource_level INT NOT NULL, - max_resource_level INT NOT NULL, - individual_harvest_level INT NOT NULL, - - PRIMARY KEY(id) - - )ENGINE=InnoDB /*!40100 DEFAULT CHARACTER SET UTF8 */"); - - - db_query("INSERT INTO {vc_forestry_4player_harvest_table} (min_resource_level,max_resource_level,individual_harvest_level) values(20,80,5)"); - db_query("INSERT INTO {vc_forestry_4player_harvest_table} (min_resource_level,max_resource_level,individual_harvest_level) values(16,19,4)"); - db_query("INSERT INTO {vc_forestry_4player_harvest_table} (min_resource_level,max_resource_level,individual_harvest_level) values(12,15,3)"); - db_query("INSERT INTO {vc_forestry_4player_harvest_table} (min_resource_level,max_resource_level,individual_harvest_level) values(8,11,2)"); - db_query("INSERT INTO {vc_forestry_4player_harvest_table} (min_resource_level,max_resource_level,individual_harvest_level) values(4,7,1)"); - db_query("INSERT INTO {vc_forestry_4player_harvest_table} (min_resource_level,max_resource_level,individual_harvest_level) values(0,3,0)"); - - db_query("CREATE TABLE {vc_forestry_3player_harvest_table} ( - id INT AUTO_INCREMENT, - min_resource_level INT NOT NULL, - max_resource_level INT NOT NULL, - individual_harvest_level INT NOT NULL, - - PRIMARY KEY(id) - - )ENGINE=InnoDB /*!40100 DEFAULT CHARACTER SET UTF8 */"); - - db_query("INSERT INTO {vc_forestry_3player_harvest_table} (min_resource_level,max_resource_level,individual_harvest_level) values(15,60,5)"); - db_query("INSERT INTO {vc_forestry_3player_harvest_table} (min_resource_level,max_resource_level,individual_harvest_level) values(12,14,4)"); - db_query("INSERT INTO {vc_forestry_3player_harvest_table} (min_resource_level,max_resource_level,individual_harvest_level) values(9,11,3)"); - db_query("INSERT INTO {vc_forestry_3player_harvest_table} (min_resource_level,max_resource_level,individual_harvest_level) values(6,8,2)"); - db_query("INSERT INTO {vc_forestry_3player_harvest_table} (min_resource_level,max_resource_level,individual_harvest_level) values(3,5,1)"); - db_query("INSERT INTO {vc_forestry_3player_harvest_table} (min_resource_level,max_resource_level,individual_harvest_level) values(0,2,0)"); - - - $flag=TRUE; - - break; - case 'pgsql': - db_query("CREATE TABLE {vc_student} ( - - id varchar(14) NOT NULL, - group_id INT NOT NULL, - vc_game_id INT NOT NULL, - - PRIMARY KEY(id), - - FOREIGN KEY(vc_game_id) REFERENCES vc_game(id) - ON DELETE CASCADE - )"); - - //Forestry Game Harvest Tables. - db_query("CREATE TABLE {vc_forestry_5player_harvest_table} ( - id INT NOT NULL AUTO_INCREMENT, - min_resource_level INT NOT NULL, - max_resource_level INT NOT NULL, - individual_harvest_level INT NOT NULL, - - PRIMARY KEY(id) - - ) /*!40100 DEFAULT CHARACTER SET UTF8 */"); - - - db_query("INSERT INTO {vc_forestry_5player_harvest_table} (min_resource_level,max_resource_level,individual_harvest_level) values(25,100,5)"); - db_query("INSERT INTO {vc_forestry_5player_harvest_table} (min_resource_level,max_resource_level,individual_harvest_level) values(20,24,4)"); - db_query("INSERT INTO {vc_forestry_5player_harvest_table} (min_resource_level,max_resource_level,individual_harvest_level) values(15,19,3)"); - db_query("INSERT INTO {vc_forestry_5player_harvest_table} (min_resource_level,max_resource_level,individual_harvest_level) values(10,14,2)"); - db_query("INSERT INTO {vc_forestry_5player_harvest_table} (min_resource_level,max_resource_level,individual_harvest_level) values(5,9,1)"); - db_query("INSERT INTO {vc_forestry_5player_harvest_table} (min_resource_level,max_resource_level,individual_harvest_level) values(0,4,0)"); - - - - db_query("CREATE TABLE {vc_forestry_4player_harvest_table} ( - id INT NOT NULL AUTO_INCREMENT, - min_resource_level INT NOT NULL, - max_resource_level INT NOT NULL, - individual_harvest_level INT NOT NULL, - - PRIMARY KEY(id) - - ) /*!40100 DEFAULT CHARACTER SET UTF8 */"); - - - db_query("INSERT INTO {vc_forestry_4player_harvest_table} (min_resource_level,max_resource_level,individual_harvest_level) values(20,80,5)"); - db_query("INSERT INTO {vc_forestry_4player_harvest_table} (min_resource_level,max_resource_level,individual_harvest_level) values(16,19,4)"); - db_query("INSERT INTO {vc_forestry_4player_harvest_table} (min_resource_level,max_resource_level,individual_harvest_level) values(12,15,3)"); - db_query("INSERT INTO {vc_forestry_4player_harvest_table} (min_resource_level,max_resource_level,individual_harvest_level) values(8,11,2)"); - db_query("INSERT INTO {vc_forestry_4player_harvest_table} (min_resource_level,max_resource_level,individual_harvest_level) values(4,7,1)"); - db_query("INSERT INTO {vc_forestry_4player_harvest_table} (min_resource_level,max_resource_level,individual_harvest_level) values(0,3,0)"); - - - - - db_query("CREATE TABLE {vc_forestry_3player_harvest_table} ( - id INT NOT NULL AUTO_INCREMENT, - min_resource_level INT NOT NULL, - max_resource_level INT NOT NULL, - individual_harvest_level INT NOT NULL, - - PRIMARY KEY(id) - - ) /*!40100 DEFAULT CHARACTER SET UTF8 */"); - - db_query("INSERT INTO {vc_forestry_3player_harvest_table} (min_resource_level,max_resource_level,individual_harvest_level) values(15,60,5)"); - db_query("INSERT INTO {vc_forestry_3player_harvest_table} (min_resource_level,max_resource_level,individual_harvest_level) values(12,14,4)"); - db_query("INSERT INTO {vc_forestry_3player_harvest_table} (min_resource_level,max_resource_level,individual_harvest_level) values(9,11,3)"); - db_query("INSERT INTO {vc_forestry_3player_harvest_table} (min_resource_level,max_resource_level,individual_harvest_level) values(6,8,2)"); - db_query("INSERT INTO {vc_forestry_3player_harvest_table} (min_resource_level,max_resource_level,individual_harvest_level) values(3,5,1)"); - db_query("INSERT INTO {vc_forestry_3player_harvest_table} (min_resource_level,max_resource_level,individual_harvest_level) values(0,2,0)"); - - //assign the students turn for stage 2 of forestry - db_query("CREATE TABLE {vc_forestry_student_turn} ( - id INT NOT NULL AUTO_INCREMENT, - vc_student_id varchar(14) NOT NULL, - vc_stage_id INT NOT NULL, - vc_student_group_id INT NOT NULL, - - - PRIMARY KEY(id), - - FOREIGN KEY(vc_student_id) REFERENCES vc_student(id) - ON DELETE CASCADE, - - FOREIGN KEY(vc_stage_id) REFERENCES vc_stage(id) - ON DELETE CASCADE, - - FOREIGN KEY(vc_student_group_id) REFERENCES vc_student(group_id) - ON DELETE CASCADE - - - ) /*!40100 DEFAULT CHARACTER SET UTF8 */"); - - - - $flag=TRUE; - - - - break; - default: - drupal_set_message(t('Unsupported Database')); + break; + default: + drupal_set_message(t('Unsupported Database')); } if($flag) { - drupal_set_message(t('Experiment core tables is successfully created.')); + drupal_set_message(t('Experiment core tables successfully created.')); } else { - drupal_set_message(t('Experiment core tables is NOT successfully created.'),'error'); + drupal_set_message(t('Experiment core tables NOT created.'),'error'); } } @@ -296,17 +180,13 @@ */ function experiment_uninstall() { - db_query("DROP TABLE {vc_forestry_3player_harvest_table}"); - db_query("DROP TABLE {vc_forestry_4player_harvest_table}"); - db_query("DROP TABLE {vc_forestry_5player_harvest_table}"); + db_query("DROP TABLE {vc_student}"); + db_query("DROP TABLE {vc_group}"); + + db_query("DROP TABLE {vc_game}"); + db_query("DROP TABLE {vc_rules}"); + db_query("DROP TABLE {vc_stage}"); + db_query("DROP TABLE {vc_experiment}"); - db_query("DROP TABLE {vc_forestry_common_resource_pool}"); - db_query("DROP TABLE {vc_student}"); - db_query("DROP TABLE {vc_group}"); - db_query("DROP TABLE {vc_game}"); - db_query("DROP TABLE {vc_rules}"); - db_query("DROP TABLE {vc_stage}"); - db_query("DROP TABLE {vc_experiment}"); - - drupal_set_message(t('Experiment core tables were successfully deleted from the database. We hope.')); + drupal_set_message(t('Experiment core tables were successfully deleted from the database. We hope.')); } Modified: vcweb/trunk/virtualcommons/experiment/experiment.module =================================================================== --- vcweb/trunk/virtualcommons/experiment/experiment.module 2008-07-30 22:59:46 UTC (rev 18) +++ vcweb/trunk/virtualcommons/experiment/experiment.module 2008-08-01 01:19:07 UTC (rev 19) @@ -2,8 +2,9 @@ // vim:sts=2:sw=2:filetype=php // $Id$ -//$path=drupal_get_filename('module', 'virtualcommons'); -//include('teacher.php'); // or require etc. +//$path=drupal_get_filename('module', 'vcweb'); +//ini_set('include_path', '.:/classes'); +include_once ('experiment.inc'); // or require etc. //include('sites/all/modules/virtualcommons/experiment/class_files/teacher.php'); /** @@ -40,13 +41,13 @@ 'type'=>MENU_CALLBACK, 'access' => user_access('Only Teachers') ); - $items[]=array( 'path' => 'game_start', + /* $items[]=array( 'path' => 'game_start', // 'title' => t('Forestry Game - Stage 1'), 'callback'=>'game_start', // 'callback argument' => array('forestry_game_stage1_part2'), 'type'=>MENU_CALLBACK, 'access' => user_access('Only Teachers') - ); + );*/ } return $items; } @@ -147,8 +148,17 @@ { $teacher_id=$GLOBALS['user']->uid; $game_name=$form_values['games']; - $no_student=$form_values['no_student']; - if(!isset($_SESSION['no_of_student'])) + $no_student=(int) $form_values['no_student']; + + $game=new Game(); + $game->setExpId($game_name); + $game->setTeacherId($teacher_id); + $game->setStageId(1); + $game->setNoOfStudent($no_student); + $game->setRoundNo(1); + $game->saveGame(); + + if(!isset($_SESSION['no_of_student'])) { $_SESSION['no_student']=$no_student; } @@ -160,7 +170,7 @@ } - //Fishery + /* //Fishery if($game_name==1) { $result=db_result(db_query("Select id from {virtualcommons_experiments} where exp_name LIKE '%%Fishery%%' ")); @@ -184,7 +194,8 @@ drupal_set_message(t('Thanks for filling out the form. Your Game will start soon. ')); - db_query("Insert into {virtualcommons_conducts} (users_id, virtualcommons_experiments_id ,date, no_of_students ) values(%d,%d,NOW(),%d)",$teacher_id,$result,$no_student); + //db_query("Insert into {virtualcommons_conducts} (users_id, virtualcommons_experiments_id ,date, no_of_students ) values(%d,%d,NOW(),%d)",$teacher_id,$result,$no_student); + //echo 'Thanks for filling out the form. Your Game will start soon,'. $fname; return 'studentgroup'; } @@ -263,47 +274,54 @@ $var=10; $group_no=1; + // FIXME: duplicated algorithm for generating student ids if($groups_5 <> 0) { for($i=0;$i<$groups_5;$i++) { + $groupArray = array(); for($j=0;$j<5;$j++) { $stud_id=uniqid(rand(0,9), false); $row[]=array('Group '.$group_no,$stud_id); - $row_submit[]=array($group_no,$stud_id); + $groupArray[] = $stud_id; - } +// $row_submit[]=array($group_no,$stud_id); - $group_no++; + } + $row_submit[$group_no++] = $groupArray; } } if($groups_4 <> 0) { for($i=0;$i<$groups_4;$i++) { + $groupArray = array(); for($j=0;$j<4;$j++) { $stud_id=uniqid(rand(0,9),false); $row[]=array('Group '.$group_no,$stud_id); - $row_submit[]=array($group_no,$stud_id); + $groupArray[] = $stud_id; +// $row_submit[]=array($group_no,$stud_id); } - $group_no++; + $row_submit[$group_no++] = $groupArray; } } if($groups_3 <> 0) { for($i=0;$i<$groups_3;$i++) { + $groupArray = array(); for($j=0;$j<3;$j++) { $stud_id=uniqid(rand(0,9), false); $row[]=array('Group '.$group_no,$stud_id); - $row_submit[]=array($group_no,$stud_id); + $groupArray[] = $stud_id; +// $row_submit[]=array($group_no,$stud_id); } - $group_no++; + $row_submit[$group_no++] = $groupArray; } } @@ -363,54 +381,21 @@ } - +// invoked after groups have already been created and the teacher clicks +// "start game" function studentgroup_submit($form_id, $form_values) { //put it in the database student $id=$GLOBALS['user']->uid; $table=$_SESSION['student_info']; - $virtual_conduct_id=db_result(db_query("select max(id),users_id from {virtualcommons_conducts} where users_id=%d group by users_id",$id)); - $turn=array('1','2','3','4','5'); - $prev_group_no=0; - $temp=-1; - $i=0; - foreach ($table as $key=>$value) - { - drupal_set_message(t('Key is: %key<br>',array('%key'=>$i))); - foreach ($value as $key=>$value) - { + $game=new Game(); + $game->setTeacherId($id); + $virtual_conduct_id=$game->getGameID(); + $game->saveGroupStudent($table); - if($key==0) - { - $group_no=$value; - if($temp <> $group_no) - { - $temp=$group_no; - $i=0; - } - - - } - else if($key==1) - { - $stud_id=$value; - drupal_set_message(t('Group Id is %group Student id is: %value Turn id is %turn',array('%turn'=>$turn[$i],'%value'=>$stud_id,'%group'=>$group_no))); - db_query("Insert into {virtualcommons_student} (id,group_no,virtualcommons_conducts_id,start_flag,turn_no) values('%s',%d,%d,false,%d)",$stud_id,$group_no,$virtual_conduct_id,$turn[$i]); - - - /* db_query("insert into {virtualcommons_forestry_student_turn} - (turn_no,virtualcommons_student_id,virtualcommons_stage_id,virtualcommons_student_group_no) - values('%s','%s',2,%d)",$turn[$i],$stud_id,$group_no);*/ - - $i++; - - } - - } - } - + //depending upon the experiment game, assign the resource table to each group. $exp_name=$_SESSION['game_name']; if($exp_name==1) @@ -422,35 +407,9 @@ else if($exp_name==2) { //$exp_name="Forestry Game"; - $result_group=db_query("select count(group_no) AS cnt,group_no from {virtualcommons_student} where virtualcommons_conducts_id= %d group by group_no",$virtual_conduct_id); - - while($data=db_fetch_object($result_group)) - { - $no_of_student=$data->cnt; - $group_no=$data->group_no; - //drupal_set_message(t($no_of_student.' '. $group_no)); - if($no_of_student == 5) - { - db_query("Insert into {virtualcommons_forestry_common_resource_pool} (virtualcommons_student_group_no,common_resource_pool,virtualcommons_conducts_id, harvest_decision,max_harvest_decision) - values(%d,%d,%d,%d,%d)",$group_no,100,$virtual_conduct_id,0,100); - - } - - else if($no_of_student == 4) - { - db_query("Insert into {virtualcommons_forestry_common_resource_pool} (virtualcommons_student_group_no,common_resource_pool,virtualcommons_conducts_id, harvest_decision,max_harvest_decision) - values(%d,%d,%d,%d,%d)",$group_no,80,$virtual_conduct_id,0,80); - } - - - else if($no_of_student == 3) - { - db_query("Insert into {virtualcommons_forestry_common_resource_pool} (virtualcommons_student_group_no,common_resource_pool,virtualcommons_conducts_id, harvest_decision,max_harvest_decision) values(%d,%d,%d,%d,%d)",$group_no,60,$virtual_conduct_id,0,60); - } - - } - + $game->initForestry(); } + else if($exp_name==3) { $exp_name="Water Irrigation Game"; @@ -458,15 +417,19 @@ unset($_SESSION['student_info']); unset($_SESSION['game_name']); + + //set flag=1 in vc_student and allow them to play + $flag=1; + $game->updateStartFlag($flag); - return 'game_start'; + return 'teacher_dashboard'; } -function game_start() +/*function game_start() { $output=t('Please click the Start Game button.'); $output.=drupal_get_form('game_start_form'); @@ -490,5 +453,5 @@ db_query("update virtualcommons_student set start_flag=true where virtualcommons_conducts_id=%d",$virtual_conduct_id); return 'teacher_dashboard'; -} +}*/ Added: vcweb/trunk/virtualcommons/experiment/init-experiment.sql =================================================================== --- vcweb/trunk/virtualcommons/experiment/init-experiment.sql (rev 0) +++ vcweb/trunk/virtualcommons/experiment/init-experiment.sql 2008-08-01 01:19:07 UTC (rev 19) @@ -0,0 +1,62 @@ +db_query("insert into {vc_experiment} (name) values('Fishery Game')"); +db_query("insert into {vc_experiment} (name) values('Forestry Game')"); +db_query("insert into {vc_experiment} (name) values('Water Irrigation Game')"); + +db_query("insert into { vc_stage} (stage_no,vc_experiment_id,no_of_rounds,voting,no_of_practice_rounds) values(1,1,10,'No',3)"); +db_query("insert into { vc_stage} (stage_no,vc_experiment_id,no_of_rounds,voting,no_of_practice_rounds) values(2,1,10,'Yes',0)"); +db_query("insert into { vc_stage} (stage_no,vc_experiment_id,no_of_rounds,voting,no_of_practice_rounds) values(1,2,10,'No',3)"); +db_query("insert into { vc_stage} (stage_no,vc_experiment_id,no_of_rounds,voting,no_of_practice_rounds) values(2,2,10,'Yes',0)"); +db_query("insert into { vc_stage} (stage_no,vc_experiment_id,no_of_rounds,voting,no_of_practice_rounds) values(1,3,10,'No',3)"); +db_query("insert into { vc_stage} (stage_no,vc_experiment_id,no_of_rounds,voting,no_of_practice_rounds) values(2,3,10,'Yes',0)"); + +db_query("insert into { vc_rules} (vc_stage_id,rule_no,name,description) values(1,1,'Lottery','With this rule the computer draws randomly for each player a location the player is allowed to fish. We throw a virtual dice to see whether an inspector (when a 6 is thrown) come to the region and to check on your locations. When you harvest in a location which you are not allowed to, you have to pay back the harvest points. For example if the player harvests in the place A with 2 effort units when the allowed place to fish is B and the dice yield 6, the player pays back the harvest.')"); +db_query("insert into { vc_rules} (vc_stage_id,rule_no,name,description) values(1,2,'Rotation','Only one location is allowed to be fished in each round. There is a rotation +AABBAABBAABBAA of a ban where you are not allowed to harvest. It means that: +Round 1 ban in A +Round 2 ban in A +Round 3 ban in B +Round 4 ban in B +Round 5 ban in A +Round 6 ban in A +Round 7 ban in B +Round 8 ban in B +Round 9 ban in A +Round 10 ban in A +Thus in the forth round you are not allowed to harvest in location A. When you harvest, but are not allowed to, the throwing of a virtual dice determines whether you need to pay a penalty. If we throw a six, the penalty is to return back the harvest plus.')"); +db_query("insert into { vc_rules} (vc_stage_id,rule_no,name,description) values(1,3,'Property Rights','Each of you can put an effort of 0 or 1 per round. We throw a virtual dice every round. If we throw a six, an inspector comes to the region to check on your effort levels. If a participant writes 2 units of effort on its game card, and the inspector is present, the participant does not get the points it wrote down on its decision sheet.')"); +db_query("insert into { vc_rules} (vc_stage_id,rule_no,name,description) values(2,1,'Lottery','With this rule only two participants can harvest each round. Who is allowed to harvest is determined by drawing two cards with players numbers. The instructor writes down the player numbers who are allowed on the board. When someone harvest, but is not allowed to, this participant may get a penalty. Every round we throw a dice after the decisions are made. If we throw a six an inspector is in the forest and will catch the rule breakers, the participants who harvested in a turn it was not allowed to. In that case the participant has to payback the harvest plus an extra 3 units. If the dice shows any other number everybody keeps its earnings and we pass to the next round.')"); +db_query("insert into { vc_rules} (vc_stage_id,rule_no,name,description) values(2,2,'Rotation','With this rule each participant will have its turn to extract forest unit. Only two participants can harvest each round. In this way it will be a rotation scheme to extract forest units. Each participant will be assigned randomly a turn card to extract forest units: The extraction order is: +Round 1: extracts wood the player A, B +Round 2 extracts wood the player C, D +Round 3: extracts wood the player E, A +Round 4: extracts wood the player B, C +Round 5: extracts wood the player D, E +Round 6: extracts wood the player A, B +Round 7: extracts wood the player C, D +Round 8 extracts wood the player E, A +Round 9: extracts wood the player B, C +Round 10: extracts wood the player D, E + +If this rule is chosen, players get randomly a character A, B, C, D or E. player 1 may for example get turn D. + +When someone harvest, but is not allowed to, this participant may get a penalty. Every round we throw a dice after the decisions are made. If we throw a six an inspector is in the forest and will catch the rule breakers, the participants who harvested in a turn it was not allowed to. In that case the participant has to payback the harvest plus an extra 3 units. So, if participant whose turn is A is writing down on the decision sheet to harvest 3 units when only the player with turn C is allowed to harvest, we throw a dice, and when we throw a six, participant with turn A do not get the points on its decision sheet, and we subtract an extra 3 from the total collected points of player with turn A. If the dice shows any other number everybody keeps its earnings and we pass to the next round. +')"); +db_query("insert into { vc_rules} (vc_stage_id,rule_no,name,description) values(2,3,'Property Rights','Each of you can harvest legally 0, 1 or 2 units per round. If a participant types a higher amount than 2, he or she can be caught by the inspector and has to pay a penalty. In every round we throw a virtual dice. And when we throw a six, and the participants who harvest more than 2 units in that round, do not get the points it wrote down on its game card, and we subtract an extra 3 points from it’s total so far.')"); +db_query("insert into { vc_rules} (vc_stage_id,rule_no,name,description) values(3,1,'Lottery','In this rule we draw for each round, after you have contributed to the maintenance of the irrigation system, the order in which you can take water for irrigation will be assigned randomly.')"); +db_query("insert into { vc_rules} (vc_stage_id,rule_no,name,description) values(3,2,'Rotation','There will be a fixed rotation in which you can collect water. This order is a 5 round rotation system: +Round 1: ABCDE +Round 2: BCDEA +Round 3: CDEAB +Round 4: DEABC +Round 5: EABCD +Round 6: ABCDE +Round 7: BCDEA +Round 8: CDEAB +Round 9: DEABC +Round 10: EABCD')"); +db_query("insert into { vc_rules} (vc_stage_id,rule_no,name,description) values(3,3,'Property Rights','Each of you has a right of 20% of the water of the irrigation system. This amount is calculated after the available water is announced. The order to extract water remains the same for all the rounds: ABCDE. A virtual dice is thrown in each round. When 6 is thrown, an inspector arrives to the irrigation system and will check the water extraction. The player who takes more than the 20% share pays back the extra amount taken, and an extra amount of 6 units.')"); + + + + + Modified: vcweb/trunk/virtualcommons/experiment/student_login/student_login.module =================================================================== --- vcweb/trunk/virtualcommons/experiment/student_login/student_login.module 2008-07-30 22:59:46 UTC (rev 18) +++ vcweb/trunk/virtualcommons/experiment/student_login/student_login.module 2008-08-01 01:19:07 UTC (rev 19) @@ -1,9 +1,12 @@ <?php // $Id$ +// vim:sts=2:sw=2:filetype=php /** * implement the _user hook. */ +include_once('./' . drupal_get_path('module', 'experiment') . '/experiment.inc'); + function student_login_perm() { return array('Only Students'); @@ -19,7 +22,7 @@ 'path' => 'student_login', 'title' => t('Student Login'), 'callback' => 'drupal_get_form', - 'callback arguments'=>array(student_login_nameform), + 'callback arguments'=>array(student_login_nameform), 'access' => TRUE//user_access('Only Students') ); @@ -28,47 +31,52 @@ return $items; } function student_login_nameform() { -$form = array(); -$form['#id']='student_form'; -$form['student_info'] = array( - '#title' => t('Student Information'), - '#type' => 'fieldset', -'#description'=>t('Please enter correct the student ID, you received from your teacher.') + $form = array(); + $form['#id']='student_form'; + $form['student_info'] = array( + '#title' => t('Student Information'), + '#type' => 'fieldset', + '#description'=>t('Please enter correct the student ID, you received from your teacher.') -); -$form['student_info']['id'] = array( - '#title' => t('Enter the Student ID'), - '#type' => 'textfield', - '#required'=>TRUE + ); + $form['student_info']['id'] = array( + '#title' => t('Enter the Student ID'), + '#type' => 'textfield', + '#required'=>TRUE -); + ); -$form['submit'] = array( - '#type' => 'submit', - '#value' => t('Start Game!!!') -); -return $form; + $form['submit'] = array( + '#type' => 'submit', + '#value' => t('Start Game!!!') + ); + return $form; } function student_login_nameform_validate($form_id,$form_values) { -$stud_id=$form_values['id']; -$result=db_result(db_query("Select id from {virtualcommons_student} where id='%s'",$stud_id)); + $stud_id=$form_values['id']; + $group = Group::checkStudentId($stud_id); + if ($group) { + // set the game object into the session, currently only contains the + // game_id + $_SESSION['group'] = serialize($group); + } + else { + form_set_error('id',t('Invalid Student ID. Please contact your instructor.')); + } -if($result=='') - form_set_error('id',t('Invalid Student ID. Please contact your instructor.')); - } function student_login_nameform_submit($form_id,$form_values) { -$_SESSION['student_id']=$form_values['id']; + $_SESSION['student_id']=$form_values['id']; -return 'forestry'; + return 'forestry'; } Added: vcweb/trunk/virtualcommons/experiment/survey-questions.sql =================================================================== --- vcweb/trunk/virtualcommons/experiment/survey-questions.sql (rev 0) +++ vcweb/trunk/virtualcommons/experiment/survey-questions.sql 2008-08-01 01:19:07 UTC (rev 19) @@ -0,0 +1,119 @@ +insert into vc_survey(vc_experiment_id,date_of_creation) values('1','2008-07-01'); +insert into vc_survey(vc_experiment_id,date_of_creation) values('2','2008-07-01'); +insert into vc_survey(vc_experiment_id,date_of_creation) values('3','2008-07-01'); + +insert into vc_survey_questions(vc_survey_id,vc_rules_id,questions) values(1,1,'How efficient do you think this rule is for managing the fishing grounds?'); +insert into vc_survey_questions(vc_survey_id,vc_rules_id,questions) values(1,1,'How fair do you think this rule is for managing the fishing grounds? '); +insert into vc_survey_questions(vc_survey_id,vc_rules_id,questions) values(1,1,'How much personal freedom do you think this rule allows you in managing the fishing grounds?'); +insert into vc_survey_questions(vc_survey_id,vc_rules_id,questions) values(1,1,'How much do you think this rule would advance your own self-interest as measured by your total earning?'); +insert into vc_survey_questions(vc_survey_id,vc_rules_id,questions) values(1,1,'All things considered how attractive do you find this rule?'); + +insert into vc_survey_questions(vc_survey_id,vc_rules_id,questions) values(1,2,'How efficient do you think this rule is for managing the fishing grounds?'); +insert into vc_survey_questions(vc_survey_id,vc_rules_id,questions) values(1,2,'How fair do you think this rule is for managing the fishing grounds? '); +insert into vc_survey_questions(vc_survey_id,vc_rules_id,questions) values(1,2,'How much personal freedom do you think this rule allows you in managing the fishing grounds?'); +insert into vc_survey_questions(vc_survey_id,vc_rules_id,questions) values(1,2,'How much do you think this rule would advance your own self-interest as measured by your total earning?'); +insert into vc_survey_questions(vc_survey_id,vc_rules_id,questions) values(1,2,'All things considered how attractive do you find this rule?'); + +insert into vc_survey_questions(vc_survey_id,vc_rules_id,questions) values(1,3,'How efficient do you think this rule is for managing the fishing grounds?'); +insert into vc_survey_questions(vc_survey_id,vc_rules_id,questions) values(1,3,'How fair do you think this rule is for managing the fishing grounds? '); +insert into vc_survey_questions(vc_survey_id,vc_rules_id,questions) values(1,3,'How much personal freedom do you think this rule allows you in managing the fishing grounds?'); +insert into vc_survey_questions(vc_survey_id,vc_rules_id,questions) values(1,3,'How much do you think this rule would advance your own self-interest as measured by your total earning?'); +insert into vc_survey_questions(vc_survey_id,vc_rules_id,questions) values(1,3,'All things considered how attractive do you find this rule?'); + +insert into vc_survey_questions(vc_survey_id,vc_rules_id,questions) values(2,4,'How efficient do you think this rule is for managing the forest?'); +insert into vc_survey_questions(vc_survey_id,vc_rules_id,questions) values(2,4,'How fair do you think this rule is for managing the forest? '); +insert into vc_survey_questions(vc_survey_id,vc_rules_id,questions) values(2,4,'How much personal freedom do you think this rule allows you in managing the forest?'); +insert into vc_survey_questions(vc_survey_id,vc_rules_id,questions) values(2,4,'How much do you think this rule would advance your own self-interest as measured by your total earning?'); +insert into vc_survey_questions(vc_survey_id,vc_rules_id,questions) values(2,4,'All things considered how attractive do you find this rule?'); + + +insert into vc_survey_questions(vc_survey_id,vc_rules_id,questions) values(2,5,'How efficient do you think this rule is for managing the forest?'); +insert into vc_survey_questions(vc_survey_id,vc_rules_id,questions) values(2,5,'How fair do you think this rule is for managing the forest? '); +insert into vc_survey_questions(vc_survey_id,vc_rules_id,questions) values(2,5,'How much personal freedom do you think this rule allows you in managing the forest?'); +insert into vc_survey_questions(vc_survey_id,vc_rules_id,questions) values(2,5,'How much do you think this rule would advance your own self-interest as measured by your total earning?'); +insert into vc_survey_questions(vc_survey_id,vc_rules_id,questions) values(2,5,'All things considered how attractive do you find this rule?'); + + +insert into vc_survey_questions(vc_survey_id,vc_rules_id,questions) values(2,6,'How efficient do you think this rule is for managing the fishing grounds?'); +insert into vc_survey_questions(vc_survey_id,vc_rules_id,questions) values(2,6,'How fair do you think this rule is for managing the fishing grounds? '); +insert into vc_survey_questions(vc_survey_id,vc_rules_id,questions) values(2,6,'How much personal freedom do you think this rule allows you in managing the fishing grounds?'); +insert into vc_survey_questions(vc_survey_id,vc_rules_id,questions) values(2,6,'How much do you think this rule would advance your own self-interest as measured by your total earning?'); +insert into vc_survey_questions(vc_survey_id,vc_rules_id,questions) values(2,6,'All things considered how attractive do you find this rule?'); + + +insert into vc_survey_questions(vc_survey_id,vc_rules_id,questions) values(3,7,'How efficient do you think this rule is for managing the irrigation system?'); +insert into vc_survey_questions(vc_survey_id,vc_rules_id,questions) values(3,7,'How fair do you think this rule is for managing the irrigation system? '); +insert into vc_survey_questions(vc_survey_id,vc_rules_id,questions) values(3,7,'How much personal freedom do you think this rule allows you in managing the irrigation system?'); +insert into vc_survey_questions(vc_survey_id,vc_rules_id,questions) values(3,7,'How much do you think this rule would advance your own self-interest as measured by your total earning?'); +insert into vc_survey_questions(vc_survey_id,vc_rules_id,questions) values(3,7,'All things considered how attractive do you find this rule?'); + + +insert into vc_survey_questions(vc_survey_id,vc_rules_id,questions) values(3,8,'How efficient do you think this rule is for managing the irrigation system?'); +insert into vc_survey_questions(vc_survey_id,vc_rules_id,questions) values(3,8,'How fair do you think this rule is for managing the irrigation system? '); +insert into vc_survey_questions(vc_survey_id,vc_rules_id,questions) values(3,8,'How much personal freedom do you think this rule allows you in managing the irrigation system?'); +insert into vc_survey_questions(vc_survey_id,vc_rules_id,questions) values(3,8,'How much do you think this rule would advance your own self-interest as measured by your total earning?'); +insert into vc_survey_questions(vc_survey_id,vc_rules_id,questions) values(3,8,'All things considered how attractive do you find this rule?'); + + +insert into vc_survey_questions(vc_survey_id,vc_rules_id,questions) values(3,9,'How efficient do you think this rule is for managing the irrigation system?'); +insert into vc_survey_questions(vc_survey_id,vc_rules_id,questions) values(3,9,'How fair do you think this rule is for managing the irrigation system? '); +insert into vc_survey_questions(vc_survey_id,vc_rules_id,questions) values(3,9,'How much personal freedom do you think this rule allows you in managing the irrigation system?'); +insert into vc_survey_questions(vc_survey_id,vc_rules_id,questions) values(3,9,'How much do you think this rule would advance your own self-interest as measured by your total earning?'); +insert into vc_survey_questions(vc_survey_id,vc_rules_id,questions) values(3,9,'All things considered how attractive do you find this rule?'); + +insert into vc_survey_questions_options(vc_survey_questions_id,min_value,max_value) values(1,'not at all efficient','very efficient'); +insert into vc_survey_questions_options(vc_survey_questions_id,min_value,max_value) values(2,'not at all fair','very fair'); +insert into vc_survey_questions_options(vc_survey_questions_id,min_value,max_value) values(3,'no freedom at all','complete freedom'); +insert into vc_survey_questions_options(vc_survey_questions_id,min_value,max_value) values(4,'not at all','very much'); +insert into vc_survey_questions_options(vc_survey_questions_id,min_value,max_value) values(5,'not attractive at all','Very attractive'); + +insert into vc_survey_questions_options(vc_survey_questions_id,min_value,max_value) values(6,'not at all efficient','very efficient'); +insert into vc_survey_questions_options(vc_survey_questions_id,min_value,max_value) values(7,'not at all fair','very fair'); +insert into vc_survey_questions_options(vc_survey_questions_id,min_value,max_value) values(8,'no freedom at all','complete freedom'); +insert into vc_survey_questions_options(vc_survey_questions_id,min_value,max_value) values(9,'not at all','very much'); +insert into vc_survey_questions_options(vc_survey_questions_id,min_value,max_value) values(10,'not attractive at all','Very attractive'); + +insert into vc_survey_questions_options(vc_survey_questions_id,min_value,max_value) values(11,'not at all efficient','very efficient'); +insert into vc_survey_questions_options(vc_survey_questions_id,min_value,max_value) values(12,'not at all fair','very fair'); +insert into vc_survey_questions_options(vc_survey_questions_id,min_value,max_value) values(13,'no freedom at all','complete freedom'); +insert into vc_survey_questions_options(vc_survey_questions_id,min_value,max_value) values(14,'not at all','very much'); +insert into vc_survey_questions_options(vc_survey_questions_id,min_value,max_value) values(15,'not attractive at all','Very attractive'); + + +insert into vc_survey_questions_options(vc_survey_questions_id,min_value,max_value) values(16,'not at all efficient','very efficient'); +insert into vc_survey_questions_options(vc_survey_questions_id,min_value,max_value) values(17,'not at all fair','very fair'); +insert into vc_survey_questions_options(vc_survey_questions_id,min_value,max_value) values(18,'no freedom at all','complete freedom'); +insert into vc_survey_questions_options(vc_survey_questions_id,min_value,max_value) values(19,'not at all','very much'); +insert into vc_survey_questions_options(vc_survey_questions_id,min_value,max_value) values(20,'not attractive at all','Very attractive'); + + +insert into vc_survey_questi... [truncated message content] |