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:  * Horde_Widget_GalleryFaces:: class to display a widget containing mini
 4:  * thumbnails of faces in the gallery.
 5:  *
 6:  * Copyright 2008-2012 Horde LLC (http://www.horde.org/)
 7:  *
 8:  * @author Duck <duck@obala.net>
 9:  * @author Michael J. Rubinsky <mrubinsk@horde.org>
10:  *
11:  * @package Ansel
12:  */
13: class Ansel_Widget_GalleryFaces extends Ansel_Widget_Base
14: {
15:     /**
16:      * Supported views for this widget
17:      *
18:      * @var array
19:      */
20:     protected $_supported_views = array('Gallery');
21: 
22:     /**
23:      * Constructor
24:      *
25:      * @param array $params  Any parameters for this widget
26:      * @return Ansel_Widget_ImageFaces
27:      */
28:     public function __construct($params)
29:     {
30:         parent::__construct($params);
31:         $this->_title = _("People in this gallery");
32:     }
33: 
34:     /**
35:      * Return the HTML representing this widget.
36:      *
37:      * @return string  The HTML for this widget.
38:      */
39:     public function html()
40:     {
41:         if ($GLOBALS['conf']['faces']['driver']) {
42:             $html = $this->_getFaceNames();
43:             return $this->_htmlBegin() . $html . $this->_htmlEnd();
44:         } else {
45:             return '';
46:         }
47:     }
48: 
49:     /**
50:      * Helper function for getting faces for this gallery.
51:      *
52:      * @return string  The HTML
53:      */
54:     protected function _getFaceNames()
55:     {
56:         if ($this->_view->resource->get('faces')) {
57:             return '<div id="faces_widget_content"><br /><em>' . _("No faces found") . '</em></div>';
58:         }
59: 
60:         $faces = $GLOBALS['injector']->getInstance('Ansel_Faces');
61: 
62:         // Check for existing faces for this gallery.
63:         $html = '<div style="display: block'
64:             . ';background:' . $this->_style->background
65:             . ';width:100%;max-height:300px;overflow:auto;" id="faces_widget_content" >';
66: 
67:         $images = $faces->getGalleryFaces($this->_view->resource->id);
68:         if ($this->_view->gallery->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::EDIT)) {
69:             $link_text = (empty($images) ? _("Find faces") : _("Edit faces"));
70:             $html .= Horde::url('faces/gallery.php')->add('gallery', $this->_view->gallery->id)->link(
71:                          array('id' => 'edit_faces',
72:                                'class' => 'widget'))
73:                   . $link_text . '</a>';
74:         }
75: 
76:         $faces_html = '<div id="faces-on-gallery">';
77: 
78:         // Iterate over all the found faces and build the tiles.
79:         shuffle($images);
80:         foreach ($images as $face) {
81:             // Get the tile for this face
82:             $html .= Ansel_Faces::getFaceTile($face);
83:         }
84: 
85:         // Close up the nodes
86:         $html .= '</div></div></div></div>';
87: 
88:         return $html;
89:     }
90: 
91: }
92: 
API documentation generated by ApiGen