source: trunk/web/addons/job_monarch/lib/extjs-30/examples/writer/remote/lib/response.php @ 625

Last change on this file since 625 was 625, checked in by ramonb, 15 years ago

lib/extjs-30:

  • new ExtJS 3.0
File size: 661 bytes
Line 
1<?php
2/**
3 * @class Response
4 * A simple JSON Response class.
5 */
6class Response {
7    public $success, $data, $message, $errors, $tid, $trace;
8
9    public function __construct($params = array()) {
10        $this->success  = isset($params["success"]) ? $params["success"] : false;
11        $this->message  = isset($params["message"]) ? $params["message"] : '';
12        $this->data     = isset($params["data"])    ? $params["data"]    : array();
13    }
14
15    public function to_json() {
16        return json_encode(array(
17            'success'   => $this->success,
18            'message'   => $this->message,
19            'data'      => $this->data
20        ));
21    }
22}
Note: See TracBrowser for help on using the repository browser.