]> jfr.im git - z_archive/KronOS.git/commitdiff
Added DimeCadmiums functions to json model
authorConny Sjöblom <redacted>
Tue, 16 Oct 2012 07:22:30 +0000 (10:22 +0300)
committerConny Sjöblom <redacted>
Tue, 16 Oct 2012 07:22:30 +0000 (10:22 +0300)
application/models/json.php

index 63295b147bc38bf6bcbf0c60e840539fc7b767e4..a102b84399eaa7eb9f3486997db361465a9d8bb4 100644 (file)
@@ -8,6 +8,26 @@ class Json extends CI_Model {
        }
 
        public function index() {
-               echo "";
+       }
+
+       public function success($contents, $data=NULL) {
+               $resp = array(
+                       'success' => TRUE,
+                       'time' => time(),
+                       'contents' => $contents,
+                       'data' => $data,
+               );
+               return json_encode($resp);
+       }
+
+       public function error($reason) {
+               $resp = array(
+                       'success' => False,
+                       'time' => time(),
+                       'error' => array(
+                               'reason' => $reason,
+                       ),
+               );
+               return json_encode($resp);
        }
 }