~cdparra/gelee/trunk

« back to all changes in this revision

Viewing changes to webui/ecosystem/workspace/extjs/examples/writer/remote/lib/response.php

  • Committer: parra
  • Date: 2010-03-15 15:56:56 UTC
  • Revision ID: svn-v4:ac5bba68-f036-4e09-846e-8f32731cc928:trunk/gelee:1448
merged gelee at svn

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
/**
 
3
 * @class Response
 
4
 * A simple JSON Response class.
 
5
 */
 
6
class 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
}