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

  • A
  • Actions
  • Alert
  • AlterCSSClassNamesEvent
  • AssetsCollector
  • Button
  • CSSCollector
  • Dataset
  • Date
  • DateRange
  • DateTime
  • Decorator
  • Document
  • DropdownMenu
  • Element
  • File
  • Form
  • Group
  • Helpers
  • HTMLString
  • Iterator
  • JSCollector
  • ListView
  • ListViewColumn
  • Modal
  • Pager
  • Popover
  • PopoverWidget
  • Ranger
  • RecursiveIterator
  • Salutation
  • Searchbox
  • Section
  • SplitButton
  • Text
  • Widget

Interfaces

  • CSSClassNames
  • DecoratorInterface
  • HTMLStringInterface
  • Validator

Traits

  • CSSClassNamesProperty

Exceptions

  • ElementIsEmpty

Functions

  • _array_flatten_callback
  • array_flatten
  • array_insert
  • check_session
  • dump
  • escape
  • escape_all
  • format
  • format_size
  • get_accessible_file
  • get_document
  • normalize
  • render_css_class
  • render_exception
  • retrieve_form
  • retrieve_form_errors
  • shorten
  • stable_sort
  • store_form
  • store_form_errors
  • strip
  • t
  1 <?php
  2 
  3 /*
  4  * This file is part of the Brickrouge 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 Brickrouge;
 13 
 14 class Ranger extends Element
 15 {
 16     const T_START = '#ranger-start';
 17     const T_LIMIT = '#ranger-limit';
 18     const T_COUNT = '#ranger-count';
 19     const T_WITH = '#ranger-with';
 20     const T_EDITABLE = '#ranger-editable';
 21     const T_NO_ARROWS = '#ranger-no-arrows';
 22 
 23     public function __construct($type, $tags)
 24     {
 25         parent::__construct($type, $tags + array('class' => 'wdranger'));
 26     }
 27 
 28     protected function render_inner_html()
 29     {
 30         $start = max(1, $this[self::T_START]);
 31         $limit = $this[self::T_LIMIT] ?: 10;
 32         $count = $this[self::T_COUNT];
 33 
 34         $start_final = $start;
 35 
 36         if ($this[self::T_EDITABLE] && $count > $limit)
 37         {
 38             $start_final = (string) new Text
 39             (
 40                 array
 41                 (
 42                     'name' => 'start',
 43                     'value' => $start,
 44                     'size' => 4,
 45                     'class' => 'measure'
 46                 )
 47             );
 48         }
 49 
 50         $rc = t
 51         (
 52             'From :start to :finish on :max', array
 53             (
 54                 ':start' => $start_final,
 55                 ':finish' => $start + $limit > $count ? $count : $start + $limit - 1,
 56                 ':max' => $count
 57             ),
 58 
 59             array('scope' => 'ranger.element')
 60         );
 61 
 62         if ($count > $limit && !$this[self::T_NO_ARROWS])
 63         {
 64             $url = $this->getURLBase();
 65 
 66             $rc .= '<a href="' . $url . ($start - $limit < 1 ? $count - $limit + 1 + ($count % $limit ? $limit - ($count % $limit) : 0) : $start - $limit) . '" class="browse previous">&lt;</a>';
 67             $rc .= '<a href="' . $url . ($start + $limit >= $count ? 1 : $start + $limit) . '" class="browse next">&gt;</a>';
 68         }
 69 
 70         return $rc;
 71     }
 72 
 73     protected function getURLBase()
 74     {
 75         $with = $this[self::T_WITH];
 76 
 77         if ($with)
 78         {
 79             if (is_string($with))
 80             {
 81                 $parts = explode(',', $with);
 82                 $parts = array_map('trim', $parts);
 83                 $parts = array_flip($parts);
 84 
 85                 foreach ($parts as $name => &$part)
 86                 {
 87                     $part = isset($_REQUEST[$name]) ? $_REQUEST[$name] : null;
 88                 }
 89             }
 90             else
 91             {
 92                 $parts = (array) $with;
 93             }
 94         }
 95         else
 96         {
 97             $parts = array();
 98         }
 99 
100         #
101         # add the 'using' part
102         #
103 
104         $using = 'start';//$this[self::T_USING] ?: 'start';
105 
106         unset($parts[$using]);
107 
108         $parts['limit'] = $this[self::T_LIMIT] ?: 10;
109         $parts[$using] = ''; // so that 'using' is at the end of the string
110 
111         #
112         # build the query
113         #
114 
115         $rc = '';//$this[self::T_URLBASE];
116 
117         $rc .= '?' . http_build_query
118         (
119             $parts, '', '&amp;'
120         );
121 
122         return $rc;
123     }
124 }
Autodoc API documentation generated by ApiGen 2.8.0