school and school_city class
user edit with parent edit included (ajax) city and school connected overview updated
This commit is contained in:
82
_class/class_school.php
Normal file
82
_class/class_school.php
Normal file
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
|
||||
//ISKOLA OSZTÁLY
|
||||
|
||||
|
||||
class school {
|
||||
private $sc_id;
|
||||
private $sc_name;
|
||||
private $sc_school_city_scc_id; //ID
|
||||
private $sc_school_city; //OBJ
|
||||
private $sc_deleted;
|
||||
|
||||
public function set_sc_id($_id) {
|
||||
$this->sc_id = $_id;
|
||||
}
|
||||
|
||||
public function set_sc_name($_name) {
|
||||
$this->sc_name = $_name;
|
||||
}
|
||||
|
||||
public function set_sc_school_city_scc_id($_school_city_scc_id) {
|
||||
$this->sc_school_city_scc_id = $_school_city_scc_id;
|
||||
}
|
||||
|
||||
public function set_sc_school_city($_school_city) {
|
||||
$this->sc_school_city = $_school_city;
|
||||
}
|
||||
|
||||
public function set_sc_deleted($_deleted) {
|
||||
$this->sc_deleted = $_deleted;
|
||||
}
|
||||
|
||||
public function get_sc_id() {
|
||||
return $this->sc_id;
|
||||
}
|
||||
|
||||
public function get_sc_name() {
|
||||
return $this->sc_name;
|
||||
}
|
||||
|
||||
public function get_sc_school_city_scc_id() {
|
||||
return $this->sc_school_city_scc_id;
|
||||
}
|
||||
|
||||
public function get_sc_school_city() {
|
||||
return $this->sc_school_city;
|
||||
}
|
||||
|
||||
public function get_sc_deleted() {
|
||||
return $this->sc_deleted;
|
||||
}
|
||||
|
||||
public function set_school_data_by_id($_sc_id) {
|
||||
global $sql, $school;
|
||||
$school_data_assoc_array = $sql->assoc_array("select * from school where sc_id = " . $_sc_id);
|
||||
$school_data_array = $school_data_assoc_array[0];
|
||||
foreach ($school_data_array as $field => $value) {
|
||||
$function_name = "set_" . $field;
|
||||
$this->$function_name($value); //alapadatok beállítása
|
||||
if ($field == 'sc_school_city_scc_id' && !empty($value)) {
|
||||
$sc_city = new school_city();
|
||||
$sc_city->set_school_city_data_by_id($value);
|
||||
$this->set_sc_school_city($sc_city);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function create_school($_sc_name, $_scc_id) {
|
||||
global $sql;
|
||||
return $sql->insert_into('school', array('sc_name' => $_sc_name, 'sc_school_city_scc_id' => $_scc_id));
|
||||
}
|
||||
|
||||
public static function update_school($_sc_id, $_sc_name, $_scc_id) {
|
||||
global $sql;
|
||||
$sql->update_table('school', array('sc_name' => $_sc_name, 'sc_school_city_scc_id' => $_scc_id), array('sc_id' => $_sc_id));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
69
_class/class_school_city.php
Normal file
69
_class/class_school_city.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
//ISKOLA-VÁROS OSZTÁLY
|
||||
|
||||
|
||||
class school_city {
|
||||
private $scc_id;
|
||||
private $scc_city;
|
||||
private $scc_order;
|
||||
private $scc_deleted;
|
||||
|
||||
public function set_scc_id($_id) {
|
||||
$this->scc_id = $_id;
|
||||
}
|
||||
|
||||
public function set_scc_city($_city) {
|
||||
$this->scc_city = $_city;
|
||||
}
|
||||
|
||||
public function set_scc_order($_order) {
|
||||
$this->scc_order = $_order;
|
||||
}
|
||||
|
||||
public function set_scc_deleted($_deleted) {
|
||||
$this->scc_deleted = $_deleted;
|
||||
}
|
||||
|
||||
public function get_scc_id() {
|
||||
return $this->scc_id;
|
||||
}
|
||||
|
||||
public function get_scc_city() {
|
||||
return $this->scc_city;
|
||||
}
|
||||
|
||||
public function get_scc_order() {
|
||||
return $this->scc_order;
|
||||
}
|
||||
|
||||
public function get_scc_deleted() {
|
||||
return $this->scc_deleted;
|
||||
}
|
||||
|
||||
public static function create_school_city($_scc_city) {
|
||||
global $sql;
|
||||
return $sql->insert_into('school_city', array('scc_city' => $_scc_city));
|
||||
}
|
||||
|
||||
public static function update_school_city($_scc_id, $_scc_city, $_scc_order) {
|
||||
global $sql;
|
||||
$sql->update_table('school_city', array('scc_city' => $_scc_city, 'scc_order' => $_scc_order), array('scc_id' => $_scc_id));
|
||||
}
|
||||
|
||||
|
||||
public function set_school_city_data_by_id($_scc_id) {
|
||||
global $sql, $school_city;
|
||||
$school_city_data_assoc_array = $sql->assoc_array("select * from school_city where scc_id = " . $_scc_id);
|
||||
$school_city_data_array = $school_city_data_assoc_array[0];
|
||||
foreach ($school_city_data_array as $field => $value) {
|
||||
$function_city = "set_" . $field;
|
||||
$this->$function_city($value); //alapadatok beállítása
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
@@ -13,24 +13,25 @@ class user_kid extends user_parent {
|
||||
private $user_email;
|
||||
private $user_last_login;
|
||||
private $user_gender;
|
||||
private $user_address;
|
||||
private $user_address_scc_id;
|
||||
private $user_birth_date;
|
||||
private $user_birth_year;
|
||||
private $user_first_training;
|
||||
private $user_beforehand;
|
||||
private $user_hand;
|
||||
private $user_last_modified;
|
||||
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;
|
||||
private $user_school_sc_id; //SCHOOL ID
|
||||
private $user_school; //SCHOOL OBJ
|
||||
private $user_parent_1;
|
||||
private $user_parent_2;
|
||||
private $user_phone;
|
||||
private $user_facebook;
|
||||
private $user_region;
|
||||
private $user_ago_category;
|
||||
private $user_contact;
|
||||
private $user_other;
|
||||
private $user_deleted;
|
||||
@@ -68,12 +69,6 @@ class user_kid extends user_parent {
|
||||
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;
|
||||
}
|
||||
@@ -137,12 +132,6 @@ class user_kid extends user_parent {
|
||||
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);
|
||||
@@ -222,11 +211,29 @@ class user_kid extends user_parent {
|
||||
public function get_uk_last_modified() {
|
||||
return $this->user_last_modified;
|
||||
}
|
||||
public function set_uk_address($_address) {
|
||||
$this->user_address = $_address;
|
||||
public function set_uk_address_scc_id($_address) {
|
||||
$this->user_address_scc_id = $_address;
|
||||
}
|
||||
public function get_uk_address() {
|
||||
return $this->user_address;
|
||||
public function get_uk_address_scc_id() {
|
||||
return $this->user_address_scc_id;
|
||||
}
|
||||
public function set_uk_beforehand($_beforehand) {
|
||||
$this->user_beforehand = $_beforehand;
|
||||
}
|
||||
public function get_uk_beforehand() {
|
||||
return $this->user_beforehand;
|
||||
}
|
||||
public function set_uk_age_category($_age_category) {
|
||||
$this->user_age_category = $_age_category;
|
||||
}
|
||||
public function get_uk_age_category() {
|
||||
return $this->user_age_category;
|
||||
}
|
||||
public function set_uk_school($_school) {
|
||||
$this->user_school = $_school;
|
||||
}
|
||||
public function get_uk_school() {
|
||||
return $this->user_school;
|
||||
}
|
||||
public function is_logged_in() {
|
||||
//leellenőrzi cookie alapján h be vagyunk-e jelentkezve
|
||||
@@ -251,14 +258,23 @@ class user_kid extends user_parent {
|
||||
foreach ($user_data_array as $field => $value) {
|
||||
$function_name = "set_" . $field;
|
||||
$this->$function_name($value); //alapadatok beállítása
|
||||
if ($field == 'uk_school_sc_id' && !empty($value)) {
|
||||
$school = new school();
|
||||
$school->set_school_data_by_id($value);
|
||||
$this->set_uk_school($school);
|
||||
}
|
||||
//$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) {
|
||||
global $sql;
|
||||
//beilleszti AB-ba
|
||||
//visszaadja az ID-t
|
||||
|
||||
if ($_email == '') $_email = 'null';
|
||||
if ($_facebook == '') $_facebook = 'null';
|
||||
if ($_phone == '') $_phone = 'null';
|
||||
|
||||
return $sql->insert_into('user_parent',
|
||||
array(
|
||||
@@ -273,11 +289,15 @@ class user_kid extends user_parent {
|
||||
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']));
|
||||
//megnézzük adott-e az iskolához települést, ha nem, akkor null-ra állítjuk
|
||||
//if (isset($_user_value_array['uk_school_city_scc_id']) && $_user_value_array['uk_school_city_scc_id'] == '') $_user_value_array['uk_school_city_scc_id'] = 'null';
|
||||
//$new_school_id = $sql->insert_into('school', array('sc_name' => $_user_value_array['add_school'], 'sc_school_city_scc_id' => $_user_value_array['uk_school_city_scc_id']));
|
||||
$new_school_id = school::create_school($_user_value_array['add_school'], $_user_value_array['uk_school_city_scc_id']);
|
||||
log::register('new_school', $new_school_id);
|
||||
$_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']);
|
||||
unset($_user_value_array['add_school']);
|
||||
unset($_user_value_array['uk_school_city_scc_id']);
|
||||
//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
|
||||
@@ -286,7 +306,8 @@ class user_kid extends user_parent {
|
||||
$_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']);
|
||||
$_user_value_array['parent_1_facebook'], $_user_value_array['parent_1_phone']);
|
||||
log::register('new_parent', $_user_value_array['uk_parent_1']);
|
||||
}
|
||||
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']);
|
||||
@@ -298,6 +319,7 @@ class user_kid extends user_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']);
|
||||
log::register('new_parent', $_user_value_array['uk_parent_2']);
|
||||
}
|
||||
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']);
|
||||
@@ -327,13 +349,19 @@ class user_kid extends user_parent {
|
||||
$_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']);
|
||||
$_user_value_array['parent_1_facebook'], $_user_value_array['parent_1_phone']);
|
||||
log::register('new_parent', $_user_value_array['uk_parent_1']);
|
||||
}
|
||||
else {
|
||||
//meglévő szülő updatelése
|
||||
user_parent::update_parent(array(
|
||||
'up_email' => $_user_value_array['parent_1_email'],
|
||||
'up_facebook' => $_user_value_array['parent_1_facebook'],
|
||||
'up_phone' => $_user_value_array['parent_1_phone']), $_user_value_array['uk_parent_1']);
|
||||
|
||||
}
|
||||
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']);
|
||||
@@ -345,7 +373,17 @@ class user_kid extends user_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']);
|
||||
log::register('new_parent', $_user_value_array['uk_parent_2']);
|
||||
}
|
||||
else {
|
||||
//meglévő szülő updatelése
|
||||
//var_dump($_user_value_array['uk_parent_2']);
|
||||
user_parent::update_parent(array(
|
||||
'up_email' => $_user_value_array['parent_2_email'],
|
||||
'up_facebook' => $_user_value_array['parent_2_facebook'],
|
||||
'up_phone' => $_user_value_array['parent_2_phone']), $_user_value_array['uk_parent_2']);
|
||||
|
||||
}
|
||||
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']);
|
||||
@@ -353,10 +391,14 @@ class user_kid extends user_parent {
|
||||
|
||||
//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']));
|
||||
//$new_school_id = $sql->insert_into('school', array('sc_name' => $_user_value_array['add_school'], 'sc_school_city_scc_id' => $_user_value_array['uk_school_city_scc_id']));
|
||||
$new_school_id = school::create_school($_user_value_array['add_school'], $_user_value_array['uk_school_city_scc_id']);
|
||||
log::register('new_school', $new_school_id);
|
||||
$_user_value_array['uk_school_sc_id'] = $new_school_id;
|
||||
}
|
||||
|
||||
unset($_user_value_array['add_school']);
|
||||
unset($_user_value_array['uk_school_city_scc_id']);
|
||||
|
||||
//date handler
|
||||
if (!isset($_user_value_array['uk_first_training']) || $_user_value_array['uk_first_training'] == "") {
|
||||
|
||||
Reference in New Issue
Block a user