Permalink
Browse files

module mission

add mission in database, and mission for a player
  • Loading branch information...
1 parent bf88fb4 commit ea8a69ef2fc64a0dad126199089858534fa29d51 @jeremypetrequin committed May 2, 2012
Showing with 67 additions and 0 deletions.
  1. +49 −0 api/modules/mission/mission.php
  2. +18 −0 api/modules/mission/model_mission.php
@@ -0,0 +1,49 @@
+<?php
+/**
+ * @date : May 2012
+ * @project : urbanTraps
+ * @package : /modules/mission
+ * @author : Badger
+ *
+ *
+ * this module doesn't work
+ */
+
+include_once(dirname(__FILE__).'/model_mission.php');
+
+class mission extends pageDefault {
+ private $_model = null;
+
+ /**
+ * when user receive a mission
+ * url to call http://localhost:8888/urbantraps/api/?p=mission&task=hasMission&mission_id=1&joueur_id=2
+ */
+ protected function _hasMission() {
+ $this->_model = new model_mission();
+
+ $this->_model->insert(array(
+ 'Joueur_id'=>$_REQUEST['joueur_id'],
+ 'Mission_id'=>$_REQUEST['mission_id'],
+ 'start' => date('Y/m/d H:i:s')
+ ));
+ }
+
+ /*
+ * create a mission in BDD
+ * url to call http://localhost:8888/urbantraps/api/?p=mission&task=addMission&nom=Mission 1&desc=lorem ipsum dolor sit amet&duree=30&nb_pts=200
+ */
+ protected function _addMission() {
+ $this->_model = new model_mission();
+ $this->_model->setTable('Mission');
+ $this->_model->setId('id');
+
+ $this->_model->insert(array(
+ 'nom' => $_REQUEST['nom'],
+ 'desc' => $_REQUEST['desc'],
+ 'duree' => $_REQUEST['duree'],
+ 'nb_pts' => $_REQUEST['nb_pts']
+ ));
+ }
+}
+
+?>
@@ -0,0 +1,18 @@
+<?php
+/**
+ * @date : May 2012
+ * @project : urbanTraps
+ * @package : /modules/mission
+ * @author : Badger
+ */
+
+class model_mission extends modelDefault {
+
+ public function __construct() {
+ parent::__construct();
+ parent::setTable('MissionJoueur');
+ parent::setId('id');
+ }
+}
+
+?>

0 comments on commit ea8a69e

Please sign in to comment.