/** * ... simple action to return some json data * */ public function gridAction() { $users = Bc_UserDTO::fetchAsArray(null, 'firstname'); $json = '{ "identifier": "id", "idAttribute":"id", "label": "firstname","items": '; $json .= Zend_Json::encode($users); $json .= '}'; echo $json; exit; }
public function editAction() { $this->_helper->layout()->disableLayout(); $id = $this->_request->getParam('id', null); if ($id === null) { //no id set, must be a new user //do nothing $this->view->userData = array('id' => '', 'firstname' => '', 'secondname' => '', 'birthdate' => ''); } else { //fetch user data from DB $userData = Bc_UserDTO::fetchAsArray(array('id' => $id)); if (!isset($userData[0])) { $this->_outputAjaxCallResult(false); } $this->view->userData = $userData[0]; echo json_encode($userData[0]); } exit; }