AdminModule/presenters/BasePresenter.php
public function createGrid(Nette\Application\UI\Presenter $presenter, $name, $entity, $order = null, $where = null)
    {
        $grid = new \Grido\Grid($presenter, $name);

        $qb = $this->em->createQueryBuilder();

        if ($order) {
            foreach ($order as $o) {
                $qb->addOrderBy('l.'.$o['by'], $o['dir']);
            }
        }

        if ($where) {
            foreach ($where as $w) {
                $qb->andWhere('l.'.$w);
            }
        }

        if (strpos($entity, 'WebCMS') === false) {
            $grid->setModel($qb->select('l')->from("WebCMS\Entity\\$entity", 'l'));
        } else {
            $grid->setModel($qb->select('l')->from($entity, 'l'));
        }

        $grid->setRememberState(true);
        $grid->setDefaultPerPage(10);
        $grid->setTranslator($this->translator);
        $grid->setFilterRenderType(\Grido\Components\Filters\Filter::RENDER_INNER);

        return $grid;
    }
public function createGrid(Nette\Application\UI\Presenter $presenter, $name, $entity, $order = null, $where = null)
    {
        $grid = new \Grido\Grid($presenter, $name);

        $qb = $this->em->createQueryBuilder();

        if ($order) {
            foreach ($order as $o) {
                $qb->addOrderBy('l.'.$o['by'], $o['dir']);
            }
        }

        if ($where) {
            foreach ($where as $w) {
                $qb->andWhere('l.'.$w);
            }
        }

        if (strpos($entity, 'WebCMS') === false) {
            $grid->setModel($qb->select('l')->from("WebCMS\Entity\\$entity", 'l'));
        } else {
            $grid->setModel($qb->select('l')->from($entity, 'l'));
        }

        $grid->setRememberState(true);
        $grid->setDefaultPerPage(10);
        $grid->setTranslator($this->translator);
        $grid->setFilterRenderType(\Grido\Components\Filters\Filter::RENDER_INNER);

        return $grid;
    }
public function createGrid ( Nette \ Application \ UI \ Presenter $ presenter , $ name , $ entity , $ order = null , $ where = null ) { $ grid = new \ Grido \ Grid ( $ presenter , $ name ) ; $ qb = $ this -> em -> createQueryBuilder ( ) ; if ( $ order ) { foreach ( $ order as $ o ) { $ qb -> addOrderBy ( 'l.' . $ o [ 'by' ] , $ o [ 'dir' ] ) ; } } if ( $ where ) { foreach ( $ where as $ w ) { $ qb -> andWhere ( 'l.' . $ w ) ; } } if ( strpos ( $ entity , 'WebCMS' ) === false ) { $ grid -> setModel ( $ qb -> select ( 'l' ) -> from ( "WebCMS\Entity\\$entity" , 'l' ) ) ; } else { $ grid -> setModel ( $ qb -> select ( 'l' ) -> from ( $ entity , 'l' ) ) ; } $ grid -> setRememberState ( true ) ; $ grid -> setDefaultPerPage ( 10 ) ; $ grid -> setTranslator ( $ this -> translator ) ; $ grid -> setFilterRenderType ( \ Grido \ Components \ Filters \ Filter :: RENDER_INNER ) ; return $ grid ; }
Creates default basic grid.
@param  Nette\Application\UI\Presenter $presenter
@param  String                         $name
@param  String                         $entity
@param  string[]                       $where
@return \Grido\Grid
Creates default basic grid .