protected function add() { $active = ClassTools::getValue('form_active'); $badge = new ClassBadge(); $badge->id_badge_type = ClassTools::getValue('form_rank'); $badge->name = ClassTools::getValue('form_name'); $badge->id_user = ClassAuth::getCurrentUserId(); $badge->active = $active && $active == '1' ? '1' : '0'; // komunikaty bledu if (!$badge->add()) { $this->alerts['danger'] = $badge->errors; return; } // komunikat sukcesu $this->alerts['success'] = "Poprawnie dodano nowe odznaczenie: <b>{$badge->name}</b>"; // czyszczeie zmiennych wyswietlania $this->tpl_values = ''; $_POST = array(); return; }