json output
This commit is contained in:
parent
9022c04c90
commit
0aabc58a61
@ -4,12 +4,13 @@ class Controller_api_community extends Crunchbutton_Controller_Rest {
|
|||||||
public function init() {
|
public function init() {
|
||||||
switch ($this->method()) {
|
switch ($this->method()) {
|
||||||
case 'get':
|
case 'get':
|
||||||
$out = Community::o(1)->exports();
|
$out = Community::o(c::getPagePiece(2));
|
||||||
print_r($out); exit;
|
if ($out->id_community) {
|
||||||
echo json_encode($out);
|
echo $out->json();
|
||||||
|
} else {
|
||||||
|
echo json_encode(['error' => 'invalid object']);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class Controller_api_restaurant extends Crunchbutton_Controller_Rest {
|
||||||
|
public function init() {
|
||||||
|
switch ($this->method()) {
|
||||||
|
case 'get':
|
||||||
|
$out = Restaurant::o(c::getPagePiece(2));
|
||||||
|
if ($out->id_restaurant) {
|
||||||
|
echo $out->json();
|
||||||
|
} else {
|
||||||
|
echo json_encode(['error' => 'invalid object']);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -37,6 +37,13 @@ class Crunchbutton_Restaurant extends Cana_Table {
|
|||||||
return $this->_hours;
|
return $this->_hours;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function notification() {
|
||||||
|
if (!isset($this->_notification)) {
|
||||||
|
$this->_notification = Notification::q('select * from notification where id_notification="'.$this->id_notification.'"');
|
||||||
|
}
|
||||||
|
return $this->_notification;
|
||||||
|
}
|
||||||
|
|
||||||
public function exports() {
|
public function exports() {
|
||||||
$out = $this->properties();
|
$out = $this->properties();
|
||||||
foreach ($this->dishes() as $dish) {
|
foreach ($this->dishes() as $dish) {
|
||||||
|
|||||||
11
include/library/Crunchbutton/Restaurant/Notification.php
Normal file
11
include/library/Crunchbutton/Restaurant/Notification.php
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class Crunchbutton_Notification extends Cana_Table {
|
||||||
|
public function __construct($id = null) {
|
||||||
|
parent::__construct();
|
||||||
|
$this
|
||||||
|
->table('notification')
|
||||||
|
->idVar('id_notification')
|
||||||
|
->load($id);
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user