Class Ansel_Storage

Description

Class for interfacing with back end data storage.

Located in /lib/Ansel.php (line 3016)


	
			
Variable Summary
 mixed $galleries
 mixed $images
 Horde_Share $shares
 mixed $_db
 mixed $_scope
Method Summary
 Ansel_Storage Ansel_Storage ([ $scope = null])
 void countCategories ([ $perms = PERMS_SHOW])
 void countGalleries (string $userid, [integer $perm = PERMS_SHOW], [mixed $attributes = null], [string $parent = null], [boolean $allLevels = true])
 Ansel_Gallery createGallery ([array $attributes = array()], [object Perms $perm = null], [mixed $parent = null])
 void emptyGallery (Ansel_Gallery $gallery)
 mixed galleryExists (integer $gallery_id, [string $slug = null])
 void getGalleries ( $ids)
 mixed getGalleriesBySlugs (array $slugs)
 mixed &getGallery (integer $gallery_id, [array $overrides = array()])
 mixed &getGalleryBySlug (string $slug, [array $overrides = array()])
 Ansel_Image &getImage (integer $id)
 string getImageJson (array $images, [string $style = null], [boolean $full = false], [string $image_view = 'mini'], [boolean $view_links = false])
 array getImages (array $ids, [ $preserve_order = false])
 mixed getImagesGeodata ([array $image_ids = array()], [integer $gallery = null])
 void getRandomGallery ([ $perm = PERMS_SHOW], [ $attributes = null], [ $parent = null], [ $allLevels = true])
 array getRecentImages ([array $galleries = array()], [integer $limit = 10], [string $slugs = array()], string $where)
 void getRecentImagesGeodata ([ $user = null], [ $start = 0], [ $count = 8])
 mixed listCategories ([integer $perm = PERMS_SHOW], [integer $from = 0], [integer $count = 0])
 mixed listGalleries ([integer $perm = PERMS_SHOW], [mixed $attributes = null], [mixed $parent = null], [boolean $allLevels = true], [integer $from = 0], [integer $count = 0], [string $sort_by = null], [integer $direction = 0])
 mixed listImages (integer $gallery_id, [integer $from = 0], [integer $count = 0], [mixed $fields = 'image_id'], [string $where = ''], [mixed $sort = 'image_sort'])
 mixed removeGallery (Ansel_Gallery $gallery)
 void searchLocations ([ $search = ''])
 integer slugExists (string $slug)
 void _getImageCommentCounts ( $ids)
 string _getImageFields ([ $alias = ''])
Variables
mixed $galleries = array() (line 3020)
mixed $images = array() (line 3030)
Horde_Share $shares = null (line 3027)

The Horde_Shares object to use for this scope.

mixed $_db = null (line 3019)
mixed $_scope = 'ansel' (line 3018)
Methods
Constructor Ansel_Storage (line 3032)
Ansel_Storage Ansel_Storage ([ $scope = null])
  • $scope
countCategories (line 3662)
void countCategories ([ $perms = PERMS_SHOW])
  • $perms
countGalleries (line 3682)

Return the count of galleries that the user has specified permissions to and that match any of the requested attributes.

void countGalleries (string $userid, [integer $perm = PERMS_SHOW], [mixed $attributes = null], [string $parent = null], [boolean $allLevels = true])
  • string $userid: The user to check access for.
  • integer $perm: The level of permissions to require for a gallery to return it.
  • mixed $attributes: Restrict the galleries counted to those matching $attributes. An array of attribute/values pairs or a gallery owner username.
  • string $parent: The parent share to start counting at.
  • boolean $allLevels: Return all levels, or just the direct children of $parent? Defaults to all levels.
createGallery (line 3060)

Create and initialise a new gallery object.

  • return: A new gallery object or PEAR_Error.
Ansel_Gallery createGallery ([array $attributes = array()], [object Perms $perm = null], [mixed $parent = null])
  • array $attributes: The gallery attributes
  • object Perms $perm: The permissions for the gallery if the defaults are not desirable.
  • mixed $parent: The gallery id of the parent (if any)
emptyGallery (line 3355)

Empties a gallery of all images.

void emptyGallery (Ansel_Gallery $gallery)
galleryExists (line 3613)

Check if a gallery exists. Need to do this here instead of Horde_Share since Horde_Share::exists() takes a share_name, not a share_id plus we might also be checking by gallery_slug and this is more efficient than a listShares() call for one gallery.

  • return: true | false | PEAR_Error
mixed galleryExists (integer $gallery_id, [string $slug = null])
  • integer $gallery_id: The gallery id
  • string $slug: The gallery slug
getGalleries (line 3345)

Retrieve an array of Ansel_Gallery objects for the requested ids

void getGalleries ( $ids)
  • $ids
getGalleriesBySlugs (line 3320)

Retrieve an array of Ansel_Gallery objects for the given slugs.

  • return: Array of Ansel_Gallery objects | PEAR_Error
mixed getGalleriesBySlugs (array $slugs)
  • array $slugs: The gallery slugs
getGallery (line 3279)

Retrieve an Ansel_Gallery given the share id

  • return: Ansel_Gallery | PEAR_Error
mixed &getGallery (integer $gallery_id, [array $overrides = array()])
  • integer $gallery_id: The share_id to fetch
  • array $overrides: An array of attributes that should be overridden when the gallery is returned.
getGalleryBySlug (line 3260)

Retrieve an Ansel_Gallery given the gallery's slug

  • return: Ansel_Gallery object | PEAR_Error
mixed &getGalleryBySlug (string $slug, [array $overrides = array()])
  • string $slug: The gallery slug
  • array $overrides: An array of attributes that should be overridden when the gallery is returned.
getImage (line 3437)

Returns the image corresponding to the given id.

  • return: The image object corresponding to the given name.
Ansel_Image &getImage (integer $id)
  • integer $id: The ID of the image to retrieve.
getImageJson (line 3756)

Retrieve json data for an arbitrary list of image ids, not necessarily from the same gallery.

  • return: The json data || PEAR_Error
string getImageJson (array $images, [string $style = null], [boolean $full = false], [string $image_view = 'mini'], [boolean $view_links = false])
  • array $images: An array of image ids
  • string $style: A named gallery style to force if requesting pretty thumbs.
  • boolean $full: Generate full urls
  • string $image_view: Which image view to use? screen, thumb etc..
  • boolean $view_links: Include links to the image view
getImages (line 3477)

Returns the images corresponding to the given ids.

  • return: of Ansel_Image objects.
array getImages (array $ids, [ $preserve_order = false])
  • array $ids: An array of image ids.
  • $preserve_order
getImagesGeodata (line 3907)

Return images' geolocation data.

  • return: An array of geodata || PEAR_Error
mixed getImagesGeodata ([array $image_ids = array()], [integer $gallery = null])
  • array $image_ids: An array of image_ids to look up.
  • integer $gallery: A gallery id. If this is provided, will return all images in the gallery that have geolocation data ($image_ids would be ignored).
getRandomGallery (line 3828)

Returns a random Ansel_Gallery from a list fitting the search criteria.

void getRandomGallery ([ $perm = PERMS_SHOW], [ $attributes = null], [ $parent = null], [ $allLevels = true])
  • $perm
  • $attributes
  • $parent
  • $allLevels
getRecentImages (line 3552)

Return a list of image ids of the most recently added images.

  • return: An array of Ansel_Image objects
array getRecentImages ([array $galleries = array()], [integer $limit = 10], [string $slugs = array()], string $where)
  • array $galleries: An array of gallery ids to search in. If left empty, will search all galleries with PERMS_SHOW.
  • integer $limit: The maximum number of images to return
  • string $slugs: An array of gallery slugs.
  • string $where: Additional where clause
getRecentImagesGeodata (line 3929)

Like getRecentImages, but returns geotag data for the most recently added images from the current user. Useful for providing images to help locate images at the same place.

void getRecentImagesGeodata ([ $user = null], [ $start = 0], [ $count = 8])
  • $user
  • $start
  • $count
listCategories (line 3634)

Return a list of categories containing galleries with the given permissions for the current user.

  • return: List of categories | PEAR_Error
mixed listCategories ([integer $perm = PERMS_SHOW], [integer $from = 0], [integer $count = 0])
  • integer $perm: The level of permissions required.
  • integer $from: The gallery to start listing at.
  • integer $count: The number of galleries to return.
listGalleries (line 3729)

Retrieves the current user's gallery list from storage.

  • return: An array of Ansel_Gallery objects | PEAR_Error
mixed listGalleries ([integer $perm = PERMS_SHOW], [mixed $attributes = null], [mixed $parent = null], [boolean $allLevels = true], [integer $from = 0], [integer $count = 0], [string $sort_by = null], [integer $direction = 0])
  • integer $perm: The level of permissions to require for a gallery to return it.
  • mixed $attributes: Restrict the galleries counted to those matching $attributes. An array of attribute/values pairs or a gallery owner username.
  • mixed $parent: The parent gallery to start listing at. (Ansel_Gallery, gallery id or null)
  • boolean $allLevels: Return all levels, or just the direct children of $parent?
  • integer $from: The gallery to start listing at.
  • integer $count: The number of galleries to return.
  • string $sort_by: The field to order the results by.
  • integer $direction: Sort direction:
    1. - ascending
    2. - descending
listImages (line 3860)

Lists a slice of the image ids in the given gallery.

  • return: An array of image_ids | PEAR_Error
mixed listImages (integer $gallery_id, [integer $from = 0], [integer $count = 0], [mixed $fields = 'image_id'], [string $where = ''], [mixed $sort = 'image_sort'])
  • integer $gallery_id: The gallery to list from.
  • integer $from: The image to start listing.
  • integer $count: The numer of images to list.
  • mixed $fields: The fields to return (either an array of fileds or a single string).
  • string $where: A SQL where clause ($gallery_id will be ignored if this is non-empty).
  • mixed $sort: The field(s) to sort by.
removeGallery (line 3381)

Removes an Ansel_Gallery.

  • return: True || PEAR_Error
mixed removeGallery (Ansel_Gallery $gallery)
searchLocations (line 3936)
void searchLocations ([ $search = ''])
  • $search
slugExists (line 3220)

Check that a slug exists.

  • return: The share_id the slug represents, or 0 if not found.
integer slugExists (string $slug)
  • string $slug: The slug name
_getImageCommentCounts (line 3525)
void _getImageCommentCounts ( $ids)
  • $ids
_getImageFields (line 3954)

Helper function to get a string of field names

string _getImageFields ([ $alias = ''])
  • $alias

Documentation generated on Sun, 30 Jan 2011 05:08:43 +0000 by phpDocumentor 1.4.3