public function browseAction($subj = "") { if ($this->request->isPost()) { $subj = $this->request->getPost('subj'); if ($subj != "") { $this->response->redirect("goal/browse/{$subj}"); $this->view->disable(); } } //grab all goals with given subject query (or just all) $result = array(); $goals = Goals::findAll(); if ($goals) { foreach ($goals as $goal) { //check every goal $subject = $goal->subject; if (($subj == "" || $subject == $subj) && !$goal->isComplete) { //good, add to results array_push($result, $goal); } } } $this->view->setVar("result", $result); }