PHP Класс Ansel_Gallery, horde

Copyright 2001-2016 Horde LLC (http://www.horde.org/) See the enclosed file COPYING for license information (GPL). If you did not receive this file, see http://www.horde.org/licenses/gpl.
Автор: Michael J. Rubinsky ([email protected])
Наследование: implements Serializable
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$_modeHelper Ansel_GalleryMode_ The gallery mode helper
$_share Horde_Share_Object The share object for this gallery.

Открытые методы

Метод Описание
__construct ( Horde_Share_Object $share ) : Ansel_Gallery The Ansel_Gallery constructor.
__get ( string $property ) : mixed Helper for accessing the gallery id
addImage ( array $image_data, boolean $default = false ) : integer Add an image to this gallery.
addImageObject ( Ansel_Image $image, boolean $default = false ) : integer Adds an Ansel_Image object to this gallery.
canDownload ( ) : boolean Checks if the user can download the full photo
clearStacks ( ) Clear all of this gallery's key image stacks from the VFS and the gallery's data store.
clearThumbs ( ) Removes all generated and cached thumbnails for this gallery.
clearViews ( ) Removes all generated and cached views for this gallery.
copyImagesTo ( array $images, Ansel_Gallery $gallery ) : integer Copy image and related data to specified gallery.
countChildren ( $user, $perm = Horde_Perms::SHOW, $allLevels = true )
countGalleryChildren ( integer $perm = Horde_Perms::SHOW, boolean $galleries_only = false, boolean $noauto = true ) : integer Return the count of this gallery's children
countImages ( boolean $subgalleries = false ) : integer Returns the number of images in this gallery and, optionally, all sub-galleries.
get ( string $property ) : mixed Get a gallery property
getChildren ( string $user, integer $perm = Horde_Perms::SHOW, boolean $allLevels = true ) : array Get all children of this share.
getDate ( )
getGalleryChildren ( integer $perm = Horde_Perms::SHOW, integer $from, integer $to, boolean $noauto = true ) : A Get the children of this gallery.
getGalleryCrumbData ( ) : An Get an array describing where this gallery is in a breadcrumb trail.
getIdentity ( ) : Horde_Prefs_Identity Returns this share's owner's Identity object.
getImage ( integer $id ) : Ansel_Image Returns the image in this gallery corresponding to the given id.
getImages ( integer $from, integer $count ) Gets a slice of the images in this gallery.
getKeyImage ( Ansel_Style $style = null ) : mixed Returns the key image for this gallery.
getParent ( ) : Ansel_Gallery
getParents ( ) : array
getPermission ( ) : Horde_Perms_Permission Returns the permission of this share.
getRecentImages ( integer $limit = 10 ) : array Return the most recently added images in this gallery.
getShare ( ) : Horde_Share_Object Get the gallery's share object.
getStyle ( ) : Ansel_Style Return the style definition for this gallery.
getTags ( ) : array Returns this gallery's tags.
getTile ( Ansel_Gallery $parent = null, Ansel_Style $style = null, boolean $mini = false, array $params = [] ) : Ansel_Tile_Gallery Output the HTML for this gallery's tile.
hasFeature ( string $feature ) : boolean Check for special capabilities of this gallery.
hasPasswd ( ) : boolean Determine if we need to unlock a password protected gallery
hasPermission ( string $userid, integer $permission, string $creator = null ) : boolean Checks to see if a user has a given permission.
hasSubGalleries ( ) : boolean Checks if the gallery has any subgallery
isOldEnough ( ) : boolean Check user age limtation
listImages ( integer $from, integer $count ) : array Lists a slice of the image ids in this gallery.
moveImagesTo ( array $images, Ansel_Gallery $gallery ) : integer Move images from this gallery to a new gallery.
removeImage ( mixed $image, boolean $isStack = false ) Remove the given image from this gallery.
removeTag ( string $tag ) Remove a single tag from this gallery's tag collection
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.
save ( ) Saves any changes to this object to the backend permanently.
serialize ( ) : string Serialize this object.
set ( string $attribute, mixed $value, boolean $update = false ) Sets an attribute value in this object.
setDate ( $date )
setImageOrder ( integer $imageId, integer $pos ) Set the order of an image in this gallery.
setParent ( mixed $parent ) Sets this gallery's parent gallery.
setPermission ( Horde_Perms_Permission $permission, $update = true )
setTags ( array $tags, $replace = true ) Set/replace this gallery's tags.
toArray ( )
toJson ( boolean $full = false ) : StdClass Returns a json representation of this gallery.
unserialize ( $data )
updateImageCount ( integer $images, boolean $add = true ) Update the gallery image count.

Защищенные методы

Метод Описание
_getDefaultImageId ( ) : integer | boolean Returns the id for the key image of this gallery.
_setModeHelper ( string $type = 'Normal' ) : Ansel_Gallery_Mode Simple factory to set the proper mode object.

Описание методов

__construct() публичный Метод

The Ansel_Gallery constructor.
public __construct ( Horde_Share_Object $share ) : Ansel_Gallery
$share Horde_Share_Object
Результат Ansel_Gallery

__get() публичный Метод

Helper for accessing the gallery id
public __get ( string $property ) : mixed
$property string The property
Результат mixed

_getDefaultImageId() защищенный Метод

Returns the id for the key image of this gallery.
protected _getDefaultImageId ( ) : integer | boolean
Результат integer | boolean The image id or false if none found.

_setModeHelper() защищенный Метод

Simple factory to set the proper mode object.
protected _setModeHelper ( string $type = 'Normal' ) : Ansel_Gallery_Mode
$type string The mode to use
Результат Ansel_Gallery_Mode object

addImage() публичный Метод

Add an image to this gallery.
public addImage ( array $image_data, boolean $default = false ) : integer
$image_data array 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'
$default boolean Make this image the new default tile image.
Результат integer The id of the new image.

addImageObject() публичный Метод

Adds an Ansel_Image object to this gallery.
public addImageObject ( Ansel_Image $image, boolean $default = false ) : integer
$image Ansel_Image The ansel image object to add
$default boolean Set this image as the gallery's key image.
Результат integer The new image id

canDownload() публичный Метод

Checks if the user can download the full photo
public canDownload ( ) : boolean
Результат boolean Whether or not user can download full photos

clearStacks() публичный Метод

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

clearThumbs() публичный Метод

Removes all generated and cached thumbnails for this gallery.
public clearThumbs ( )

clearViews() публичный Метод

Removes all generated and cached views for this gallery.
public clearViews ( )

copyImagesTo() публичный Метод

Copy image and related data to specified gallery.
public copyImagesTo ( array $images, Ansel_Gallery $gallery ) : integer
$images array An array of image ids.
$gallery Ansel_Gallery The gallery to copy images to.
Результат integer The number of images copied

countChildren() публичный Метод

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

countGalleryChildren() публичный Метод

Return the count of this gallery's children
public countGalleryChildren ( integer $perm = Horde_Perms::SHOW, boolean $galleries_only = false, boolean $noauto = true ) : integer
$perm integer The permissions to require.
$galleries_only boolean Only include galleries, no images.
$noauto boolean Do not auto drill down into gallery tree.
Результат integer The count of this gallery's children.

countImages() публичный Метод

Returns the number of images in this gallery and, optionally, all sub-galleries.
public countImages ( boolean $subgalleries = false ) : integer
$subgalleries boolean Determines whether subgalleries should be counted or not.
Результат integer number of images in this gallery

get() публичный Метод

Get a gallery property
public get ( string $property ) : mixed
$property string The property to return.
Результат mixed The value.

getChildren() публичный Метод

Get all children of this share.
public getChildren ( string $user, integer $perm = Horde_Perms::SHOW, boolean $allLevels = true ) : array
$user string The user to use for checking perms
$perm integer Horde_Perms::* constant. If NULL will return all shares regardless of permissions.
$allLevels boolean Return all levels.
Результат array An array of Ansel_Gallery objects

getDate() публичный Метод

public getDate ( )

getGalleryChildren() публичный Метод

Get the children of this gallery.
public getGalleryChildren ( integer $perm = Horde_Perms::SHOW, integer $from, integer $to, boolean $noauto = true ) : A
$perm integer The permissions to limit to.
$from integer The child to start at.
$to integer The child to end with.
$noauto boolean Prevent auto
Результат A mixed array of Ansel_Gallery and Ansel_Image objects that are children of this gallery.

getGalleryCrumbData() публичный Метод

Get an array describing where this gallery is in a breadcrumb trail.
public getGalleryCrumbData ( ) : An
Результат An array of 'title' and 'navdata' hashes with the [0] element being the deepest part.

getIdentity() публичный Метод

Returns this share's owner's Identity object.
public getIdentity ( ) : Horde_Prefs_Identity
Результат Horde_Prefs_Identity object for the owner of this gallery.

getImage() публичный Метод

Returns the image in this gallery corresponding to the given id.
public getImage ( integer $id ) : Ansel_Image
$id integer The ID of the image to retrieve.
Результат Ansel_Image The image object corresponding to the given id.

getImages() публичный Метод

Gets a slice of the images in this gallery.
public getImages ( integer $from, integer $count )
$from integer The image to start fetching.
$count integer The numer of images to return.

getKeyImage() публичный Метод

Returns the key image for this gallery.
public getKeyImage ( Ansel_Style $style = null ) : mixed
$style Ansel_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.
Результат mixed The image_id of the key image or false.

getParent() публичный Метод

public getParent ( ) : Ansel_Gallery
Результат Ansel_Gallery

getParents() публичный Метод

public getParents ( ) : array
Результат array An array of Ansel_Gallery objects.

getPermission() публичный Метод

Returns the permission of this share.
public getPermission ( ) : Horde_Perms_Permission
Результат Horde_Perms_Permission Permission object that represents the permissions on this share.

getRecentImages() публичный Метод

Return the most recently added images in this gallery.
public getRecentImages ( integer $limit = 10 ) : array
$limit integer The maximum number of images to return.
Результат array An array of Ansel_Image objects

getShare() публичный Метод

Get the gallery's share object.
public getShare ( ) : Horde_Share_Object
Результат Horde_Share_Object

getStyle() публичный Метод

Return the style definition for this gallery.
public getStyle ( ) : Ansel_Style
Результат Ansel_Style The style definition array.

getTags() публичный Метод

Returns this gallery's tags.
public getTags ( ) : array
Результат array of tag info

getTile() публичный Метод

Output the HTML for this gallery's tile.
public getTile ( Ansel_Gallery $parent = null, Ansel_Style $style = null, boolean $mini = false, array $params = [] ) : Ansel_Tile_Gallery
$parent Ansel_Gallery The parent Ansel_Gallery object
$style Ansel_Style A style object to use.
$mini boolean Force the use of a mini thumbnail?
$params array Any additional parameters the Ansel_Tile object may need.
Результат Ansel_Tile_Gallery

hasFeature() публичный Метод

Check for special capabilities of this gallery.
public hasFeature ( string $feature ) : boolean
$feature string The feature to check for.
Результат boolean

hasPasswd() публичный Метод

Determine if we need to unlock a password protected gallery
public hasPasswd ( ) : boolean
Результат boolean

hasPermission() публичный Метод

Checks to see if a user has a given permission.
public hasPermission ( string $userid, integer $permission, string $creator = null ) : boolean
$userid string The userid of the user.
$permission integer A Horde_Perms::* constant to test for.
$creator string The creator of the event.
Результат boolean Whether or not $userid has $permission.

hasSubGalleries() публичный Метод

Checks if the gallery has any subgallery
public hasSubGalleries ( ) : boolean
Результат boolean

isOldEnough() публичный Метод

Check user age limtation
public isOldEnough ( ) : boolean
Результат boolean

listImages() публичный Метод

Lists a slice of the image ids in this gallery.
public listImages ( integer $from, integer $count ) : array
$from integer The image to start listing.
$count integer The numer of images to list.
Результат array An array of image_ids

moveImagesTo() публичный Метод

Move images from this gallery to a new gallery.
public moveImagesTo ( array $images, Ansel_Gallery $gallery ) : integer
$images array An array of image ids.
$gallery Ansel_Gallery The gallery to move the images to.
Результат integer The number of images moved.

removeImage() публичный Метод

Remove the given image from this gallery.
public removeImage ( mixed $image, boolean $isStack = false )
$image mixed Image to delete. Can be an Ansel_Image or an image ID.
$isStack boolean Indicates if this image represents a stack image.

removeTag() публичный Метод

Remove a single tag from this gallery's tag collection
public removeTag ( string $tag )
$tag string The tag name to remove.

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.
public resetKeyImage ( )

save() публичный Метод

Saves any changes to this object to the backend permanently.
public save ( )

serialize() публичный Метод

Serialize this object.
public serialize ( ) : string
Результат string The serialized data.

set() публичный Метод

Sets an attribute value in this object.
public set ( string $attribute, mixed $value, boolean $update = false )
$attribute string The attribute to set.
$value mixed The value for $attribute.
$update boolean Commit only this change to storage.

setDate() публичный Метод

public setDate ( $date )

setImageOrder() публичный Метод

Set the order of an image in this gallery.
public setImageOrder ( integer $imageId, integer $pos )
$imageId integer The image to sort.
$pos integer The sort position of the image.

setParent() публичный Метод

Sets this gallery's parent gallery.
public setParent ( mixed $parent )
$parent mixed An Ansel_Gallery or a gallery_id.

setPermission() публичный Метод

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

setTags() публичный Метод

Set/replace this gallery's tags.
public setTags ( array $tags, $replace = true )
$tags array An array of tag names to associate with this image.

toArray() публичный Метод

public toArray ( )

toJson() публичный Метод

Returns a json representation of this gallery.
public toJson ( boolean $full = false ) : StdClass
$full boolean Return all information (subgalleries and images)?
Результат 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

unserialize() публичный Метод

public unserialize ( $data )

updateImageCount() публичный Метод

Update the gallery image count.
public updateImageCount ( integer $images, boolean $add = true )
$images integer Number of images in action
$add boolean True if adding, false if removing

Описание свойств

$_modeHelper защищенное свойство

The gallery mode helper
protected Ansel_GalleryMode_ $_modeHelper
Результат Ansel_GalleryMode_

$_share защищенное свойство

The share object for this gallery.
protected Horde_Share_Object $_share
Результат Horde_Share_Object