예제 #1
0
 protected function edit()
 {
     // ladowanie klasy
     $item = new ClassTrainingCenter(ClassTools::getValue('id_training_centre'));
     // sprawdza czy klasa zostala poprawnie zaladowana
     if (!$item->load_class) {
         $this->alerts['danger'] = "Centrum szkolenia nie istnieje.";
         return;
     }
     $active = ClassTools::getValue('form_active');
     $item->name = ClassTools::getValue('form_name');
     $item->location = ClassTools::getValue('form_location');
     $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 centrum szkolenia: <b>{$item->name}</b>";
     // czyszczeie zmiennych wyswietlania
     $this->tpl_values = '';
     $_POST = array();
     return;
 }