function submitAction() { $this->_helper->layout->disableLayout(); $this->_helper->viewRenderer->setNoRender(TRUE); $session = SessionWrapper::getInstance(); $config = Zend_Registry::get("config"); $this->_translate = Zend_Registry::get("translate"); $formvalues = $this->_getAllParams(); if (!isArrayKeyAnEmptyString('id', $formvalues)) { $formvalues['status'] = 2; // debugMessage($formvalues); $timesheet = new Timesheet(); $timesheet->populate(decode($formvalues['id'])); $timesheet->setStatus($formvalues['status']); $timesheet->setDateSubmitted(DEFAULT_DATETIME); try { $timesheet->save(); $session->setVar(SUCCESS_MESSAGE, "Successfully submitted for Approval"); } catch (Exception $e) { $session->setVar(ERROR_MESSAGE, $e->getMessage()); } } if (!isArrayKeyAnEmptyString('ids', $formvalues)) { // debugMessage($formvalues); $idsarray = array_remove_empty(explode(',', $formvalues['ids'])); // debugMessage($idsarray); $formvalues['status'] = 2; $timesheet_collection = new Doctrine_Collection(Doctrine_Core::getTable("Timesheet")); if (count($idsarray) > 0) { $hrs = 0; foreach ($idsarray as $key => $id) { $timesheet = new Timesheet(); $timesheet->populate($id); $timesheet->setStatus($formvalues['status']); $timesheet->setDateSubmitted(DEFAULT_DATETIME); $timesheet_collection->add($timesheet); } try { $timesheet_collection->save(); $session->setVar(SUCCESS_MESSAGE, "Successfully submitted for Approval"); } catch (Exception $e) { $session->setVar(ERROR_MESSAGE, $e->getMessage()); } } } $this->_helper->redirector->gotoUrl(decode($this->_getParam(URL_SUCCESS))); }