Exemplo n.º 1
0
 protected function edit()
 {
     // ladowanie klasy
     $item = new ClassSoldier2Equipment(ClassTools::getValue('id_soldier2equipments'));
     // sprawdza czy klasa zostala poprawnie zaladowana
     if (!$item->load_class) {
         $this->alerts['danger'] = "Wyposażenie żołnierza nie istnieje.";
         return;
     }
     $item->id_equipment = ClassTools::getValue('id_equipment');
     $item->equipment_count = ClassTools::getValue('form_count');
     $item->date_equipment_add = ClassTools::getValue('form_date');
     $item->description = ClassTools::getValue('form_description');
     $item->id_soldier = ClassTools::getValue('id_soldier');
     $item->id_user = ClassAuth::getCurrentUserId();
     // komunikaty bledu
     if (!$item->update()) {
         $this->alerts['danger'] = $item->errors;
         return;
     }
     // komunikat
     $this->alerts['success'] = "Poprawnie zaktualizowano wyposażenie żołnierza: <b>{$item->equipment_name}</b>";
     // czyszczeie zmiennych wyswietlania
     $this->tpl_values = '';
     $_POST = array();
     return;
 }