Ansel_Api::listGalleries PHP Method

listGalleries() public method

Returns a list of all galleries.
public listGalleries ( array $params = [] ) : array
$params array Optional parameters:
 (string)scope       The application scope, if not default.
 (integer)perm       The permissions filter to use [Horde_Perms::SHOW]
 (mixed)attributes   Restrict the galleries returned to those matching
                     the filters. Can be an array of attribute/values
                     pairs or a gallery owner username.
 (integer)parent     The parent share to start listing at.
 (boolean)all_levels If set, return all levels below parent, not just
                     direct children [TRUE]
 (integer)from       The gallery to start listing at.
 (integer)count      The number of galleries to return.
 (string)sort_by     Attribute to sort by
 (integer)direction  The direction to sort by [Ansel::SORT_ASCENDING]
 (array)tags        An array of tags to limit results by.
return array An array of gallery information.
    public function listGalleries(array $params = array())
    {
        // If no scope is given use Ansel's default
        if (!empty($params['scope'])) {
            $GLOBALS['injector']->getInstance('Ansel_Config')->set('scope', $params['scope']);
        }
        $galleries = $GLOBALS['injector']->getInstance('Ansel_Storage')->listGalleries($params);
        $return = array();
        foreach ($galleries as $gallery) {
            $return[] = array_merge($gallery->toArray(), array('crumbs' => $gallery->getGalleryCrumbData()));
        }
        return $return;
    }