public static function sqlGetAllItems($using_pages = false, $current_page = '1', $items_on_page = '5', $controller_search = '') { if ($sql = parent::sqlGetAllItems($using_pages, $current_page, $items_on_page, $controller_search)) { foreach ($sql as $key => $val) { // Rodzaj jednostki nazwa // $sql[$key]['military_group_name'] = self::sqlGetGroupNameById($val['id_military_group']); $sql[$key]['military_group_name'] = ClassMilitaryType::sqlGetItemNameByIdParent($val['id_military_type']); // Nazwa statusu $sql[$key]['active_name'] = ClassUser::getNameStatus($val['active']); } } return $sql; }
protected function edit() { // ladowanie klasy $item = new ClassMilitaryType(ClassTools::getValue('id_military_type')); // sprawdza czy klasa zostala poprawnie zaladowana if (!$item->load_class) { $this->alerts['danger'] = 'Rodzaj jednoski wojskowej nie istnieje'; return; } $active = ClassTools::getValue('form_active'); $item->name = ClassTools::getValue('form_name'); $item->id_user = ClassAuth::getCurrentUserId(); $item->active = $active && $active == '1' ? '1' : '0'; // komunikaty bledu if (!$item->update()) { $this->alerts['danger'] = $item->errors; return; } // komunikat $this->alerts['success'] = "Poprawnie zaktualizowano rodzaj jednoski wojskowej: <b>" . htmlspecialchars($item->name) . "</b>"; // czyszczeie zmiennych wyswietlania $this->tpl_values = ''; $_POST = array(); return; }
protected function getSearchDefinition() { $form_values = array('class' => 'ClassMilitary', 'controller' => $this->search_controller, 'form' => array('id_military' => array('class' => 'table_id', 'type' => 'text'), 'number' => array('class' => 'table_number', 'type' => 'text'), 'name' => array('class' => 'table_name', 'type' => 'text'), 'location' => array('class' => 'table_lokalizacja', 'type' => 'text'), 'id_military_type' => array('class' => 'table_rodzaj', 'type' => 'select', 'options' => ClassMilitaryType::sqlGetAllItemsNameById(NULL)), 'active' => array('class' => 'table_status', 'type' => 'select', 'options' => array('0' => 'Wyłączony', '1' => 'Włączony')), 'actions' => array('class' => 'table_akcje'))); return $form_values; }