Ejemplo n.º 1
0
 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;
 }