protected function edit() { // ladowanie klasy $item = new ClassEquipmentType(ClassTools::getValue('id_equipment_type')); // sprawdza czy klasa zostala poprawnie zaladowana if (!$item->load_class) { $this->alerts['danger'] = "Typ wyposażenia nie istnieje."; } $active = ClassTools::getValue('form_active'); $form_parent = ClassTools::getValue('form_parent'); $item->name = ClassTools::getValue('form_name'); $item->id_parent = $form_parent != '' && is_numeric($form_parent) ? $form_parent : NULL; $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 typ wydażenia: <b>{$item->name}</b>"; // czyszczeie zmiennych wyswietlania $this->tpl_values = ''; $_POST = array(); return; }
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]['equipment_type_name'] = ClassEquipmentType::sqlGetItemNameByIdParent($val['id_equipment_type']); // Nazwa statusu $sql[$key]['active_name'] = ClassUser::getNameStatus($val['active']); } } return $sql; }
protected function getSearchDefinition() { $form_values = array('class' => 'ClassEquipment', 'controller' => $this->search_controller, 'form' => array('id_equipment' => array('class' => 'table_id', 'type' => 'text'), 'name' => array('class' => 'table_name', 'type' => 'text'), 'id_equipment_type' => array('class' => 'table_type', 'type' => 'select', 'search' => true, 'optgroup' => ClassEquipmentType::getEquipmentTypes()), 'active' => array('class' => 'table_status', 'type' => 'select', 'options' => array('0' => 'Wyłączony', '1' => 'Włączony')), 'actions' => array('class' => 'table_akcje'))); return $form_values; }