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;
 }
 public function createComponentCompetitorListGrid($name)
 {
     $eventId = $this->getParameter('eventId');
     $source = new ArrayDataSource($this->applicationModel->getEventApplicationsTable($eventId));
     $races = $this->eventModel->getEventRaces($eventId);
     $services = $this->eventModel->getEventServices($eventId)->order('type ASC');
     $primaryKey = 'id';
     $grid = new Grid($this, $name);
     $grid->setPrimaryKey($primaryKey);
     $grid->setDataSource($source);
     $grid->addText('name', 'Jméno závodníka');
     $grid->addText('competitor_index', 'Index závodníka');
     $grid->addText('si', 'Číslo čipu');
     foreach ($races as $key => $val) {
         $grid->addText('race_' . $val->id, $val->name);
         $grid->addText('category_' . $val->id, 'Kategorie');
     }
     foreach ($services as $key => $val) {
         $grid->addText('service_' . $val->id, $val->name);
     }
     $grid->addDate('created', 'Vytvořeno')->setFormat('j. n. Y H:i:s');
     $grid->setDefaultOrder('created', 'ASC');
     return $grid;
 }