コード例 #1
0
 /**
  * ... 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;
 }
コード例 #2
0
ファイル: UserController.php プロジェクト: noon/phpMyBirthday
 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;
 }