/** * Retrieve the JSON for all the contracts. */ public function jsonAction() { // Determine if we should include administrative contracts. $regularOnly = $this->getBool('regularOnly'); // Wrap the whole thing in a try/catch. try { // Get all the contracts. $contractDao = new ContractDao(); $contracts = $contractDao->getAll($regularOnly); // Create the JSON object to return. $json = new stdClass(); $json->success = true; $json->contracts = $contracts; } catch (Zend_Exception $ex) { // Create the error JSON object to return. $json = new stdClass(); $json->success = false; $json->msg = $ex->getMessage(); $json->contracts = array(); } // Return all the contracts as JSON. $this->_helper->json($json); }