Example #1
0
 public function showdishesAction()
 {
     $id = $this->_getParam('id', 0);
     if ($id > 0) {
         //show dishes in this category
         $fooditems = new Model_DbTable_FoodItems();
         $itemsRowset = $fooditems->find($id);
         $thisCategory = $itemsRowset->current();
         $catname = $thisCategory["name"];
         $this->view->catname = $catname;
         $this->view->title = "{$catname}s Found:";
         $this->view->headTitle($this->view->title, 'PREPEND');
         $dishesFound = $thisCategory->findModel_DbTable_DishesByCategory();
         $restaurants = new Model_DbTable_Restaurants();
         $foundRest = array();
         foreach ($dishesFound as $dish) {
             $restRowset = $restaurants->find($dish["restaurant_id"]);
             $curRest = $restRowset->current();
             $foundRest[$curRest["id"]] = $curRest["name"];
             //TODO: this should be replaced with a JOIN for more efficiency
         }
         $this->view->dishes = $dishesFound;
         $this->view->restaurants = $foundRest;
     }
 }
Example #2
0
 public function detailAction()
 {
     $id = $this->_getParam('id', 0);
     if ($id > 0) {
         //show detailed view of this dish, its rating, and restaurant
         $dishesC = new Model_DbTable_DishesComplete();
         $itemsRowset = $dishesC->find($id);
         $thisDishC = $itemsRowset->current();
         $this->view->dish = $thisDishC;
         $restaurants = new Model_DbTable_Restaurants();
         $itemsRowset = $restaurants->find($thisDishC['rest_id']);
         $thisRest = $itemsRowset->current();
         $this->view->restaurant = $thisRest;
         $dishName = $thisDishC['dish_name'];
         $categoryID = $thisDishC['fooditem_id'];
         $fooditems = new Model_DbTable_FoodItems();
         $itemsRowset = $fooditems->find($categoryID);
         $thisCategory = $itemsRowset->current();
         $cuisineID = $thisCategory['cuisine_id'];
         $cuisines = new Model_DbTable_Cuisines();
         $itemsRowset = $cuisines->find($cuisineID);
         $thisCuisine = $itemsRowset->current();
         $categoryName = $thisCategory['name'];
         $cuisineName = $thisCuisine['name'];
         $this->view->title = "{$cuisineName}: {$categoryName}: {$dishName}";
         $this->view->headTitle("{$dishName}", 'PREPEND');
         $dishes = new Model_DbTable_Dishes();
         $itemsRowset = $dishes->find($id);
         $thisDish = $itemsRowset->current();
         $foundReviews = $thisDish->findDependentRowset('Model_DbTable_ReviewsComplete', 'Dish');
         $this->view->reviews = $foundReviews;
     }
 }