Esempio n. 1
0
 /**
  * Determine if the given User can be read by the logged in user.
  *
  * @param  \User  $user
  * @param  \User  $post
  * @return bool
  */
 private function read(User $loggedIn, User $user)
 {
     $found = $user->id === $user->id;
     $classesOwned = ClassOwner::getClasses($user->id);
     $found |= $classesOwned->contains(\ClassUser::getClassesForUser($user->id));
     return $found;
 }
Esempio n. 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) {
             // Nazwa statusu
             $sql[$key]['active_name'] = ClassUser::getNameStatus($val['active']);
         }
     }
     return $sql;
 }
Esempio n. 3
0
 public function load()
 {
     parent::load();
     if ($this->load_class) {
         // $this->mission_type_name = self::sqlGetTypeNameId($this->id_mission_type);
         $this->mission_type_name = ClassMissionType::sqlGetItemNameByIdParent($this->id_mission_type);
         $this->date_end_name = self::getDateEndNameByDateEnd($this->date_end);
         // $this->status = self::getStatusName($this->date_end, $this->active);
         $this->status = self::getStatusMission($this->date_start, $this->date_end);
         $this->date_end_name_pl = self::getDateEndNameByDateEnd($this->date_end, true);
         $this->date_start_pl = date('d.m.Y H:i', strtotime($this->date_start));
         $this->active_name = ClassUser::getNameStatus($this->active);
     }
 }
Esempio n. 4
0
 public function indexAction()
 {
     $profile = Users::findFirst($this->dispatcher->getParam("id"));
     if (!$profile) {
         $this->flash->error("Пользователь не существует");
         $this->view->prof_user = false;
     } else {
         $this->view->prof_user = true;
         $this->view->prof_username = $profile->username;
         $this->view->prof_email = $profile->email;
         $this->view->prof_name = $profile->name;
         $this->view->prof_phone = $profile->phone;
         $profile_sale = Buyers::findByid_users($this->dispatcher->getParam("id"));
         $this->view->prof_sex = $profile->sex;
         $this->view->prof_sale = count($profile_comments);
         $this->view->prof_day = intval((strtotime(date("Y-m-d H:i:s")) - strtotime($profile->created_at)) / (60 * 60 * 24));
         $class = ClassUser::findFirst($profile->class);
         $this->view->prof_class = $class->description;
     }
 }
Esempio n. 5
0
 public function load()
 {
     parent::load();
     if ($this->load_class) {
         $item = new ClassTrainingCenter($this->id_training_centre);
         if (!$item->load_class) {
             $this->training_center_name = 'Centrum szkolenia nie istnieje';
         } else {
             $this->training_center_name = $item->name . ', ' . $item->location;
         }
         // data rozpoczecia misji
         $this->date_start_name = self::getPlDate($this->date_start);
         // nazwa lub data zakonczenia misji
         $this->date_end_name = self::getDateEndNameByDateEnd($this->date_end, true);
         // nazwa statusu
         // $this->status = self::getStatusName($this->date_end, $this->active);
         $this->status = self::getStatusTraining($this->date_start, $this->date_end);
         $this->active_name = ClassUser::getNameStatus($this->active);
     }
 }
Esempio n. 6
0
 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;
 }
Esempio n. 7
0
 /**
  * Determine if the given article can be read by the user.
  *
  * @param  \User  $user
  * @param  \Article  $post
  * @return bool
  */
 public function read(User $user, HClass $class)
 {
     return \ClassUser::exists($user->id, $class->id);
 }
Esempio n. 8
0
 /**
  * Exclude object from result
  *
  * @param     ClassUser $classUser Object to remove from the list of results
  *
  * @return    ClassUserQuery The current query, for fluid interface
  */
 public function prune($classUser = null)
 {
     if ($classUser) {
         $this->addCond('pruneCond0', $this->getAliasedColName(ClassUserPeer::CLASS_ID), $classUser->getClassId(), Criteria::NOT_EQUAL);
         $this->addCond('pruneCond1', $this->getAliasedColName(ClassUserPeer::USER_ID), $classUser->getUserId(), Criteria::NOT_EQUAL);
         $this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR);
     }
     return $this;
 }
Esempio n. 9
0
<?php

session_start();
require_once '../comunes/header_int.php';
require_once '../clases/users.php';
//require_once('../class/modal.php');
/*Clases*/
$obj_user = new ClassUser();
/*Metodos*/
$resultado_user = $obj_user->get_Users();
?>
<div id="botones">
    <a class="btn btn-primary btn-lg" href="new_user.php" role="button">Agregar</a>
</div>
<?php 
/*Paginacion*/
$objPaginator = new ClassPaginator();
if (!isset($_REQUEST['pg'])) {
    $_REQUEST['pg'] = 1;
}
$pagina_actual = $_REQUEST['pg'];
$resultado_usuario = $objPaginator->create_paginator($resultado_user, $_REQUEST['pg']);
/*Fin Paginacion*/
?>

<div class="table">
  <table class="table table-bordered table-hover">
  	<thead>
	    <tr>
	    	<th>Id</th>
	    	<th>Usuario</th>
Esempio n. 10
0
 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');
 }
Esempio n. 11
0
<?php

session_name("EnterAccessCFERecibos");
session_start();
include_once "../business/administrador/ClassUser.php";
$user = new ClassUser();
if ($_GET["saveUsuarios"]) {
    try {
        if ($user->guardarUsuarios($_REQUEST)) {
            exit(json_encode(array("error" => false, "message" => "Se ha realizado correctamente")));
        } else {
            exit(json_encode(array("error" => true, "message" => "Error inesperado, verifique los datos")));
        }
    } catch (Exception $e) {
        exit(json_encode(array("error" => true, "message" => $e->getMessage())));
    }
} elseif ($_GET["verUser"]) {
    $user->setDtcUsuarios();
    $data = $user->getUsuariosByDataTable($_REQUEST["draw"], $_REQUEST["columns"], $_REQUEST["order"], $_REQUEST["start"], $_REQUEST["length"], $_REQUEST["search"]["value"]);
    exit(json_encode($data));
} elseif ($_GET["editarUser"]) {
    exit(json_encode($user->findUserById($_REQUEST["id"])));
} elseif ($_GET["eliminarUser"]) {
    try {
        if ($user->deleteUser($_GET["id"])) {
            exit(json_encode(array("error" => false, "message" => "Se ha realizado correctamente")));
        } else {
            exit(json_encode(array("error" => true, "message" => "Error inesperado, verifique los datos")));
        }
    } catch (Exception $e) {
        exit(json_encode(array("error" => true, "message" => $e->getMessage())));
Esempio n. 12
0
 /**
  * Determine if the given article can be read by the user.
  *
  * @param  \User  $user
  * @param  \Article  $post
  * @return bool
  */
 public function read(User $user, Article $article)
 {
     $aClasses = Article::getClasses($article->id);
     return $aClasses->contains(\ClassUser::getClassesForUser($user->id));
 }
Esempio n. 13
0
 public static function getClassesForUser($userId)
 {
     return ClassUser::where('user_id', '=', $userId)->get();
 }
Esempio n. 14
0
 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');
 }
Esempio n. 15
0
 /**
  * Adds an object to the instance pool.
  *
  * Propel keeps cached copies of objects in an instance pool when they are retrieved
  * from the database.  In some cases -- especially when you override doSelect*()
  * methods in your stub classes -- you may need to explicitly add objects
  * to the cache in order to ensure that the same objects are always returned by doSelect*()
  * and retrieveByPK*() calls.
  *
  * @param      ClassUser $value A ClassUser object.
  * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
  */
 public static function addInstanceToPool(ClassUser $obj, $key = null)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if ($key === null) {
             $key = serialize(array((string) $obj->getClassId(), (string) $obj->getUserId()));
         }
         // if key === null
         self::$instances[$key] = $obj;
     }
 }
Esempio n. 16
0
 /**
  * Determine if the given challenge can be read by the user.
  *
  * @param  \User  $user
  * @param  \CHALLENGE  $post
  * @return bool
  */
 public function read(User $user, Challenge $challenge)
 {
     $cClasses = Challenge::getClasses($challenge->id);
     return $cClasses->contains(\ClassUser::getClassesForUser($user->id));
 }
Esempio n. 17
0
 public function sendNewPassword($password_key)
 {
     // sprawdzanie kiedy ostatnio zostal wyslany link do zmiany hasla
     if (!($last_send = $this->sqlGetWhenPasswordSendByPasswordKey($password_key))) {
         $this->errors = "Niepoprawny link.";
         return false;
     }
     $date_password_send = new DateTime($last_send['date_send']);
     $date_now = new DateTime("now");
     $date_now->sub(new DateInterval('PT' . ClassAuth::$password_link_time . 'H'));
     // print_r($date_now);
     if ($date_password_send < $date_now) {
         $this->errors = "Link jest nieaktywny.";
         return false;
     }
     // generowanie nowego hasla
     $new_password = ClassTools::generateRandomPasswd();
     if (!($user = new ClassUser($last_send['id_user']))) {
         $this->errors = $user->errors;
         return false;
     }
     if (!$user->sqlUpdatePassword($new_password, $last_send['id_user_new_password'])) {
         $this->errors = $user->errors;
         return false;
     }
     $this->auth_user = $user;
     return $new_password;
 }
Esempio n. 18
0
<?php

session_start();
require_once '../comunes/up_pages_inter.php';
require_once '../class/users.php';
/*Clases*/
$obj_user = new ClassUser();
if ($_REQUEST['add'] == 1) {
    $obj_user->saveuser($_REQUEST['usuario'], $_REQUEST['email'], $_REQUEST['profile'], $_REQUEST['pass'], $_SESSION['tokenb']);
    header('Location: users.php');
}
/*Metodos*/
$resultado_profiles = $obj_user->get_Profiles();
?>

<form role="form" action="?add=1" method="post" accept-charset="utf-8" class="user">
  	<div class="form-group">
    	<label for="usuario">Usuario</label>
		<input type="text" class="form-control" id="usuario" name="usuario" placeholder="Usuario" required="required">
  	</div>
  	<div class="form-group">
    	<label for="email">Email Usuario</label>
    	<input type="email" class="form-control" id="email" name="email" placeholder="Email Usuario" required="required">
  	</div>
  	<div class="form-group">
  		<label for="email">Perfil Usuario</label>
	  	<select name="profile" id="profile">
	  		<option value="">Seleccione un Perfil</option>
	  		<?php 
for ($i = 0; $i < count($resultado_profiles); $i++) {
    ?>
Esempio n. 19
0
 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');
 }
Esempio n. 20
0
 public static function sqlGetAllItemsById($id_page, $without_id = false, $active = false, $using_pages = false, $current_page = '1', $items_on_page = '5', $controller_search = '')
 {
     global $DB;
     $table_name = (static::$use_prefix ? static::$prefix : '') . static::$definition['table'];
     $id = static::$definition['primary'];
     $where = '';
     $limit = '';
     if ($id_page === NULL) {
         $id_page = 'IS NULL';
     } else {
         $id_page = "= '{$id_page}'";
     }
     if (static::$has_deleted_column) {
         $where = " AND `deleted` = '0'";
     }
     if ($active) {
         $where .= " AND `active` = '1'";
     }
     if ($without_id) {
         $where .= " AND `{$id}` != '{$without_id}'";
     }
     if (static::$is_search && $controller_search != '' && ($where_search = self::generateWhereList($controller_search))) {
         $where .= " AND " . $where_search;
     }
     if ($using_pages) {
         $limit_start = ($current_page - 1) * $items_on_page;
         $limit = " LIMIT {$limit_start}, {$items_on_page}";
     }
     $zapytanie = "SELECT *\n                FROM `{$table_name}`\n                WHERE `id_parent` {$id_page}\n                    {$where}\n                ORDER BY `{$id}`\n                {$limit}\n            ;";
     $sql = $DB->pdo_fetch_all($zapytanie, true);
     if (($sql === false || !is_array($sql)) && (static::$is_search && $controller_search != '' && isset($_SESSION['search'][$controller_search]))) {
         if (static::$is_search && isset($_SESSION['search'][$controller_search])) {
             $_SESSION['search'][$controller_search] = array();
         }
     }
     if (!$sql || !is_array($sql) || count($sql) < 1) {
         return false;
     }
     if (!$active) {
         foreach ($sql as $key => $val) {
             // Nazwa statusu
             $sql[$key]['active_name'] = ClassUser::getNameStatus($val['active']);
         }
     }
     return $sql;
 }
Esempio n. 21
0
 protected function editPassword()
 {
     global $login;
     // sprawdza czy uzytkownik nie zmienil sb id podczas edycji
     if (ClassTools::getValue('id_user') != $login->auth_user['id_user']) {
         $this->alerts['danger'] = 'Niepoprawny użytkownik';
         return false;
     }
     $item = new ClassUser(ClassTools::getValue('id_user'));
     $item->id_user = ClassAuth::getCurrentUserId();
     // komunikaty bledu
     if (!$item->myAccountEditPassword(ClassTools::getValue('form_new_password'), ClassTools::getValue('form_new_password_repeat'))) {
         $this->alerts['danger'] = $item->errors;
         return;
     }
     // komunikat sukcesu
     $this->alerts['success'] = "Poprawnie zmieniono hasło.";
     // czyszczeie zmiennych wyswietlania
     $this->tpl_values = '';
     $_POST = array();
     return;
 }
 public function actionAccept()
 {
     $message = "";
     $success = 0;
     $link = "";
     if (isset($_GET["token"])) {
         if (isset($_GET["user"])) {
             $token = class_model::model()->findByAttributes(array('class_token' => $_GET["token"]));
             if ($token) {
                 $user = User::model()->findByAttributes(array('user_id' => $_GET["user"]));
                 if ($user) {
                     $user_class = new ClassUser();
                     $user_class->class_id = $token->class_id;
                     $user_class->user_id = $user->user_id;
                     $user_class->is_active = 1;
                     $user_class->save(FALSE);
                     $message = "Bạn đã chấp nhận lời mời vào lớp " . $token->class_name . ". Chúc bạn học tập tốt cùng bluebee!";
                     $success = 1;
                     $link = Yii::app()->createUrl('classpage?classid= ' . $token->class_id);
                 } else {
                     $message = 'Bạn chưa là thành viên bluebee. Hãy đăng ký để gia nhập bluebee';
                     $success = 0;
                     $link = '';
                 }
             } else {
                 $message = 'Thư mời đã xảy ra lỗi. Không thể xác nhận lời mời!';
                 $success = 0;
                 $link = '';
             }
         }
     }
     $this->render('accept', array('message' => $message, 'success' => $success, 'link' => $link));
 }
Esempio n. 23
0
 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');
 }
Esempio n. 24
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]['equipment_type_name'] = ClassEquipmentType::sqlGetItemNameByIdParent($val['id_equipment_type']);
             // Nazwa statusu
             $sql[$key]['active_name'] = ClassUser::getNameStatus($val['active']);
         }
     }
     return $sql;
 }
Esempio n. 25
0
 protected function passwordUpdate()
 {
     // ladowanie klasy i uzytkownika
     $user = new ClassUser(ClassTools::getValue('id_user'));
     // sprawdza czy klasa zostala poprawnie zaladowana
     if (!$user->load_class) {
         $this->alerts['danger'] = $user->errors;
         return;
     }
     // komunikaty
     if (!$user->passwordUpdate(ClassTools::getValue('form_new_password'), ClassTools::getValue('form_new_password_repeat'))) {
         $this->alerts['danger'] = $user->errors;
         return;
     }
     // komunikat
     $this->alerts['success'] = "Poprawnie zmieniono hasło: <b>{$user->name} {$user->surname}</b>";
     // czyszczeie zmiennych wyswietlania
     $this->tpl_values = array();
     $_POST = array();
     return;
 }