diff --git a/_ajax/get_parent_data.php b/_ajax/get_parent_data.php new file mode 100644 index 0000000..c3e5829 --- /dev/null +++ b/_ajax/get_parent_data.php @@ -0,0 +1,23 @@ +assoc_array($parent_query); + +$ret_array = array( + $parent_assoc_array[0]['up_email'], + $parent_assoc_array[0]['up_phone'], + $parent_assoc_array[0]['up_facebook'] + ); + +echo json_encode($ret_array); + +?> \ No newline at end of file diff --git a/_class/class_school.php b/_class/class_school.php new file mode 100644 index 0000000..d3c0a27 --- /dev/null +++ b/_class/class_school.php @@ -0,0 +1,82 @@ +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)); + } + + +} + + +?> \ No newline at end of file diff --git a/_class/class_school_city.php b/_class/class_school_city.php new file mode 100644 index 0000000..0cd6998 --- /dev/null +++ b/_class/class_school_city.php @@ -0,0 +1,69 @@ +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 + } + } + + +} + + +?> \ No newline at end of file diff --git a/_class/class_user_kid.php b/_class/class_user_kid.php index b747bf2..be3153a 100644 --- a/_class/class_user_kid.php +++ b/_class/class_user_kid.php @@ -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'] == "") { diff --git a/_css/default.css b/_css/default.css index 0611727..70eb468 100644 --- a/_css/default.css +++ b/_css/default.css @@ -221,6 +221,10 @@ main #main_content { width: 40%; } +.wide { + width: 80% !important; +} + .list .list_item, .list .name_tag, .list .name_tag_checked { width: 100%; } diff --git a/_css/form.css b/_css/form.css index 23c2b7b..7d05b4d 100644 --- a/_css/form.css +++ b/_css/form.css @@ -67,6 +67,8 @@ textarea { border-radius: 5px; } + + input[type=text]:focus, input[type=email]:focus, input[type=url]:focus, diff --git a/_include/include_cities.php b/_include/include_cities.php index 191cd9d..21a27ba 100644 --- a/_include/include_cities.php +++ b/_include/include_cities.php @@ -14,7 +14,7 @@ else { # VÁROS LISTA - $scc_query = "SELECT * FROM school_city WHERE scc_deleted = 0 ORDER BY scc_city ASC"; + $scc_query = "SELECT * FROM school_city WHERE scc_deleted = 0 ORDER BY - scc_order DESC, scc_city ASC"; $scc_assoc_array = $sql->assoc_array($scc_query); $smarty->assign('scc_assoc_array',$scc_assoc_array); diff --git a/_include/include_create.php b/_include/include_create.php index a709afe..44d96e4 100755 --- a/_include/include_create.php +++ b/_include/include_create.php @@ -5,25 +5,37 @@ switch ($this->get_id()) { case 'member': #ÚJ TAG LÉTREHOZÁSA //pólóméret array - $shirt_size_query = "SELECT * FROM shirt;"; + $shirt_size_query = "SELECT * FROM shirt WHERE shirt_deleted = 0;"; $shirt_size_assoc_array = $sql->assoc_array($shirt_size_query); //szülő array - $parent_query = "SELECT * FROM user_parent;"; + $parent_query = "SELECT * FROM user_parent WHERE up_deleted = 0 ORDER BY up_name ASC;"; $parent_assoc_array = $sql->assoc_array($parent_query); //SCHOOL ARRAY - $school_query = "SELECT * FROM school;"; + $school_query = "SELECT * FROM school WHERE sc_deleted = 0 ORDER BY sc_name ASC;"; $school_assoc_array = $sql->assoc_array($school_query); + $schools = array(); + foreach ($school_assoc_array as $key => $value) { + $new_school = new school(); + $new_school->set_school_data_by_id($value['sc_id']); + $schools[] = $new_school; + } //SCHOOL CITY ARRAY - $school_city_query = "SELECT * FROM school_city;"; + $school_city_query = "SELECT * FROM school_city WHERE scc_deleted = 0 ORDER BY - scc_order DESC, scc_city ASC;"; $school_city_assoc_array = $sql->assoc_array($school_city_query); + $school_cities = array(); + foreach ($school_city_assoc_array as $key => $value) { + $new_scc = new school_city(); + $new_scc->set_school_city_data_by_id($value['scc_id']); + $school_cities[] = $new_scc; + } //REGION ARRAY - $region_query = "SELECT * FROM region;"; + $region_query = "SELECT * FROM region WHERE reg_deleted = 0 ORDER BY reg_name ASC;"; $region_assoc_array = $sql->assoc_array($region_query); $smarty->assign('region_assoc_array', $region_assoc_array); $smarty->assign('shirt_size_assoc_array', $shirt_size_assoc_array); - $smarty->assign('school_assoc_array', $school_assoc_array); - $smarty->assign('school_city_assoc_array', $school_city_assoc_array); + $smarty->assign('school_assoc_array', $schools); + $smarty->assign('school_city_assoc_array', $school_cities); $smarty->assign('parent_assoc_array', $parent_assoc_array); $smarty->assign('today', date("Y-m-d")); @@ -77,6 +89,16 @@ switch ($this->get_id()) { break; case 'school': # SCHOOL létrehozása + //SCHOOL CITY ARRAY + $school_city_query = "SELECT * FROM school_city WHERE scc_deleted = 0 ORDER BY - scc_order DESC, scc_city ASC;"; + $school_city_assoc_array = $sql->assoc_array($school_city_query); + $school_cities = array(); + foreach ($school_city_assoc_array as $key => $value) { + $new_scc = new school_city(); + $new_scc->set_school_city_data_by_id($value['scc_id']); + $school_cities[] = $new_scc; + } + $smarty->assign('school_cities',$school_cities); $smarty->display('school_create.tpl'); break; default: diff --git a/_include/include_delete_city.php b/_include/include_delete_city.php index 0157f32..682d691 100644 --- a/_include/include_delete_city.php +++ b/_include/include_delete_city.php @@ -5,10 +5,17 @@ if ($this->is_id()) { //$sql->execute_query($delete_query); //akiknek ez a city_id van beállítva, azoknál null-ra állítjuk - $school_city_query = "SELECT uk_id FROM user_kid WHERE uk_school_city_scc_id = " . $this->get_id(); + $school_city_query = "SELECT uk_id FROM user_kid WHERE uk_address_scc_id = " . $this->get_id(); $school_city_assoc_array = $sql->assoc_array($school_city_query); foreach ($school_city_assoc_array as $uk_id) { - $sql->update_table('user_kid', array('uk_school_city_scc_id' => 'null'), array('uk_id' => $uk_id['uk_id'])); + $sql->update_table('user_kid', array('uk_address_scc_id' => 'null'), array('uk_id' => $uk_id['uk_id'])); + } + + //amelyik sulinak ez a city_id van beállítva, azoknál null-ra állítjuk + $school_city_query = "SELECT sc_id FROM school WHERE sc_school_city_scc_id = " . $this->get_id(); + $school_city_assoc_array = $sql->assoc_array($school_city_query); + foreach ($school_city_assoc_array as $sc_id) { + $sql->update_table('school', array('sc_school_city_scc_id' => 'null'), array('sc_id' => $sc_id['sc_id'])); } $sql->update_table('school_city', array('scc_deleted' => 1), array('scc_id' => $this->get_id())); diff --git a/_include/include_members.php b/_include/include_members.php index 2e52739..0f29266 100755 --- a/_include/include_members.php +++ b/_include/include_members.php @@ -16,15 +16,27 @@ if ($this->is_id()) { //SCHOOL ARRAY $school_query = "SELECT * FROM school WHERE sc_deleted = 0 ORDER BY sc_name ASC;"; $school_assoc_array = $sql->assoc_array($school_query); + $schools = array(); + foreach ($school_assoc_array as $key => $value) { + $new_school = new school(); + $new_school->set_school_data_by_id($value['sc_id']); + $schools[] = $new_school; + } //SCHOOL CITY ARRAY - $school_city_query = "SELECT * FROM school_city WHERE scc_deleted = 0 ORDER BY scc_city ASC;"; + $school_city_query = "SELECT * FROM school_city WHERE scc_deleted = 0 ORDER BY - scc_order DESC, scc_city ASC;"; $school_city_assoc_array = $sql->assoc_array($school_city_query); + $school_cities = array(); + foreach ($school_city_assoc_array as $key => $value) { + $new_scc = new school_city(); + $new_scc->set_school_city_data_by_id($value['scc_id']); + $school_cities[] = $new_scc; + } //REGION ARRAY $region_query = "SELECT * FROM region WHERE reg_deleted = 0 ORDER BY reg_name ASC;"; $region_assoc_array = $sql->assoc_array($region_query); //smarty thingz - $smarty->assign('school_assoc_array', $school_assoc_array); - $smarty->assign('school_city_assoc_array', $school_city_assoc_array); + $smarty->assign('school_assoc_array', $schools); + $smarty->assign('school_city_assoc_array', $school_cities); $smarty->assign('region_assoc_array', $region_assoc_array); $smarty->assign('user_data', $user_data_assoc_array[0]); $smarty->assign('shirt_size_assoc_array', $shirt_size_assoc_array); diff --git a/_include/include_overview.php b/_include/include_overview.php index f9ae924..33f64f6 100644 --- a/_include/include_overview.php +++ b/_include/include_overview.php @@ -22,6 +22,8 @@ else { } + + //todo: object $smarty->display('user_overview.tpl'); diff --git a/_include/include_schools.php b/_include/include_schools.php index 3a51919..a76aa73 100644 --- a/_include/include_schools.php +++ b/_include/include_schools.php @@ -7,6 +7,24 @@ if ($this->is_id()) { # ISKOLA SZERKESZTÉSE + $new_school = new school(); + $new_school->set_school_data_by_id($this->get_id()); + + //SCC LIST + $school_city_query = "SELECT scc_id FROM school_city WHERE scc_deleted = 0 ORDER BY - scc_order DESC, scc_city ASC;"; + $school_city_assoc_array = $sql->assoc_array($school_city_query); + $school_cities = array(); + foreach ($school_city_assoc_array as $key => $value) { + $new_scc = new school_city(); + $new_scc->set_school_city_data_by_id($value['scc_id']); + $school_cities[] = $new_scc; + } + + //var_dump($school_cities); + + $smarty->assign('school', $new_school); + $smarty->assign('school_cities', $school_cities); + $smarty->display('school_data_edit.tpl'); } @@ -14,10 +32,17 @@ else { # ISKOLA LISTA - $tr_type_query = "SELECT * FROM school WHERE sc_deleted = 0 ORDER BY sc_name ASC"; - $tr_type_assoc_array = $sql->assoc_array($tr_type_query); + $school_query = "SELECT * FROM school WHERE sc_deleted = 0 ORDER BY sc_name ASC"; + $school_assoc_array = $sql->assoc_array($school_query); + $schools = array(); + foreach ($school_assoc_array as $school_array) { + $new_school = new school(); + $new_school->set_school_data_by_id($school_array['sc_id']); + $schools[] = $new_school; + } - $smarty->assign('school_assoc_array',$tr_type_assoc_array); + + $smarty->assign('schools',$schools); $smarty->display('school_list.tpl'); diff --git a/event_handler.php b/event_handler.php index b528d41..fbe3c8b 100644 --- a/event_handler.php +++ b/event_handler.php @@ -188,11 +188,7 @@ if (isset($_POST['action'])) { break; case 'city_create': # település létrehozása - //todo: település object - $new_city_id = $sql->insert_into('school_city', array( - 'scc_city' => $_POST['scc_city'], - ) - ); + $new_city_id = school_city::create_school_city($_POST['scc_city']); log::register('new_city', $new_city_id); header("Location: /admin/cities"); break; @@ -202,7 +198,12 @@ if (isset($_POST['action'])) { foreach ($_POST as $key => $value) { $key_parts = explode('_', $key); $scc_id = $key_parts[1]; - $sql->update_table('school_city', array('scc_city' => $value), array('scc_id' => $scc_id)); + if ($key_parts[0] != "order") { + $sql->update_table('school_city', array('scc_city' => $value), array('scc_id' => $scc_id)); + } + else { + $sql->update_table('school_city', array('scc_order' => ($value==0?'null':$value)), array('scc_id' => $scc_id)); + } } log::register('update_city', 'update all'); header("Location: /admin/cities"); @@ -228,25 +229,17 @@ if (isset($_POST['action'])) { log::register('update_region', 'update all'); header("Location: /admin/regions"); break; - case 'school_create': + case 'school_data_create': # iskola létrehozása - //todo: iskola object - $new_school_id = $sql->insert_into('school', array( - 'sc_name' => $_POST['sc_name'], - ) - ); + $new_school_id = school::create_school($_POST['sc_name'], $_POST['sc_school_city_scc_id']); log::register('new_school', $new_school_id); header("Location: /admin/schools"); break; - case 'school_update': - # school lista updatelése AB-ba + case 'school_data_edit': + # iskola módosítása unset($_POST['action']); - foreach ($_POST as $key => $value) { - $key_parts = explode('_', $key); - $sc_id = $key_parts[1]; - $sql->update_table('school', array('sc_name' => $value), array('sc_id' => $sc_id)); - } - log::register('update_school', 'update all'); + school::update_school($_POST['sc_id'], $_POST['sc_name'], $_POST['sc_school_city_scc_id']); + log::register('update_school', $_POST['sc_id']); header("Location: /admin/schools"); break; default: diff --git a/template/templates/city_list.tpl b/template/templates/city_list.tpl index 8bef338..9e3562d 100644 --- a/template/templates/city_list.tpl +++ b/template/templates/city_list.tpl @@ -8,6 +8,7 @@
+ Törlés
diff --git a/template/templates/school_create.tpl b/template/templates/school_create.tpl index beee860..0c579a5 100644 --- a/template/templates/school_create.tpl +++ b/template/templates/school_create.tpl @@ -1,12 +1,24 @@
- +
+
+ +
+ +
+
+
diff --git a/template/templates/school_data_edit.tpl b/template/templates/school_data_edit.tpl new file mode 100644 index 0000000..2ed1772 --- /dev/null +++ b/template/templates/school_data_edit.tpl @@ -0,0 +1,46 @@ +
+ + + + + +
+ +
+
+ + +
+ +
+ +
+
+ +
+
+ +
+
+ + +
+ + + \ No newline at end of file diff --git a/template/templates/school_list.tpl b/template/templates/school_list.tpl index df25038..d2ad663 100644 --- a/template/templates/school_list.tpl +++ b/template/templates/school_list.tpl @@ -1,23 +1,19 @@ -
-
- - - {foreach $school_assoc_array as $school} -
-
- - Törlés -
-
+
- - {/foreach} - + + \ No newline at end of file diff --git a/template/templates/user_data_create.tpl b/template/templates/user_data_create.tpl index 65aac63..088bb39 100644 --- a/template/templates/user_data_create.tpl +++ b/template/templates/user_data_create.tpl @@ -2,28 +2,28 @@
- +
- +
- +
- +
- Nem: + Nem:
@@ -35,28 +35,42 @@
- +
- +
- -
+ +
+ +
- +
+
+ +
+
+
- Kéz: + Kéz:
@@ -69,46 +83,47 @@
- +
- +
- +
- +
- +
-
- +
+
@@ -116,14 +131,10 @@
-
- -
-
- +
+
+ +
+
- +
- +
- +
- +
diff --git a/template/templates/user_data_edit.tpl b/template/templates/user_data_edit.tpl index ed66124..4174425 100755 --- a/template/templates/user_data_edit.tpl +++ b/template/templates/user_data_edit.tpl @@ -8,28 +8,28 @@
- +
- +
- +
- +
- Nem: + Nem:
@@ -41,28 +41,41 @@
- +
- +
- -
+ +
+ +
- +
+
+ +
+
- Kéz: + Kéz:
@@ -75,22 +88,22 @@
- +
- +
- +
- +
- +
-
- +
+
-
- +
+
@@ -143,13 +157,9 @@
-
- -
-
- +
+
- +
-
- +
+
-
- +
+
-
- +
+
@@ -218,17 +232,17 @@
-
+
-
+
-
+
@@ -268,8 +282,10 @@ else $(".add_parent_1_block").hide(); if ($("#uk_parent_2").val() == 'null') $(".add_parent_2_block").show(); else $(".add_parent_2_block").hide(); - if ($("#uk_school_sc_id").val() == 'null') $(".add_school_block").show(); - else $(".add_school_block").hide(); + if ($("#uk_school_sc_id").val() == 'null') $(".add_school").show(); + else $(".add_school").hide(); + $("#uk_parent_1").trigger("change"); + $("#uk_parent_2").trigger("change"); }); $('#uk_parent_1').change(function() { @@ -281,7 +297,53 @@ }); $('#uk_school_sc_id').change(function() { - $(".add_school_block").toggle(this.value == 'null'); + $(".add_school").toggle(this.value == 'null'); + }); + + + $("#uk_parent_1").change(function(){ + $.post("/_ajax/get_parent_data.php", + { + parent_id: $("#uk_parent_1").val(), + parent_number: 1 + }, + function(data, status){ + if (!data) { + $("#parent_1_phone").val(''); + $("#parent_1_email").val(''); + $("#parent_1_facebook").val(''); + } + else { + var pdata = JSON.parse(data); + $("#parent_1_phone").val(pdata[1]); + $("#parent_1_email").val(pdata[0]); + $("#parent_1_facebook").val(pdata[2]); + + } + }); + }); + + + $("#uk_parent_2").change(function(){ + $.post("/_ajax/get_parent_data.php", + { + parent_id: $("#uk_parent_2").val(), + parent_number: 2 + }, + function(data, status){ + if (!data) { + $("#parent_2_phone").val(''); + $("#parent_2_email").val(''); + $("#parent_2_facebook").val(''); + } + else { + var pdata = JSON.parse(data); + $("#parent_2_phone").val(pdata[1]); + $("#parent_2_email").val(pdata[0]); + $("#parent_2_facebook").val(pdata[2]); + + } + }); }); \ No newline at end of file diff --git a/template/templates/user_overview.tpl b/template/templates/user_overview.tpl index 5d04b2a..6e8dc94 100644 --- a/template/templates/user_overview.tpl +++ b/template/templates/user_overview.tpl @@ -39,14 +39,27 @@ {/if}
+
+ +
+ {if $user_login->get_uk_beforehand()} + {$user_login->get_uk_beforehand()} + {else} +   + {/if} +
+
- {if $user_login->get_uk_address()} - {$user_login->get_uk_address()} + {if $user_login->get_uk_address_scc_id()} + {$user_login->get_uk_address_scc_id()} {else}   {/if} @@ -123,8 +136,8 @@ Iskola neve:
- {if $user_login->get_uk_school_name()} - {$user_login->get_uk_school_name()} + {if $user_login->get_uk_school()} + {$user_login->get_uk_school()->get_sc_name()} {else}   {/if} @@ -136,21 +149,12 @@ Iskola település:
- {if $user_login->get_uk_school_city()} - {$user_login->get_uk_school_city()} - {else} -   - {/if} -
-
-
- -
- {if $user_login->get_uk_school_district()} - {$user_login->get_uk_school_district()} + {if $user_login->get_uk_school()} + {if $user_login->get_uk_school()->get_sc_school_city()} + {$user_login->get_uk_school()->get_sc_school_city()->get_scc_city()} + {else} +   + {/if} {else}   {/if} @@ -169,6 +173,19 @@ {/if}
+
+ +
+ {if $user_login->get_uk_age_category()} + {$user_login->get_uk_age_category()} + {else} +   + {/if} +
+