Procedural File: print_album_menu.php
Source Location: /plugins/print_album_menu.php
Page Details
printAlbumMenu for Zenphoto
Changelog 1.4.5: - Fixes some validation issues and an php warning
1.4.4.5: - Minor fix about a php notice for an undefined variable
1.4.4.4: - Corrects an inconsistency about misslabeled css id and classes parameters:
There is now a class for the active toplevel element, so that you can use it for top and sub levels. - Also now not every list item gets the active class assigned anymore...
1.4.4.3. - Minor bug fix, used the album title instead of the unique album folder name at one place.
1.4.4.2. - HTML validation again (turns css id for subalbums into the valid css class) Thanks to miem for the find.
1.4.4.1 1.4.4: - Adds new list mode option '$showsubs' to optionally always show subalbums
- Fixes a html validation error of using a CSS id several times for the active top level albums (now a class)
1.4.3.1: - Some very minor code cleanup
1.4.3: - Divided the menu into two separate functions printAlbumMenuList() and printAlbumMenuJump(). The plan to always have the jump menu
mode showing top level albums and sub level albums was simply easier to achieve separated than within the more complicated and especially context sensitive list mode code. printAlbumMenu() remains as a wrapper function so that it can be used as before. - Some documentation errors fixed
1.4.2: - Fixes lost count for jump menu in the 1.4.1
- Some more code optimizations: Another helper function checkAlbumDisplayLevel() added
- Helper function checkIfActiveAlbum() renamed to checkSelectedAlbum()
- Helper function createAlbumMenuLink() extended for the jump menu variant
1.4.1: - Jump variant: 'choose an album' text removed , now the active album is always selected.
This adds the helper function checkIfActiveAlbum()
- List variant: Adds missing index link and title atribute to the links and make its name editiable and and option (see below)
- List variant: Adds helper function createAlbumMenuLink() to generate the link / none link and get rid of some repetive lines of code
1.4: - New options for more layout flexibility: "list-top" for only showing the toplevel albums,
"list-sub" for showing only sublevel albums if within a toplevel album or one of its subalbums
1.3.3: - Code reworked, now uses the gallery/album objects so that protected and unpublished
albums as well as the album sortorder are handled automatically
- For better usability selected album names in the list are now not links anymore as suggested
on the forum a while ago (also the former used <strong> is skipped)
1.3.2: - turned into a plugin for zenphoto 1.1.5 svn/1.1.6
1.3.1: - support for album passwords
- a little code reformatting
- the return of the somehow forgotten published or not published check
1.3: - only for zenphoto 1.1. or newer
- nearly completly rewritten
- Supports 4 subalbum levels with context sensitive fold out display
1.2.2.3: - Automatic detection if mod_rewrite is enabled but it has to be set and save in the admin options.
- Better looking source code thanks to spacing and linebreaks implemented by aitf311
1.2.2.2: - Automatic disabling of the counter for main albums so that they don't show "(0)" anymore if you only use subalbums for images
now for subalbums, too.1.2.2.1: - Automatic disabling of the counter for main albums so that they don't show "(0)" anymore if you only use subalbums for images
1.2.2: - Change Subalbum CSS-ID "$id2" to CLASS "$class" ((X)HTML Validation issue)
- Add htmlspecialchars to the printed album titles, so that validation does not fail because of ampersands in names.
1.2.1: - New option for mod_rewrite (needs to be automatic...),
- bug fixes for the id-Tags, which didn't get used.
1.2: Now works with sbillard's album publishing function.1.1.: - Option for album list or a drop down jump menu if you want to save space
- Displays the number of images in the album (like e.g. wordpress does with articles)
- Option for disabling the counter
- Parameters for CSS-Ids for styling, separate ones for main album and subalbums
- Renamed the function name from show_album_menu() to more zp style printAlbumMenu()
| Author: | Malte Müller (acrylian) |
| Version: | 1.4.5 |
Functions
checkAlbumDisplayLevel [line 461]
A printAlbumMenu() helper function that checks what subalbum level should be displayed. If you are in an subalbum that it itself an subalbum and containts subalbums it returns true and lets the album menu display the parent album, the current level and the next sublevel Not for standalone use.
Parameters:
|
object |
$currentalbum: |
The album object of the current album in whose level we are |
|
object |
$parentalbum: |
The album object of the parent album |
|
string |
$currentfolder: |
The current folder |
|
int |
$level: |
The level the function should check for (1-4 for sublevel 1 - 4) |
bool checkAlbumDisplayLevel(
object $currentalbum, object $parentalbum, string $currentfolder, int $level
)
|
|
checkSelectedAlbum [line 431]
A printAlbumMenu() helper function for the jump menu mode of printAlbumMenu() that only checks which the current album so that the entry in the in the dropdown jump menu can be selected Not for standalone use.
Parameters:
|
string |
$checkalbum: |
The album title to check |
|
string |
$option: |
"index" for index level, "album" for album level |
API Tags:
| Return: | returns nothing or "selected" |
string checkSelectedAlbum(
string $checkalbum, string $option
)
|
|
createAlbumMenuLink [line 380]
A printAlbumMenu() helper function for the list menu mode of printAlbumMenu() that only generates an list item, as a link if not the current album Not for standalone use.
Parameters:
|
object |
$album: |
the album oject |
|
string |
$option2: |
the value of $option of the printAlbumMenu() |
|
string |
$css: |
One of the both css_active values of the printAlbumMenu() |
|
string |
$albumpath: |
the albumpath for mod_rewrite or not |
|
string |
$mode: |
"list" for list mode link, "jump" for jump mode link |
|
int |
$level: |
level number for jump mode (0 toplevel, 1-4 sublevel) |
string createAlbumMenuLink(
object $album, string $option2, string $css, string $albumpath, string $mode, [int $level = '']
)
|
|
printAlbumMenu [line 132]
Prints a list of all albums context sensitive up to the 4th subalbum level.
Since 1.4.3 this is a wrapper function for the separate functions printAlbumMenuList() and printAlbumMenuJump(). that was included to remain compatiblility with older installs of this menu. Usage: add the following to the php page where you wish to use these menus: enable this extension on the zenphoto admin plugins tab; Call the function printAlbumMenu() at the point where you want the menu to appear.
Parameters:
|
string |
$option: |
"list" for html list, "list-top" for only the top level albums, "list-sub" for only the subalbums if in one of theme or their toplevel album |
|
string |
$option2: |
"count" for a image counter in brackets behind the album name, "" = for no image numbers or leave blank |
|
string |
$css_id: |
insert css id for the main album list, leave blank if you don't use (only list mode) |
|
string |
$css_class_topactive: |
insert css class for the active link in the main album list (only list mode) |
|
string |
$css_class: |
insert css class for the sub album lists (only list mode) |
|
string |
$css_class_active: |
insert css class for the active link in the sub album lists (only list mode) |
|
string |
$indexname: |
insert the name how you want to call the link to the gallery index (insert "" if you don't use it, it is not printed then) |
|
string |
$showsubs: |
'true' to always show the subalbums, 'false' for normal context sensitive behaviour (only list mode) |
API Tags:
| Return: | list or drop down jump menu of the albums |
Information Tags:
html printAlbumMenu(
string $option, string $option2, [string $css_id = ''], [string $css_class_topactive = ''], [string $css_class = ''], [string $css_class_active = ''], [string $indexname = "Gallery Index"], [string $showsubs = false]
)
|
|
printAlbumMenuJump [line 305]
Prints a dropdown menu of all albums up to the 4 sublevel (not context sensitive) Is used by the wrapper function printAlbumMenu() if the options "jump" is choosen. For standalone use, too.
Usage: add the following to the php page where you wish to use these menus: enable this extension on the zenphoto admin plugins tab; Call the function printAlbumMenuJump() at the point where you want the menu to appear.
Parameters:
|
string |
$option: |
"count" for a image counter in brackets behind the album name, "" = for no image numbers |
|
string |
$indexname: |
insert the name (default "Gallery Index") how you want to call the link to the gallery index, insert "" if you don't use it, it is not printed then. |
void printAlbumMenuJump(
[string $option = "count"], [string $indexname = "Gallery Index"]
)
|
|
printAlbumMenuList [line 158]
Prints a nested html list of all albums context sensitive up to the 4th subalbum level.
Usage: add the following to the php page where you wish to use these menus: enable this extension on the zenphoto admin plugins tab; Call the function printAlbumMenuList() at the point where you want the menu to appear.
Parameters:
|
string |
$option: |
"list" for html list, "list-top" for only the top level albums, "list-sub" for only the subalbums if in one of theme or their toplevel album |
|
string |
$option2: |
"count" for a image counter in brackets behind the album name, "" = for no image numbers or leave blank |
|
string |
$css_id: |
insert css id for the main album list, leave blank if you don't use (only list mode) |
|
string |
$css_id_active: |
insert css class for the active link in the main album list (only list mode) |
|
string |
$css_class: |
insert css class for the sub album lists (only list mode) |
|
string |
$css_class_active: |
insert css class for the active link in the sub album lists (only list mode) |
|
string |
$indexname: |
insert the name (default "Gallery Index") how you want to call the link to the gallery index, insert "" if you don't use it, it is not printed then. |
|
string |
$showsubs: |
'true' to always show the subalbums, 'false' for normal context sensitive behaviour (only list mode) |
|
|
$css_class_topactive: |
|
API Tags:
| Return: | list of the albums |
html printAlbumMenuList(
string $option, string $option2, [string $css_id = ''], [ $css_class_topactive = ''], [string $css_class = ''], [string $css_class_active = ''], [string $indexname = "Gallery Index"], [string $showsubs = false], string $css_id_active
)
|
|
|
|