protected function loadTemplate($page_name) { if ($page_name && file_exists($_SERVER['DOCUMENT_ROOT'] . '/views/' . $page_name . '.tpl')) { $this->loadScripts(); // pobieranie usera global $login; $user = ClassUser::sqlGetNameSurnameById($login->auth_user['id_user']); $user_name = $user['name']; $user_surname = $user['surname']; $user_name_surname = $user['name'] . ' ' . $user['surname']; ob_start(); include_once 'views/partial/header.tpl'; // include_once 'views/partial/top-nav.php'; include_once 'views/' . $page_name . '.tpl'; if ($this->top_help_file && $this->top_help_file != '' && file_exists($_SERVER['DOCUMENT_ROOT'] . "/views/help/{$this->top_help_file}.tpl")) { include_once "views/help/{$this->top_help_file}.tpl"; } include_once 'views/partial/footer.php'; $content = ob_get_contents(); ob_end_clean(); return $content; } return false; }
protected function getPageView($soldier) { global $login; // tylul na pasku $this->top_title = 'Podgląd misji żołnierza'; // zmienne wyswietlania na wypadek gdy strona z odznaczeniem nie istnieje $wstecz = "/zolnierze/{$soldier->id}/misje"; // sprawdzanie czy id istnieje w linku if (!($id_child_item = ClassTools::getValue('id_child_item'))) { $this->tpl_values['wstecz'] = $wstecz; $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 ClassSoldier2Mission($id_child_item); $this->tpl_values['wstecz'] = $wstecz; // sprawdzanie czy klasa zostala poprawnie zaladowana if (!$item->load_class) { $this->alerts['danger'] = 'Przypisanie misji do żołnierza nie istnieje'; // ladowanie strony do wyswietlania bledow // zmienne ktore mozna uzyc: wstecz, title oraz alertow return $this->loadTemplate('alert'); } // sprawdzanie szkola jest przypisana do tego zolnierza if ($soldier->id != $item->id_soldier) { $this->alerts['danger'] = 'Misja nie jest przypisana do tego żołnierza'; // ladowanie strony do wyswietlania bledow // zmienne ktore mozna uzyc: wstecz, title oraz alertow return $this->loadTemplate('alert'); } // tytul $this->tpl_title = "{$soldier->name} {$soldier->surname}: Misja: Podgląd"; // skrypty $this->load_js_functions = true; $this->tpl_values['status_name'] = $item->status_name; $this->tpl_values['detached'] = $item->detached; $this->tpl_values['description'] = ClassTools::nl2br($item->description); $this->tpl_values['description_detach'] = ClassTools::nl2br($item->description_detach); $this->tpl_values['user_detach'] = ClassUser::sqlGetNameSurnameById($item->id_user); $this->tpl_values['date_update'] = date('d.m.Y H:i', strtotime($item->date_update)); // ladowanie misji $this->tpl_values['mission'] = new ClassMission($item->id_mission); $this->breadcroumb[] = array('name' => htmlspecialchars($this->tpl_values['mission']->name), 'link' => "/zolnierze/{$soldier->id}/misje/podglad/{$item->id}"); // prawa zalogowanego uzytkownika $this->tpl_values['id_login_permission'] = $login->auth_user['id_permission']; // przypisanie zmiennych formularza do zmiennych klasy $array_form_class = array('id_soldier2missions' => $item->id, 'id_soldier' => $soldier->id, 'id_mission' => $item->id_mission, 'date_mission_add' => $item->date_mission_add, 'date_mission_detach' => $item->date_mission_detach); // przypisywanieszych zmiennych do zmiennych formularza $this->setValuesTemplateByArrayPost($array_form_class); // ladowanie strony z formularzem return $this->loadTemplate('/soldier/missions-view'); }
protected function getPageView($soldier) { global $login; // zmienne wyswietlania na wypadek gdy strona z odznaczeniem nie istnieje $wstecz = "/zolnierze/{$soldier->id}/odznaczenia"; $title = "{$soldier->name} {$soldier->surname}: Odznaczenia: Podgląd"; // sprawdzanie czy id istnieje w linku if (!($id_child_item = ClassTools::getValue('id_child_item'))) { $this->tpl_values['wstecz'] = $wstecz; $this->tpl_values['title'] = $title; $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 ClassSoldier2Badge($id_child_item); $this->tpl_values['wstecz'] = $wstecz; $this->tpl_values['title'] = $title; // sprawdzanie czy klasa zostala poprawnie zaladowana if (!$item->load_class) { $this->alerts['danger'] = 'Odzneczenie nie jest powiazane z żołnierzem.'; // ladowanie strony do wyswietlania bledow // zmienne ktore mozna uzyc: wstecz, title oraz alertow return $this->loadTemplate('alert'); } // sprawdzanie szkola jest przypisana do tego zolnierza if ($soldier->id != $item->id_soldier) { $this->alerts['danger'] = 'Odzneczenie nie jest powiazane z żołnierzem.'; // ladowanie strony do wyswietlania bledow // zmienne ktore mozna uzyc: wstecz, title oraz alertow return $this->loadTemplate('alert'); } // tytul $this->tpl_title = "{$soldier->name} {$soldier->surname}: Odznaczenia: Podgląd"; // skrypty $this->load_js_functions = true; $this->tpl_values['status_name'] = $item->status_name; $this->tpl_values['received'] = $item->received; $this->tpl_values['badge_type'] = $item->badge_type; $this->tpl_values['date_receive'] = $item->date_receive; $this->tpl_values['date_grant'] = $item->date_grant; $this->tpl_values['description'] = ClassTools::nl2br($item->description); $this->tpl_values['description_receive'] = ClassTools::nl2br($item->description_receive); $this->tpl_values['user_receive'] = ClassUser::sqlGetNameSurnameById($item->id_user); $this->tpl_values['date_update'] = date('d.m.Y H:i', strtotime($item->date_update)); // ladowanie szkolenia $this->tpl_values['badge'] = new ClassBadge($item->id_badge); // prawa zalogowanego uzytkownika $this->tpl_values['id_login_permission'] = $login->auth_user['id_permission']; // przypisanie zmiennych formularza do zmiennych klasy $array_form_class = array('id_soldier2badges' => $item->id, 'id_soldier' => $soldier->id, 'id_badge' => $item->id_badge); // przypisywanieszych zmiennych do zmiennych formularza $this->setValuesTemplateByArrayPost($array_form_class); // ladowanie strony z formularzem return $this->loadTemplate('/soldier/badges-view'); }
protected function getPageView() { // tylul na pasku $this->top_title = 'Podgląd misji'; // zmienne wyswietlania na wypadek gdy strona z misja nie istnieje $this->tpl_values['wstecz'] = '/misje'; $this->tpl_values['title'] = 'Podgląd misji'; // 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 i misji $mission = new ClassMission($id_item); // sprawdzanie czy misja zostala poprawnie zaladowana if (!$mission->load_class) { $this->alerts['danger'] = 'Misja nie istnieje'; // ladowanie strony do wyswietlania bledow // zmienne ktore mozna uzyc: wstecz, title oraz alertow return $this->loadTemplate('alert'); } // tytul $this->tpl_title = 'Misja: Podgląd'; $this->breadcroumb[] = array('name' => htmlspecialchars($mission->name), 'link' => "/misje/podglad/{$mission->id}"); // skrypty $this->load_js_functions = true; // print_r($mission); // values $this->tpl_values['id_mission'] = $mission->id; $this->tpl_values['form_name'] = $mission->name; $this->tpl_values['form_location'] = $mission->location; $this->tpl_values['form_description'] = ClassTools::nl2br($mission->description); $this->tpl_values['form_date_start'] = ClassMission::getPlDate($mission->date_start); $this->tpl_values['form_date_end'] = ClassMission::getPlDate($mission->date_end); $this->tpl_values['form_active'] = $mission->active; $this->tpl_values['status'] = $mission->status; $this->tpl_values['type'] = $mission->mission_type_name; $this->tpl_values['date_update'] = $mission->date_update; $this->tpl_values['log'] = $mission->sqlGetLogItem(); $this->tpl_values['user'] = ClassUser::sqlGetNameSurnameById($mission->id_user); // print_r($this->tpl_values['log']); // ladowanie strony z formularzem return $this->loadTemplate('/mission/view'); }
protected function getPageView() { // tylul na pasku $this->top_title = 'Podgląd szkolenia'; // zmienne wyswietlania na wypadek gdy strona nie istnieje $this->tpl_values['wstecz'] = '/szkolenia'; // 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 ClassTraining($id_item); // sprawdzanie czy item zostal poprawnie zaladowany if (!$item->load_class) { $this->tpl_values['wstecz'] = '/szkolenia'; $this->alerts['danger'] = 'Szkolenie nie istnieje'; // ladowanie strony do wyswietlania bledow // zmienne ktore mozna uzyc: wstecz, title oraz alertow return $this->loadTemplate('alert'); } $this->breadcroumb[] = array('name' => htmlspecialchars($item->name), 'link' => "/szkolenia/podglad/{$item->id}"); // tytul $this->tpl_title = 'Szkolenie: Podgląd'; // skrypty $this->load_js_functions = true; // values $this->tpl_values['id_training'] = $item->id; $this->tpl_values['form_name'] = $item->name; $this->tpl_values['form_code'] = $item->code; $this->tpl_values['form_training_center'] = $item->training_center_name; $this->tpl_values['form_description'] = ClassTools::nl2br($item->description); $this->tpl_values['form_date_start'] = ClassTraining::getPlDate($item->date_start); $this->tpl_values['form_date_end'] = ClassTraining::getPlDate($item->date_end); $this->tpl_values['form_active'] = $item->active; $this->tpl_values['status'] = $item->status; $this->tpl_values['date_update'] = $item->date_update; $this->tpl_values['log'] = $item->sqlGetLogItem(); $this->tpl_values['user'] = ClassUser::sqlGetNameSurnameById($item->id_user); // print_r($this->tpl_values['log']); // ladowanie strony z formularzem return $this->loadTemplate('/training/view'); }