Example #1
0
    public function process()
    {
        $slots = queryTab('
			select * from slot
			natural join joueur
			where partie_id=' . partie()->getID() . '
			order by slot_position
		');
        smarty()->assign('slots', $slots);
        smarty()->assign('options', jeu()->getOptions());
        smarty()->assign('isHost', intval(slot()->joueur_id) == intval(partie()->host));
    }
Example #2
0
    private function getListe()
    {
        $quickjoin = queryTab('
			select *
			from partie
			natural join jeu
			natural join joueur
			where joueur_id=partie_host
			and partie_etat=' . Partie::PREPARATION);
        $games = array();
        foreach ($quickjoin as $data) {
            $games[] = array('partie' => new Partie($data), 'host' => new Joueur($data), 'jeu' => new DBItem('jeu', $data));
        }
        return $games;
    }
Example #3
0
    /**
     * 
     * Retourne les slots sur lesquels le joueur
     * actuelle joue.
     * Si jeu() n'est pas null, filtre les slots de ce jeu.
     */
    public function getSlots()
    {
        if (is_null(jeu())) {
            $slots = queryTab('
				select * from slot
				where joueur_id=' . joueur()->getID());
        } else {
            $slots = queryTab('
				select * from slot natural join partie
				where joueur_id=' . joueur()->getID() . '
				and jeu_id=' . jeu()->getID());
        }
        $ret = array();
        foreach ($slots as $slot) {
            $ret[] = new Slot($slot);
        }
        return $ret;
    }
Example #4
0
    public function ajax_updateOrganize()
    {
        $r = new AJAXResponse();
        $res = queryTab('
			select *
			from partie
			natural join slot
			natural join joueur
			natural join jeu
			where partie_id=' . partie()->getID() . '
			order by slot_position
		');
        $r->partie = partie();
        // revoi tout pour garder infos sur joueur
        $r->slots = $res;
        $r->slot = partie()->getSlot(joueur());
        $r->jeu = new DBItem('jeu', $res[0]);
        return $r;
    }
Example #5
0
 public static function getCollection($object, $query)
 {
     $tab = queryTab($query);
     $col = array();
     foreach ($tab as $line) {
         $col[] = new $object($line);
     }
     return $col;
 }
Example #6
0
    public function process()
    {
        smarty()->assign('slot', slot());
        $slots = queryTab('
			select * from slot
			natural join joueur