diff --git a/include/controllers/default/crunchbutton/api/v1/login/index.php b/include/controllers/default/crunchbutton/api/login/index.php similarity index 100% rename from include/controllers/default/crunchbutton/api/v1/login/index.php rename to include/controllers/default/crunchbutton/api/login/index.php diff --git a/include/controllers/default/crunchbutton/api/v1/note/index.php b/include/controllers/default/crunchbutton/api/note/index.php similarity index 100% rename from include/controllers/default/crunchbutton/api/v1/note/index.php rename to include/controllers/default/crunchbutton/api/note/index.php diff --git a/include/controllers/default/crunchbutton/api/user/index.php b/include/controllers/default/crunchbutton/api/user/index.php new file mode 100644 index 000000000..f11b84b4d --- /dev/null +++ b/include/controllers/default/crunchbutton/api/user/index.php @@ -0,0 +1,14 @@ +method()) { + case 'get': + $r = new Resturant(c::getPagePiece(1)); + print_r($r); + + break; + + } + } +} \ No newline at end of file diff --git a/include/controllers/default/crunchbutton/api/v1/delivery/index.php b/include/controllers/default/crunchbutton/api/v1/delivery/index.php deleted file mode 100644 index 24cfb6a01..000000000 --- a/include/controllers/default/crunchbutton/api/v1/delivery/index.php +++ /dev/null @@ -1,16 +0,0 @@ -files()->json(); - break; - default: - echo $delivery->json(); - break; - } - } -} \ No newline at end of file diff --git a/include/controllers/default/crunchbutton/api/v1/file/index.php b/include/controllers/default/crunchbutton/api/v1/file/index.php deleted file mode 100644 index 58456e213..000000000 --- a/include/controllers/default/crunchbutton/api/v1/file/index.php +++ /dev/null @@ -1,40 +0,0 @@ -method()) { - case 'delete': - $file = Crunchbutton_File::o(c::getPagePiece(3)); - if (!$file->id_file) { - echo json_encode(['error' => 'invalid resource']); - exit; - } - $file->active = 1; - $file->save(); - - break; - - case 'get': - $file = Crunchbutton_File::o(c::getPagePiece(3)); - if (!$file->id_file) { - echo json_encode(['error' => 'invalid resource']); - exit; - } - switch (c::getPagePiece(4)) { - case 'notes': - echo $file->notes()->json(); - break; - default: - echo $file->json(); - break; - } - break; - - case 'post': - $file = new Crunchbutton_File; - $file->serialize($this->request()); - $file->save(); - break; - } - } -} \ No newline at end of file diff --git a/include/controllers/default/crunchbutton/api/v1/home.php b/include/controllers/default/crunchbutton/api/v1/home.php deleted file mode 100644 index 48913ab9a..000000000 --- a/include/controllers/default/crunchbutton/api/v1/home.php +++ /dev/null @@ -1,7 +0,0 @@ -user()->watched()->json(); - } -} \ No newline at end of file diff --git a/include/controllers/default/crunchbutton/api/v1/index.php b/include/controllers/default/crunchbutton/api/v1/index.php deleted file mode 100644 index ceaacf836..000000000 --- a/include/controllers/default/crunchbutton/api/v1/index.php +++ /dev/null @@ -1,7 +0,0 @@ - 'invalid request']); - } -} \ No newline at end of file diff --git a/include/controllers/default/crunchbutton/api/v1/project/index.php b/include/controllers/default/crunchbutton/api/v1/project/index.php deleted file mode 100644 index ad7ae951f..000000000 --- a/include/controllers/default/crunchbutton/api/v1/project/index.php +++ /dev/null @@ -1,16 +0,0 @@ -deliveries()->json(); - break; - default: - echo $project->json(); - break; - } - } -} \ No newline at end of file diff --git a/include/controllers/default/crunchbutton/api/v1/server/index.php b/include/controllers/default/crunchbutton/api/v1/server/index.php deleted file mode 100644 index d187f90ef..000000000 --- a/include/controllers/default/crunchbutton/api/v1/server/index.php +++ /dev/null @@ -1,17 +0,0 @@ -method()) { - case 'get': - $server = Server::o(c::getPagePiece(3)); - if (!$server->id_server) { - echo json_encode(['error' => 'invalid resource']); - exit; - } - echo $server->json(); - break; - - } - } -} \ No newline at end of file diff --git a/include/controllers/default/crunchbutton/api/v1/user/index.php b/include/controllers/default/crunchbutton/api/v1/user/index.php deleted file mode 100644 index a6566e4f7..000000000 --- a/include/controllers/default/crunchbutton/api/v1/user/index.php +++ /dev/null @@ -1,17 +0,0 @@ -method()) { - case 'get': - $user = User::o(c::getPagePiece(3)); - if (!$user->id_user) { - echo json_encode(['error' => 'invalid resource']); - exit; - } - echo $user->json(); - break; - - } - } -} \ No newline at end of file diff --git a/include/controllers/default/crunchbutton/home/index.php b/include/controllers/default/crunchbutton/home/index.php index a7b75f58c..72bff303d 100644 --- a/include/controllers/default/crunchbutton/home/index.php +++ b/include/controllers/default/crunchbutton/home/index.php @@ -2,6 +2,8 @@ class Controller_home extends Cana_Controller { public function init() { + $r = Restaurant::q('select * from restaurant where active=1'); + Cana::view()->restaurants = $r; Cana::view()->display('home/index'); } } \ No newline at end of file diff --git a/include/library/Crunchbutton/Community.php b/include/library/Crunchbutton/Community.php new file mode 100644 index 000000000..83cadd846 --- /dev/null +++ b/include/library/Crunchbutton/Community.php @@ -0,0 +1,11 @@ +table('community') + ->idVar('id_community') + ->load($id); + } +} \ No newline at end of file diff --git a/include/library/Crunchbutton/Restaurant.php b/include/library/Crunchbutton/Restaurant.php new file mode 100644 index 000000000..172f791fc --- /dev/null +++ b/include/library/Crunchbutton/Restaurant.php @@ -0,0 +1,11 @@ +table('restaurant') + ->idVar('id_restaurant') + ->load($id); + } +} \ No newline at end of file diff --git a/include/library/Crunchbutton/Restaurant/Communty.php b/include/library/Crunchbutton/Restaurant/Communty.php new file mode 100644 index 000000000..4d834efbc --- /dev/null +++ b/include/library/Crunchbutton/Restaurant/Communty.php @@ -0,0 +1,11 @@ +table('restaurant_community') + ->idVar('id_restaurant_community') + ->load($id); + } +} \ No newline at end of file diff --git a/include/views/default/crunchbutton/home/index.phtml b/include/views/default/crunchbutton/home/index.phtml index 834b2680f..525370179 100644 --- a/include/views/default/crunchbutton/home/index.phtml +++ b/include/views/default/crunchbutton/home/index.phtml @@ -19,12 +19,12 @@