/** * Activate a employee. */ public function activateAction() { // Get the ids of the employees to activate. $ids = $this->getInts('ids'); // Determine if there are multiple employees to activate. $multiple = count($ids) > 1 ? true : false; // Wrap the whole thing in a try/catch. try { // Get the DAO. $employeeDao = new EmployeeDao(); // Activate all the employees. $count = $employeeDao->activate($ids); // Make sure some employees were activated. if (isset($count) && $count > 0) { // Create the JSON object to return. $json = new stdClass(); $json->success = true; if ($multiple) { $json->msg = 'The employees were activated successfully.'; } else { $json->msg = 'The employee was activated successfully.'; } } else { // Create the error JSON object to return. $json = new stdClass(); $json->success = false; if ($multiple) { $json->msg = 'Failed to activate the employees.'; } else { $json->msg = 'Failed to activate the employee.'; } } } catch (Zend_Exception $ex) { // Create the error JSON object to return. $json = new stdClass(); $json->success = false; $json->msg = $ex->getMessage(); } // Return the JSON. $this->_helper->json($json); }