ZenphotoCMS 1.6.5

image_album_statistics.php

Support functions for "statistics" about images and albums.

Supports such statistics as "most popular", "latest", "top rated", etc.

CAUTION: The way to get a specific album has changed. You now have to pass the foldername of an album instead the album title.

Tags
author

Malte Müller (acrylian), Stephen Billard (sbillard), gjr

Table of Contents

Functions

getAlbumStatistic()  : array<string|int, mixed>
Returns a array of album objects of album statistic accordingly to $option
printAlbumStatistic()  : mixed
Prints album statistic according to $option as an unordered HTML list A css id is attached by default named '$option_album'
printAlbumStatisticItem()  : mixed
A helper function that only prints a item of the loop within printAlbumStatistic() Not for standalone use.
getImageStatistic()  : array<string|int, mixed>
Returns a array of image objects of image statistic according to $option
printImageStatistic()  : string
Prints image statistic according to $option as an unordered HTML list A css id is attached by default named accordingly'$option'
checkIfNew()  : bool
A little helper function that checks if an image or album is to be considered 'new' within the time range set in relation to getImageDate()/getAlbumDate() Returns true or false.
getNumAllSubalbums()  : bool
Gets the number of all subalbums of all subalbum levels of either the current album or $albumobj
getPictureOfTheDay()  : object|nill
Returns an randomly selected image objecet from the gallery per day.

Functions

getAlbumStatistic()

Returns a array of album objects of album statistic accordingly to $option

getAlbumStatistic([int $number = 5 ][, string $option = '' ][, string $albumfolder = '' ][, int $threshold = 0 ][, mixed $sortdirection = 'desc' ][, bool $collection = false ]) : array<string|int, mixed>
Parameters
$number : int = 5

the number of albums to get

$option : string = ''

"popular" for the most popular albums, "latest" for the latest uploaded by id (Discovery) "latest-date" for the latest by date "latest-mtime" for the latest by mtime "latest-publishdate" for the latest by publishdate "mostrated" for the most voted, "toprated" for the best voted "latestupdated" for the latest updated "random" for random order (yes, strictly no statistical order...)

$albumfolder : string = ''

The name of an album to get only the statistc for its direct subalbums

$threshold : int = 0

the minimum number of ratings (for rating options) or hits (for popular option) an album must have to be included in the list. (Default 0)

$sortdirection : mixed = 'desc'
$collection : bool = false

only if $albumfolder is set: true if you want to get statistics to include all subalbum levels

Return values
array<string|int, mixed>

printAlbumStatistic()

Prints album statistic according to $option as an unordered HTML list A css id is attached by default named '$option_album'

printAlbumStatistic(string $number, string $option[, bool $showtitle = false ][, bool $showdate = false ][, bool $showdesc = false ][, int $desclength = 40 ][, string $showstatistic = '' ][, int $width = NULL ][, int $height = NULL ][, bool $crop = NULL ][, mixed $albumfolder = '' ][, mixed $firstimglink = false ][, int $threshold = 0 ][, bool $collection = false ]) : mixed
Parameters
$number : string

the number of albums to get

$option : string

"popular" for the most popular albums, "latest" for the latest uploaded by id (Discovery) "latest-date" for the latest by date "latest-mtime" for the latest by mtime "latest-publishdate" for the latest by publishdate "mostrated" for the most voted, "toprated" for the best voted "latestupdated" for the latest updated "random" for random order (yes, strictly no statistical order...)

$showtitle : bool = false

if the album title should be shown

$showdate : bool = false

if the album date should be shown

$showdesc : bool = false

if the album description should be shown

$desclength : int = 40

the length of the description to be shown

$showstatistic : string = ''

"hitcounter" for showing the hitcounter (views), "rating" for rating, "rating+hitcounter" for both.

$width : int = NULL

the width/cropwidth of the thumb if crop=true else $width is longest size. (Default 85px)

$height : int = NULL

the height/cropheight of the thumb if crop=true else not used. (Default 85px)

$crop : bool = NULL

'true' (default) if the thumb should be cropped, 'false' if not

$albumfolder : mixed = ''
$firstimglink : mixed = false
$threshold : int = 0

the minimum number of ratings (for rating options) or hits (for popular option) an album must have to be included in the list. (Default 0)

$collection : bool = false

only if $albumfolder is set: true if you want to get statistics to include all subalbum levels

printAlbumStatisticItem()

A helper function that only prints a item of the loop within printAlbumStatistic() Not for standalone use.

printAlbumStatisticItem(array<string|int, mixed> $album, string $option[, bool $showtitle = false ][, bool $showdate = false ][, bool $showdesc = false ][, int $desclength = 40 ][, string $showstatistic = '' ][, int $width = NULL ][, int $height = NULL ][, bool $crop = NULL ][, bool $firstimglink = false ]) : mixed
Parameters
$album : array<string|int, mixed>

the array with album objects that getAlbumsStatistic() submitted

$option : string

"popular" for the most popular albums, "latest" for the latest uploaded by id (Discovery) "latest-date" for the latest by date "latest-mtime" for the latest by mtime "latest-publishdate" for the latest by publishdate "mostrated" for the most voted, "toprated" for the best voted "latestupdated" for the latest updated "random" for random order (yes, strictly no statistical order...)

$showtitle : bool = false

if the album title should be shown

$showdate : bool = false

if the album date should be shown

$showdesc : bool = false

if the album description should be shown

$desclength : int = 40

the length of the description to be shown

$showstatistic : string = ''

"hitcounter" for showing the hitcounter (views), "rating" for rating, "rating+hitcounter" for both.

$width : int = NULL

the width/cropwidth of the thumb if crop=true else $width is longest size. (Default 85px)

$height : int = NULL

the height/cropheight of the thumb if crop=true else not used. (Default 85px)

$crop : bool = NULL

'true' (default) if the thumb should be cropped, 'false' if not

$firstimglink : bool = false

'false' (default) if the album thumb link should lead to the album page, 'true' if to the first image of theh album if the album itself has images

getImageStatistic()

Returns a array of image objects of image statistic according to $option

getImageStatistic(string $number, string $option[, string $albumfolder = '' ][, bool $collection = false ][, int $threshold = 0 ][, mixed $sortdirection = 'desc' ]) : array<string|int, mixed>
Parameters
$number : string

the number of images to get

$option : string

"popular" for the most popular images, "popular" for the most popular albums, "latest" for the latest uploaded by id (Discovery) "latest-date" for the latest by date "latest-mtime" for the latest by mtime "latest-publishdate" for the latest by publishdate "mostrated" for the most voted, "toprated" for the best voted "latestupdated" for the latest updated "random" for random order (yes, strictly no statistical order...)

$albumfolder : string = ''

foldername of an specific album

$collection : bool = false

only if $albumfolder is set: true if you want to get statistics from this album and all of its subalbums

$threshold : int = 0

the minimum number of ratings (for rating options) or hits (for popular option) an image must have to be included in the list. (Default 0)

$sortdirection : mixed = 'desc'
Return values
array<string|int, mixed>

printImageStatistic()

Prints image statistic according to $option as an unordered HTML list A css id is attached by default named accordingly'$option'

printImageStatistic(string $number, string $option[, string $albumfolder = '' ][, bool $showtitle = false ][, bool $showdate = false ][, bool $showdesc = false ][, int $desclength = 40 ][, string $showstatistic = '' ][, int $width = NULL ][, int $height = NULL ][, bool $crop = NULL ][, bool $collection = false ][, bool $fullimagelink = false ][, int $threshold = 0 ]) : string
Parameters
$number : string

the number of albums to get

$option : string

"popular" for the most popular images, "popular" for the most popular albums, "latest" for the latest uploaded by id (Discovery) "latest-date" for the latest by date "latest-mtime" for the latest by mtime "latest-publishdate" for the latest by publishdate "mostrated" for the most voted, "toprated" for the best voted "latestupdated" for the latest updated "random" for random order (yes, strictly no statistical order...)

$albumfolder : string = ''

foldername of an specific album

$showtitle : bool = false

if the image title should be shown

$showdate : bool = false

if the image date should be shown

$showdesc : bool = false

if the image description should be shown

$desclength : int = 40

the length of the description to be shown

$showstatistic : string = ''

"hitcounter" for showing the hitcounter (views), "rating" for rating, "rating+hitcounter" for both.

$width : int = NULL

the width/cropwidth of the thumb if crop=true else $width is longest size. (Default 85px)

$height : int = NULL

the height/cropheight of the thumb if crop=true else not used. (Default 85px)

$crop : bool = NULL

'true' (default) if the thumb should be cropped, 'false' if not

$collection : bool = false

only if $albumfolder is set: true if you want to get statistics from this album and all of its subalbums

$fullimagelink : bool = false

'false' (default) for the image page link , 'true' for the unprotected full image link (to use Colorbox for example)

$threshold : int = 0

the minimum number of ratings (for rating options) or hits (for popular option) an image must have to be included in the list. (Default 0)

Return values
string

checkIfNew()

A little helper function that checks if an image or album is to be considered 'new' within the time range set in relation to getImageDate()/getAlbumDate() Returns true or false.

checkIfNew([string $mode = "image" ][, int $timerange = 604800 ]) : bool
Parameters
$mode : string = "image"

What to check "image" or "album".

$timerange : int = 604800

The time range the item should be considered new. Default is 604800 (unix time seconds = ca. 7 days)

Return values
bool

getNumAllSubalbums()

Gets the number of all subalbums of all subalbum levels of either the current album or $albumobj

getNumAllSubalbums(object $albumobj[, string $pre = '' ]) : bool
Parameters
$albumobj : object

Optional album object to check

$pre : string = ''

Optional text you want to print before the number

Return values
bool

getPictureOfTheDay()

Returns an randomly selected image objecet from the gallery per day.

getPictureOfTheDay([string $albumfolder = '' ][, bool $collection = false ]) : object|nill

Returns null on failure

Parameters
$albumfolder : string = ''

foldername of an specific album. If not set from all images in the gallery

$collection : bool = false

only if $albumfolder is set: true if you want to get statistics from this album and all of its subalbums

Tags
since
1.5.8
Return values
object|nill

        
On this page

Search results