20161215
This commit is contained in:
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user