示例#1
0
 protected function getPageEdit()
 {
     // tylul na pasku
     $this->top_title = 'Edytuj żołnierza';
     // zmienne wyswietlania na wypadek gdy strona z odznaczeniem nie istnieje
     $this->tpl_values['wstecz'] = '/zolnierze';
     // sprawdzanie czy id istnieje w linku
     if (!($id_item = ClassTools::getValue('id_item'))) {
         $this->alerts['danger'] = 'Brak podanego id';
         // ladowanie strony do wyswietlania bledow
         // zmienne ktore mozna uzyc: wstecz, title oraz alertow
         return $this->loadTemplate('alert');
     }
     $this->actions();
     // ladowanie klasy
     $item = new ClassSoldier($id_item);
     // sprawdzanie czy klasa zostala poprawnie zaladowana
     if (!$item->load_class) {
         $this->tpl_values['wstecz'] = '/zolnierze';
         $this->alerts['danger'] = 'Żołnierz nie istnieje';
         // ladowanie strony do wyswietlania bledow
         // zmienne ktore mozna uzyc: wstecz, title oraz alertow
         return $this->loadTemplate('alert');
     }
     // tytul
     $this->tpl_title = 'Żołnierze: Edycja';
     // skrypty
     $this->load_select2 = true;
     $this->load_datetimepicker = true;
     $this->load_js_functions = true;
     // ladowanie typow edukacji
     $this->tpl_values['education_types'] = ClassEducationType::sqlGetAllItemsNameById(NULL, false, true);
     // ladowanie statusow
     $this->tpl_values['soldier_statuses'] = ClassSoldierStatus::sqlGetAllItemsNameById(NULL, false, true);
     // ladowanie jednostek
     $this->tpl_values['form_militaries'] = ClassMilitary::getMilitariesWithGroups();
     // zmienna ktora decyduje co formularz ma robic
     $this->tpl_values['sew_action'] = 'edit';
     $this->breadcroumb[] = array('name' => "{$item->name} {$item->surname}", 'link' => "/zolnierze/podglad/{$item->id}");
     $this->breadcroumb[] = array('name' => 'Edytuj', 'link' => "/zolnierze/edytuj/{$item->id}");
     // przypisanie zmiennych formularza do zmiennych klasy
     $array_form_class = array('id_soldier' => $item->id, 'form_sex' => $item->sex, 'form_name' => $item->name, 'form_second_name' => $item->second_name, 'form_surname' => $item->surname, 'form_date_birthday' => $item->date_birthday, 'form_place_birthday' => $item->place_birthday, 'form_citizenship' => $item->citizenship, 'form_nationality' => $item->nationality, 'form_pesel' => $item->pesel, 'form_identity_document' => $item->identity_document, 'form_mail' => $item->mail, 'form_phone' => $item->phone, 'form_height' => $item->height, 'form_weight' => $item->weight, 'form_shoe_number' => $item->shoe_number, 'form_blood_group' => $item->blood_group, 'form_name_mother' => $item->name_mother, 'form_surname_mother' => $item->surname_mother, 'form_name_father' => $item->name_father, 'form_surname_father' => $item->surname_father, 'form_name_partner' => $item->name_partner, 'form_surname_partner' => $item->surname_partner, 'form_education_type' => $item->id_education_type, 'form_wku' => $item->wku, 'form_health_category' => $item->health_category, 'form_military' => $item->id_military, 'form_injuries' => $item->injuries, 'form_status' => $item->id_status);
     // przypisywanieszych zmiennych do zmiennych formularza
     $this->setValuesTemplateByArrayPost($array_form_class);
     // ladowanie strony z formularzem
     return $this->loadTemplate('/soldier/form');
 }
示例#2
0
 public function load()
 {
     parent::load();
     if ($this->load_class) {
         // poziom wyksztalcenia nazwa
         $this->education_type_name = ClassEducationType::sqlGetItemNameByIdParent($this->id_education_type);
         // Nazwa statusu
         $this->status_name = ClassSoldierStatus::sqlGetItemNameByIdParent($this->id_status);
         // Zmiana daty na polski format
         $this->date_birthday = date('d.m.Y', strtotime($this->date_birthday));
         // nazwa plci
         $this->sex_name = self::getSexName($this->sex);
         // nazwa jednostki wojskowej
         $military = new ClassMilitary($this->id_military);
         $this->military_name = $military->name . ', ' . $military->location;
     }
 }