Ejemplo n.º 1
0
 public function getAllBirds()
 {
     $db = new Db();
     $birds = array();
     $results = $db->select("SELECT\r\n        birds.bid AS 'bid',\r\n        birds.date AS 'date',\r\n        birds.species AS 'species',\r\n        birds.distance AS 'distance',\r\n        birds.migrant AS 'migrant',\r\n        birds.sex AS 'sex',\r\n        birds.nest AS 'nest',\r\n        birds.eggs as 'eggs',\r\n        users.user_name as 'userName'\r\n        FROM birds\r\n        INNER JOIN users ON\r\n        birds.users_user_id = users.user_id\r\n        ORDER BY bid DESC;");
     foreach ($results as $result) {
         $bird = new Bird();
         $bird->hydrate($result);
         $birds[] = $bird;
     }
     return $birds;
 }
Ejemplo n.º 2
0
        $birdManager->_update($bird);
        header('Location: user.php');
        break;
    case 'save_bird':
        $birdManager = new BirdManager();
        $arr = array();
        $arr["bid"] = isset($_GET["bid"]) ? $_GET["bid"] : '';
        $arr["users_user_id"] = isset($_GET["userID"]) ? $_GET["userID"] : '';
        $arr["date"] = isset($_GET["date"]) ? $_GET["date"] : '';
        $arr["species"] = isset($_GET["species"]) ? $_GET["species"] : '';
        $arr["eggs"] = isset($_GET["eggs"]) ? $_GET["eggs"] : '';
        $arr["nest"] = isset($_GET["nest"]) ? $_GET["nest"] : '';
        $arr["distance"] = isset($_GET["distance"]) ? $_GET["distance"] : '';
        $arr["migrant"] = isset($_GET["migrant"]) ? $_GET["migrant"] : '';
        $arr["sex"] = isset($_GET["sex"]) ? $_GET["sex"] : '';
        $arr["users_user_id"] = isset($_GET["users_user_id"]) ? $_GET["users_user_id"] : '';
        $bird = new Bird();
        $bird->hydrate($arr);
        $birdManager->save($bird);
        header('Location: user.php');
        break;
    default:
        $birdManager = new BirdManager();
        $birds = $birdManager->getMyBird($target);
        include '../views/user_bird_view_list.php';
        break;
}
?>
</body>
</html>