Example #1
0
 public function categoryAction()
 {
     $modelTransaction = new Application_Model_Transaction();
     $modelCategory = new Application_Model_Category();
     $this->view->categories = $modelCategory->getAll();
     if ($this->getRequest()->isPost()) {
         $category = $this->getRequest()->getPost('category', null);
         $this->view->category = $category;
         $this->view->sumCategory = $modelTransaction->getForGraphByCategory($category, date("Y"));
         $budgetCategory = $modelTransaction->getBudgetForGraphByCategory($category, date("Y"));
         $budgetCategoryFormated = array_fill(1, 12, 0);
         foreach ($budgetCategory as $category) {
             $budgetCategoryFormated[$category->month] = $category->maximum;
         }
         $this->view->budgetCategory = $budgetCategoryFormated;
         $this->view->months = array(1 => 'Janvier', 2 => 'Février', 3 => 'Mars', 4 => 'Avril', 5 => 'Mai', 6 => 'Juin', 7 => 'Juillet', 8 => 'Août', 9 => 'Septembre', 10 => 'Octobre', 11 => 'Novembre', 12 => 'Décembre');
     }
 }