Ejemplo n.º 1
0
 /**
  * Renvoie les Batiments liés aux Hexas de la collection fournie en paramètre
  * @param HexaCollection $hexas
  * @return BatimentCollection
  */
 public static function getFromHexas(HexaCollection $hexas)
 {
     $ids = $hexas->getIdsStr();
     if (!$ids) {
         return new BatimentCollection();
     }
     $req = "SELECT * FROM batiment WHERE idHexa IN (" . $ids . ");";
     return DbHandler::collFromQuery($req, 'Batiment', 'BatimentCollection');
 }
Ejemplo n.º 2
0
 /**
  * Renvoie les Visibles liés aux Hexas de la collection fournie en paramètre
  * @param HexaCollection $hexas
  * @param Joueur $joueur Ne fournit que les visiles de ce joueur pour la collection d'hexas
  * @return VisibleCollection
  */
 public static function getFromHexas(HexaCollection $hexas, Joueur $joueur = null)
 {
     $ids = $hexas->getIdsStr();
     if (!$ids) {
         return new VisibleCollection();
     }
     $req = "SELECT * FROM visible WHERE idHexa IN (" . $ids . ")";
     if (!is_null($joueur)) {
         $req .= " AND idJoueur = " . $joueur->getId();
     }
     $req .= ";";
     return DbHandler::collFromQuery($req, 'Visible', 'VisibleCollection');
 }
 /**
  * Renvoie les Infrastructures liés aux Hexas de la collection fournie en paramètre
  * @param HexaCollection $hexas
  * @return InfrastructureCollection
  */
 public static function getFromHexas(HexaCollection $hexas)
 {
     return self::getFromIdsHexas($hexas->getIdsStr(true));
 }
Ejemplo n.º 4
0
 /**
  * Renvoie les Productions liés aux Hexas de la collection fournie
  * @var HexaCollection $hexas
  * @return ProductionCollection
  */
 public static function getFromHexas(HexaCollection $hexas)
 {
     $req = "SELECT * from production WHERE idBatiment IN (SELECT batiment.idBatiment FROM batiment WHERE batiment.idHexa IN (" . $hexas->getIdsStr() . "))";
     return DbHandler::collFromQuery($req, 'Production', 'ProductionCollection');
 }
Ejemplo n.º 5
0
 /**
  * Renvoie les Competences liés aux Hexas de la collection fournie
  * @var HexaCollection $hexas
  * @return CompetenceCollection
  */
 public static function getFromHexas(HexaCollection $hexas)
 {
     $req = "SELECT * from competence WHERE idQg IN (SELECT qg.idQg FROM qg WHERE qg.idHexa IN (" . $hexas->getIdsStr() . "))";
     return DbHandler::collFromQuery($req, 'Competence', 'CompetenceCollection');
 }
Ejemplo n.º 6
0
 /**
  * Renvoie les Trajectoires entières qui ont au moins 1 case dans $hexas
  * @param HexaCollection $hexas
  * @return TrajCollection
  */
 public static function getEntieresFromHexas(HexaCollection $hexas)
 {
     $ids = $hexas->getIdsStr();
     if (!$ids) {
         return new TrajCollection();
     }
     $req = "SELECT * FROM traj WHERE idQg IN (SELECT DISTINCT(sousTraj.idQg) FROM traj sousTraj WHERE sousTraj.idHexa IN (" . $ids . "));";
     return DbHandler::collFromQuery($req, 'Traj', 'TrajCollection');
 }