public function __construct(\MUtil_Html_PagePanel $panel, $glue = ' ', $args_array = null) { $args = \MUtil_Ra::args(func_get_args(), array('panel' => 'MUtil_Html_PagePanel', 'glue'), array('glue' => ' ')); if (isset($args['panel'])) { $this->_panel = $args['panel']; unset($args['panel']); } else { throw new \MUtil_Html_HtmlException('Illegal argument: no panel passed to ' . __CLASS__ . ' constructor.'); } if (isset($args['glue'])) { $this->setGlue($args['glue']); unset($args['glue']); } else { $this->setGlue($glue); } $page = $this->toLazy()->page; $args = array($page) + $args; // We create the element here as this creates as an element using the specifications at this moment. // If created at render time the settings might have changed, introducing hard to trace bugs. $this->_element = $panel->createPageLink($this->toLazy()->notCurrent(), $page, $args); }
/** * Create a page panel * * @param mixed $paginator \MUtil_Ra::args() arguements * @param mixed $request * @param mixed $translator * @param mixed $args * @return \MUtil_Html_PagePanel */ public static function pagePanel($paginator = null, $request = null, $translator = null, $args = null) { $types = array('paginator' => 'Zend_Paginator', 'request' => 'Zend_Controller_Request_Abstract', 'translator' => 'Zend_Translate', 'view' => 'Zend_View'); $args = \MUtil_Ra::args(func_get_args(), $types, null, \MUtil_Ra::STRICT); $panel_args = array(); foreach (array('baseUrl', 'paginator', 'request', 'scrollingStyle', 'view', 'itemCount') as $var) { if (isset($args[$var])) { $panel_args[$var] = $args[$var]; unset($args[$var]); } } if (isset($args['translator'])) { $translator = $args['translator']; unset($args['translator']); } else { $translator = \Zend_Registry::get('Zend_Translate'); } if (isset($args['class'])) { if ($args['class'] instanceof \MUtil_Html_AttributeInterface) { $args['class']->add('browselink'); } else { $args['class'] = new \MUtil_Html_ClassArrayAttribute('browselink', $args['class']); } } else { $args['class'] = new \MUtil_Html_ClassArrayAttribute('browselink'); } // \MUtil_Echo::track($args); // \MUtil_Echo::track($panel_args['baseUrl']); if (\MUtil_Bootstrap::enabled()) { $pager = new \MUtil_Bootstrap_Html_PagePanel($panel_args); } else { $pager = new \MUtil_Html_PagePanel($panel_args); } $pager[] = $pager->pageLinks(array($translator->_('<< First'), 'class' => new \MUtil_Html_ClassArrayAttribute('browselink', 'keyHome')), array($translator->_('< Previous'), 'class' => new \MUtil_Html_ClassArrayAttribute('browselink', 'keyPgUp')), array($translator->_('Next >'), 'class' => new \MUtil_Html_ClassArrayAttribute('browselink', 'keyPgDn')), array($translator->_('Last >>'), 'class' => new \MUtil_Html_ClassArrayAttribute('browselink', 'keyEnd')), $translator->_(' | '), $args); $pager->div($pager->uptoOffDynamic($translator->_('to'), $translator->_('of'), array('-', 'class' => new \MUtil_Html_ClassArrayAttribute('browselink btn btn-xs', 'keyCtrlUp')), array('+', 'class' => new \MUtil_Html_ClassArrayAttribute('browselink btn btn-xs', 'keyCtrlDown')), null, ' ', $args), array('class' => 'pagination-index rightFloat pull-right')); return $pager; }