where("type", "=", "album") ->where("id", "!=", "1") ->viewable() ->find_all(); // Loop through each album and output the necessary information. foreach ($albums as $album) { $album_contents = ORM::factory("item") ->where("parent_id", "=", $album->id) ->where("type", "=", "photo") ->viewable() ->find_all(); print ($album->level-2) . "\t" . $album->id . "\t" . $album->name . "\t" . count($album_contents) . "\n"; } } else if ($_GET['a'] == "photos") { // Generate an array of photo's in the specified album. $photos = ORM::factory("item") ->where("type", "=", "photo") ->where("parent_id", "=", $_GET['id']) ->viewable() ->find_all(); // Loop through each photo, generate a list of tags (if available) and then output the necessary information. foreach ($photos as $photo) { $photo_keywords = ""; if (module::is_active("tag")) { $photo_tags = ORM::factory("tag") ->join("items_tags", "tags.id", "items_tags.tag_id") ->where("items_tags.item_id", "=", $photo->id) ->find_all(); foreach ($photo_tags as $tag) { $photo_keywords = $photo_keywords . $tag->name . ", "; } // Cut off the ", " from the end of the string. if ($photo_keywords != "") { $photo_keywords = substr($photo_keywords, 0, -2); } } print $photo->id . "\t" . $photo->title . "\t" . stristr($photo->resize_url(false),"/var/") . "\t" . stristr($photo->thumb_url(false), "/var/") . "\t\t" . $photo->description . "\t" . $photo_keywords . "\n"; } } } }