Ejemplo n.º 1
0
 protected function createComponentGrid($name)
 {
     $grid = new \App\Grids\baseGrid($this, $name);
     $grid->model = $this->model;
     $grid->addColumnText('name', 'Název')->setSortable()->setFilterText()->setColumn("wrk_assignment.name");
     $grid->addColumnText('subject', 'Předmět')->setSortable()->setFilterText();
     $grid->addColumnText('works', 'Počet prací')->setSortable();
     $grid->addColumnText('firstname', 'Jméno autora')->setSortable()->setFilterText();
     $grid->addColumnText('lastname', 'Příjmení autora')->setSortable()->setFilterText();
     $grid->addColumnText('active', 'Aktivní')->setSortable()->setReplacement($grid::$booleanReplacements)->setFilterSelect($grid::$booleanFilters)->setColumn("wrk_assignment.active");
     $grid->addActionHref("id", "Detail");
     if ($this->user->isAllowed("Works:Ideas", 'clone')) {
         $grid->addActionHref("clone", "Kopie")->setConfirm(function ($item) {
             return "Opravdu chcete vytvořit kopii námětu {$item->name}?";
         });
     }
     $grid->addActionHref("delete", "Odstranit")->setConfirm(function ($item) {
         return "Opravdu chcete odstranit námět {$item->name}?";
     })->setDisable(function ($item) {
         return $item->works > 0 || !($this->user->isInRole("administrator") || $this->user->id == $item->user_id);
     });
     $grid->addActionHref('enable', 'Povolit')->setDisable(function ($item) {
         return $item->active == 1 || !($this->user->isInRole("administrator") || $this->user->id == $item->user_id);
     });
     $grid->addActionHref('disable', 'Zablokovat')->setDisable(function ($item) {
         return $item->active == 0 || !($this->user->isInRole("administrator") || $this->user->id == $item->user_id);
     });
     $operations = array('delete' => 'Odstranit', 'enable' => 'Povolit', 'disable' => 'Zablokovat');
     $grid->setOperation($operations, $this->gridOperationsHandler)->setConfirm('delete', 'Opravdu chcete smazat všech %i zadání?');
     $grid->setDefaultSort(array('name' => 'ASC'));
     return $grid;
 }
Ejemplo n.º 2
0
 protected function createComponentGrid($name)
 {
     $grid = new \App\Grids\baseGrid($this, $name);
     if ($this->user->isInRole("administrator") || $this->user->isInRole("teacher")) {
         $grid->model = $this->model;
     } else {
         $grid->model = $this->model->getSelection()->where("user_id = " . $this->user->id);
     }
     $grid->addColumnText('wrk_name', 'Název')->setSortable()->setFilterText();
     $grid->addColumnText('firstname', 'Jméno autora')->setSortable()->setFilterText();
     $grid->addColumnText('lastname', 'Příjmení autora')->setSortable()->setFilterText();
     $grid->addColumnText('class', 'Třída')->setSortable()->setFilterText();
     $grid->addColumnText('year', 'Školní rok')->setSortable()->setFilterText();
     $grid->addColumnText('set_name', 'Sada prací')->setSortable()->setFilterText();
     $grid->addColumnText('status', 'Stav')->setSortable()->setReplacement($this->statuses)->setFilterSelect($this->statuses);
     $grid->addColumnDate('created_date', 'Vytvořeno')->setSortable()->setFilterDate();
     $grid->addActionHref("id", "Detail");
     $grid->addActionHref("application", "Přihláška");
     $grid->addActionHref("delete", "Odstranit")->setConfirm(function ($item) {
         return "Opravdu chcete odstranit zadání práce {$item->name}?";
     })->setDisable(function ($item) {
         if ($item->status > 0) {
             return true;
         }
         if (!($this->user->isInRole("administrator") || $this->user->id == $item->created_by)) {
             return true;
         }
         return false;
     });
     $operations = array('delete' => 'Odstranit');
     $grid->setOperation($operations, $this->gridOperationsHandler)->setConfirm('delete', 'Opravdu chcete smazat všech %i prací?');
     $grid->setDefaultSort(array('name' => 'ASC'));
     return $grid;
 }
Ejemplo n.º 3
0
 protected function createComponentGrid($name)
 {
     $grid = new \App\Grids\baseGrid($this, $name);
     $grid->model = $this->model;
     $grid->addColumnText('firstname', 'Jméno')->setSortable()->setFilterText();
     $grid->addColumnText('lastname', 'Příjmení')->setSortable()->setFilterText();
     $grid->addColumnText('gender', 'Pohlaví')->setSortable()->setReplacement($grid::$genderReplacements)->setFilterSelect($grid::$genderFilters);
     $grid->addColumnDate('birthdate', 'Narození')->setSortable()->setFilterDate();
     $grid->addColumnText('email', 'Email')->setSortable()->setFilterText();
     $grid->addColumnText('imap_username', 'Školní login')->setSortable()->setFilterText();
     $grid->addColumnText('facebook_id', 'Facebook')->setSortable()->setFilterText();
     $grid->addColumnText('active', 'Aktivní')->setSortable()->setReplacement($grid::$booleanReplacements)->setFilterSelect($grid::$booleanFilters);
     $grid->addColumnText('enabled', 'Povolený')->setSortable()->setReplacement($grid::$booleanReplacements)->setFilterSelect($grid::$booleanFilters);
     $grid->addActionHref("id", "Detail");
     $grid->addActionHref("delete", "Odstranit")->setConfirm(function ($item) {
         return "Opravdu chcete odstranit uživatele {$item->firstname} {$item->lastname}?";
     });
     $grid->addActionHref('activate', 'Aktivovat')->setDisable(function ($item) {
         return $item->active == 1;
     });
     $grid->addActionHref('deactivate', 'Deaktivovat')->setDisable(function ($item) {
         return $item->active == 0;
     });
     $grid->addActionHref('enable', 'Povolit')->setDisable(function ($item) {
         return $item->enabled == 1;
     });
     $grid->addActionHref('disable', 'Zablokovat')->setDisable(function ($item) {
         return $item->enabled == 0;
     });
     $operations = array('delete' => 'Odstranit', 'enable' => 'Povolit', 'disable' => 'Zablokovat');
     $grid->setOperation($operations, $this->gridOperationsHandler)->setConfirm('delete', 'Opravdu chcete smazat všech %i uživatelů?');
     $grid->setDefaultSort(array('lastname' => 'ASC'));
     return $grid;
 }
Ejemplo n.º 4
0
 protected function createComponentGrid($name)
 {
     $grid = new \App\Grids\baseGrid($this, $name);
     $grid->model = $this->model;
     $operations = array('delete' => 'Odstranit');
     $grid->setOperation($operations, callback($this, 'gridOperationsHandler'))->setConfirm('delete', 'Opravdu chcete smazat všech %i položek?');
     $grid->setDefaultSort(array('name' => 'ASC'));
     return $grid;
 }
Ejemplo n.º 5
0
 protected function createComponentGrid($name)
 {
     $grid = new \App\Grids\baseGrid($this, $name);
     $grid->model = $this->model;
     $grid->addColumnText('name', 'Název')->setSortable()->setFilterText();
     $grid->addColumnText('active', 'Aktivní')->setSortable()->setReplacement($grid::$booleanReplacements)->setFilterSelect($grid::$booleanFilters);
     $grid->addActionHref("id", "Detail");
     $grid->addActionHref("delete", "Odstranit")->setConfirm(function ($item) {
         return "Opravdu chcete odstranit sadu {$item->name}?";
     });
     $grid->addActionHref("edit", "Editovat");
     $grid->addActionHref('enable', 'Povolit')->setDisable(function ($item) {
         return $item->active == 1;
     });
     $grid->addActionHref('disable', 'Zablokovat')->setDisable(function ($item) {
         return $item->active == 0;
     });
     $operations = array('delete' => 'Odstranit', 'enable' => 'Povolit', 'disable' => 'Zablokovat');
     $grid->setOperation($operations, $this->gridOperationsHandler)->setConfirm('delete', 'Opravdu chcete smazat všech %i sad?');
     $grid->setDefaultSort(array('name' => 'ASC'));
     return $grid;
 }
Ejemplo n.º 6
0
 protected function createComponentGrid($name)
 {
     $grid = new \App\Grids\baseGrid($this, $name);
     $grid->model = $this->model;
     $grid->addColumnText('name', 'Název')->setSortable()->setFilterText();
     $grid->addColumnText('firstname', 'Jméno správce')->setSortable()->setFilterText();
     $grid->addColumnText('lastname', 'Příjmení správce')->setSortable()->setFilterText();
     $grid->addColumnText('members', 'Členové')->setSortable()->setFilterNumber();
     $grid->addColumnText('active', 'Aktivní')->setSortable()->setReplacement($grid::$booleanReplacements)->setFilterSelect($grid::$booleanFilters);
     $grid->addColumnText('open', 'Otevřená')->setSortable()->setReplacement($grid::$booleanReplacements)->setFilterSelect($grid::$booleanFilters);
     $grid->addColumnText('visible_all', 'Viditelná')->setSortable()->setReplacement($grid::$booleanReplacements)->setFilterSelect($grid::$booleanFilters);
     $grid->addColumnText('visible_members', 'Viditelná členy')->setSortable()->setReplacement($grid::$booleanReplacements)->setFilterSelect($grid::$booleanFilters);
     $grid->addColumnText('list_all', 'Veřejný seznam')->setSortable()->setReplacement($grid::$booleanReplacements)->setFilterSelect($grid::$booleanFilters);
     $grid->addColumnText('list_members', 'Privátní seznam')->setSortable()->setReplacement($grid::$booleanReplacements)->setFilterSelect($grid::$booleanFilters);
     $grid->addColumnText('member', 'Jsem členem?')->setSortable()->setReplacement($grid::$booleanReplacements)->setFilterSelect($grid::$booleanFilters);
     $grid->addActionHref("id", "Detail");
     $grid->addActionHref("delete", "Odstranit")->setDisable(function ($item) {
         if ($item->permanent) {
             return true;
         }
         if (!($this->user->isInRole("administrator") || $this->user->id == $item->user_id)) {
             return true;
         }
         return false;
     })->setConfirm(function ($item) {
         return "Opravdu chcete odstranit skupinu {$item->name}?";
     });
     $grid->addActionHref("out", "Opustit")->setDisable(function ($item) {
         return !($item->open && $item->member);
     });
     $grid->addActionHref("in", "Přidat se")->setDisable(function ($item) {
         return !($item->open && !$item->member);
     });
     $operations = array();
     $grid->setOperation($operations, callback($this, 'gridOperationsHandler'))->setConfirm('delete', 'Opravdu chcete smazat všech %i položek?');
     $grid->setDefaultSort(array('name' => 'ASC'));
     return $grid;
 }