summaryrefslogtreecommitdiff
path: root/core/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'core/controllers')
-rw-r--r--core/controllers/album.php6
-rw-r--r--core/controllers/item.php6
-rw-r--r--core/controllers/photo.php6
-rw-r--r--core/controllers/rest.php13
4 files changed, 16 insertions, 15 deletions
diff --git a/core/controllers/album.php b/core/controllers/album.php
index 1701e283..a5853fa7 100644
--- a/core/controllers/album.php
+++ b/core/controllers/album.php
@@ -23,13 +23,13 @@ class Album_Controller extends Item_Controller {
* @see Rest_Controller::_form($resource)
*/
public function _form($comment) {
- throw new Exception("@todo Comment_Controller::_get NOT IMPLEMENTED");
+ throw new Exception("@todo Album_Controller::_form NOT IMPLEMENTED");
}
/**
- * @see Rest_Controller::_get($resource)
+ * @see Rest_Controller::_get($resource, $output_format)
*/
- public function _get($item) {
+ public function _get($item, $output_format) {
// @todo: these need to be pulled from the database
$theme_name = "default";
$page_size = 9;
diff --git a/core/controllers/item.php b/core/controllers/item.php
index 053acc92..70af9d95 100644
--- a/core/controllers/item.php
+++ b/core/controllers/item.php
@@ -23,11 +23,11 @@ class Item_Controller extends REST_Controller {
/**
* @see Rest_Controller::_form($resource)
*/
- public function _form($comment) {
- throw new Exception("@todo Comment_Controller::_get NOT IMPLEMENTED");
+ public function _form($item) {
+ throw new Exception("@todo Comment_Controller::_form NOT IMPLEMENTED");
}
- public function _get($item) {
+ public function _get($item, $format) {
// Redirect to the more specific resource type, since it will render
// differently. We could also just delegate here, but it feels more appropriate
// to have a single canonical resource mapping.
diff --git a/core/controllers/photo.php b/core/controllers/photo.php
index 2a0153a2..819af133 100644
--- a/core/controllers/photo.php
+++ b/core/controllers/photo.php
@@ -23,13 +23,13 @@ class Photo_Controller extends Item_Controller {
* @see Rest_Controller::_form($resource)
*/
public function _form($comment) {
- throw new Exception("@todo Comment_Controller::_get NOT IMPLEMENTED");
+ throw new Exception("@todo Comment_Controller::_form NOT IMPLEMENTED");
}
/**
- * @see Rest_Controller::_get($resource)
+ * @see Rest_Controller::_get($resource, $output_format)
*/
- public function _get($item) {
+ public function _get($item, $output_format) {
$template = new View("page.html");
// @todo: this needs to be data-driven
diff --git a/core/controllers/rest.php b/core/controllers/rest.php
index 82262f3b..3b630f2d 100644
--- a/core/controllers/rest.php
+++ b/core/controllers/rest.php
@@ -24,19 +24,19 @@
* class Comment_Controller extends REST_Controller {
* protected $resource_type = "comment"; // this tells REST which model to use
*
- * public function _get(ORM $comment) {
+ * public function _get(ORM $comment, $output_format) {
* // Handle GET request
* }
*
- * public function _put(ORM $comment) {
+ * public function _put(ORM $comment, $output_format) {
* // Handle PUT request
* }
*
- * public function _post(ORM $comment) {
+ * public function _post(ORM $comment, $output_format) {
* // Handle POST request
* }
*
- * public function _delete(ORM $comment) {
+ * public function _delete(ORM $comment, $output_format) {
* // Handle DELETE request
* }
*
@@ -67,8 +67,9 @@ abstract class REST_Controller extends Controller {
* We're expecting to run in an environment that only supports GET/POST, so expect to tunnel
* PUT/DELETE through POST.
*/
+ $output_format = $this->input->get("_format", $this->input->post("_format", "html"));
if (request::method() == "get") {
- $this->_get($resource);
+ $this->_get($resource, $output_format);
if (Session::instance()->get("use_profiler", false)) {
$profiler = new Profiler();
@@ -107,7 +108,7 @@ abstract class REST_Controller extends Controller {
* Perform a GET request on this resource
* @param ORM $resource the instance of this resource type
*/
- abstract public function _get($resource);
+ abstract public function _get($resource, $output_format);
/**
* Perform a PUT request on this resource