20161215
This commit is contained in:
@@ -47,16 +47,51 @@ class login {
|
||||
|
||||
}
|
||||
|
||||
public function login_user($_user_id, $_user_type) {
|
||||
public function check_coach_login($_user_name, $_user_password) {
|
||||
global $sql;
|
||||
//ez a függvény ellenőrzi le a bevitt adatok
|
||||
//vissszadja a user_id-t, ha helyesek az adatok
|
||||
//null ha nem
|
||||
$check_query =
|
||||
"
|
||||
SELECT ua_id FROM user_coach WHERE
|
||||
(ua_name = '" . $_user_name . "' AND
|
||||
ua_password = '" . md5($_user_password ) . "')";
|
||||
|
||||
echo $check_query;
|
||||
|
||||
if ($sql->num_of_rows($check_query)) return $sql->single_variable($check_query);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public function check_kid_login($_user_name, $_user_password) {
|
||||
global $sql;
|
||||
//ez a függvény ellenőrzi le a bevitt adatok
|
||||
//vissszadja a user_id-t, ha helyesek az adatok
|
||||
//null ha nem
|
||||
$check_query =
|
||||
"
|
||||
SELECT uk_id FROM user_kid WHERE
|
||||
(uk_name = '" . $_user_name . "' AND
|
||||
uk_password = '" . $_user_password . "')";
|
||||
|
||||
if ($sql->num_of_rows($check_query)) return $sql->single_variable($check_query);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public function login_user($_user_id, $_cookie_name, $_user_type) {
|
||||
//beállítja a belépett user adatait cookieba (ha még nincs)
|
||||
global $sql;
|
||||
|
||||
if (!isset($_COOKIE['badminon_coach_user'])) {
|
||||
if (!isset($_COOKIE[$_cookie_name])) {
|
||||
//user objektumot nem lehet cookie-ban tárolni, ezért user_id-t rakunk bele
|
||||
$user_login = new user();
|
||||
if ($_user_type == 1) $user_login = new user();
|
||||
else $user_login = new user_kid();
|
||||
$user_login->set_user_data_by_id($_user_id);
|
||||
$user_login->update_login_time();
|
||||
setcookie('badminton_coach_user', $_user_id, time()+60*60*72, '/');
|
||||
setcookie($_cookie_name, $_user_id, time()+60*60*72, '/');
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -21,8 +21,20 @@ class page {
|
||||
}
|
||||
|
||||
public function get_page_nav() {
|
||||
global $smarty;
|
||||
//itt majd el lehet ágaztatni, ha nem admin oldalon vagyunk stb, de egyenlőre nem kell
|
||||
global $smarty, $sql;
|
||||
//nem kell if, hanem page alapján beillesztük az id-t
|
||||
if ($this->get_page() == 'admin') {
|
||||
$menus_query = "SELECT * FROM subpage WHERE spage_page_id = 1;";
|
||||
$menu_assoc_array = $sql->assoc_array($menus_query);
|
||||
$smarty->assign('menus', $menu_assoc_array);
|
||||
}
|
||||
elseif ($this->get_page() == 'view') {
|
||||
$menus_query = "SELECT * FROM subpage WHERE spage_page_id = 2;";
|
||||
$menu_assoc_array = $sql->assoc_array($menus_query);
|
||||
$smarty->assign('menus', $menu_assoc_array);
|
||||
}
|
||||
|
||||
$smarty->assign('page', $this->get_page());
|
||||
$smarty->display('nav.tpl');
|
||||
}
|
||||
|
||||
@@ -105,6 +117,14 @@ class page {
|
||||
# EDZÉS TÍPUSOK
|
||||
include('include_training_types.php');
|
||||
break;
|
||||
case 'regions':
|
||||
# DIÁKOLIMPIA KÖRZETEK
|
||||
include('include_regions.php');
|
||||
break;
|
||||
case 'lock_training':
|
||||
# EDZÉS ZÁROLÁS, FELOLDÁS
|
||||
include('include_lock_training.php');
|
||||
break;
|
||||
case 'delete_training_type':
|
||||
# EDZÉS TÍPUS TÖRLÉS
|
||||
include('include_delete_training_type.php');
|
||||
@@ -121,8 +141,13 @@ class page {
|
||||
# VÁROS TÖRLÉS
|
||||
include('include_delete_city.php');
|
||||
break;
|
||||
case 'delete_region':
|
||||
# KÖRZET TÖRLÉS
|
||||
include('include_delete_region.php');
|
||||
break;
|
||||
case 'logout':
|
||||
# kijelentkezés
|
||||
$from = "coach";
|
||||
include('include_logout.php');
|
||||
break;
|
||||
default:
|
||||
@@ -135,8 +160,22 @@ class page {
|
||||
include('ajax/'.$this->get_subpage());
|
||||
}
|
||||
break;
|
||||
case 'style':
|
||||
//var_dump('haha');
|
||||
case 'view':
|
||||
# SZÜLŐ FELÜLET
|
||||
switch ($this->get_subpage()) {
|
||||
case 'logout':
|
||||
# kijelentkezés
|
||||
$from = "parent";
|
||||
include('include_logout.php');
|
||||
break;
|
||||
case 'overview':
|
||||
# áttekintő oldal adatokkal és edzéslistával
|
||||
include('include_overview.php');
|
||||
break;
|
||||
default:
|
||||
include('include_overview.php');
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
# code...
|
||||
@@ -164,27 +203,27 @@ class page {
|
||||
$this->id = $_id;
|
||||
}
|
||||
|
||||
private function get_page() {
|
||||
public function get_page() {
|
||||
return $this->page;
|
||||
}
|
||||
|
||||
private function get_subpage() {
|
||||
public function get_subpage() {
|
||||
return $this->subpage;
|
||||
}
|
||||
|
||||
private function get_id() {
|
||||
public function get_id() {
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
private function is_page() {
|
||||
public function is_page() {
|
||||
return !empty($this->page);
|
||||
}
|
||||
|
||||
private function is_subpage() {
|
||||
public function is_subpage() {
|
||||
return !empty($this->subpage);
|
||||
}
|
||||
|
||||
private function is_id() {
|
||||
public function is_id() {
|
||||
return !empty($this->id);
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ class sql extends mysqli {
|
||||
|
||||
public function single_variable($_query) {
|
||||
$result = self::query($_query);
|
||||
//var_dump($_query);
|
||||
$assoc_array = $result->fetch_array(MYSQLI_NUM);
|
||||
return $assoc_array['0'];
|
||||
}
|
||||
@@ -49,7 +50,7 @@ class sql extends mysqli {
|
||||
$i++;
|
||||
}
|
||||
$this->_query = 'insert into ' . $table . ' (' . $fields . ') values (' . $values . ');';
|
||||
var_dump($this->_query);
|
||||
//var_dump($this->_query);
|
||||
self::query($this->_query);
|
||||
return $this->insert_id;
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ class training {
|
||||
private $tr_training_type_trt_id;
|
||||
private $tr_user_coach_uc_id;
|
||||
private $tr_duration;
|
||||
private $tr_locked;
|
||||
|
||||
|
||||
public function set_tr_id($_tr_id) {
|
||||
@@ -32,6 +33,10 @@ class training {
|
||||
$this->tr_duration = $_tr_duration;
|
||||
}
|
||||
|
||||
public function set_tr_locked($_tr_locked) {
|
||||
$this->tr_locked = $_tr_locked;
|
||||
}
|
||||
|
||||
public function get_tr_id() {
|
||||
return $this->tr_id;
|
||||
}
|
||||
@@ -40,6 +45,18 @@ class training {
|
||||
return !$_formatted ? $this->tr_date : date("Y. F d. H:i", strtotime($this->tr_date));
|
||||
}
|
||||
|
||||
public function get_tr_date_day() {
|
||||
return date("d", strtotime($this->tr_date));
|
||||
}
|
||||
|
||||
public function get_tr_date_day_of_week() {
|
||||
return date("w", strtotime($this->tr_date));
|
||||
}
|
||||
|
||||
public function get_tr_date_time() {
|
||||
return date("H:i", strtotime($this->tr_date));
|
||||
}
|
||||
|
||||
public function get_tr_training_type_trt_id() {
|
||||
return $this->tr_training_type_trt_id;
|
||||
}
|
||||
@@ -48,6 +65,10 @@ class training {
|
||||
return $this->tr_duration;
|
||||
}
|
||||
|
||||
public function get_tr_locked() {
|
||||
return $this->tr_locked;
|
||||
}
|
||||
|
||||
public function get_tr_type_name_by_id() {
|
||||
global $sql;
|
||||
return $sql->single_variable("SELECT trt_name FROM training_type WHERE trt_id = " . $this->get_tr_training_type_trt_id());
|
||||
@@ -77,7 +98,7 @@ class training {
|
||||
for ($actual_day=date('d', strtotime($_training_value_array['tr_date'])); $actual_day <= $last_day; $actual_day=$actual_day+7) {
|
||||
$new_tr_id = $sql->insert_into('training',
|
||||
array(
|
||||
'tr_date' => date('Y-m') . '-' . $actual_day . ' ' . date('H:i', strtotime($_training_value_array['tr_date'])),
|
||||
'tr_date' => date('Y-m', strtotime($_training_value_array['tr_date'])) . '-' . $actual_day . ' ' . date('H:i', strtotime($_training_value_array['tr_date'])),
|
||||
'tr_training_type_trt_id' => $_training_value_array['tr_training_type_trt_id'],
|
||||
'tr_duration' => $_training_value_array['tr_duration']
|
||||
)
|
||||
@@ -89,6 +110,13 @@ class training {
|
||||
$sql->insert_into('training_coach', array('trc_training_tr_id' => $new_tr_id, 'trc_coach_uc_id' => $coach_id));
|
||||
}
|
||||
}
|
||||
//itt rakjuk be a segédedzőket
|
||||
if (isset($_training_value_array['helpets'])) {
|
||||
foreach ($_training_value_array['helpets'] as $coach_id) {
|
||||
# beilleszt minden edzőt ehhez az edzéshez
|
||||
$sql->insert_into('training_coach', array('trc_training_tr_id' => $new_tr_id, 'trc_coach_uc_id' => $coach_id, 'trc_helper' => 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
//var_dump($day_array);
|
||||
}
|
||||
@@ -98,6 +126,11 @@ class training {
|
||||
$coaches = $_training_value_array['coaches'];
|
||||
unset($_training_value_array['coaches']);
|
||||
}
|
||||
//helpers
|
||||
if (isset($_training_value_array['helpers'])) {
|
||||
$helpers = $_training_value_array['helpers'];
|
||||
unset($_training_value_array['helpers']);
|
||||
}
|
||||
$new_tr_id = $sql->insert_into('training', $_training_value_array);
|
||||
if (isset($coaches)) {
|
||||
foreach ($coaches as $coach_id) {
|
||||
@@ -105,6 +138,12 @@ class training {
|
||||
$sql->insert_into('training_coach', array('trc_training_tr_id' => $new_tr_id, 'trc_coach_uc_id' => $coach_id));
|
||||
}
|
||||
}
|
||||
if (isset($helpers)) {
|
||||
foreach ($helpers as $coach_id) {
|
||||
# beilleszt minden edzőt ehhez az edzéshez
|
||||
$sql->insert_into('training_coach', array('trc_training_tr_id' => $new_tr_id, 'trc_coach_uc_id' => $coach_id, 'trc_helper' => 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -118,8 +157,17 @@ class training {
|
||||
foreach ($_training_value_array['coaches'] as $coach_id) {
|
||||
$sql->insert_into('training_coach', array('trc_training_tr_id' => $_tr_id, 'trc_coach_uc_id' => $coach_id));
|
||||
}
|
||||
|
||||
unset($_training_value_array['coaches']);
|
||||
}
|
||||
if (isset($_training_value_array['helpers'])) {
|
||||
//helper handler -> kitoroljuk mindet és újra insertaljuk
|
||||
foreach ($_training_value_array['helpers'] as $coach_id) {
|
||||
$sql->insert_into('training_coach', array('trc_training_tr_id' => $_tr_id, 'trc_coach_uc_id' => $coach_id, 'trc_helper' => 1));
|
||||
}
|
||||
|
||||
unset($_training_value_array['helpers']);
|
||||
}
|
||||
|
||||
$sql->update_table('training', $_training_value_array, array('tr_id' => $_tr_id));
|
||||
}
|
||||
|
||||
@@ -15,7 +15,6 @@ class user {
|
||||
private $user_last_name;
|
||||
private $user_first_name;
|
||||
private $user_password;
|
||||
private $user_helper;
|
||||
private $user_last_login;
|
||||
private $logged_in;
|
||||
private $user_type;
|
||||
@@ -41,10 +40,6 @@ class user {
|
||||
$this->user_password = $_u_pass;
|
||||
}
|
||||
|
||||
public function set_ua_helper($_u_helper) {
|
||||
$this->user_helper = $_u_helper;
|
||||
}
|
||||
|
||||
public function set_ua_last_login($_u_last_login) {
|
||||
$this->user_last_login = $_u_last_login;
|
||||
}
|
||||
@@ -73,10 +68,6 @@ class user {
|
||||
return $this->user_password;
|
||||
}
|
||||
|
||||
public function get_ua_helper() {
|
||||
return $this->user_helper;
|
||||
}
|
||||
|
||||
public function get_ua_deleted() {
|
||||
return $this->user_deleted;
|
||||
}
|
||||
@@ -109,7 +100,14 @@ class user {
|
||||
public function is_coach_at_training($_training_id) {
|
||||
global $sql;
|
||||
//kap egy training id-t, és megmondja, hogy az user be van-e jelölve edzőként azon az edzésen
|
||||
$query = "SELECT * FROM training_coach WHERE trc_coach_uc_id = '" . $this->get_ua_id() . "' AND trc_training_tr_id = '" . $_training_id ."';";
|
||||
$query = "SELECT * FROM training_coach WHERE trc_coach_uc_id = '" . $this->get_ua_id() . "' AND trc_training_tr_id = '" . $_training_id ."' AND trc_helper = 0;";
|
||||
return $sql->num_of_rows($query);
|
||||
}
|
||||
|
||||
public function is_helper_at_training($_training_id) {
|
||||
global $sql;
|
||||
//kap egy training id-t, és megmondja, hogy az user be van-e jelölve segédedzőként azon az edzésen
|
||||
$query = "SELECT * FROM training_coach WHERE trc_coach_uc_id = '" . $this->get_ua_id() . "' AND trc_training_tr_id = '" . $_training_id ."' AND trc_helper = 1;";
|
||||
return $sql->num_of_rows($query);
|
||||
}
|
||||
|
||||
@@ -123,23 +121,21 @@ class user {
|
||||
$this->user_type = $_type;
|
||||
}
|
||||
|
||||
public static function create_user($_name, $_helper, $_password) {
|
||||
public static function create_user($_name, $_password) {
|
||||
global $sql;
|
||||
return $sql->insert_into('user_coach', array(
|
||||
'ua_name' => $_name,
|
||||
'ua_helper' => $_helper,
|
||||
'ua_password' => $_password
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public static function update_user($_name, $_helper, $_password, $_ua_id) {
|
||||
public static function update_user($_name, $_password, $_ua_id) {
|
||||
global $sql;
|
||||
if ($_password != "-1") {
|
||||
return $sql->update_table('user_coach',
|
||||
array(
|
||||
'ua_name' => $_name,
|
||||
'ua_helper' => $_helper,
|
||||
'ua_password' => $_password
|
||||
),
|
||||
array(
|
||||
@@ -151,7 +147,6 @@ class user {
|
||||
return $sql->update_table('user_coach',
|
||||
array(
|
||||
'ua_name' => $_name,
|
||||
'ua_helper' => $_helper
|
||||
),
|
||||
array(
|
||||
'ua_id' => $_ua_id
|
||||
|
||||
@@ -22,6 +22,7 @@ class user_kid extends user_parent {
|
||||
private $logged_in;
|
||||
private $user_type;
|
||||
private $user_shirt_size;
|
||||
private $user_shirt_note;
|
||||
private $user_school_sc_id;
|
||||
private $user_school_district;
|
||||
private $user_school_city_scc_id;
|
||||
@@ -29,6 +30,10 @@ class user_kid extends user_parent {
|
||||
private $user_parent_2;
|
||||
private $user_phone;
|
||||
private $user_facebook;
|
||||
private $user_region;
|
||||
private $user_contact;
|
||||
private $user_other;
|
||||
|
||||
public function set_uk_id($_uid) {
|
||||
$this->user_id = $_uid;
|
||||
}
|
||||
@@ -54,7 +59,10 @@ class user_kid extends user_parent {
|
||||
$this->user_last_login = $_u_last_login;
|
||||
}
|
||||
public function set_uk_shirt_size_ss_id($_shirt_size) {
|
||||
$this->shirt_size = $_shirt_size;
|
||||
$this->user_shirt_size = $_shirt_size;
|
||||
}
|
||||
public function set_uk_shirt_note($_shirt_note) {
|
||||
$this->user_shirt_note = $_shirt_note;
|
||||
}
|
||||
public function set_uk_school_sc_id($_school) {
|
||||
$this->user_school_sc_id = $_school;
|
||||
@@ -71,6 +79,16 @@ class user_kid extends user_parent {
|
||||
public function set_uk_parent_2($_uk_parent_2) {
|
||||
$this->user_parent_2 = $_uk_parent_2;
|
||||
}
|
||||
public function set_uk_region_reg_id($_uk_region) {
|
||||
$this->user_region = $_uk_region;
|
||||
}
|
||||
public function set_uk_contact($_uk_contact) {
|
||||
$this->user_contact = $_uk_contact;
|
||||
}
|
||||
public function set_uk_other($_uk_other) {
|
||||
$this->user_other = $_uk_other;
|
||||
}
|
||||
|
||||
public function get_uk_id() {
|
||||
return $this->user_id;
|
||||
}
|
||||
@@ -89,28 +107,78 @@ class user_kid extends user_parent {
|
||||
public function get_uk_email() {
|
||||
return $this->user_email;
|
||||
}
|
||||
public function get_uk_phone() {
|
||||
return $this->user_phone;
|
||||
}
|
||||
public function get_uk_facebook() {
|
||||
return $this->user_facebook;
|
||||
}
|
||||
public function get_uk_shirt_size() {
|
||||
return $this->user_shirt_size;
|
||||
}
|
||||
public function get_uk_shirt_size_name() {
|
||||
global $sql;
|
||||
if ($this->user_shirt_size) return $sql->single_variable("select shirt_name from shirt where shirt_id = " . $this->user_shirt_size);
|
||||
else return null;
|
||||
}
|
||||
|
||||
public function get_uk_shirt_note() {
|
||||
return $this->user_shirt_note;
|
||||
}
|
||||
public function get_uk_school_sc_id() {
|
||||
return $this->user_school_sc_id;
|
||||
}
|
||||
public function get_uk_school_name() {
|
||||
global $sql;
|
||||
if ($this->user_school_sc_id) return $sql->single_variable('select sc_name from school where sc_id = ' . $this->user_school_sc_id);
|
||||
else return null;
|
||||
}
|
||||
public function get_uk_school_district() {
|
||||
return $this->user_school_district;
|
||||
}
|
||||
public function get_uk_school_city_scc_id() {
|
||||
return $this->user_school_city_scc_id;
|
||||
}
|
||||
public function get_uk_school_city() {
|
||||
global $sql;
|
||||
if ($this->user_school_city_scc_id) return $sql->single_variable('select scc_city from school_city where scc_id = ' . $this->user_school_city_scc_id);
|
||||
else return null;
|
||||
}
|
||||
public function get_uk_parent_1() {
|
||||
return $this->user_parent_1;
|
||||
}
|
||||
public function get_uk_parent_2() {
|
||||
return $this->user_parent_2;
|
||||
}
|
||||
public function get_uk_region_reg_id() {
|
||||
return $this->user_region;
|
||||
}
|
||||
public function get_uk_region_name() {
|
||||
global $sql;
|
||||
if ($this->user_region) return $sql->single_variable('select reg_name from region where reg_id = ' . $this->user_region);
|
||||
else return null;
|
||||
}
|
||||
public function get_uk_contact() {
|
||||
return $this->user_contact;
|
||||
}
|
||||
public function get_uk_other() {
|
||||
return $this->user_other;
|
||||
}
|
||||
|
||||
|
||||
public function get_uk_presence($_training_id) {
|
||||
global $sql;
|
||||
return $sql->num_of_rows('select * from presence where pr_user_kid_uk_id = ' . $this->get_uk_id() . ' AND pr_training_tr_id = ' . $_training_id);
|
||||
}
|
||||
|
||||
public function get_uk_presence_on_previous_trainings($_trainigs) {
|
||||
//az előző edzések ID-ját kapja paraméterül
|
||||
//megadja, hogy hányszor volt a gyerek
|
||||
global $sql;
|
||||
|
||||
return $sql->single_variable("SELECT count(*) FROM presence WHERE pr_training_tr_id IN (" . implode(',', $_trainigs) . ") AND pr_user_kid_uk_id = " . $this->get_uk_id() . ";");
|
||||
}
|
||||
|
||||
public function set_uk_gender($_gender) {
|
||||
$this->user_gender = $_gender;
|
||||
}
|
||||
@@ -153,6 +221,22 @@ class user_kid extends user_parent {
|
||||
public function get_uk_address() {
|
||||
return $this->user_address;
|
||||
}
|
||||
public function is_logged_in() {
|
||||
//leellenőrzi cookie alapján h be vagyunk-e jelentkezve
|
||||
//JAVÍTVA: adja vissza az adattag igazságértékét
|
||||
return $this->logged_in;
|
||||
}
|
||||
public function set_login($_login) {
|
||||
//bool-t kap paraméterül
|
||||
$this->logged_in = $_login;
|
||||
}
|
||||
|
||||
public function update_login_time($_uk_id = null) {
|
||||
global $sql;
|
||||
//az adott user_id-n updateli a login_time-ot
|
||||
$sql->update_table('user_kid', array('uk_last_login' => date('Y-m-d')), array('uk_id' => (empty($_uk_id)?$this->get_uk_id():$_uk_id)));
|
||||
}
|
||||
|
||||
public function set_user_data_by_id($_uk_id) {
|
||||
global $sql, $user;
|
||||
$user_data_assoc_array = $sql->assoc_array("select * from user_kid where uk_id = " . $_uk_id);
|
||||
@@ -161,7 +245,7 @@ class user_kid extends user_parent {
|
||||
$function_name = "set_" . $field;
|
||||
$this->$function_name($value); //alapadatok beállítása
|
||||
//$this->set_ua_type(2); //kid típus beállítása
|
||||
//$this->set_login(true);
|
||||
$this->set_login(true);
|
||||
}
|
||||
}
|
||||
public static function add_new_parent($_parent_name, $_email, $_facebook, $_phone) {
|
||||
@@ -212,6 +296,22 @@ class user_kid extends user_parent {
|
||||
if (isset($_user_value_array['parent_2_email'])) unset($_user_value_array['parent_2_email']);
|
||||
if (isset($_user_value_array['parent_2_facebook'])) unset($_user_value_array['parent_2_facebook']);
|
||||
if (isset($_user_value_array['parent_2_phone'])) unset($_user_value_array['parent_2_phone']);
|
||||
|
||||
//date handler
|
||||
if (!isset($_user_value_array['uk_first_training']) || $_user_value_array['uk_first_training'] == "") {
|
||||
$_user_value_array['uk_first_training'] = 'null';
|
||||
}
|
||||
if (!isset($_user_value_array['uk_birth_date']) || $_user_value_array['uk_birth_date'] == "") {
|
||||
$_user_value_array['uk_birth_date'] = 'null';
|
||||
}
|
||||
if (!isset($_user_value_array['uk_birth_year']) || $_user_value_array['uk_birth_year'] == "") {
|
||||
$_user_value_array['uk_birth_year'] = 'null';
|
||||
}
|
||||
|
||||
foreach ($_user_value_array as $index => $value) {
|
||||
if ($value == "") $_user_value_array[$index] = 'null';
|
||||
}
|
||||
|
||||
return $sql->insert_into('user_kid', $_user_value_array);
|
||||
}
|
||||
public static function update_user($_user_value_array, $_user_id) {
|
||||
@@ -243,6 +343,29 @@ class user_kid extends user_parent {
|
||||
if (isset($_user_value_array['parent_2_email'])) unset($_user_value_array['parent_2_email']);
|
||||
if (isset($_user_value_array['parent_2_facebook'])) unset($_user_value_array['parent_2_facebook']);
|
||||
if (isset($_user_value_array['parent_2_phone'])) unset($_user_value_array['parent_2_phone']);
|
||||
|
||||
//SCHOOL HANDLER
|
||||
if (isset($_user_value_array['add_school']) && $_user_value_array['add_school'] != "") {
|
||||
$new_school_id = $sql->insert_into('school', array('sc_name' => $_user_value_array['add_school']));
|
||||
$_user_value_array['uk_school_sc_id'] = $new_school_id;
|
||||
}
|
||||
unset($_user_value_array['add_school']);
|
||||
|
||||
//date handler
|
||||
if (!isset($_user_value_array['uk_first_training']) || $_user_value_array['uk_first_training'] == "") {
|
||||
$_user_value_array['uk_first_training'] = 'null';
|
||||
}
|
||||
if (!isset($_user_value_array['uk_birth_date']) || $_user_value_array['uk_birth_date'] == "") {
|
||||
$_user_value_array['uk_birth_date'] = 'null';
|
||||
}
|
||||
if (!isset($_user_value_array['uk_birth_year']) || $_user_value_array['uk_birth_year'] == "") {
|
||||
$_user_value_array['uk_birth_year'] = 'null';
|
||||
}
|
||||
|
||||
foreach ($_user_value_array as $index => $value) {
|
||||
if ($value == "") $_user_value_array[$index] = 'null';
|
||||
}
|
||||
|
||||
//ha nincs bejelölve h aktív akkor nem kapja meg ezt az értéket, manuálisan kell beállítani
|
||||
if (!isset($_user_value_array['uk_is_active'])) $_user_value_array['uk_is_active'] = 0;
|
||||
$sql->update_table('user_kid', $_user_value_array, array('uk_id' => $_user_id));
|
||||
|
||||
@@ -17,6 +17,7 @@ class user_parent {
|
||||
private $up_email;
|
||||
private $up_phone;
|
||||
private $up_facebook;
|
||||
private $logged_in;
|
||||
|
||||
|
||||
public function set_up_id($_id) {
|
||||
@@ -75,6 +76,11 @@ class user_parent {
|
||||
return $this->up_facebook;
|
||||
}
|
||||
|
||||
public function set_login($_login) {
|
||||
//bool-t kap paraméterül
|
||||
$this->logged_in = $_login;
|
||||
}
|
||||
|
||||
public function set_user_data_by_id($_uk_id) {
|
||||
global $sql, $user;
|
||||
$user_data_assoc_array = $sql->assoc_array("select * from user_parent where up_id = " . $_uk_id);
|
||||
@@ -82,6 +88,7 @@ class user_parent {
|
||||
foreach ($user_data_array as $field => $value) {
|
||||
$function_name = "set_" . $field;
|
||||
$this->$function_name($value); //alapadatok beállítása
|
||||
$this->set_login(true);
|
||||
//$this->set_ua_type(3); //parent típus beállítása
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user