Beispiel #1
0
 public function createComponentUserListGrid($name)
 {
     $grid = new Grid($this, $name);
     $source = new ArrayDataSource($this->userFacade->getUsersTable());
     $primaryKey = 'id';
     $grid->setPrimaryKey($primaryKey);
     $grid->setDataSource($source);
     $grid->addText('username', 'Uživatelské jméno');
     $grid->addText('name', 'Jméno');
     $grid->addText('email', 'Email');
     $grid->addText('role', 'Role');
     $actions = $grid->addActions('');
     $actions->addButton()->setType('btn-primary')->setText('Upravit')->setAttribute('href', new Link('User:edit', array('userId' => '{' . $primaryKey . '}')));
     $actions->addButton()->setType('btn-danger')->setText('Smazat')->setAttribute('href', new Link('User:delete', array('userId' => '{' . $primaryKey . '}')));
     return $grid;
 }
 protected function createComponentEventListGrid($name)
 {
     $source = new NetteDbDataSource($this->eventModel->getEvents());
     $grid = new Grid($this, $name);
     $primaryKey = 'id';
     $grid->setPrimaryKey($primaryKey);
     $grid->setDataSource($source);
     $grid->addText('name', 'Název');
     $grid->addDate('date', 'Datum')->setFormat('j. n. Y');
     $grid->addText('description', 'Popis')->setOrdering(false);
     $grid->setDefaultOrder('date', 'ASC');
     $actions = $grid->addActions('');
     $actions->addButton()->setType('btn-primary')->setText('Detail závodu')->setAttribute('href', new Link('Event:default', array('eventId' => '{' . $primaryKey . '}')));
     $actions->addButton()->setType('btn-success')->setText('Přihlásit se')->setAttribute('href', new Link('Application:guestNew', array('eventId' => '{' . $primaryKey . '}')));
     $actions->addButton()->setType('btn-primary')->setText('Seznam účastníků')->setAttribute('href', new Link('CompetitorList:default', array('eventId' => '{' . $primaryKey . '}')));
     return $grid;
 }