251 lines
9.1 KiB
PHP
251 lines
9.1 KiB
PHP
<?php
|
|
/*
|
|
USER_KID osztály
|
|
GYEREKEK osztálya, a USER_PARENT osztályból öröklődik
|
|
*/
|
|
class user_kid extends user_parent {
|
|
private $user_id;
|
|
private $user_name;
|
|
private $user_is_active;
|
|
private $user_last_name;
|
|
private $user_first_name;
|
|
private $user_password;
|
|
private $user_email;
|
|
private $user_last_login;
|
|
private $user_gender;
|
|
private $user_address;
|
|
private $user_birth_date;
|
|
private $user_birth_year;
|
|
private $user_first_training;
|
|
private $user_hand;
|
|
private $user_last_modified;
|
|
private $logged_in;
|
|
private $user_type;
|
|
private $user_shirt_size;
|
|
private $user_school_sc_id;
|
|
private $user_school_district;
|
|
private $user_school_city_scc_id;
|
|
private $user_parent_1;
|
|
private $user_parent_2;
|
|
private $user_phone;
|
|
private $user_facebook;
|
|
public function set_uk_id($_uid) {
|
|
$this->user_id = $_uid;
|
|
}
|
|
public function set_uk_name($_uname) {
|
|
$this->user_name = $_uname;
|
|
}
|
|
public function set_uk_is_active($_active) {
|
|
$this->user_is_active = $_active;
|
|
}
|
|
public function set_uk_password($_u_pass) {
|
|
$this->user_password = $_u_pass;
|
|
}
|
|
public function set_uk_email($_u_email) {
|
|
$this->user_email = $_u_email;
|
|
}
|
|
public function set_uk_phone($_u_phone) {
|
|
$this->user_phone = $_u_phone;
|
|
}
|
|
public function set_uk_facebook($_facebook) {
|
|
$this->user_facebook = $_facebook;
|
|
}
|
|
public function set_uk_last_login($_u_last_login) {
|
|
$this->user_last_login = $_u_last_login;
|
|
}
|
|
public function set_uk_shirt_size_ss_id($_shirt_size) {
|
|
$this->shirt_size = $_shirt_size;
|
|
}
|
|
public function set_uk_school_sc_id($_school) {
|
|
$this->user_school_sc_id = $_school;
|
|
}
|
|
public function set_uk_school_district($_district) {
|
|
$this->user_school_district = $_district;
|
|
}
|
|
public function set_uk_school_city_scc_id($_city_id) {
|
|
$this->user_school_city_scc_id = $_city_id;
|
|
}
|
|
public function set_uk_parent_1($_uk_parent_1) {
|
|
$this->user_parent_1 = $_uk_parent_1;
|
|
}
|
|
public function set_uk_parent_2($_uk_parent_2) {
|
|
$this->user_parent_2 = $_uk_parent_2;
|
|
}
|
|
public function get_uk_id() {
|
|
return $this->user_id;
|
|
}
|
|
public function get_uk_name() {
|
|
return $this->user_name;
|
|
}
|
|
public function get_uk_last_name() {
|
|
return $this->user_last_name;
|
|
}
|
|
public function get_uk_first_name() {
|
|
return $this->user_first_name;
|
|
}
|
|
public function get_uk_password() {
|
|
return $this->user_password;
|
|
}
|
|
public function get_uk_email() {
|
|
return $this->user_email;
|
|
}
|
|
public function get_uk_shirt_size() {
|
|
return $this->user_shirt_size;
|
|
}
|
|
public function get_uk_school_sc_id() {
|
|
return $this->user_school_sc_id;
|
|
}
|
|
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_parent_1() {
|
|
return $this->user_parent_1;
|
|
}
|
|
public function get_uk_parent_2() {
|
|
return $this->user_parent_2;
|
|
}
|
|
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 set_uk_gender($_gender) {
|
|
$this->user_gender = $_gender;
|
|
}
|
|
public function get_uk_gender() {
|
|
return $this->user_gender;
|
|
}
|
|
public function set_uk_birth_date($_birth_date) {
|
|
$this->user_birth_date = $_birth_date;
|
|
}
|
|
public function get_uk_birth_date() {
|
|
return $this->user_birth_date;
|
|
}
|
|
public function set_uk_birth_year($_birth_year) {
|
|
$this->user_birth_year = $_birth_year;
|
|
}
|
|
public function get_uk_birth_year() {
|
|
return $this->user_birth_year;
|
|
}
|
|
public function set_uk_first_training($_first_training) {
|
|
$this->user_first_training = $_first_training;
|
|
}
|
|
public function get_uk_first_training() {
|
|
return $this->user_first_training;
|
|
}
|
|
public function set_uk_hand($_hand) {
|
|
$this->user_hand = $_hand;
|
|
}
|
|
public function get_uk_hand() {
|
|
return $this->user_hand;
|
|
}
|
|
public function set_uk_last_modified($_last_modified) {
|
|
$this->user_last_modified = $_last_modified;
|
|
}
|
|
public function get_uk_last_modified() {
|
|
return $this->user_last_modified;
|
|
}
|
|
public function set_uk_address($_address) {
|
|
$this->user_address = $_address;
|
|
}
|
|
public function get_uk_address() {
|
|
return $this->user_address;
|
|
}
|
|
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);
|
|
$user_data_array = $user_data_assoc_array[0];
|
|
foreach ($user_data_array as $field => $value) {
|
|
$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);
|
|
}
|
|
}
|
|
public static function add_new_parent($_parent_name, $_email, $_facebook, $_phone) {
|
|
global $sql;
|
|
//beilleszti AB-ba
|
|
//visszaadja az ID-t
|
|
|
|
return $sql->insert_into('user_parent',
|
|
array(
|
|
'up_name' => $_parent_name,
|
|
'up_email' => $_email,
|
|
'up_facebook' => $_facebook,
|
|
'up_phone' => $_phone
|
|
)
|
|
);
|
|
}
|
|
public static function create_user($_user_value_array) {
|
|
global $sql;
|
|
//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']);
|
|
}
|
|
if (isset($_user_value_array['add_school'])) unset($_user_value_array['add_school']);
|
|
//PARENT_1 HANDLER
|
|
if (isset($_user_value_array['add_parent_1']) && $_user_value_array['add_parent_1'] != "") {
|
|
//lehet, hogy csak a neve van megadva, ezért meg kell vizsgálni, hogy a többi létezik-e; ha nem => null
|
|
//var_dump($_user_value_array);
|
|
//die("hiba");
|
|
$_user_value_array['uk_parent_1'] = self::add_new_parent(
|
|
$_user_value_array['add_parent_1'],
|
|
$_user_value_array['parent_1_email'],
|
|
$_user_value_array['parent_1_facebook'], $_user_value_array['parent_1_phone']);
|
|
}
|
|
if (isset($_user_value_array['add_parent_1'])) unset($_user_value_array['add_parent_1']);
|
|
if (isset($_user_value_array['parent_1_email'])) unset($_user_value_array['parent_1_email']);
|
|
if (isset($_user_value_array['parent_1_facebook'])) unset($_user_value_array['parent_1_facebook']);
|
|
if (isset($_user_value_array['parent_1_phone'])) unset($_user_value_array['parent_1_phone']);
|
|
//PARENT_2 HANDLER
|
|
if (isset($_user_value_array['add_parent_2']) && $_user_value_array['add_parent_2'] != "") {
|
|
$_user_value_array['uk_parent_2'] = self::add_new_parent(
|
|
$_user_value_array['add_parent_2'],
|
|
$_user_value_array['parent_2_email'], $_user_value_array['parent_2_facebook'],
|
|
$_user_value_array['parent_2_phone']);
|
|
}
|
|
if (isset($_user_value_array['add_parent_2'])) unset($_user_value_array['add_parent_2']);
|
|
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']);
|
|
return $sql->insert_into('user_kid', $_user_value_array);
|
|
}
|
|
public static function update_user($_user_value_array, $_user_id) {
|
|
global $sql;
|
|
//a módosítás dátumát updateljük
|
|
$_user_value_array['uk_last_modified'] = date("Y-m-d");
|
|
//PARENT_1 HANDLER
|
|
if (isset($_user_value_array['add_parent_1']) && $_user_value_array['add_parent_1'] != "") {
|
|
//lehet, hogy csak a neve van megadva, ezért meg kell vizsgálni, hogy a többi létezik-e; ha nem => null
|
|
//var_dump($_user_value_array);
|
|
//die("hiba");
|
|
$_user_value_array['uk_parent_1'] = self::add_new_parent(
|
|
$_user_value_array['add_parent_1'],
|
|
$_user_value_array['parent_1_email'],
|
|
$_user_value_array['parent_1_facebook'], $_user_value_array['parent_1_phone']);
|
|
}
|
|
if (isset($_user_value_array['add_parent_1'])) unset($_user_value_array['add_parent_1']);
|
|
if (isset($_user_value_array['parent_1_email'])) unset($_user_value_array['parent_1_email']);
|
|
if (isset($_user_value_array['parent_1_facebook'])) unset($_user_value_array['parent_1_facebook']);
|
|
if (isset($_user_value_array['parent_1_phone'])) unset($_user_value_array['parent_1_phone']);
|
|
//PARENT_2 HANDLER
|
|
if (isset($_user_value_array['add_parent_2']) && $_user_value_array['add_parent_2'] != "") {
|
|
$_user_value_array['uk_parent_2'] = self::add_new_parent(
|
|
$_user_value_array['add_parent_2'],
|
|
$_user_value_array['parent_2_email'], $_user_value_array['parent_2_facebook'],
|
|
$_user_value_array['parent_2_phone']);
|
|
}
|
|
if (isset($_user_value_array['add_parent_2'])) unset($_user_value_array['add_parent_2']);
|
|
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']);
|
|
//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));
|
|
}
|
|
}
|
|
?>
|