summaryrefslogtreecommitdiff
path: root/core/controllers/photo.php
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2008-11-09 19:20:23 +0000
committerBharat Mediratta <bharat@menalto.com>2008-11-09 19:20:23 +0000
commit1b490c5fe6ce6ced7b02bbdf8c939a991f0378af (patch)
treed06cda6e05d7121f6ec08154115c15b148436d44 /core/controllers/photo.php
parent065bbb2120ce0aaee96a3886bd06c90ca26da9bd (diff)
Make Gallery3 more RESTful.
Create Item_Controller as a common superclass for Album_Controller and Photo_Controller. Change routes to route requests to Item_Controller for dispatching, which in turn will generate get/post/put/delete requests to the controlller so that each controller has a RESTful surface. Change in_place editing to take advantage of this.
Diffstat (limited to 'core/controllers/photo.php')
-rw-r--r--core/controllers/photo.php25
1 files changed, 11 insertions, 14 deletions
diff --git a/core/controllers/photo.php b/core/controllers/photo.php
index 45db4b02..55ab6247 100644
--- a/core/controllers/photo.php
+++ b/core/controllers/photo.php
@@ -17,22 +17,19 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
-class Photo_Controller extends Template_Controller {
- public $template = "page.html";
+class Photo_Controller extends Item_Controller {
+ public function get($item) {
+ $template = new View("page.html");
- public function view($id) {
- $item = ORM::factory("item")->where("id", $id)->find();
- if (empty($item->id)) {
- return Kohana::show_404();
- }
-
- $this->template->content = new View("photo.html");
+ /** @todo: this needs to be data-driven */
+ $theme = new Theme("default", $template);
- $this->template->set_global('item', $item);
- $this->template->set_global('children', $item->children());
- $this->template->set_global('parents', $item->parents());
+ $template->set_global('item', $item);
+ $template->set_global('children', $item->children());
+ $template->set_global('parents', $item->parents());
+ $template->set_global('theme', $theme);
+ $template->content = new View("photo.html");
- /** @todo: this needs to be data-driven */
- $this->template->set_global('theme', new Theme("default", $this->template));
+ print $template->render();
}
}