public function viewAction()
 {
     if (!$this->checkRequiredParams(array('id'))) {
         $this->_redirect('/recipe/index');
     }
     $userID = $this->_getParam('id');
     $user = $this->_model->getSingleByField('name', $userID);
     $this->view->title = 'Viewing user ' . $user['name'];
     $this->view->user = $user;
     $c = new Recipe_Model_Comment();
     $this->view->comments = $c->getComments('u.name', $userID);
 }
 /**
  * View the recipe in all its wonderful glory
  */
 public function viewAction()
 {
     $this->_model->getRecipe($this->_id);
     // If this is being viewed by a guest or not by the creator
     if (!$this->_acl->isAllowed($this->_identity, $this->_model, 'edit')) {
         $this->_model['view_count']++;
         $this->_db->update("recipes", array("view_count" => $this->_model['view_count']), "id = " . $this->_id);
     }
     $rate = new Recipe_Model_Rating();
     // Only do this if we have a logged in user
     if ($this->_identity) {
         $comment_form = $this->getForm('Comment');
         $rating_form = $this->getForm('Rating');
         $comment_form->populate(array('recipe_id' => $this->_id));
         $rating_form->populate(array('recipe_id' => $this->_id));
         $this->view->comment_form = $comment_form;
         $this->view->rating_form = $rating_form;
         // Figure out if this user has made a rating or not
         $this->view->hasRated = $rate->hasRated($this->_id, $this->_identity->id);
     }
     $this->view->recipe = $this->_model->toArray();
     $ingredients = $this->_model->getIngredients($this->_id);
     $this->view->ingredients = $ingredients;
     $methods = $this->_model->getMethods($this->_id);
     $this->view->methods = $methods;
     $c = new Recipe_Model_Comment();
     $this->view->comments = $c->getComments('c.recipe_id', $this->_id);
     $this->view->ratings = $rate->getRatings($this->_id);
 }