Autodoc
  • Namespace
  • Class
  • Tree

Namespaces

  • BlueTihi
    • Context
  • Brickrouge
    • Element
      • Nodes
    • Renderer
    • Widget
  • ICanBoogie
    • ActiveRecord
    • AutoConfig
    • CLDR
    • Composer
    • Core
    • Event
    • Exception
    • HTTP
      • Dispatcher
      • Request
    • I18n
      • Translator
    • Mailer
    • Modules
      • Taxonomy
        • Support
      • Thumbnailer
        • Versions
    • Object
    • Operation
      • Dispatcher
    • Prototype
    • Routes
    • Routing
      • Dispatcher
    • Session
  • Icybee
    • ActiveRecord
      • Model
    • ConfigOperation
    • Document
    • EditBlock
    • Element
      • ActionbarContextual
      • ActionbarSearch
      • ActionbarToolbar
    • FormBlock
    • Installer
    • ManageBlock
    • Modules
      • Articles
      • Cache
        • Collection
        • ManageBlock
      • Comments
        • ManageBlock
      • Contents
        • ManageBlock
      • Dashboard
      • Editor
        • Collection
      • Files
        • File
        • ManageBlock
      • Forms
        • Form
        • ManageBlock
      • I18n
      • Images
        • ManageBlock
      • Members
      • Modules
        • ManageBlock
      • Nodes
        • ManageBlock
        • Module
      • Pages
        • BreadcrumbElement
        • LanguagesElement
        • ManageBlock
        • NavigationBranchElement
        • NavigationElement
        • Page
        • PageController
      • Registry
      • Search
      • Seo
      • Sites
        • ManageBlock
      • Taxonomy
        • Terms
          • ManageBlock
        • Vocabulary
          • ManageBlock
      • Users
        • ManageBlock
        • NonceLogin
        • Roles
      • Views
        • ActiveRecordProvider
        • Collection
        • View
    • Operation
      • ActiveRecord
      • Constructor
      • Module
      • Widget
    • Rendering
  • None
  • Patron
  • PHP

Classes

  • AdjustThumbnailOptions
  • AdjustThumbnailVersion
  • CacheManager
  • GetOperation
  • Hooks
  • Module
  • PopThumbnailVersion
  • Thumbnail
  • Version
  • Versions

Exceptions

  • VersionNotDefined

Constants

  • CACHE_VERSIONS
  1 <?php
  2 
  3 /*
  4  * This file is part of the Icybee package.
  5  *
  6  * (c) Olivier Laviale <olivier.laviale@gmail.com>
  7  *
  8  * For the full copyright and license information, please view the LICENSE
  9  * file that was distributed with this source code.
 10  */
 11 
 12 namespace ICanBoogie\Modules\Thumbnailer;
 13 
 14 use ICanBoogie\Image;
 15 
 16 use Brickrouge\Element;
 17 use Brickrouge\Form;
 18 use Brickrouge\Text;
 19 
 20 class AdjustThumbnailVersion extends \Brickrouge\Group
 21 {
 22     private $elements = array();
 23 
 24     static protected function add_assets(\Brickrouge\Document $document)
 25     {
 26         parent::add_assets($document);
 27 
 28         $document->css->add(DIR . 'public/module.css');
 29         $document->js->add(DIR . 'public/module.js');
 30     }
 31 
 32     public function __construct(array $attributes=array())
 33     {
 34         global $core;
 35 
 36         parent::__construct
 37         (
 38             \ICanBoogie\array_merge_recursive
 39             (
 40                 array
 41                 (
 42                     Element::CHILDREN => array
 43                     (
 44                         new Element
 45                         (
 46                             'div', array
 47                             (
 48                                 Form::LABEL => 'Dimensions',
 49                                 Element::CHILDREN => array
 50                                 (
 51                                     'width' => $this->elements['width'] = new Text
 52                                     (
 53                                         array
 54                                         (
 55                                             Text::ADDON => 'px',
 56 
 57                                             'class' => 'measure',
 58                                             'size' => 5
 59                                         )
 60                                     ),
 61 
 62                                     ' × ',
 63 
 64                                     'height' => $this->elements['height'] = new Text
 65                                     (
 66                                         array
 67                                         (
 68                                             Text::ADDON => 'px',
 69 
 70                                             'class' => 'measure',
 71                                             'size' => 5
 72                                         )
 73                                     )
 74                                 )
 75                             )
 76                         ),
 77 
 78                         'method' => $this->elements['method'] = new Element
 79                         (
 80                             'select', array
 81                             (
 82                                 Form::LABEL => 'Méthode',
 83                                 Element::OPTIONS => array
 84                                 (
 85                                     Image::RESIZE_FILL => 'Remplir',
 86                                     Image::RESIZE_FIT => 'Ajuster',
 87                                     Image::RESIZE_SURFACE => 'Surface',
 88                                     Image::RESIZE_FIXED_HEIGHT => 'Hauteur fixe, largeur ajustée',
 89                                     Image::RESIZE_FIXED_HEIGHT_CROPPED => 'Hauteur fixe, largeur respectée',
 90                                     Image::RESIZE_FIXED_WIDTH => 'Largeur fixe, hauteur ajustée',
 91                                     Image::RESIZE_FIXED_WIDTH_CROPPED => 'Largeur fixe, hauteur respectée',
 92                                     Image::RESIZE_CONSTRAINED => 'Contraindre'
 93                                 )
 94                             )
 95                         ),
 96 
 97                         'no-upscale' => $this->elements['no-upscale'] = new Element
 98                         (
 99                             Element::TYPE_CHECKBOX, array
100                             (
101                                 Element::LABEL => 'Redimensionner mais ne pas agrandir'
102                             )
103                         ),
104 
105                         new Element
106                         (
107                             'div', array
108                             (
109                                 Form::LABEL => 'Format de la miniature',
110 
111                                 self::CHILDREN => array
112                                 (
113                                     'format' => $this->elements['format'] = new Element
114                                     (
115                                         'select', array
116                                         (
117                                             self::OPTIONS => array
118                                             (
119                                                 null => 'auto',
120                                                 'jpeg' => 'JPEG',
121                                                 'png' => 'PNG',
122                                                 'gif' => 'GIF'
123                                             ),
124 
125                                             'style' => 'vertical-align: middle; width: auto'
126                                         )
127                                     ),
128 
129                                     '&nbsp;',
130 
131                                     'quality' => $this->elements['quality'] = new Text
132                                     (
133                                         array
134                                         (
135                                             Text::ADDON => 'Qualité',
136                                             Text::ADDON_POSITION => 'before',
137                                             self::DEFAULT_VALUE => 80,
138 
139                                             'class' => 'measure',
140                                             'size' => 3
141                                         )
142                                     )
143                                 )
144                             )
145                         ),
146 
147                         'background' => $this->elements['background'] = new Text
148                         (
149                             array
150                             (
151                                 Form::LABEL => 'Remplissage'
152                             )
153                         ),
154 
155                         'filter' => $this->elements['filter'] = new Text
156                         (
157                             array
158                             (
159                                 Form::LABEL => 'Filtre'
160                             )
161                         )
162                     ),
163 
164                     'class' => 'adjust widget-adjust-thumbnail-version',
165                     'data-widget-constructor' => 'AdjustThumbnailVersion'
166                 ),
167 
168                 $attributes
169             )
170         );
171     }
172 
173     public function offsetSet($offset, $value)
174     {
175         switch ($offset)
176         {
177             case self::DEFAULT_VALUE:
178             {
179                 $options = $value;
180 
181                 if (is_string($options))
182                 {
183                     $options = json_decode($options);
184                 }
185 
186                 foreach ($options as $identifier => $v)
187                 {
188                     if (empty($this->elements[$identifier]))
189                     {
190                         continue;
191                     }
192 
193                     $element[$offset] = $v;
194                 }
195             }
196             break;
197 
198             case 'name':
199             {
200                 foreach ($this->elements as $identifier => $element)
201                 {
202                     $element[$offset] = $value . '[' . $identifier . ']';
203                 }
204             }
205             break;
206 
207             case 'value':
208             {
209                 $options = $value;
210 
211                 if (is_string($options))
212                 {
213                     $options = json_decode($options);
214                 }
215 
216                 if (!$options)
217                 {
218                     break;
219                 }
220 
221                 foreach ($options as $identifier => $v)
222                 {
223                     if (empty($this->elements[$identifier]))
224                     {
225                         continue;
226                     }
227 
228                     // FIXME-20110518: use handle_value() ?
229 
230                     $this->elements[$identifier][($identifier == 'interlace' || $identifier == 'no-upscale') ? 'checked' : 'value'] = $v;
231                 }
232             }
233             break;
234         }
235 
236         parent::offsetSet($offset, $value);
237     }
238 }
239 
240 namespace Brickrouge\Widget;
241 
242 class AdjustThumbnailVersion extends \ICanBoogie\Modules\Thumbnailer\AdjustThumbnailVersion
243 {
244 
245 }
Autodoc API documentation generated by ApiGen 2.8.0