diff options
author | Tim Almdal <tnalmdal@shaw.ca> | 2009-03-08 16:29:01 +0000 |
---|---|---|
committer | Tim Almdal <tnalmdal@shaw.ca> | 2009-03-08 16:29:01 +0000 |
commit | 39954ad0b77800b3d4935430794adf18c2625148 (patch) | |
tree | a9016b38fa2b1ed0e9a20276457f2011a4a70f27 /core/helpers | |
parent | bf6c814e81a00d6aec3cacdecd3b93b90cf73a3e (diff) |
Implement Sortable albums. Current sort fields include (Creation
Date, Update Date, Random Key, Title, Mime Type, Item Type & Number of views)
Diffstat (limited to 'core/helpers')
-rw-r--r-- | core/helpers/album.php | 23 | ||||
-rw-r--r-- | core/helpers/core_installer.php | 1 |
2 files changed, 24 insertions, 0 deletions
diff --git a/core/helpers/album.php b/core/helpers/album.php index c75095be..d93840c1 100644 --- a/core/helpers/album.php +++ b/core/helpers/album.php @@ -85,6 +85,29 @@ class album_Core { } $group->input("title")->label(t("Title"))->value($parent->title); $group->textarea("description")->label(t("Description"))->value($parent->description); + $sort_order = $group->group("sort_order", array("id" => "gAlbumSortOrder")) + ->label(t("Sort Order")); + if (empty($parent->sort_order)) { + list ($sort_column, $sort_direction) = explode(" ", $parent->sort_column); + } else { + list ($sort_column, $sort_direction) = array("", "ASC"); + } + $sort_order->dropdown("column", array("id" => "gAlbumSortColumn")) + ->label(t("Sort by")) + ->options(array("" => t("select a column"), + "created" => t("Creation Date"), + "mime_type" => t("Mime Type"), + "title" => t("Title"), + "type" => t("Type"), + "updated" => t("Updated Date"), + "view_count" => t("Number of views"), + "rand_key" => t("Random"))) + ->selected($sort_column); + $sort_order->dropdown("direction", array("id" => "gAlbumSortDirection")) + ->label(t("Order")) + ->options(array("ASC" => t("Ascending"), + "DESC" => t("Descending"))) + ->selected($sort_direction); $group->hidden("type")->value("album"); $group->submit("")->value(t("Modify")); $form->add_rules_from(ORM::factory("item")); diff --git a/core/helpers/core_installer.php b/core/helpers/core_installer.php index 83c6907a..3a1013e0 100644 --- a/core/helpers/core_installer.php +++ b/core/helpers/core_installer.php @@ -78,6 +78,7 @@ class core_installer { `view_count` int(9) default 0, `width` int(9) default NULL, `rand_key` float default NULL, + `sort_column` varchar(255) default NULL, PRIMARY KEY (`id`), KEY `parent_id` (`parent_id`), KEY `type` (`type`), |