public function companyAction() { $form = new Application_Form_Company(); $form->setAction('index/company'); $this->view->form = $form; $company = new Application_Model_DbTable_Company(); $employee = new Application_Model_DbTable_Employee(); $department = new Application_Model_DbTable_Department(); if ($this->getRequest()->isPost()) { $formData = $this->getRequest()->getPost(); if ($form->isValid($formData) && $form->save->isChecked()) { $id = (int) $form->getValue('id'); $name = $form->getValue('name'); $company->updateCompany($id, $name); $this->_helper->redirector('index'); } else { if ($form->isValid($formData) && $form->cut->isChecked()) { $id = (int) $form->getValue('id'); $employee->cutCompany($id); $this->_helper->redirector('index'); } else { if ($form->isValid($formData) && $form->select->isChecked()) { $depId = (int) $form->getValue('departments'); $this->_helper->redirector('department', 'index', null, array('id' => $depId)); } } } } else { $id = 1; $c = $company->getCompany($id); $c[total] = $employee->getTotalForCompany($id); $form->populate($c); $form->fillLists($id); } }