HosipLan

Untitled

Oct 17th, 2011
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.00 KB | None | 0 0
  1. /**
  2.  * @author Filip Procházka
  3.  */
  4. class OverviewGrid extends Kdyby\Components\Grinder\Grid
  5. {
  6.  
  7.     /** @var Users */
  8.     private $users;
  9.  
  10.  
  11.  
  12.     /**
  13.      * @param Users $users
  14.      * @param Session $session
  15.      */
  16.     public function __construct(Users $users, Session $session)
  17.     {
  18.         parent::__construct(
  19.                 $users->getRepository()->createQueryBuilder('u')->getGrinderModel()
  20.             );
  21.  
  22.         $this->users = $users;
  23.         $this->setUpProtection($session);
  24.  
  25.         $this->sortColumn = 'username';
  26.  
  27.         $this->getVisualPaginator()
  28.             ->setPlacement(self::PLACEMENT_BOTTOM);
  29.     }
  30.  
  31.  
  32.  
  33.     /**
  34.      * @return Users
  35.      */
  36.     protected function getUsers()
  37.     {
  38.         return $this->users;
  39.     }
  40.  
  41.  
  42.  
  43.     /**
  44.      * @param Presenter $presenter
  45.      */
  46.     protected function configure(Presenter $presenter)
  47.     {
  48.         $this->addCheckColumn('select');
  49.  
  50.         $this->addColumn('username', 'Username');
  51.         $this->addColumn('fullname', 'Name')->setSortable(FALSE);
  52.         $this->addColumn('company', 'Company');
  53.         $this->addColumn('email', 'E-mail');
  54.         $this->addColumn('info.phone', 'Phone');
  55.  
  56.         $this->addColumn('edit', 'Edit')
  57.             ->setLink($presenter->lazyLink('Edit:'), array('userId' => 'id'))
  58.             ->setImage('%themePath%/img/icons/pencil.png')
  59.             ->getImagePrototype()->height('16px');
  60.  
  61.         $this->addImageColumn('sendmail', '%themePath%/img/icons/mail.png')
  62.             ->setLink($presenter->lazyLink('Message:'), array('userId' => 'id'))
  63.             ->getImagePrototype()->height('16px');
  64.  
  65. //      $this->addAction('approved', NULL, array('handlerPassEntity' => TRUE))
  66. //          ->setHandler(callback($this, 'ApproveClicked'))
  67. //          ->setImage(array(
  68. //                  '1' => '%themePath%/img/icons/button-white-check.png',
  69. //                  '0' => '%themePath%/img/icons/button-white-stop.png',
  70. //              ))
  71. //          ->getImagePrototype()->height('16px');
  72.     }
  73.  
  74.  
  75.  
  76.     /**
  77.      * @param GridFilters $filters
  78.      * @param Presenter $presenter
  79.      */
  80.     protected function configureFilters(GridFilters $filters, Presenter $presenter)
  81.     {
  82.         $filters->addParameter('u.approved', $presenter, 'approved')
  83.             ->setDefaultValue('1');
  84.     }
  85.  
  86. }
  87.  
Advertisement
Add Comment
Please, Sign In to add comment