Overview

Packages

  • Ansel
  • None

Classes

  • Ansel
  • Ansel_Ajax_Application
  • Ansel_Ajax_Imple_EditCaption
  • Ansel_Ajax_Imple_EditFaces
  • Ansel_Ajax_Imple_EditGalleryFaces
  • Ansel_Ajax_Imple_Embed
  • Ansel_Ajax_Imple_GallerySlugCheck
  • Ansel_Ajax_Imple_ImageSaveGeotag
  • Ansel_Ajax_Imple_LocationAutoCompleter
  • Ansel_Ajax_Imple_MapLayerSelect
  • Ansel_Ajax_Imple_TagActions
  • Ansel_Ajax_Imple_ToggleGalleryActions
  • Ansel_Ajax_Imple_ToggleOtherGalleries
  • Ansel_Ajax_Imple_UploadNotification
  • Ansel_Api
  • Ansel_Exception
  • Ansel_Faces
  • Ansel_Faces_Base
  • Ansel_Faces_Facedetect
  • Ansel_Faces_User
  • Ansel_Factory_Faces
  • Ansel_Factory_Storage
  • Ansel_Factory_Styles
  • Ansel_Form_Ecard
  • Ansel_Form_Image
  • Ansel_Form_ImageDate
  • Ansel_Form_Upload
  • Ansel_Gallery
  • Ansel_Gallery_Decorator_Date
  • Ansel_GalleryMode_Base
  • Ansel_GalleryMode_Date
  • Ansel_GalleryMode_Normal
  • Ansel_Image
  • Ansel_ImageGenerator
  • Ansel_ImageGenerator_Mini
  • Ansel_ImageGenerator_PolaroidThumb
  • Ansel_ImageGenerator_PolaroidThumbStack
  • Ansel_ImageGenerator_RoundedThumb
  • Ansel_ImageGenerator_RoundedThumbStack
  • Ansel_ImageGenerator_Screen
  • Ansel_ImageGenerator_ShadowThumb
  • Ansel_ImageGenerator_ShadowThumbStack
  • Ansel_ImageGenerator_SquareThumb
  • Ansel_ImageGenerator_Thumb
  • Ansel_LoginTasks_SystemTask_Upgrade
  • Ansel_Report
  • Ansel_Report_letter
  • Ansel_Report_mail
  • Ansel_Report_tickets
  • Ansel_Search
  • Ansel_Search_exif
  • Ansel_Search_Tag
  • Ansel_Storage
  • Ansel_Style
  • Ansel_Tagger
  • Ansel_Test
  • Ansel_Tile_DateGallery
  • Ansel_Tile_Gallery
  • Ansel_Tile_Image
  • Ansel_View_Ansel
  • Ansel_View_Base
  • Ansel_View_EmbeddedRenderer_GalleryLink
  • Ansel_View_EmbeddedRenderer_Mini
  • Ansel_View_EmbeddedRenderer_Slideshow
  • Ansel_View_Gallery
  • Ansel_View_GalleryProperties
  • Ansel_View_GalleryRenderer_Base
  • Ansel_View_GalleryRenderer_Gallery
  • Ansel_View_GalleryRenderer_GalleryLightbox
  • Ansel_View_Image
  • Ansel_View_List
  • Ansel_View_Results
  • Ansel_View_Slideshow
  • Ansel_View_Upload
  • Ansel_Widget
  • Ansel_Widget_Actions
  • Ansel_Widget_Base
  • Ansel_Widget_GalleryFaces
  • Ansel_Widget_Geotag
  • Ansel_Widget_ImageFaces
  • Ansel_Widget_Links
  • Ansel_Widget_OtherGalleries
  • Ansel_Widget_OwnerFaces
  • Ansel_Widget_SimilarPhotos
  • Ansel_Widget_Tags
  • Ansel_XPPublisher
  • Overview
  • Package
  • Class
  • Tree
  1: <?php
  2: /**
  3:  * Ansel_Tile_Gallery:: class wraps display of thumbnail 'tiles' displayed
  4:  * for a gallery on the Ansel_View_Gallery view.
  5:  *
  6:  * @author Michael Rubinsky <mrubinsk@horde.org>
  7:  * @category Horde
  8:  * @license  http://www.horde.org/licenses/gpl GPL
  9:  * @package  Ansel
 10:  */
 11: class Ansel_Tile_Gallery
 12: {
 13:     /**
 14:      * Outputs the html for a gallery tile.
 15:      *
 16:      * @param Ansel_Gallery $gallery  The Ansel_Gallery we are displaying.
 17:      * @param Ansel_Style $style      A style object.
 18:      * @param boolean $mini           Force the use of a mini thumbail?
 19:      * @param array $params           An array containing additional parameters.
 20:      *                                Currently, gallery_view_url and
 21:      *                                image_view_url are used to override the
 22:      *                                respective urls. %g and %i are replaced
 23:      *                                with image id and gallery id, respectively
 24:      *
 25:      *
 26:      * @return  Outputs the HTML for the tile.
 27:      */
 28:     public function getTile($gallery, $style = null, $mini = false, $params = array())
 29:     {
 30:         /*
 31:          * See what view we are being displayed in to see if we need to show
 32:          * the owner info or not.
 33:          */
 34:         $view = Horde_Util::getFormData('view', 'Gallery');
 35:         $haveSearch = ($view == 'Results') ? 1 : 0;
 36:         if (($view == 'Results' || $view == 'List') ||
 37:             (basename($_SERVER['PHP_SELF']) == 'index.php' &&
 38:              $GLOBALS['prefs']->getValue('defaultview') == 'galleries')) {
 39:             $showOwner = true;
 40:         } else {
 41:             $showOwner = false;
 42:         }
 43: 
 44:         /* Check gallery permissions and get appropriate tile image */
 45:         if ($gallery->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::READ)) {
 46:             if (is_null($style)) {
 47:                 $style = $gallery->getStyle();
 48:             }
 49:             $thumbstyle = $mini ? 'mini' : 'thumb';
 50:             if ($gallery->hasPasswd()) {
 51:                 $gallery_image = Horde::img('gallery-locked.png');
 52:             } else {
 53:                 $gallery_image = Ansel::getImageUrl(
 54:                     $gallery->getKeyImage($style),
 55:                     $thumbstyle,
 56:                     true,
 57:                     $style);
 58:                 $gallery_image = '<img src="' . $gallery_image . '" alt="' . htmlspecialchars($gallery->get('name')) . '" />';
 59:             }
 60:         } else {
 61:             $gallery_image = Horde::img('thumb-error.png');
 62:         }
 63: 
 64:         /* Check for being called via the api and generate correct view links */
 65:         if (!isset($params['gallery_view_url'])) {
 66:             $view_link = Ansel::getUrlFor('view',
 67:                                           array('gallery' => $gallery->id,
 68:                                                 'view' => 'Gallery',
 69:                                                 'havesearch' => $haveSearch,
 70:                                                 'slug' => $gallery->get('slug')))->link();
 71:         } else {
 72:             $view_link = new Horde_Url(
 73:                 str_replace(array('%g', '%s'),
 74:                             array($gallery->id, $gallery->get('slug')),
 75:                             urldecode($params['gallery_view_url'])));
 76:             $view_link = $view_link->link();
 77:         }
 78: 
 79:         $image_link = $view_link . $gallery_image . '</a>';
 80:         $text_link = $view_link . htmlspecialchars($gallery->get('name'))
 81:                      . '</a>';
 82: 
 83:         if ($gallery->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::EDIT) && !$mini) {
 84:             $properties_link = Horde::url('gallery.php', true)->add(
 85:                         array('gallery' => $gallery->id,
 86:                               'actionID' => 'modify',
 87:                               'havesearch' => $haveSearch,
 88:                               'url' => Horde::selfUrl(true, false, true)));
 89:             $properties_link = $properties_link->link() . _("Gallery Properties") . '</a>';
 90:         }
 91: 
 92:         if ($showOwner && !$mini &&
 93:             $GLOBALS['registry']->getAuth() != $gallery->get('owner')) {
 94:             $owner_link = Ansel::getUrlFor('view',
 95:                                             array('view' => 'List',
 96:                                                   'owner' => $gallery->get('owner'),
 97:                                                   'groupby' => 'owner'),
 98:                                             true)->link();
 99:             $gallery_owner = $gallery->getIdentity();
100:             $owner_string = $gallery_owner->getValue('fullname');
101:             if (empty($owner_string)) {
102:                 $owner_string = $gallery->get('owner');
103:             }
104:             $owner_link .= htmlspecialchars($owner_string) . '</a>';
105:         }
106: 
107:         $gallery_count = $gallery->countImages(true);
108:         $background_color = $style->background;
109: 
110:         $date_format = $GLOBALS['prefs']->getValue('date_format');
111:         $created = _("Created:") . ' '
112:                    . strftime($date_format, (int)$gallery->get('date_created'));
113:         $modified = _("Modified") . ' '
114:                    . strftime($date_format, (int)$gallery->get('last_modified'));
115: 
116:         Horde::startBuffer();
117:         include ANSEL_TEMPLATES . '/tile/gallery' . ($mini ? 'mini' : '') . '.inc';
118: 
119:         return Horde::endBuffer();
120:     }
121: 
122: }
123: 
API documentation generated by ApiGen