예제 #1
0
파일: Grid.php 프로젝트: Opifer/Cms
 /**
  * {@inheritdoc}
  */
 protected function processSessionData()
 {
     parent::processSessionData();
     // Columns
     if (($columnIds = $this->get(self::REQUEST_QUERY_COLUMNS)) !== null) {
         if (count((array) $columnIds)) {
             foreach ($this->columns as $column) {
                 if (!in_array($column->getId(), $columnIds)) {
                     $column->setVisible(false);
                 } else {
                     $column->setVisible(true);
                 }
             }
         }
     }
 }
 /**
  * @param string $section
  * @param \APY\DataGridBundle\Grid\Grid $grid
  * @param \APY\DataGridBundle\Grid\Column\Column $param
  * @return string
  */
 public function getGridUrl($section, $grid, $param = null)
 {
     $separator = strpos($grid->getRouteUrl(), '?') ? '&' : '?';
     switch ($section) {
         case 'order':
             if ($param->isSorted()) {
                 return $grid->getRouteUrl() . $separator . $grid->getHash() . '[' . Grid::REQUEST_QUERY_ORDER . ']=' . $param->getId() . '|' . ($param->getOrder() == 'asc' ? 'desc' : 'asc');
             } else {
                 return $grid->getRouteUrl() . $separator . $grid->getHash() . '[' . Grid::REQUEST_QUERY_ORDER . ']=' . $param->getId() . '|asc';
             }
         case 'page':
             return $grid->getRouteUrl() . $separator . $grid->getHash() . '[' . Grid::REQUEST_QUERY_PAGE . ']=' . $param;
         case 'limit':
             return $grid->getRouteUrl() . $separator . $grid->getHash() . '[' . Grid::REQUEST_QUERY_LIMIT . ']=';
         case 'reset':
             return $grid->getRouteUrl() . $separator . $grid->getHash() . '[' . Grid::REQUEST_QUERY_RESET . ']=';
     }
 }
예제 #3
0
 /**
  * @param \Symfony\Component\DependencyInjection\Container $container
  * @param string $id set if you are using more then one grid inside controller
  */
 public function __construct($container, $id = '')
 {
     parent::__construct($container, $id);
 }
예제 #4
0
 /**
  * {@inheritdoc}
  */
 public function getGrid()
 {
     $config = $this->getGridConfig();
     $grid = new Grid($this->container, $config->getName(), $config);
     foreach ($this->columns as $column) {
         $grid->addColumn($column);
     }
     if (!empty($this->actions)) {
         foreach ($this->actions as $columnId => $actions) {
             foreach ($actions as $action) {
                 $grid->addRowAction($action);
             }
         }
     }
     $grid->initialize();
     return $grid;
 }
예제 #5
0
파일: Grid.php 프로젝트: Codixis/CSBill
 /**
  * @return array
  */
 public function getRouteParameters()
 {
     if ($this->request->query->has('grid')) {
         $this->routeParameters['grid'] = $this->request->query->get('grid');
     }
     return parent::getRouteParameters();
 }