From 7017e95c99d03bd43a1956fbc54ac2f85517d886 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sun, 4 Jan 2009 09:28:57 +0000 Subject: Allow passing a query string as an argument to Item_Model::url() --- core/helpers/core_menu.php | 2 +- core/models/item.php | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) (limited to 'core') diff --git a/core/helpers/core_menu.php b/core/helpers/core_menu.php index 29de486e..8316aa1f 100644 --- a/core/helpers/core_menu.php +++ b/core/helpers/core_menu.php @@ -90,7 +90,7 @@ class core_menu_Core { ->append(Menu::factory("link") ->id("album") ->label(_("Return to album")) - ->url("{$theme->item()->parent()->url()}?show={$theme->item->id}") + ->url($theme->item()->parent()->url("show={$theme->item->id}")) ->css_id("gAlbumLink")); } diff --git a/core/models/item.php b/core/models/item.php index 6f56e726..a684b713 100644 --- a/core/models/item.php +++ b/core/models/item.php @@ -105,13 +105,19 @@ class Item_Model extends ORM_MPTT { /** * album: url::site("albums/2") * photo: url::site("photos/3") + * + * @param string $query the query string (eg "show=3") */ - public function url() { + public function url($query=array()) { if ($this->is_album()) { - return url::site("albums/$this->id"); + $url = url::site("albums/$this->id"); } else { - return url::site("photos/$this->id"); + $url = url::site("photos/$this->id"); + } + if ($query) { + $url .= "?$query"; } + return $url; } /** -- cgit v1.2.3