Constants

VERSION

VERSION

Serializable version constant

Properties

$id

$id : integer

The gallery id.

Type

integer

$_share

$_share : \Horde_Share_Object

The share object for this gallery.

Type

\Horde_Share_Object

$_modeHelper

$_modeHelper : \Ansel_GalleryMode_*

The gallery mode helper

Type

\Ansel_GalleryMode_* — object

Methods

__construct()

__construct(\Horde_Share_Object  $share) : \Ansel_Gallery

The Ansel_Gallery constructor.

Parameters

\Horde_Share_Object $share

Returns

\Ansel_Gallery

__get()

__get(string  $property) : mixed

Helper for accessing the gallery id

Parameters

string $property

The property

Returns

mixed

get()

get(string  $property) : mixed

Get a gallery property

Parameters

string $property

The property to return.

Returns

mixed —

The value.

getParents()

getParents() : array

Returns

array —

An array of Ansel_Gallery objects.

setPermission()

setPermission(\Horde_Perms_Permission  $permission,   $update = true) 

Parameters

\Horde_Perms_Permission $permission
$update

getShare()

getShare() : \Horde_Share_Object

Get the gallery's share object.

Returns

\Horde_Share_Object

hasFeature()

hasFeature(string  $feature) : boolean

Check for special capabilities of this gallery.

Parameters

string $feature

The feature to check for.

Returns

boolean

canDownload()

canDownload() : boolean

Checks if the user can download the full photo

Returns

boolean —

Whether or not user can download full photos

save()

save() 

Saves any changes to this object to the backend permanently.

Throws

\Ansel_Exception

updateImageCount()

updateImageCount(integer  $images, boolean  $add = true) 

Update the gallery image count.

Parameters

integer $images

Number of images in action

boolean $add

True if adding, false if removing

Throws

\Ansel_Exception

addImageObject()

addImageObject(\Ansel_Image  $image, boolean  $default = false) : integer

Adds an Ansel_Image object to this gallery.

Parameters

\Ansel_Image $image

The ansel image object to add

boolean $default

Set this image as the gallery's key image.

Returns

integer —

The new image id

addImage()

addImage(array  $image_data, boolean  $default = false) : integer

Add an image to this gallery.

Parameters

array $image_data

The image to add. Keys include:

   image_filename   - The filename of the image [REQUIRED].
   data             - The binary image data [REQUIRED]
   image_caption    - The caption/description. Defaults to filename.
   image_type       - The MIME type of the image. Attempts to detect.
 
                      'image_caption', and 'data'. Optional keys
                      include 'image_filename' and 'image_type'
boolean $default

Make this image the new default tile image.

Returns

integer —

The id of the new image.

clearStacks()

clearStacks() 

Clear all of this gallery's key image stacks from the VFS and the gallery's data store.

Throws

\Ansel_Exception

clearThumbs()

clearThumbs() 

Removes all generated and cached thumbnails for this gallery.

clearViews()

clearViews() 

Removes all generated and cached views for this gallery.

resetKeyImage()

resetKeyImage() 

Reset the gallery's key image. This will force Ansel to attempt to fetch a new key image the next time one is requested.

moveImagesTo()

moveImagesTo(array  $images, \Ansel_Gallery  $gallery) : integer

Move images from this gallery to a new gallery.

Parameters

array $images

An array of image ids.

\Ansel_Gallery $gallery

The gallery to move the images to.

Returns

integer —

The number of images moved.

copyImagesTo()

copyImagesTo(array  $images, \Ansel_Gallery  $gallery) : integer

Copy image and related data to specified gallery.

Parameters

array $images

An array of image ids.

\Ansel_Gallery $gallery

The gallery to copy images to.

Throws

\Ansel_Exception

Returns

integer —

The number of images copied

setImageOrder()

setImageOrder(integer  $imageId, integer  $pos) 

Set the order of an image in this gallery.

Parameters

integer $imageId

The image to sort.

integer $pos

The sort position of the image.

Throws

\Ansel_Exception

removeImage()

removeImage(mixed  $image, boolean  $isStack = false) 

Remove the given image from this gallery.

Parameters

mixed $image

Image to delete. Can be an Ansel_Image or an image ID.

boolean $isStack

Indicates if this image represents a stack image.

Throws

\Horde_Exception_NotFound,

Ansel_Exception

getIdentity()

getIdentity() : \Horde_Prefs_Identity

Returns this share's owner's Identity object.

Returns

\Horde_Prefs_Identity —

object for the owner of this gallery.

getTile()

getTile(\Ansel_Gallery  $parent = null, \Ansel_Style  $style = null, boolean  $mini = false, array  $params = array()) : \Ansel_Tile_Gallery

Output the HTML for this gallery's tile.

Parameters

\Ansel_Gallery $parent

The parent Ansel_Gallery object

\Ansel_Style $style

A style object to use.

boolean $mini

Force the use of a mini thumbnail?

array $params

Any additional parameters the Ansel_Tile object may need.

Returns

\Ansel_Tile_Gallery

getChildren()

getChildren(string  $user, integer  $perm = \Horde_Perms::SHOW, boolean  $allLevels = true) : array

Get all children of this share.

Parameters

string $user

The user to use for checking perms

integer $perm

Horde_Perms::* constant. If NULL will return all shares regardless of permissions.

boolean $allLevels

Return all levels.

Throws

\Ansel_Exception

Returns

array —

An array of Ansel_Gallery objects

getGalleryChildren()

getGalleryChildren(integer  $perm = \Horde_Perms::SHOW, integer  $from, integer  $to, boolean  $noauto = true) : \A

Get the children of this gallery.

Parameters

integer $perm

The permissions to limit to.

integer $from

The child to start at.

integer $to

The child to end with.

boolean $noauto

Prevent auto

Returns

\A —

mixed array of Ansel_Gallery and Ansel_Image objects that are children of this gallery.

countGalleryChildren()

countGalleryChildren(integer  $perm = \Horde_Perms::SHOW, boolean  $galleries_only = false, boolean  $noauto = true) : integer

Return the count of this gallery's children

Parameters

integer $perm

The permissions to require.

boolean $galleries_only

Only include galleries, no images.

boolean $noauto

Do not auto drill down into gallery tree.

Returns

integer —

The count of this gallery's children.

countChildren()

countChildren(  $user,   $perm = \Horde_Perms::SHOW,   $allLevels = true) 

Parameters

$user
$perm
$allLevels

listImages()

listImages(integer  $from, integer  $count) : array

Lists a slice of the image ids in this gallery.

Parameters

integer $from

The image to start listing.

integer $count

The numer of images to list.

Returns

array —

An array of image_ids

getImages()

getImages(integer  $from, integer  $count) 

Gets a slice of the images in this gallery.

Parameters

integer $from

The image to start fetching.

integer $count

The numer of images to return.

getRecentImages()

getRecentImages(integer  $limit = 10) : array

Return the most recently added images in this gallery.

Parameters

integer $limit

The maximum number of images to return.

Returns

array —

An array of Ansel_Image objects

getImage()

getImage(integer  $id) : \Ansel_Image

Returns the image in this gallery corresponding to the given id.

Parameters

integer $id

The ID of the image to retrieve.

Returns

\Ansel_Image

The image object corresponding to the given id.

hasSubGalleries()

hasSubGalleries() : boolean

Checks if the gallery has any subgallery

Returns

boolean

countImages()

countImages(boolean  $subgalleries = false) : integer

Returns the number of images in this gallery and, optionally, all sub-galleries.

Parameters

boolean $subgalleries

Determines whether subgalleries should be counted or not.

Returns

integer —

number of images in this gallery

getKeyImage()

getKeyImage(\Ansel_Style  $style = null) : mixed

Returns the key image for this gallery.

Parameters

\Ansel_Style $style

Force the use of this style, if it's available otherwise use whatever style is choosen for this gallery. If prettythumbs are not available then we always use ansel_default style.

Returns

mixed —

The image_id of the key image or false.

getTags()

getTags() : array

Returns this gallery's tags.

Throws

\Horde_Exception

Returns

array —

of tag info

setTags()

setTags(array  $tags,   $replace = true) 

Set/replace this gallery's tags.

Parameters

array $tags

An array of tag names to associate with this image.

$replace

Throws

\Horde_Exception_PermissionDenied

removeTag()

removeTag(string  $tag) 

Remove a single tag from this gallery's tag collection

Parameters

string $tag

The tag name to remove.

getStyle()

getStyle() : \Ansel_Style

Return the style definition for this gallery.

Returns

\Ansel_Style

The style definition array.

hasPermission()

hasPermission(string  $userid, integer  $permission, string  $creator = null) : boolean

Checks to see if a user has a given permission.

Parameters

string $userid

The userid of the user.

integer $permission

A Horde_Perms::* constant to test for.

string $creator

The creator of the event.

Returns

boolean —

Whether or not $userid has $permission.

getPermission()

getPermission() : \Horde_Perms_Permission

Returns the permission of this share.

Returns

\Horde_Perms_Permission —

Permission object that represents the permissions on this share.

isOldEnough()

isOldEnough() : boolean

Check user age limtation

Returns

boolean

hasPasswd()

hasPasswd() : boolean

Determine if we need to unlock a password protected gallery

Returns

boolean

setParent()

setParent(mixed  $parent) 

Sets this gallery's parent gallery.

Parameters

mixed $parent

An Ansel_Gallery or a gallery_id.

Throws

\Ansel_Exception

set()

set(string  $attribute, mixed  $value, boolean  $update = false) 

Sets an attribute value in this object.

Parameters

string $attribute

The attribute to set.

mixed $value

The value for $attribute.

boolean $update

Commit only this change to storage.

Throws

\Ansel_Exception

setDate()

setDate(  $date) 

Parameters

$date

getDate()

getDate() 

getGalleryCrumbData()

getGalleryCrumbData() : \An

Get an array describing where this gallery is in a breadcrumb trail.

Returns

\An —

array of 'title' and 'navdata' hashes with the [0] element being the deepest part.

serialize()

serialize() : string

Serialize this object.

Returns

string —

The serialized data.

unserialize()

unserialize(  $data) 

Parameters

$data

toJson()

toJson(boolean  $full = false) : \StdClass

Returns a json representation of this gallery.

Parameters

boolean $full

Return all information (subgalleries and images)?

Returns

\StdClass —

An object describing the gallery

'id' - gallery id
'p'  - gallery's parent's id (null if top level)
'pn' - gallery's parent's name (null if top level)
'n'  - gallery name
'dc' - date created
'dm' - date modified
'd'  - description
'ki' - key image
'sg' - an object with the following properties:
     'n'  - gallery name
     'dc' - date created
     'dm' - date modified
     'd'  - description
     'ki' - key image

 'imgs' - an array of image objects with the following properties:
     'id'  - the image id
     'url' - the image url

toArray()

toArray() 

_setModeHelper()

_setModeHelper(string  $type = 'Normal') : \Ansel_Gallery_Mode

Simple factory to set the proper mode object.

Parameters

string $type

The mode to use

Returns

\Ansel_Gallery_Mode —

object

_getDefaultImageId()

_getDefaultImageId() : integer|boolean

Returns the id for the key image of this gallery.

Returns

integer|boolean —

The image id or false if none found.