public function importEmployeeSheetAction() { $request = $this->getRequest(); $form = new Application_Form_EmployeeImport(); if ($request->isPost()) { $options = $request->getPost(); if ($form->isValid($options)) { $user = new Application_Model_User(); $targetPath = $user->uploadEmployeeSheet(); if (file_exists($targetPath)) { $rows = $user->importEmployee($options, $targetPath); $this->_flashMessenger->addMessage(array('success' => $rows . ' records imported!')); $this->_helper->_redirector->gotoUrl($this->view->seoUrl('/hr/import-employee-sheet')); } else { $this->_flashMessenger->addMessage(array('error' => 'Import failed')); $this->_helper->_redirector->gotoUrl($this->view->seoUrl('/hr/import-employee-sheet')); } $form->reset(); } else { $form->reset(); $form->populate($options); } } $this->view->form = $form; }