Пример #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;
 }
Пример #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;
 }
Пример #3
0
 protected function createComponentGroupsGrid($name)
 {
     $grid = new \App\Grids\baseGrid($this, $name);
     $grid->addColumnText('shortname', 'Zkratka')->setSortable()->setFilterText();
     $grid->addColumnText('name', 'Plný název')->setSortable()->setFilterText();
     $grid->addColumnText('class', 'Třída')->setSortable()->setFilterText()->setColumn("sch_class.shortname");
     $grid->addColumnText('members', 'Počet členů')->setSortable();
     $grid->addActionHref("id", "Detail", "Groups:id")->setPrimaryKey("id");
     return $grid;
 }
Пример #4
0
 protected function createComponentLoadsGrid($name)
 {
     $grid = new \App\Grids\baseGrid($this, $name);
     $grid->addColumnText('teacher_firstname', 'Jméno učitele')->setSortable()->setFilterText()->setColumn("user.firstname");
     $grid->addColumnText('teacher_lastname', 'Příjmení učitele')->setSortable()->setFilterText()->setColumn("user.lastname");
     $grid->addColumnText('subject_name', 'Předmět')->setSortable()->setFilterText()->setColumn("sch_subject.name");
     $grid->addColumnText('group_name', 'Skupina')->setSortable()->setFilterText()->setColumn("sch_group.name");
     $grid->addColumnText('class_name', 'Třída')->setSortable()->setFilterText()->setColumn("sch_class.shortname");
     $grid->addColumnText('hours', 'Hodin')->setSortable();
     $grid->addActionHref("id", "Detail", "Groups:id")->setPrimaryKey("sch_group_id");
     return $grid;
 }
Пример #5
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;
 }
Пример #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('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;
 }
Пример #7
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;
 }
Пример #8
0
 protected function createComponentGrid($name)
 {
     $grid = new \App\Grids\baseGrid($this, $name);
     if ($this->user->isInRole("administrator")) {
         $grid->setModel($this->model);
     } else {
         //$grid->setModel($this->model);
         $grid->setModel($this->model->getSelection()->where("(user_id = " . $this->user->id . " OR public = 1)"));
     }
     $grid->addColumnText('original', 'Název')->setSortable()->setFilterText();
     $grid->addColumnText('extension', 'Typ')->setSortable()->setFilterText();
     $grid->addColumnText('firstname', 'Jméno vlastníka')->setSortable()->setFilterText();
     $grid->addColumnText('lastname', 'Příjmení vlastníka')->setSortable()->setFilterText();
     $grid->addColumnText('public', 'Veřejný')->setSortable()->setReplacement($grid::$booleanReplacements)->setFilterSelect($grid::$booleanFilters);
     $grid->addColumnText('uploaded', 'Nahráno')->setSortable()->setFilterDate();
     $grid->addColumnText('size', 'Velikost')->setSortable()->setFilterNumber();
     $grid->addActionHref("id", "Detail");
     $grid->addActionHref("download", "Uložit")->setDisable(function ($item) {
         if (!($this->user->isInRole("administrator") || $this->user->id == $item->user_id || $item->public)) {
             return true;
         }
         return false;
     });
     $grid->addActionHref("delete", "Odstranit")->setDisable(function ($item) {
         if ($item->locked) {
             return true;
         }
         if (!($this->user->isInRole("administrator") || $this->user->id == $item->user_id)) {
             return true;
         }
         return false;
     })->setConfirm(function ($item) {
         return "Opravdu chcete odstranit soubor {$item->original}?";
     });
     $operations = array('delete' => 'Odstranit');
     $grid->setOperation($operations, callback($this, 'gridOperationsHandler'))->setConfirm('delete', 'Opravdu chcete smazat všech %i souborů?');
     return $grid;
 }
Пример #9
0
 protected function createComponentGrid($name)
 {
     $grid = new \App\Grids\baseGrid($this, $name);
     $grid->model = $this->model;
     //$grid->addColumnText('title', 'Titul')->setSortable()->setFilterText();
     $grid->addColumnText('firstname', 'Jméno')->setSortable()->setFilterText();
     $grid->addColumnText('lastname', 'Příjmení')->setSortable()->setFilterText();
     //$grid->addColumnText('title_after', 'Titul')->setSortable()->setFilterText();
     $grid->addColumnText('gender', 'Pohlaví')->setSortable()->setReplacement($grid::$genderReplacements)->setFilterSelect($grid::$genderFilters);
     $grid->addColumnText('class', 'Třída')->setSortable();
     $grid->addColumnText('catalog_number', 'Katalogové číslo')->setSortable()->setFilterNumber();
     $grid->addColumnEmail('email', 'Email')->setSortable()->setFilterText();
     $grid->addColumnText('phone', 'Telefon')->setSortable()->setFilterText();
     $grid->addFilterText('class', 'Třída')->setColumn("sch_class.shortname");
     $grid->addActionHref("id", "Detail")->setPrimaryKey("user_id");
     return $grid;
 }
Пример #10
0
 protected function createComponentGrid($name)
 {
     $grid = new \App\Grids\baseGrid($this, $name);
     if ($this->user->isInRole("manager")) {
         $grid->model = $this->model;
     } else {
         if ($this->user->isInRole("teacher")) {
             $grid->model = $this->model->getUsersActivity($this->user->id);
         }
     }
     $grid->addColumnText('fn', 'Jméno')->setSortable()->setFilterText();
     $grid->addColumnText('ln', 'Příjmení')->setSortable()->setFilterText();
     $grid->addColumnText('pk', 'PK')->setSortable()->setFilterText();
     $grid->addColumnText('date', 'Datum')->setSortable()->setFilterText();
     $grid->addColumnText('name', 'Název')->setSortable()->setFilterText();
     //$grid->addColumnText('timeInM', 'Čas (m)')->setSortable()->setFilterText();
     $grid->addColumnText('note', 'Poznámka');
     $grid->addColumnText('preapproval', 'Schválená PK')->setSortable()->setReplacement($grid::$booleanReplacements)->setFilterSelect($grid::$booleanFilters)->setColumn("act_works.preapproval");
     //tohle pouzit opuze pokud je prihlasen reditel (aby mohl filtrovat j*z schvalene prace)
     $grid->addColumnText('approval', 'Schválená')->setSortable()->setReplacement($grid::$booleanReplacements)->setFilterSelect($grid::$booleanFilters)->setColumn("act_works.approval");
     //TODO: odmenu vidi jen manager a vlastnik
     $grid->addColumnText('reward', 'Odměna')->setSortable();
     $grid->addActionHref("approve", "Schválení")->setDisable(function ($item) {
         return !($this->model->isWorksPkHead($item->act_notebooks_id, $this->user->id) || $this->user->isInRole("manager"));
     });
     $grid->addActionHref("addact", "Editace")->setDisable(function ($item) {
         return !($item->created_id == $this->user->id || $this->user->id == $item->user_id);
     });
     $grid->addActionHref("delete", "Smazat")->setDisable(function ($item) {
         return !($item->created_id == $this->user->id || $this->user->id == $item->user_id);
     });
     $grid->setFilterRenderType(\Grido\Components\Filters\Filter::RENDER_INNER);
     return $grid;
 }
Пример #11
0
 protected function createComponentGrid($name)
 {
     $grid = new \App\Grids\baseGrid($this, $name);
     if ($this->user->isInRole("manager")) {
         $grid->model = $this->model;
     } else {
         if ($this->user->isInRole("teacher")) {
             $grid->model = $this->model->getUsersActivity($this->user->id);
         }
     }
     $pks = $this->model->getPKList();
     $nothing = array("" => "");
     $pks = $nothing + $pks;
     $grid->addColumnText('fn', 'Jméno')->setSortable()->setFilterText()->setColumn("user.firstname");
     $grid->addColumnText('ln', 'Příjmení')->setSortable()->setFilterText()->setColumn("user.lastname");
     $grid->addColumnText('pk', 'PK')->setSortable()->setFilterSelect($pks)->setColumn("act_notebooks_id");
     $grid->addColumnDate('date', 'Datum')->setSortable()->setFilterText()->setColumn("act_works.date");
     $grid->addColumnText('name', 'Název')->setSortable()->setFilterText();
     $grid->addColumnText('timeInM', 'Čas (h)')->setSortable()->setFilterText();
     $grid->addColumnText('note', 'Poznámka')->setSortable()->setFilterText();
     $grid->addColumnText('preapproval', 'Schválená PK')->setSortable()->setReplacement($grid::$booleanReplacements)->setFilterSelect($grid::$booleanFilters);
     $grid->addColumnText('approval', 'Schválená')->setSortable()->setReplacement($grid::$booleanReplacements)->setFilterSelect($grid::$booleanFilters);
     $grid->addColumnText('reward', 'Odměna')->setSortable();
     $grid->addActionHref("approve", "Schválení")->setDisable(function ($item) {
         return !($this->model->isWorksPkHead($item->act_notebooks_id, $this->user->id) || $this->user->isInRole("manager"));
     });
     $grid->addActionHref("addact", "Editace")->setDisable(function ($item) {
         return !($item->created_id == $this->user->id || $this->user->id == $item->user_id) || $this->model->isActivityApproved($item->id);
     });
     $grid->addActionHref("delete", "Smazat")->setDisable(function ($item) {
         return !($item->created_id == $this->user->id || $this->user->id == $item->user_id) || $this->model->isActivityApproved($item->id);
     });
     $grid->setFilterRenderType(\Grido\Components\Filters\Filter::RENDER_INNER);
     return $grid;
 }