Exemple #1
0
 protected function getSearchDefinition()
 {
     // $ranks = ClassBadge::getRanks();
     // $form_ranks = array();
     // foreach($ranks as $rank){
     // $form_ranks[$rank['id_badge_rank']] = $rank['name'];
     // }
     $form_ranks = ClassBadgeType::sqlGetAllItemsNameById(NULL);
     $form_values = array('class' => 'ClassBadge', 'controller' => $this->search_controller, 'form' => array('id_badge' => array('class' => 'table_id', 'type' => 'text'), 'name' => array('class' => 'table_name', 'type' => 'text'), 'id_badge_type' => array('class' => 'table_rank', 'type' => 'select', 'options' => $form_ranks), 'active' => array('class' => 'table_status', 'type' => 'select', 'options' => array('0' => 'Wyłączony', '1' => 'Włączony')), 'actions' => array('class' => 'table_akcje')));
     return $form_values;
 }
Exemple #2
0
 public static function sqlGetAllItems($using_pages = false, $current_page = '1', $items_on_page = '5', $controller_search = '')
 {
     if ($sql = parent::sqlGetAllItems($using_pages, $current_page, $items_on_page, $controller_search)) {
         foreach ($sql as $key => $val) {
             // Rodzaj jednostki nazwa
             $sql[$key]['badge_rank_name'] = ClassBadgeType::sqlGetItemNameByIdParent($val['id_badge_type']);
             // Nazwa statusu
             $sql[$key]['active_name'] = ClassUser::getNameStatus($val['active']);
         }
     }
     return $sql;
 }
Exemple #3
0
 protected function edit()
 {
     // ladowanie klasy
     $item = new ClassBadgeType(ClassTools::getValue('id_badge_type'));
     // sprawdza czy klasa zostala poprawnie zaladowana
     if (!$item->load_class) {
         $this->alerts['danger'] = 'Rodzaj odznaczenia nie istnieje';
         return;
     }
     $active = ClassTools::getValue('form_active');
     $item->name = ClassTools::getValue('form_name');
     $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 rodzaj odznaczenia: <b>" . htmlspecialchars($item->name) . "</b>";
     // czyszczeie zmiennych wyswietlania
     $this->tpl_values = '';
     $_POST = array();
     return;
 }