Esempio n. 1
0
 protected function add()
 {
     // return;
     $active = ClassTools::getValue('form_active');
     $form_parent = ClassTools::getValue('form_parent');
     $item = new ClassEquipmentType();
     $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->add()) {
         $this->alerts['danger'] = $item->errors;
         return;
     }
     // komunikat sukcesu
     $this->alerts['success'] = "Poprawnie dodano nowy typ wyposażenia: <b>{$item->name}</b>";
     // czyszczeie zmiennych wyswietlania
     $this->tpl_values = '';
     $_POST = array();
     return;
 }