Exemplo n.º 1
0
 protected function init($config)
 {
     $this->updateLabels();
     $this->updateKeys();
     $this->checkPage();
     return parent::init($config);
 }
Exemplo n.º 2
0
 /**
  * Get HTML code for header
  * @param Table $table
  * @return string
  */
 public function getHeaderCode(\mpf\widgets\datatable\Table $table)
 {
     $label = $this->getLabel();
     if (!$this->order) {
         return $label;
     }
     $order = $this->dataProvider->getOrder();
     $prefix = '';
     $this->iconArrowUp = str_replace(array('%DATATABLE_ASSETS%', '%SIZE%'), array($table->getAssetsURL(), $this->iconSize . 'x' . $this->iconSize), $this->iconArrowUp);
     $this->iconArrowDown = str_replace(array('%DATATABLE_ASSETS%', '%SIZE%'), array($table->getAssetsURL(), $this->iconSize . 'x' . $this->iconSize), $this->iconArrowDown);
     if ('%MPF_ASSETS%' == substr($this->iconArrowUp, 0, 12)) {
         $this->iconArrowUp = AssetsPublisher::get()->mpfAssetFile(substr($this->iconArrowUp, 12));
     }
     if ('%MPF_ASSETS%' == substr($this->iconArrowDown, 0, 12)) {
         $this->iconArrowDown = AssetsPublisher::get()->mpfAssetFile(substr($this->iconArrowDown, 12));
     }
     if ($order[0] == (is_string($this->order) ? $this->order : '`' . $this->name . '`')) {
         $prefix = 'ASC' == $order[1] ? Html::get()->image($this->iconArrowUp, 'Order Descendent', ['class' => 'order-by-img']) : Html::get()->image($this->iconArrowDown, 'Order Ascendent', ['class' => 'order-by-img']);
     }
     return $this->dataProvider->getColumnOrderLink(is_string($this->order) ? $this->order : '`' . $this->name . '`', $prefix . $label);
 }
Exemplo n.º 3
0
 public function getPageLink($pageNo, $type)
 {
     if (!in_array($type, array('next', 'first', 'previous', 'last'))) {
         trigger_error('Invalid page type ' . $type . '!');
     }
     $icon = $this->{$type . 'PageIcon'};
     if (false === strpos($icon, '/')) {
         $label = $this->translate($icon);
     } else {
         $icon = str_replace('%DATATABLE_ASSETS%', $this->getAssetsURL(), $icon);
         if ('%MPF_ASSETS%' == substr($icon, 0, 12)) {
             $icon = AssetsPublisher::get()->mpfAssetFile(substr($icon, 12));
         }
         $label = Html::get()->image($icon, $this->translate('Page') . ' ' . $pageNo);
     }
     return $this->dataProvider->getLinkForPage($pageNo, $label);
 }