coach helper status

This commit is contained in:
Ricsi
2016-12-07 09:27:02 +01:00
parent 303f26587f
commit 8350c1f546
6 changed files with 47 additions and 20 deletions

View File

@@ -15,7 +15,7 @@ class user {
private $user_last_name;
private $user_first_name;
private $user_password;
private $user_email;
private $user_helper;
private $user_last_login;
private $logged_in;
private $user_type;
@@ -41,8 +41,8 @@ class user {
$this->user_password = $_u_pass;
}
public function set_ua_email($_u_email) {
$this->user_email = $_u_email;
public function set_ua_helper($_u_helper) {
$this->user_helper = $_u_helper;
}
public function set_ua_last_login($_u_last_login) {
@@ -73,8 +73,8 @@ class user {
return $this->user_password;
}
public function get_ua_email() {
return $this->user_email;
public function get_ua_helper() {
return $this->user_helper;
}
public function get_ua_deleted() {
@@ -123,22 +123,22 @@ class user {
$this->user_type = $_type;
}
public static function create_user($_name, $_email, $_password) {
public static function create_user($_name, $_helper, $_password) {
global $sql;
return $sql->insert_into('user_coach', array(
'ua_name' => $_name,
'ua_email' => $_email,
'ua_helper' => $_helper,
'ua_password' => $_password
)
);
}
public static function update_user($_name, $_email, $_password, $_ua_id) {
public static function update_user($_name, $_helper, $_password, $_ua_id) {
global $sql;
return $sql->update_table('user_coach',
array(
'ua_name' => $_name,
'ua_email' => $_email,
'ua_helper' => $_helper,
'ua_password' => $_password
),
array(

View File

@@ -107,6 +107,8 @@ td.create a {
margin-right: 5px;
}
.list a {
color: #473C3C;
font-family: Arial;
@@ -132,6 +134,10 @@ td.create a {
font-weight: bold;
}
.transp {
opacity: 0.5;
}
@media (min-width: 680px) {

View File

@@ -11,15 +11,30 @@ if (isset($_POST['action'])) {
USER TYPES: 1 - coach, 2 - kid, 3 - parent
*/
$login = new login();
/*
$user_coach_id = $login->check_coach_login($_POST['user_name'], $_POST['user_password']);
$user_kid_id = $login->check_kid_login($_POST['user_name'], $_POST['user_password']);
if ($user_coach_id) {
//sikeres bejelentkezés
$login->login_user($user_coach_id, 'badminton_coach_user');
header("Location: " . $actual_link);
}
elseif ($user_kid_id) {
//sikeres bejelentkezés
$login->login_user($user_kid_id, 'badminton_parent_user');
header("Location: " . $actual_link);
}
else {
die($user_coach_id);
//sikertelen bejelentkezés
}
*/
$user_id = $login->check_login($_POST['user_name'], $_POST['user_password']);
if ($user_id) {
//sikeres bejelentkezés
$login->login_user($user_id, $_POST['user_type']);
header("Location: " . $actual_link);
}
else {
//sikertelen bejelentkezés
}
break;
case 'user_data_edit':
@@ -118,7 +133,11 @@ if (isset($_POST['action'])) {
else {
$psw = "null";
}
user::create_user($_POST['ua_name'], $_POST['ua_email'], $psw);
if (!isset($_POST['ua_helper']) || empty($_POST['ua_helper'])) {
$_POST['ua_helper'] = 0;
}
user::create_user($_POST['ua_name'], $_POST['ua_helper'], $psw);
header("Location: /admin/coaches");
break;
case 'coach_data_edit':
@@ -129,7 +148,10 @@ if (isset($_POST['action'])) {
else {
$psw = "null";
}
user::update_user($_POST['ua_name'], $_POST['ua_email'], $psw, $_POST['ua_id']);
if (!isset($_POST['ua_helper']) || empty($_POST['ua_helper'])) {
$_POST['ua_helper'] = 0;
}
user::update_user($_POST['ua_name'], $_POST['ua_helper'], $psw, $_POST['ua_id']);
header("Location: /admin/coaches");
break;
case 'shirt_create':

View File

@@ -8,8 +8,8 @@
</div>
<div>
<label class="desc" id="title1" for="ua_email">Email cím:</label>
<div><input type="text" name="ua_email" id="ua_email" required></div>
<label class="desc" id="title1" for="ua_helper">Segédedző:</label>
<div><input type="checkbox" name="ua_helper" id="ua_helper" value="1"></div>
</div>
<div>

View File

@@ -12,8 +12,8 @@
</div>
<div>
<label class="desc" id="title1" for="ua_email">Email cím:</label>
<div><input type="text" name="ua_email" id="ua_email" value="{$user_data.ua_email}" required></div>
<label class="desc" id="title1" for="ua_helper">Segédedző:</label>
<div><input type="checkbox" name="ua_helper" id="ua_helper" value="1" {if $user_data.ua_helper == 1}checked{/if}></div>
</div>
<div>
@@ -38,7 +38,6 @@
<script type="text/javascript">
$( document ).ready(function() {
//
if (!$('#ua_can_login').attr('checked')) $("#password").hide();
});

View File

@@ -8,7 +8,7 @@
{foreach $user_array as $user}
<a href="/admin/coaches/{$user->get_ua_id()}">
<div class="list_item">
<img src="/_image/coach.png">
<img src="/_image/coach.png" class="{if $user->get_ua_helper()}transp{/if}">
{$user->get_ua_name()}
</div>
</a>