Ejemplo n.º 1
0
 protected function getPageList()
 {
     $this->searchActions();
     $this->actions();
     // tylul na pasku
     $this->top_title = 'Lista typów wyposażenia';
     // aktualna strona kategorii
     $page = ClassTools::getValue('page') ? ClassTools::getValue('page') : NULL;
     if ($page !== NULL) {
         $equipment_type = new ClassEquipmentType($page);
         $this->tpl_values['wstecz'] = '/typy-wyposazenia';
         // sprawdzanie czy klasa zostala poprawnie zaladowana
         if (!$equipment_type->load_class) {
             $this->alerts['danger'] = 'Typ wyposażenia nie istnieje.';
             // ladowanie strony do wyswietlania bledow
             // zmienne ktore mozna uzyc: wstecz, title oraz alertow
             return $this->loadTemplate('alert');
         }
         // sprawdzanie czy jest parentem
         if ($equipment_type->id_parent !== NULL) {
             $this->alerts['danger'] = 'Podkategoria nie może posiadać własnych podkategorii.';
             // ladowanie strony do wyswietlania bledow
             // zmienne ktore mozna uzyc: wstecz, title oraz alertow
             return $this->loadTemplate('alert');
         }
         $this->top_title = 'Lista typów wyposażenia: ' . $equipment_type->name;
         $this->breadcroumb[] = array('name' => htmlspecialchars($equipment_type->name), 'link' => "/typy-wyposazenia/podglad/{$page}");
         $this->breadcroumb[] = array('name' => 'Lista', 'link' => "/typy-wyposazenia/{$page}");
     }
     // strony
     $this->controller_name = 'typy-wyposazenia';
     $this->using_pages = true;
     $this->count_items = ClassEquipmentType::sqlGetCountItemsById($page);
     $this->current_page = ClassTools::getValue('number_page') ? ClassTools::getValue('number_page') : '1';
     // $this->items_on_page = 2;
     // tytul strony
     $this->tpl_title = 'Typy wyposażenia: Lista';
     // ladowanie funkcji
     $this->load_js_functions = true;
     // pobieranie wszystkich rekordow
     $this->tpl_values['items'] = ClassEquipmentType::sqlGetAllItemsById($page, false, false, $this->using_pages, $this->current_page, $this->items_on_page);
     // dodatkowe zmienne dla listy kategorii
     $this->tpl_values['list_page'] = $page;
     $this->tpl_values['list_page_name'] = $page === NULL ? '' : ' <b>' . ClassEquipmentType::sqlGetItemNameByIdParent($page) . '</b>';
     // ladowanie strony z lista
     return $this->loadTemplate('/equipment/types-list');
 }