ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilTermsOfServiceJsonResponse.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 require_once 'Services/JSON/classes/class.ilJsonUtil.php';
5 
12 {
13  const STATUS_SUCCESS = 1;
14  const STATUS_FAILURE = 2;
15 
19  protected $body;
20 
24  public function __construct()
25  {
26  $this->initHttpBody();
27  }
28 
32  protected function initHttpBody()
33  {
34  $this->body = new stdClass();
35  $this->body->status = self::STATUS_SUCCESS;
36  $this->body->body = '';
37  }
38 
42  public function setStatus($status)
43  {
44  $this->body->status = $status;
45  }
46 
50  public function setBody($body)
51  {
52  $this->body->body = $body;
53  }
54 
58  public function __toString()
59  {
60  header("Content-type: application/json; charset=UTF-8");
61  echo ilJsonUtil::encode($this->body);
62  exit();
63  }
64 }