From d82abe1dd3bfff21b97fef2adc3c1166452dde19 Mon Sep 17 00:00:00 2001 From: Richard Toth Date: Sat, 10 Apr 2021 18:52:38 +0200 Subject: [PATCH] camps 1 --- _ajax/get_camp_accomodation_list.php | 10 + _ajax/get_camp_contact_data.php | 10 + _ajax/get_camp_kid_data.php | 10 + _ajax/get_camp_shuttle_list.php | 15 + _class/class_camp.php | 336 +++++++++++++ _class/class_camp_accomodation_type.php | 82 ++++ _class/class_camp_apply.php | 307 ++++++++++++ _class/class_camp_contact.php | 327 +++++++++++++ _class/class_camp_contact_type.php | 53 ++ _class/class_camp_kid.php | 516 ++++++++++++++++++++ _class/class_camp_shirt.php | 45 ++ _class/class_camp_shuttle_type.php | 82 ++++ _class/class_camp_type.php | 98 ++++ _class/class_camp_user.php | 197 ++++++++ _class/class_page.php | 85 ++++ _css/camp.css | 118 +++++ _include/include_accept_apply.php | 21 + _include/include_camp_applies.php | 77 +++ _include/include_camp_apply.php | 171 +++++++ _include/include_camp_details.php | 22 + _include/include_camp_information.php | 18 + _include/include_camp_shirt_types.php | 28 ++ _include/include_camp_types.php | 37 ++ _include/include_camps.php | 140 ++++++ _include/include_create.php | 50 ++ _include/include_db_conn.php | 5 + _include/include_delete_apply.php | 23 + _include/include_delete_camp.php | 14 + _include/include_delete_camp_leader.php | 10 + _include/include_delete_camp_shirt.php | 19 + _include/include_delete_camp_type.php | 12 + _include/include_deny_apply.php | 21 + cegled.sublime-project | 8 + common.php | 6 +- event_handler.php | 6 + index.php | 2 +- queries/202104_camp.sql | 17 + template/templates/applies.tpl | 108 ++++ template/templates/camp_apply.tpl | 383 +++++++++++++++ template/templates/camp_create.tpl | 71 +++ template/templates/camp_data_update.tpl | 195 ++++++++ template/templates/camp_details.tpl | 65 +++ template/templates/camp_list.tpl | 95 ++++ template/templates/camp_shirt_create.tpl | 17 + template/templates/camp_shirt_data_edit.tpl | 23 + template/templates/camp_shirt_list.tpl | 18 + template/templates/camp_type_create.tpl | 17 + template/templates/camp_type_list.tpl | 23 + template/templates/login.tpl | 1 - 49 files changed, 4009 insertions(+), 5 deletions(-) create mode 100644 _ajax/get_camp_accomodation_list.php create mode 100644 _ajax/get_camp_contact_data.php create mode 100644 _ajax/get_camp_kid_data.php create mode 100644 _ajax/get_camp_shuttle_list.php create mode 100644 _class/class_camp.php create mode 100644 _class/class_camp_accomodation_type.php create mode 100644 _class/class_camp_apply.php create mode 100644 _class/class_camp_contact.php create mode 100644 _class/class_camp_contact_type.php create mode 100644 _class/class_camp_kid.php create mode 100644 _class/class_camp_shirt.php create mode 100644 _class/class_camp_shuttle_type.php create mode 100644 _class/class_camp_type.php create mode 100644 _class/class_camp_user.php create mode 100644 _css/camp.css create mode 100644 _include/include_accept_apply.php create mode 100644 _include/include_camp_applies.php create mode 100644 _include/include_camp_apply.php create mode 100644 _include/include_camp_details.php create mode 100644 _include/include_camp_information.php create mode 100644 _include/include_camp_shirt_types.php create mode 100644 _include/include_camp_types.php create mode 100644 _include/include_camps.php create mode 100644 _include/include_db_conn.php create mode 100644 _include/include_delete_apply.php create mode 100644 _include/include_delete_camp.php create mode 100644 _include/include_delete_camp_leader.php create mode 100644 _include/include_delete_camp_shirt.php create mode 100644 _include/include_delete_camp_type.php create mode 100644 _include/include_deny_apply.php create mode 100644 cegled.sublime-project create mode 100644 queries/202104_camp.sql create mode 100644 template/templates/applies.tpl create mode 100644 template/templates/camp_apply.tpl create mode 100644 template/templates/camp_create.tpl create mode 100644 template/templates/camp_data_update.tpl create mode 100644 template/templates/camp_details.tpl create mode 100644 template/templates/camp_list.tpl create mode 100644 template/templates/camp_shirt_create.tpl create mode 100644 template/templates/camp_shirt_data_edit.tpl create mode 100644 template/templates/camp_shirt_list.tpl create mode 100644 template/templates/camp_type_create.tpl create mode 100644 template/templates/camp_type_list.tpl diff --git a/_ajax/get_camp_accomodation_list.php b/_ajax/get_camp_accomodation_list.php new file mode 100644 index 0000000..5207c93 --- /dev/null +++ b/_ajax/get_camp_accomodation_list.php @@ -0,0 +1,10 @@ +assoc_array("SELECT * FROM camp_accomodation JOIN camp_accomodation_type on cat_id = ca_accomodation_id WHERE ca_camp_id = " . $_POST['camp_id']); + +echo json_encode($accom_assoc_array); +?> diff --git a/_ajax/get_camp_contact_data.php b/_ajax/get_camp_contact_data.php new file mode 100644 index 0000000..02d8ec4 --- /dev/null +++ b/_ajax/get_camp_contact_data.php @@ -0,0 +1,10 @@ +assoc_array("SELECT * FROM camp_contact WHERE cc_id = " . $_POST['camp_contact_id']); + +echo json_encode($cc_assoc_array); +?> diff --git a/_ajax/get_camp_kid_data.php b/_ajax/get_camp_kid_data.php new file mode 100644 index 0000000..8539d31 --- /dev/null +++ b/_ajax/get_camp_kid_data.php @@ -0,0 +1,10 @@ +assoc_array("SELECT * FROM camp_kid WHERE ck_id = " . $_POST['camp_kid_id']); + +echo json_encode($ck_assoc_array); +?> diff --git a/_ajax/get_camp_shuttle_list.php b/_ajax/get_camp_shuttle_list.php new file mode 100644 index 0000000..d4727da --- /dev/null +++ b/_ajax/get_camp_shuttle_list.php @@ -0,0 +1,15 @@ +assoc_array("SELECT * FROM camp_shuttle JOIN camp_shuttle_type on cst_id = cs_shuttle_id WHERE cs_camp_id = " . $_POST['camp_id']); + +$shuttle_array = array(); +foreach ($shuttle_assoc_array as $shuttle) { + $shuttle_array[$shuttle['cst_id']] = $shuttle['cst_name']; +} + +echo json_encode($shuttle_assoc_array); +?> diff --git a/_class/class_camp.php b/_class/class_camp.php new file mode 100644 index 0000000..599a56a --- /dev/null +++ b/_class/class_camp.php @@ -0,0 +1,336 @@ +camp_id; + } + + /** + * Sets the value of camp_id. + * + * @param mixed $camp_id the camp id + * + * @return self + */ + private function set_camp_id($camp_id) + { + $this->camp_id = $camp_id; + + return $this; + } + + /** + * Gets the value of camp_city. + * + * @return mixed + */ + public function get_camp_city() + { + return $this->camp_city; + } + + /** + * Sets the value of camp_city. + * + * @param mixed $camp_city the camp city + * + * @return self + */ + private function set_camp_city($camp_city) + { + $this->camp_city = $camp_city; + + return $this; + } + + /** + * Gets the value of camp_from. + * + * @return mixed + */ + public function get_camp_from() + { + return $this->camp_from; + } + + public function get_camp_from_day() { + $day = date("d", strtotime($this->camp_from)); + if (substr($day, 0, 1) == '0') return substr($day, 1, 1); + return date("d", strtotime($this->camp_from)); + } + + public function get_camp_to_day() { + $day = date("d", strtotime($this->camp_to)); + if (substr($day, 0, 1) == '0') return substr($day, 1, 1); + return date("d", strtotime($this->camp_to)); + } + + + /** + * Sets the value of camp_from. + * + * @param mixed $camp_from the camp from + * + * @return self + */ + private function set_camp_from($camp_from) + { + $this->camp_from = $camp_from; + + return $this; + } + + /** + * Gets the value of camp_to. + * + * @return mixed + */ + public function get_camp_to() + { + return $this->camp_to; + } + + /** + * Sets the value of camp_to. + * + * @param mixed $camp_to the camp to + * + * @return self + */ + private function set_camp_to($camp_to) + { + $this->camp_to = $camp_to; + + return $this; + } + + /** + * Gets the value of camp_camp_type_ct_id. + * + * @return mixed + */ + public function get_camp_camp_type_ct_id() + { + return $this->camp_camp_type_ct_id; + } + + /** + * Sets the value of camp_camp_type_ct_id. + * + * @param mixed $camp_camp_type_ct_id the camp camp type ct id + * + * @return self + */ + private function set_camp_camp_type_ct_id($camp_camp_type_ct_id) + { + $this->camp_camp_type_ct_id = $camp_camp_type_ct_id; + + return $this; + } + + /** + * Gets the value of camp_type. + * + * @return mixed + */ + public function get_camp_type() + { + return $this->camp_type; + } + + /** + * Sets the value of camp_type. + * + * @param mixed $camp_type the camp type + * + * @return self + */ + private function set_camp_type($camp_type) + { + $this->camp_type = $camp_type; + + return $this; + } + + + public function get_camp_deleted() { + return $this->camp_deleted; + } + + private function set_camp_deleted($_item) { + $this->camp_deleted = $_item; + + return $this; + } + + public function get_camp_is_open() { + return $this->camp_is_open; + } + + private function set_camp_is_open($_item) { + $this->camp_is_open = $_item; + + return $this; + } + + public function get_camp_leader() { + return $this->camp_leader; + } + + private function set_camp_leader($_item) { + $this->camp_leader = $_item; + + return $this; + } + + public function get_camp_helpers() { + return $this->camp_helpers; + } + + private function set_camp_helpers($_item) { + $this->camp_helpers = $_item; + + return $this; + } + + public function has_pending_apply() { + global $sql; + return $sql->num_of_rows("select * from camp join camp_apply on capp_camp_id = camp_id where capp_status = 2 AND camp_id = " . $this->get_camp_id()); + } + + public function has_deleted_apply() { + global $sql; + return $sql->num_of_rows("select * from camp join camp_apply on capp_camp_id = camp_id where capp_status = 5 AND camp_id = " . $this->get_camp_id()); + } + + public function get_camp_applies() { + //visszaadja az elfogadott jelentkezéseket ABC sorrendben + global $sql; + $apply_assoc_array = $sql->assoc_array("SELECT * FROM camp_apply JOIN camp_kid ON ck_id = capp_camp_kid_ck_id WHERE capp_status = 3 AND capp_camp_id = " . $this->get_camp_id() . " ORDER BY ck_name ASC;"); + $apply_array = array(); + foreach ($apply_assoc_array as $apply) { + $new_apply = new camp_apply(); + $new_apply->set_capp_data_by_id($apply['capp_id']); + $apply_array[] = $new_apply; + } + return $apply_array; + } + + + public function set_camp_data_by_id($_camp_id) { + global $sql; + $camp_data_assoc_array = $sql->assoc_array("select * from camp where camp_id = " . $_camp_id); + $camp_data_array = $camp_data_assoc_array[0]; + //alapadatok + foreach ($camp_data_array as $field => $value) { + $function_name = "set_" . $field; + $this->$function_name($value); + if ('camp_camp_type_ct_id' == $field) { + $new_ct = new camp_type(); + $new_ct->set_ct_data_by_id($value); + $this->set_camp_type($new_ct); + } + } + + //labdatípusok hozzáadása tömbbe + $shuttle_assoc_array = $sql->assoc_array("SELECT cs_shuttle_id FROM camp_shuttle WHERE cs_camp_id = " . $_camp_id . ";"); + if (!empty($shuttle_assoc_array)) { + foreach ($shuttle_assoc_array as $shuttle_array) { + $this->camp_shuttle[] = $shuttle_array['cs_shuttle_id']; + } + } + + + } + + public static function create_camp($_city, $_from, $_to, $_leader, $_helpers, $_is_open, $_ct_id, $_shuttles, $_accoms) { + global $sql; + + $new_camp_id = $sql->insert_into('camp',array( + 'camp_city' => $_city, + 'camp_from' => $_from, + 'camp_to' => $_to, + 'camp_leader' => $_leader, + 'camp_helpers' => $_helpers, + 'camp_is_open' => $_is_open, + 'camp_camp_type_ct_id' => $_ct_id + )); + + if (!empty($_shuttles)) { + foreach ($_shuttles as $_shuttle_id) { + $sql->insert_into('camp_shuttle', array('cs_camp_id' => $new_camp_id, 'cs_shuttle_id' => $_shuttle_id)); + } + } + + if (!empty($_accoms)) { + foreach ($_accoms as $_accom_id) { + $sql->insert_into('camp_accomodation', array('ca_camp_id' => $new_camp_id, 'ca_accomodation_id' => $_accom_id)); + } + } + + } + + public static function update_camp($_city, $_from, $_to, $_leader, $_helpers, $_is_open, $_ct_id, $_shuttles, $_accoms, $_camp_id) { + global $sql; + + $new_camp_id = $sql->update_table('camp',array( + 'camp_city' => $_city, + 'camp_from' => $_from, + 'camp_to' => $_to, + 'camp_leader' => $_leader, + 'camp_helpers' => $_helpers, + 'camp_is_open' => $_is_open, + 'camp_camp_type_ct_id' => $_ct_id + ), + array( + 'camp_id' => $_camp_id + ) + ); + + //kitöröljük a korábbi shuttle és accom sorokat + $sql->execute_query('DELETE FROM camp_shuttle WHERE cs_camp_id = ' . $_camp_id); + $sql->execute_query('DELETE FROM camp_accomodation WHERE ca_camp_id = ' . $_camp_id); + + if (!empty($_shuttles)) { + foreach ($_shuttles as $_shuttle_id) { + $sql->insert_into('camp_shuttle', array('cs_camp_id' => $_camp_id, 'cs_shuttle_id' => $_shuttle_id)); + } + } + + if (!empty($_accoms)) { + foreach ($_accoms as $_accom_id) { + $sql->insert_into('camp_accomodation', array('ca_camp_id' => $_camp_id, 'ca_accomodation_id' => $_accom_id)); + } + } + + } +} + + +?> diff --git a/_class/class_camp_accomodation_type.php b/_class/class_camp_accomodation_type.php new file mode 100644 index 0000000..a19375c --- /dev/null +++ b/_class/class_camp_accomodation_type.php @@ -0,0 +1,82 @@ +cat_id; + } + + /** + * Sets the value of cat_id. + * + * @param mixed $cat_id the cat id + * + * @return self + */ + private function set_cat_id($cat_id) + { + $this->cat_id = $cat_id; + + return $this; + } + + /** + * Gets the value of cat_name. + * + * @return mixed + */ + public function get_cat_name() + { + return $this->cat_name; + } + + /** + * Sets the value of cat_name. + * + * @param mixed $cat_name the cat name + * + * @return self + */ + private function set_cat_name($cat_name) + { + $this->cat_name = $cat_name; + + return $this; + } + + private function set_cat_deleted($_item) { + $this->cat_deleted = $_item; + } + + public function get_cat_deleted($_item) { + return $this->cat_deleted; + } + + public function set_cat_data_by_id($_cat_id) { + global $sql; + $cat_assoc_array = $sql->assoc_array("select * from camp_accomodation_type where cat_id = " . $_cat_id); + $cat_array = $cat_assoc_array[0]; + //alapadatok + foreach ($cat_array as $field => $value) { + $function_name = "set_" . $field; + $this->$function_name($value); + } + + } +} + + +?> \ No newline at end of file diff --git a/_class/class_camp_apply.php b/_class/class_camp_apply.php new file mode 100644 index 0000000..9d51091 --- /dev/null +++ b/_class/class_camp_apply.php @@ -0,0 +1,307 @@ +capp_id; + } + + /** + * Sets the value of capp_id. + * + * @param mixed $capp_id the capp id + * + * @return self + */ + private function set_capp_id($capp_id) + { + $this->capp_id = $capp_id; + + return $this; + } + + /** + * get_s the value of capp_camp_kid_ck_id. + * + * @return mixed + */ + public function get_capp_camp_kid_ck_id() + { + return $this->capp_camp_kid_ck_id; + } + + /** + * Sets the value of capp_camp_kid_ck_id. + * + * @param mixed $capp_camp_kid_ck_id the capp camp user ck id + * + * @return self + */ + private function set_capp_camp_kid_ck_id($capp_camp_kid_ck_id) + { + $this->capp_camp_kid_ck_id = $capp_camp_kid_ck_id; + + return $this; + } + + /** + * get_s the value of capp_accomodation_type. + * + * @return mixed + */ + public function get_capp_accomodation_type() + { + return $this->capp_accomodation_type; + } + + /** + * Sets the value of capp_accomodation_type. + * + * @param mixed $capp_accomodation_type the capp accomodation type + * + * @return self + */ + private function set_capp_accomodation_type($capp_accomodation_type) + { + $this->capp_accomodation_type = $capp_accomodation_type; + + return $this; + } + + /** + * get_s the value of capp_shuttle_type. + * + * @return mixed + */ + public function get_capp_shuttle_type() + { + return $this->capp_shuttle_type; + } + + /** + * Sets the value of capp_shuttle_type. + * + * @param mixed $capp_shuttle_type the capp shuttle type + * + * @return self + */ + private function set_capp_shuttle_type($capp_shuttle_type) + { + $this->capp_shuttle_type = $capp_shuttle_type; + + return $this; + } + + /** + * get_s the value of capp_date. + * + * @return mixed + */ + public function get_capp_date() + { + return $this->capp_date; + } + + /** + * Sets the value of capp_date. + * + * @param mixed $capp_date the capp date + * + * @return self + */ + private function set_capp_date($capp_date) + { + $this->capp_date = $capp_date; + + return $this; + } + + /** + * get_s the value of capp_status. + * + * @return mixed + */ + public function get_capp_status() + { + return $this->capp_status; + } + + /** + * Sets the value of capp_status. + * + * @param mixed $capp_status the capp status + * + * @return self + */ + public function set_capp_status($capp_status) + { + $this->capp_status = $capp_status; + + return $this; + } + + /** + * get_s the value of capp_accept_date. + * + * @return mixed + */ + public function get_capp_accept_date() + { + return $this->capp_accept_date; + } + + /** + * Sets the value of capp_accept_date. + * + * @param mixed $capp_accept_date the capp accept date + * + * @return self + */ + private function set_capp_accept_date($capp_accept_date) + { + $this->capp_accept_date = $capp_accept_date; + + return $this; + } + + /** + * get_s the value of capp_camp_id. + * + * @return mixed + */ + public function get_capp_camp_id() + { + return $this->capp_camp_id; + } + + /** + * Sets the value of capp_camp_id. + * + * @param mixed $capp_camp_id the capp camp id + * + * @return self + */ + private function set_capp_camp_id($capp_camp_id) + { + $this->capp_camp_id = $capp_camp_id; + + return $this; + } + + //STATIC! + public static function has_responsible_contact($_capp_id) { + global $sql; + return $sql->num_of_rows('SELECT * FROM camp_apply_contact WHERE cac_camp_apply_capp_id = ' . $_capp_id . ' AND cac_is_responsible = 1;'); + } + + public static function apply_response($_apply_id, $_status_id) { + global $sql; + $sql->update_table('camp_apply', array('capp_status' => $_status_id, 'capp_accept_date' => date("Y-m-d H:i:s")), array('capp_id' => $_apply_id)); + } + + public static function has_contact($_capp_id) { + global $sql; + return $sql->num_of_rows('SELECT * FROM camp_apply_contact WHERE cac_camp_apply_capp_id = ' . $_capp_id . ';'); + } + + public function set_capp_data_by_id($_id) { + global $sql; + $capp_data_assoc_array = $sql->assoc_array("select * from camp_apply where capp_id = " . $_id); + $capp_array = $capp_data_assoc_array[0]; + foreach ($capp_array as $field => $value) { + $function_name = "set_" . $field; + $this->$function_name($value); + if ($field == 'capp_camp_kid_ck_id') { + $new_kid = new camp_kid(); + $new_kid->set_ck_data_by_id($value); + $this->$function_name($new_kid); + } + if ($field == 'capp_accomodation_type' && $value !== null) { + $new_cat = new camp_accomodation_type(); + $new_cat->set_cat_data_by_id($value); + $this->$function_name($new_cat); + } + if ($field == 'capp_shuttle_type' && $value !== null) { + $new_cst = new camp_shuttle_type(); + $new_cst->set_cst_data_by_id($value); + $this->$function_name($new_cst); + } + if ($field == 'capp_camp_id') { + $new_camp = new camp(); + $new_camp->set_camp_data_by_id($value); + $this->$function_name($new_camp); + } + } + } + + public function get_responsible_contact() { + global $sql; + $cc_id = $sql->single_variable("SELECT cac_camp_contact_cc_id FROM camp_apply_contact WHERE cac_camp_apply_capp_id = " . $this->get_capp_id() . " AND cac_is_responsible = 1;"); + $cc = new camp_contact(); + $cc->set_cc_data_by_id($cc_id); + return $cc; + } + + //egy létező jelentkezésnél felelős kapcsolattartóra állít valakit + public static function make_contact_responsible($_apply_id, $_cc_id, $_is_responsible = false) { + global $sql; + //TODO: itt majd cac objektumot adjunk át, és akkor nem így kell updatelni hanem primary key alapján + $sql->update_table('camp_apply_contact', + array( + 'cac_is_responsible' => $_is_responsible + ), + array( + 'cac_camp_apply_capp_id' => $_apply_id, + 'cac_camp_contact_cc_id' => $_cc_id + ) + ); + } + + public static function create_camp_apply($_camp_kid, $_status = 1, $_camp_accom = 'null', $_camp_shuttle = 'null', $_camp_date = 'null', $_camp_accept_date = 'null', $_camp = 'null') { + global $sql; + return $sql->insert_into('camp_apply', array( + 'capp_camp_kid_ck_id' => $_camp_kid, + 'capp_accomodation_type' => $_camp_accom, + 'capp_shuttle_type' => $_camp_shuttle, + 'capp_date' => $_camp_date, + 'capp_accept_date' => $_camp_accept_date, + 'capp_status' => $_status, + 'capp_camp_id' => $_camp, + ) + ); + } + + //ezzel nem lehet kid-et updatelni, arra külön function kell + public static function update_camp_apply($_apply_id, $_status = 1, $_camp_accom = 'null', $_camp_shuttle = 'null', $_camp_date = 'null', $_camp_accept_date = 'null', $_camp = 'null') { + global $sql; + $sql->update_table('camp_apply', array( + 'capp_accomodation_type' => $_camp_accom, + 'capp_shuttle_type' => $_camp_shuttle, + 'capp_date' => $_camp_date, + 'capp_accept_date' => $_camp_accept_date, + 'capp_status' => $_status, + 'capp_camp_id' => $_camp, + ), array('capp_id' => $_apply_id)); + } +} + + + +?> diff --git a/_class/class_camp_contact.php b/_class/class_camp_contact.php new file mode 100644 index 0000000..9212a06 --- /dev/null +++ b/_class/class_camp_contact.php @@ -0,0 +1,327 @@ +cc_id; + } + + /** + * Sets the value of cc_id. + * + * @param mixed $cc_id the cc id + * + * @return self + */ + private function set_cc_id($cc_id) + { + $this->cc_id = $cc_id; + + return $this; + } + + /** + * Gets the value of cc_name. + * + * @return mixed + */ + public function get_cc_name() + { + return $this->cc_name; + } + + /** + * Sets the value of cc_name. + * + * @param mixed $cc_name the cc name + * + * @return self + */ + private function set_cc_name($cc_name) + { + $this->cc_name = $cc_name; + + return $this; + } + + /** + * Gets the value of cc_mobile. + * + * @return mixed + */ + public function get_cc_mobile() + { + return $this->cc_mobile; + } + + /** + * Sets the value of cc_mobile. + * + * @param mixed $cc_mobile the cc mobile + * + * @return self + */ + private function set_cc_mobile($cc_mobile) + { + $this->cc_mobile = $cc_mobile; + + return $this; + } + + /** + * Gets the value of cc_email. + * + * @return mixed + */ + public function get_cc_email() + { + return $this->cc_email; + } + + /** + * Sets the value of cc_email. + * + * @param mixed $cc_email the cc email + * + * @return self + */ + private function set_cc_email($cc_email) + { + $this->cc_email = $cc_email; + + return $this; + } + + /** + * Gets the value of cc_facebook. + * + * @return mixed + */ + public function get_cc_facebook() + { + return $this->cc_facebook; + } + + /** + * Sets the value of cc_facebook. + * + * @param mixed $cc_facebook the cc facebook + * + * @return self + */ + private function set_cc_facebook($cc_facebook) + { + $this->cc_facebook = $cc_facebook; + + return $this; + } + + /** + * Gets the value of cc_camp_contact_type_cct_id. + * + * @return mixed + */ + public function get_cc_camp_contact_type_cct_id() + { + return $this->cc_camp_contact_type_cct_id; + } + + /** + * Sets the value of cc_camp_contact_type_cct_id. + * + * @param mixed $cc_camp_contact_type_cct_id the cc camp contact type cct id + * + * @return self + */ + private function set_cc_camp_contact_type_cct_id($cc_camp_contact_type_cct_id) + { + $this->cc_camp_contact_type_cct_id = $cc_camp_contact_type_cct_id; + + return $this; + } + + /** + * Gets the value of cc_camp_contact_type. + * + * @return mixed + */ + public function get_cc_camp_contact_type() + { + return $this->cc_camp_contact_type; + } + + /** + * Sets the value of cc_camp_contact_type. + * + * @param mixed $cc_camp_contact_type the cc camp contact type + * + * @return self + */ + private function set_cc_camp_contact_type($cc_camp_contact_type) + { + $this->cc_camp_contact_type = $cc_camp_contact_type; + + return $this; + } + + /** + * Gets the value of cc_owner_id. + * + * @return mixed + */ + public function get_cc_owner_id() + { + return $this->cc_owner_id; + } + + /** + * Sets the value of cc_owner_id. + * + * @param mixed $cc_owner_id the cc owner id + * + * @return self + */ + private function set_cc_owner_id($cc_owner_id) + { + $this->cc_owner_id = $cc_owner_id; + + return $this; + } + + /** + * Gets the value of cc_owner. + * + * @return mixed + */ + public function get_cc_owner() + { + return $this->cc_owner; + } + + /** + * Sets the value of cc_owner. + * + * @param mixed $cc_owner the cc owner + * + * @return self + */ + private function set_cc_owner($cc_owner) + { + $this->cc_owner = $cc_owner; + + return $this; + } + + /** + * Gets the value of cc_original_id. + * + * @return mixed + */ + public function get_cc_original_id() + { + return $this->cc_original_id; + } + + /** + * Sets the value of cc_original_id. + * + * @param mixed $cc_original_id the cc original id + * + * @return self + */ + private function set_cc_original_id($cc_original_id) + { + $this->cc_original_id = $cc_original_id; + + return $this; + } + + /** + * Gets the value of cc_original. + * + * @return mixed + */ + public function get_cc_original() + { + return $this->cc_original; + } + + /** + * Sets the value of cc_original. + * + * @param mixed $cc_original the cc original + * + * @return self + */ + private function set_cc_original($cc_original) + { + $this->cc_original = $cc_original; + + return $this; + } + + public function set_cc_data_by_id($_id) { + global $sql; + $cc_data_assoc_array = $sql->assoc_array("select * from camp_contact where cc_id = " . $_id); + $cc_array = $cc_data_assoc_array[0]; + foreach ($cc_array as $field => $value) { + $function_name = "set_" . $field; + $this->$function_name($value); + if ($field == 'cc_camp_contact_type_cct_id') { + $new_cct = new camp_contact_type(); + $new_cct->set_cct_data_by_id($value); + $this->set_cc_camp_contact_type($new_cct); + } + if ($field == 'cc_owner_id') { + $new_cu = new camp_user(); + $new_cu->set_user_data_by_id($value); + $this->set_cc_owner($new_cu); + } + if ($field == 'cc_original_id' && !empty($value)) { + $new_cc = new camp_contact(); + $new_cc->set_cc_data_by_id($value); + $this->set_cc_original($new_cc); + } + } + } + + private static function empty_to_null($str) { + return ($str == ""?"null":$str); + } + + public static function create_camp_contact($_name, $_mobile, $_email, $_facebook, $_cct_id, $_owner_id, $_original_id) { + global $sql; + return $sql->insert_into('camp_contact', array( + 'cc_name' => $_name, + 'cc_mobile' => $_mobile, + 'cc_email' => $_email, + 'cc_facebook' => self::empty_to_null($_facebook), + 'cc_camp_contact_type_cct_id' => $_cct_id, + 'cc_owner_id' => $_owner_id, + 'cc_original_id' => $_original_id, + ) + ); + } +} + + +?> \ No newline at end of file diff --git a/_class/class_camp_contact_type.php b/_class/class_camp_contact_type.php new file mode 100644 index 0000000..cf9591e --- /dev/null +++ b/_class/class_camp_contact_type.php @@ -0,0 +1,53 @@ +cct_id = $_item; + } + + public function set_cct_name($_item) { + $this->cct_name = $_item; + } + + public function set_cct_owner($_item) { + $this->cct_owner = $_item; + } + + public function set_cct_deleted($_item) { + $this->cct_deleted = $_item; + } + + public function get_cct_id() { + return $this->cct_id; + } + + public function get_cct_name() { + return $this->cct_name; + } + + public function get_cct_owner() { + return $this->cct_owner; + } + + public function get_cct_deleted() { + return $this->cct_deleted; + } + + public function set_cct_data_by_id($_id) { + global $sql; + $ck_data_assoc_array = $sql->assoc_array("select * from camp_contact_type where cct_id = " . $_id); + $ck_data_array = $ck_data_assoc_array[0]; + foreach ($ck_data_array as $field => $value) { + $function_name = "set_" . $field; + $this->$function_name($value); + } + } +} + +?> \ No newline at end of file diff --git a/_class/class_camp_kid.php b/_class/class_camp_kid.php new file mode 100644 index 0000000..c6c6cee --- /dev/null +++ b/_class/class_camp_kid.php @@ -0,0 +1,516 @@ +ck_id; + } + + /** + * Sets the value of ck_id. + * + * @param mixed $ck_id the ck id + * + * @return self + */ + private function set_ck_id($ck_id) + { + $this->ck_id = $ck_id; + + return $this; + } + + /** + * Gets the value of ck_name. + * + * @return mixed + */ + public function get_ck_name() + { + return $this->ck_name; + } + + /** + * Sets the value of ck_name. + * + * @param mixed $ck_name the ck name + * + * @return self + */ + private function set_ck_name($ck_name) + { + $this->ck_name = $ck_name; + + return $this; + } + + /** + * Gets the value of ck_birth_year. + * + * @return mixed + */ + public function get_ck_birth_year() + { + return $this->ck_birth_year; + } + + /** + * Sets the value of ck_birth_year. + * + * @param mixed $ck_birth_year the ck birth year + * + * @return self + */ + private function set_ck_birth_year($ck_birth_year) + { + $this->ck_birth_year = $ck_birth_year; + + return $this; + } + + /** + * Gets the value of ck_ss_number. + * + * @return mixed + */ + public function get_ck_ss_number() + { + return $this->ck_ss_number; + } + + /** + * Sets the value of ck_ss_number. + * + * @param mixed $ck_ss_number the ck ss number + * + * @return self + */ + private function set_ck_ss_number($ck_ss_number) + { + $this->ck_ss_number = $ck_ss_number; + + return $this; + } + + /** + * Gets the value of ck_email. + * + * @return mixed + */ + public function get_ck_email() + { + return $this->ck_email; + } + + /** + * Sets the value of ck_email. + * + * @param mixed $ck_email the ck email + * + * @return self + */ + private function set_ck_email($ck_email) + { + $this->ck_email = $ck_email; + + return $this; + } + + /** + * Gets the value of ck_mobile. + * + * @return mixed + */ + public function get_ck_mobile() + { + return $this->ck_mobile; + } + + /** + * Sets the value of ck_mobile. + * + * @param mixed $ck_mobile the ck mobile + * + * @return self + */ + private function set_ck_mobile($ck_mobile) + { + $this->ck_mobile = $ck_mobile; + + return $this; + } + + /** + * Gets the value of ck_badminton_history. + * + * @return mixed + */ + public function get_ck_badminton_history() + { + return $this->ck_badminton_history; + } + + /** + * Sets the value of ck_badminton_history. + * + * @param mixed $ck_badminton_history the ck badminton history + * + * @return self + */ + private function set_ck_badminton_history($ck_badminton_history) + { + $this->ck_badminton_history = $ck_badminton_history; + + return $this; + } + + /** + * Gets the value of ck_sport_history. + * + * @return mixed + */ + public function get_ck_sport_history() + { + return $this->ck_sport_history; + } + + /** + * Sets the value of ck_sport_history. + * + * @param mixed $ck_sport_history the ck sport history + * + * @return self + */ + private function set_ck_sport_history($ck_sport_history) + { + $this->ck_sport_history = $ck_sport_history; + + return $this; + } + + /** + * Gets the value of ck_shirt_size_id. + * + * @return mixed + */ + public function get_ck_shirt_size_id() + { + return $this->ck_shirt_size_id; + } + + /** + * Sets the value of ck_shirt_size_id. + * + * @param mixed $ck_shirt_size_id the ck shirt size id + * + * @return self + */ + private function set_ck_shirt_size_id($ck_shirt_size_id) + { + $this->ck_shirt_size_id = $ck_shirt_size_id; + + return $this; + } + + /** + * Gets the value of ck_shirt. + * + * @return mixed + */ + public function get_ck_shirt() + { + return $this->ck_shirt; + } + + /** + * Sets the value of ck_shirt. + * + * @param mixed $ck_shirt the ck shirt + * + * @return self + */ + private function set_ck_shirt($ck_shirt) + { + $this->ck_shirt = $ck_shirt; + + return $this; + } + + /** + * Gets the value of ck_food_info. + * + * @return mixed + */ + public function get_ck_food_info() + { + return $this->ck_food_info; + } + + /** + * Sets the value of ck_food_info. + * + * @param mixed $ck_food_info the ck food _info + * + * @return self + */ + private function set_ck_food_info($ck_food_info) + { + $this->ck_food_info = $ck_food_info; + + return $this; + } + + /** + * Gets the value of ck_hygiene_info. + * + * @return mixed + */ + public function get_ck_hygiene_info() + { + return $this->ck_hygiene_info; + } + + /** + * Sets the value of ck_hygiene_info. + * + * @param mixed $ck_hygiene_info the ck hygiene _info + * + * @return self + */ + private function set_ck_hygiene_info($ck_hygiene_info) + { + $this->ck_hygiene_info = $ck_hygiene_info; + + return $this; + } + + /** + * Gets the value of ck_health_info. + * + * @return mixed + */ + public function get_ck_health_info() + { + return $this->ck_health_info; + } + + /** + * Sets the value of ck_health_info. + * + * @param mixed $ck_health_info the ck health _info + * + * @return self + */ + private function set_ck_health_info($ck_health_info) + { + $this->ck_health_info = $ck_health_info; + + return $this; + } + + /** + * Gets the value of ck_pharma_info. + * + * @return mixed + */ + public function get_ck_pharma_info() + { + return $this->ck_pharma_info; + } + + /** + * Sets the value of ck_pharma_info. + * + * @param mixed $ck_pharma_info the ck pharma _info + * + * @return self + */ + private function set_ck_pharma_info($ck_pharma_info) + { + $this->ck_pharma_info = $ck_pharma_info; + + return $this; + } + + /** + * Gets the value of ck_other_info. + * + * @return mixed + */ + public function get_ck_other_info() + { + return $this->ck_other_info; + } + + /** + * Sets the value of ck_other_info. + * + * @param mixed $ck_other_info the ck other _info + * + * @return self + */ + private function set_ck_other_info($ck_other_info) + { + $this->ck_other_info = $ck_other_info; + + return $this; + } + + /** + * Gets the value of ck_deleted. + * + * @return mixed + */ + public function get_ck_deleted() + { + return $this->ck_deleted; + } + + /** + * Sets the value of ck_deleted. + * + * @param mixed $ck_deleted the ck deleted + * + * @return self + */ + private function set_ck_deleted($ck_deleted) + { + $this->ck_deleted = $ck_deleted; + + return $this; + } + + public function get_ck_owner_id() + { + return $this->ck_id; + } + + private function set_ck_owner_id($ck_id) + { + $this->ck_owner_id = $ck_id; + + return $this; + } + + public function get_ck_owner() + { + return $this->ck_id; + } + + private function set_ck_owner($ck_id) + { + $this->ck_owner = $ck_id; + + return $this; + } + + public function get_ck_original() + { + return $this->ck_id; + } + + private function set_ck_original($ck_id) + { + $this->ck_original = $ck_id; + + return $this; + } + + public function get_ck_original_id() + { + return $this->ck_id; + } + + private function set_ck_original_id($ck_id) + { + $this->ck_original = $ck_id; + + return $this; + } + + public function set_ck_data_by_id($_id) { + global $sql; + $ck_data_assoc_array = $sql->assoc_array("select * from camp_kid where ck_id = " . $_id); + $ck_data_array = $ck_data_assoc_array[0]; + foreach ($ck_data_array as $field => $value) { + $function_name = "set_" . $field; + $this->$function_name($value); + if ($field == 'ck_shirt_size_id') { + $new_shirt = new camp_shirt(); + $new_shirt->set_cshirt_data_by_id($value); + $this->set_ck_shirt($new_shirt); + } + if ($field == 'ck_owner_id') { + $new_camp_user = new camp_user(); + $new_camp_user->set_user_data_by_id($value); + $this->set_ck_owner($new_camp_user); + } + if ($field == 'ck_original_id' && !empty($value)) { + $new_camp_kid = new camp_kid(); + $new_camp_kid->set_ck_data_by_id($value); + $this->set_ck_original($new_camp_kid); + } + } + } + + private static function empty_to_null($str) { + return ($str == ""?"null":$str); + } + + public static function create_camp_kid($_name, $_birth_year, $_ss_number, $_email, $_mobile, $_shirt_id, $_info, $_original_id, $_owner_id) { + global $sql; + return $sql->insert_into('camp_kid', array( + 'ck_name' => $_name, + 'ck_birth_year' => $_birth_year, + 'ck_ss_number' => $_ss_number, + 'ck_email' => $_email, + 'ck_mobile' => $_mobile, + 'ck_shirt_size_id' => $_shirt_id, + 'ck_original_id' => $_original_id, + 'ck_owner_id' => $_owner_id, + 'ck_sport_history' => self::empty_to_null($_info['ck_sport_history']), + 'ck_badminton_history' => self::empty_to_null($_info['ck_badminton_history']), + 'ck_food_info' => self::empty_to_null($_info['ck_food_info']), + 'ck_hygiene_info' => self::empty_to_null($_info['ck_hygiene_info']), + 'ck_health_info' => self::empty_to_null($_info['ck_health_info']), + 'ck_pharma_info' => self::empty_to_null($_info['ck_pharma_info']), + 'ck_other_info' => self::empty_to_null($_info['ck_other_info']), + + )); + } +} + + +?> \ No newline at end of file diff --git a/_class/class_camp_shirt.php b/_class/class_camp_shirt.php new file mode 100644 index 0000000..d133f5d --- /dev/null +++ b/_class/class_camp_shirt.php @@ -0,0 +1,45 @@ +cshirt_id = $_item; + } + + public function set_cshirt_name($_item) { + $this->cshirt_name = $_item; + } + + public function set_cshirt_deleted($_item) { + $this->cshirt_deleted = $_item; + } + + public function get_cshirt_id() { + return $this->cshirt_id; + } + + public function get_cshirt_name() { + return $this->cshirt_name; + } + + public function get_cshirt_deleted() { + return $this->cshirt_deleted; + } + + public function set_cshirt_data_by_id($_id) { + global $sql; + $ck_data_assoc_array = $sql->assoc_array("select * from camp_shirt where cshirt_id = " . $_id); + $ck_data_array = $ck_data_assoc_array[0]; + foreach ($ck_data_array as $field => $value) { + $function_name = "set_" . $field; + $this->$function_name($value); + } + } +} + + +?> diff --git a/_class/class_camp_shuttle_type.php b/_class/class_camp_shuttle_type.php new file mode 100644 index 0000000..65e8e68 --- /dev/null +++ b/_class/class_camp_shuttle_type.php @@ -0,0 +1,82 @@ +cst_id; + } + + /** + * Sets the value of cst_id. + * + * @param mixed $cst_id the cst id + * + * @return self + */ + private function set_cst_id($cst_id) + { + $this->cst_id = $cst_id; + + return $this; + } + + /** + * Gets the value of cst_name. + * + * @return mixed + */ + public function get_cst_name() + { + return $this->cst_name; + } + + /** + * Sets the value of cst_name. + * + * @param mixed $cst_name the cst name + * + * @return self + */ + private function set_cst_name($cst_name) + { + $this->cst_name = $cst_name; + + return $this; + } + + private function set_cst_deleted($_item) { + $this->cst_deleted = $_item; + } + + public function get_cst_deleted($_item) { + return $this->cst_deleted; + } + + public function set_cst_data_by_id($_cst_id) { + global $sql; + $cst_assoc_array = $sql->assoc_array("select * from camp_shuttle_type where cst_id = " . $_cst_id); + $cst_array = $cst_assoc_array[0]; + //alapadatok + foreach ($cst_array as $field => $value) { + $function_name = "set_" . $field; + $this->$function_name($value); + } + + } +} + + +?> \ No newline at end of file diff --git a/_class/class_camp_type.php b/_class/class_camp_type.php new file mode 100644 index 0000000..799cd5d --- /dev/null +++ b/_class/class_camp_type.php @@ -0,0 +1,98 @@ +ct_id; + } + + /** + * Sets the value of ct_id. + * + * @param mixed $ct_id the ct id + * + * @return self + */ + private function set_ct_id($ct_id) + { + $this->ct_id = $ct_id; + + return $this; + } + + /** + * Gets the value of ct_name. + * + * @return mixed + */ + public function get_ct_name() + { + return $this->ct_name; + } + + /** + * Sets the value of ct_name. + * + * @param mixed $ct_name the ct name + * + * @return self + */ + private function set_ct_name($ct_name) + { + $this->ct_name = $ct_name; + + return $this; + } + + public function get_ct_deleted() { + return $this->ct_deleted; + } + + private function set_ct_deleted($_item) { + $this->ct_deleted = $_item; + + return $this; + } + + + public function set_ct_data_by_id($_ct_id) { + global $sql; + $ct_data_assoc_array = $sql->assoc_array("select * from camp_type where ct_id = " . $_ct_id); + $ct_data_array = $ct_data_assoc_array[0]; + foreach ($ct_data_array as $field => $value) { + $function_name = "set_" . $field; + $this->$function_name($value); + } + } + + public static function create_camp_type($_name) { + global $sql; + return $sql->insert_into('camp_type', array('ct_name' => $_name)); + } + + public static function update_camp_type($_id, $_name) { + global $sql; + $sql->update_table('camp_type', array('ct_name' => $_name), array('ct_id' => $_id)); + } + + +} + +?> \ No newline at end of file diff --git a/_class/class_camp_user.php b/_class/class_camp_user.php new file mode 100644 index 0000000..dcac415 --- /dev/null +++ b/_class/class_camp_user.php @@ -0,0 +1,197 @@ +cu_id; + } + + /** + * Sets the value of cu_id. + * + * @param mixed $cu_id the cu id + * + * @return self + */ + private function set_cu_id($cu_id) + { + $this->cu_id = $cu_id; + + return $this; + } + + /** + * Gets the value of cu_email. + * + * @return mixed + */ + public function get_cu_email() + { + return $this->cu_email; + } + + /** + * Sets the value of cu_email. + * + * @param mixed $cu_email the cu email + * + * @return self + */ + private function set_cu_email($cu_email) + { + $this->cu_email = $cu_email; + + return $this; + } + + /** + * Gets the value of cu_password. + * + * @return mixed + */ + public function get_cu_password() + { + return $this->cu_password; + } + + /** + * Sets the value of cu_password. + * + * @param mixed $cu_password the cu password + * + * @return self + */ + private function set_cu_password($cu_password) + { + $this->cu_password = $cu_password; + + return $this; + } + + /** + * Gets the value of cu_reg_date. + * + * @return mixed + */ + public function get_cu_reg_date() + { + return $this->cu_reg_date; + } + + /** + * Sets the value of cu_reg_date. + * + * @param mixed $cu_reg_date the cu reg date + * + * @return self + */ + private function set_cu_reg_date($cu_reg_date) + { + $this->cu_reg_date = $cu_reg_date; + + return $this; + } + + /** + * Gets the value of cu_last_login. + * + * @return mixed + */ + public function get_cu_last_login() + { + return $this->cu_last_login; + } + + /** + * Sets the value of cu_last_login. + * + * @param mixed $cu_last_login the cu last login + * + * @return self + */ + private function set_cu_last_login($cu_last_login) + { + $this->cu_last_login = $cu_last_login; + + return $this; + } + + /** + * Gets the value of cu_deleted. + * + * @return mixed + */ + public function get_cu_deleted() + { + return $this->cu_deleted; + } + + /** + * Sets the value of cu_deleted. + * + * @param mixed $cu_deleted the cu deleted + * + * @return self + */ + private function set_cu_deleted($cu_deleted) + { + $this->cu_deleted = $cu_deleted; + + return $this; + } + + public function update_login_time($_cu_id = null) { + global $sql; + //az adott user_id-n updateli a login_time-ot + $sql->update_table('camp_user', array('cu_last_login' => date('Y-m-d H:i:s')), array('cu_id' => (empty($_cu_id)?$this->get_cu_id():$_cu_id))); + } + + + public function set_user_data_by_id($_id) { + global $sql; + $cu_data_assoc_array = $sql->assoc_array("select * from camp_user where cu_id = " . $_id); + $cu_data_array = $cu_data_assoc_array[0]; + foreach ($cu_data_array as $field => $value) { + $function_name = "set_" . $field; + $this->$function_name($value); + $this->set_login(true); + } + } + + 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 static function create_camp_user($_email, $_password, $_reg_date) { + global $sql; + return $sql->insert_into('camp_user', array( + 'cu_email' => $_email, + 'cu_password' => md5($_password), + 'cu_reg_date' => $_reg_date, + )); + } +} + +?> \ No newline at end of file diff --git a/_class/class_page.php b/_class/class_page.php index ac7303c..cf8322d 100644 --- a/_class/class_page.php +++ b/_class/class_page.php @@ -346,6 +346,58 @@ class page { $from = "admin"; include('include_logout.php'); break; + case 'camps': + # TÁBOROK + include('include_camps.php'); + break; + case 'camp_types': + # TÁBOR TÍPUSOK + include('include_camp_types.php'); + break; + case 'camp_shirt_type': + # TÁBOR PÓLÓ TÍPUSOK + include('include_camp_shirt_types.php'); + break; + case 'accept_apply': + # TÁBOR JELENTKEZÉS ELFOGADÁSA + include('include_accept_apply.php'); + break; + case 'deny_apply': + # TÁBOR JELENTKEZÉS ELUTASÍTÁSA + include('include_deny_apply.php'); + break; + case 'remove_apply': + # TÁBOR JELENTKEZÉS ELTÁVOLÍTÁSA A LISTÁBÓL + include('include_remove_apply.php'); + break; + case 'apply': + # TÁBORI JELENTKEZŐ ADATAINAK MEGTEKINTÉSE + include('include_apply.php'); + break; + case 'camp_user': + # táborvezetők + include('include_user_camp_leader.php'); + break; + case 'camp_details': + # turnusok + include('include_camp_details.php'); + break; + case 'delete_camp_type': + # TÁBOR TÍPUS TÖRLÉS + include('include_delete_camp_type.php'); + break; + case 'delete_camp': + # TÁBOR TÖRLÉS + include('include_delete_camp.php'); + break; + case 'delete_camp_shirt': + # TÁBORI PÓLÓ TÖRLÉS + include('include_delete_camp_shirt.php'); + break; + case 'delete_camp_leader': + # TÁBORVEZETŐ TÖRLÉS + include('include_delete_camp_leader.php'); + break; default: # code... break; @@ -430,6 +482,39 @@ class page { break; } break; + case 'tabor': + # TÁBOR OLDALAK + switch ($this->get_subpage()) { + case 'informaciok': + # tábori információk + include('include_camp_information.php'); + break; + case 'jelentkezes': + # jelentkezés + include('include_camp_apply.php'); + break; + case 'jelentkezesek': + # jelentkezések + include('include_camp_applies.php'); + break; + case 'move_next': + # továbblépés mentés nélkül + include('include_move_next.php'); + break; + case 'logout': + # kijelentkezés + $from = "tabor"; + include('include_logout.php'); + break; + case 'delete_apply': + # jelentkezés törlése + include('include_delete_apply.php'); + break; + default: + include('include_camp_information.php'); + break; + } + break; } } } diff --git a/_css/camp.css b/_css/camp.css new file mode 100644 index 0000000..9f0d26b --- /dev/null +++ b/_css/camp.css @@ -0,0 +1,118 @@ +nav { + box-shadow: none; + width: 100%; +} + +ul.topnav { + background-color: #0052CC; +} + +main #main_content, main #loading { + width: 100%; + box-shadow: none; +} + +.info { + padding: 0px 8%; +} + +#cct_extra_row { + margin-top: 10px; + display: none; +} + +#add_more_cct, #move_next { + margin-bottom: 15px; +} + +h1, p { + text-align: center; +} + +.info p, .info h1{ + text-align: unset; +} + +form table { + margin: 0px auto; + border-collapse: collapse; + border: 2px solid black; + background: #e7d6d6; + min-width: 400px; +} + +form table td { + font-size: 20px; + padding: 5px 10px; +} + +form table tr:hover td { + background-color: #602f2f; + color: #fff; +} + +.danger { + width: 64%; + display: block; + margin: 20px auto; + padding: 15px; +} + +.middle { + display: block; + margin: 20px auto; +} + +h2 { + text-align: center; + margin-top: 50px; +} + +.apply_table img:hover { + cursor: pointer; +} + +.reset img { + width: 15px; + display: inline-block; + position: relative; + top: 2px; + left: 5px; +} + +.reset a { + color: #000; +} + +.reset a:hover { + text-decoration: underline; +} + +.apply_table a, .apply_table a:link, .apply_table a:visited, .apply_table a:active { + color: #000; +} + +.apply_table a:hover { + text-decoration: underline; +} + +.accept_terms_box { + width: 80%; + border: 0; + border-left: 2px solid black; + margin: 30px auto 20px auto; +} + + +.accept_terms_box a, .accept_terms_box a:link, .accept_terms_box a:visited, .accept_terms_box a:active { + color: #000; +} + +.accept_terms_box a:hover { + text-decoration: underline; +} + +input.apply { + font-size: 20px; + font-weight: bold; +} diff --git a/_include/include_accept_apply.php b/_include/include_accept_apply.php new file mode 100644 index 0000000..e36aad2 --- /dev/null +++ b/_include/include_accept_apply.php @@ -0,0 +1,21 @@ +is_id()) { + + # JELENTEKEZÉS ELFOGADÁSA + camp_apply::apply_response($this->get_id(), 3); + $new_apply = new camp_apply(); + $new_apply->set_capp_data_by_id($this->get_id()); + header('Location: /admin/camps/' . $new_apply->get_capp_camp_id()->get_camp_id()); + + +} + + + + + + +?> diff --git a/_include/include_camp_applies.php b/_include/include_camp_applies.php new file mode 100644 index 0000000..5a93ea6 --- /dev/null +++ b/_include/include_camp_applies.php @@ -0,0 +1,77 @@ +is_id()) { + + //jelentkező + $apply = new camp_apply(); + $apply->set_capp_data_by_id($this->get_id()); + + //felelős kapcsolattartó + $res_cc_id = $sql->single_variable("SELECT cac_camp_contact_cc_id FROM camp_apply_contact WHERE cac_is_responsible = 1 AND cac_camp_apply_capp_id = " . $this->get_id() ); + $res_cc = new camp_contact(); + $res_cc->set_cc_data_by_id($res_cc_id); + + //további kapcst-ók + + $cc_ids = $sql->assoc_array("SELECT cac_camp_contact_cc_id FROM camp_apply_contact WHERE cac_is_responsible = 0 AND cac_camp_apply_capp_id = " . $this->get_id() ); + + $contacts = array(); + foreach ($cc_ids as $cc) { + $contact = new camp_contact(); + $contact->set_cc_data_by_id($cc['cac_camp_contact_cc_id']); + $contacts[] = $contact; + } + + $smarty->assign('apply',$apply); + $smarty->assign('res_cc',$res_cc); + $smarty->assign('contacts',$contacts); + $smarty->display('apply.tpl'); + + +} + +else { + + # JELENTKEZÉSEK: 2 táblázat + // elbírált jelentkezések + // elfogadásra váró jelentkezések + + //lekérjük az elbírált jelentkezéseket + $accepted_applies = $sql->assoc_array("SELECT * FROM camp_apply JOIN camp_kid on ck_id = capp_camp_kid_ck_id WHERE ck_owner_id = " . $user->get_cu_id() . " AND capp_status in (3,4);"); + $color = ""; + $apply_array = array(); + foreach ($accepted_applies as $apply) { + $new_apply = new camp_apply(); + $new_apply->set_capp_data_by_id($apply['capp_id']); + //lekérjük a státuszt + //TODO: objektummal + $status = $sql->single_variable('SELECT cas_name FROM camp_apply_status WHERE cas_id = ' . $new_apply->get_capp_status()); + if ($new_apply->get_capp_status() == 3) { + $color = "green"; + } + else { + $color = "red"; + } + $new_apply->set_capp_status($status); + $apply_array[] = $new_apply; + } + + + //lekérjük az elfogadásra váró jelentkezéseket + $pending_applies = $sql->assoc_array("SELECT * FROM camp_apply JOIN camp_kid on ck_id = capp_camp_kid_ck_id WHERE ck_owner_id = " . $user->get_cu_id() . " AND capp_status = 2;"); + + $apply_array_2 = array(); + foreach ($pending_applies as $apply) { + $new_apply = new camp_apply(); + $new_apply->set_capp_data_by_id($apply['capp_id']); + $apply_array_2[] = $new_apply; + } + + $smarty->assign('color', $color); + $smarty->assign('apply_array', $apply_array); + $smarty->assign('pending_apply_array', $apply_array_2); + $smarty->display('applies.tpl'); + +} + +?> \ No newline at end of file diff --git a/_include/include_camp_apply.php b/_include/include_camp_apply.php new file mode 100644 index 0000000..22f3d10 --- /dev/null +++ b/_include/include_camp_apply.php @@ -0,0 +1,171 @@ +is_id()) { + + # TÁBORI JELENTKEZÉS + //var_dump($_COOKIE); + + if ($this->get_id() == 1) { + //1. LÉPÉS JELENTKEZŐ ADATAI + //lekérjük a camp_user kid-jeit egy tömbbe + $kid_assoc_array = $sql->assoc_array("SELECT * FROM camp_kid WHERE ck_owner_id = " . $user->get_cu_id() . " AND ck_original_id IS NULL"); + $kids = array(); + foreach ($kid_assoc_array as $kid_array) { + $new_kid = new camp_kid(); + $new_kid->set_ck_data_by_id($kid_array['ck_id']); + $kids[] = $new_kid; + } + + $shirt_assoc_array = $sql->assoc_array("SELECT * FROM camp_shirt WHERE cshirt_deleted = 0 ORDER BY cshirt_id ASC;"); + $shirts = array(); + foreach ($shirt_assoc_array as $shirt) { + $new_shirt = new camp_shirt(); + $new_shirt->set_cshirt_data_by_id($shirt['cshirt_id']); + $shirts[] = $new_shirt; + } + + + $smarty->assign('step',1); + $smarty->assign('kids',$kids); + $smarty->assign('shirts',$shirts); + $smarty->display('camp_apply.tpl'); + + //var_dump($user); + } + + elseif ($this->get_id() == 2) { + //2. LÉPÉS KAPCSOLATTARTÓ ADATAI + //csak akkor érhető el, ha van cookie, egyébként visszadob az első lépésre + if (!isset($_COOKIE['badminton_camp_session_id'])) { + header('Location: /tabor/jelentkezes/1'); + } + + else { + var_dump("hali"); + + + //lekérjük a korábban megadott kapcsolattartókat + $contact_assoc_array = $sql->assoc_array("SELECT * FROM camp_contact WHERE cc_owner_id = " . $user->get_cu_id() . " AND cc_original_id IS NULL"); + $contacts = array(); + foreach ($contact_assoc_array as $contact_array) { + $new_cc = new camp_contact(); + $new_cc->set_cc_data_by_id($contact_array['cc_id']); + $contacts[] = $new_cc; + } + + //lekérjük van-e felelős kapcsolattartó + //ha van, akkor nem lehet bepipálni + //ha nincs, akkor van pipa + $has_responsible = camp_apply::has_responsible_contact($_COOKIE['badminton_camp_session_id']); + + + //lekérjük a contact type-okat + $cct_assoc_array = $sql->assoc_array("SELECT * FROM camp_contact_type WHERE cct_owner IS NULL OR cct_owner = " . $user->get_cu_id() . ";"); + $cct_array = array(); + foreach ($cct_assoc_array as $cct) { + $new_cct = new camp_contact_type(); + $new_cct->set_cct_data_by_id($cct['cct_id']); + $cct_array[] = $new_cct; + } + + $smarty->assign('cct_array', $cct_array); + + //van-e már jelentkező + $has_contact = camp_apply::has_contact($_COOKIE['badminton_camp_session_id']); + + //lekérjük a session_id alapján a camp_kid it-t, objektumot csinálunk belőle és úgy adjuk át + //$ck_id = $sql->single_variable("SELECT capp_camp_kid_ck_id FROM camp_apply WHERE capp_id = " . $_COOKIE['badminton_camp_session_id']); + //$new_camp_kid = new camp_kid(); + //$new_camp_kid->set_ck_data_by_id($ck_id); + + //van-e + //$smarty->assign('camp_kid', $new_camp_kid); + $smarty->assign('has_contact', $has_contact); + $smarty->assign('contacts', $contacts); + $smarty->assign('step',2); + $smarty->assign('has_responsible',($has_responsible?true:false)); + $smarty->assign('camp_apply_id', $_COOKIE['badminton_camp_session_id']); + $smarty->display('camp_apply.tpl'); + } + } + + elseif ($this->get_id() == 3) { + # amikor nem választott felelős kapcsolattartót + + //megnézzük van-e sessionj-e + if (!isset($_COOKIE['badminton_camp_session_id'])) { + header('Location: /tabor/jelentkezes/1'); + } + + //lekérjük a contact-okat + $contact_assoc_array = $sql->assoc_array('SELECT * FROM camp_apply_contact WHERE cac_camp_apply_capp_id = ' . $_COOKIE['badminton_camp_session_id']); + $contacts = array(); + foreach ($contact_assoc_array as $contact_array) { + $new_contact = new camp_contact(); + $new_contact->set_cc_data_by_id($contact_array['cac_camp_contact_cc_id']); + $contacts[] = $new_contact; + } + + $smarty->assign('contacts', $contacts); + $smarty->assign('step',3); + $smarty->assign('camp_apply_id', $_COOKIE['badminton_camp_session_id']); + $smarty->display('camp_apply.tpl'); + + } + + elseif ($this->get_id() == 4) { + # tábor adatok megadása + + //megnézzük van-e sessionj-e + if (!isset($_COOKIE['badminton_camp_session_id'])) { + header('Location: /tabor/jelentkezes/1'); + } + + //lekérjük azokat a táborokat, amikre lehet jelentkezni, és a kezdődátum a mainál később van (>), és nem törölt + $camp_assoc_array = $sql->assoc_array("SELECT * FROM camp WHERE camp_deleted = 0 AND camp_is_open = 1 AND camp_from > NOW() ORDER BY camp_from ASC;"); + + $camp_array = array(); + foreach ($camp_assoc_array as $camp) { + $new_camp = new camp(); + $new_camp->set_camp_data_by_id($camp['camp_id']); + $camp_array[] = $new_camp; + } + + $smarty->assign('step',4); + $smarty->assign('camp_array',$camp_array); + $smarty->assign('camp_apply_id', $_COOKIE['badminton_camp_session_id']); + $smarty->display('camp_apply.tpl'); + + } + + elseif ($this->get_id() == 5) { + # visszaigazoló szöveg + + //megnézzük van-e sessionj-e + if (!isset($_COOKIE['badminton_camp_session_id']) || empty($_COOKIE['badminton_camp_session_id'])) { + header('Location: /tabor/jelentkezes/1'); + } + + setcookie('badminton_camp_session_id', null, time()-60*60, '/'); + $smarty->assign('step',5); + $smarty->display('camp_apply.tpl'); + + } + + +} + +else { + + # REDIRECT + header("Location: /tabor/jelentkezes/1"); + + + + +} + +?> diff --git a/_include/include_camp_details.php b/_include/include_camp_details.php new file mode 100644 index 0000000..afe45a5 --- /dev/null +++ b/_include/include_camp_details.php @@ -0,0 +1,22 @@ +is_id()) { + # empty +} + +else { + + # TURNUS LISTA, LEGÖRDÜLŐ GYEREKEKKEL + + $camps_assoc_array = $sql->assoc_array("SELECT * FROM camp WHERE camp_deleted = 0 ORDER BY camp_from ASC;"); + $camps = array(); + foreach ($camps_assoc_array as $camp_array) { + $new_camp = new camp(); + $new_camp->set_camp_data_by_id($camp_array['camp_id']); + $camps[] = $new_camp; + } + + $smarty->assign('camps', $camps); + $smarty->display('camp_details.tpl'); +} +?> diff --git a/_include/include_camp_information.php b/_include/include_camp_information.php new file mode 100644 index 0000000..32d521f --- /dev/null +++ b/_include/include_camp_information.php @@ -0,0 +1,18 @@ +single_variable($info_query); + + $new_setval = new setting_value(); + $new_setval->set_setting_value_data_by_id($setv_id); + + $smarty->assign('setting', $new_setval); + + $smarty->display('information.tpl'); + + + +?> \ No newline at end of file diff --git a/_include/include_camp_shirt_types.php b/_include/include_camp_shirt_types.php new file mode 100644 index 0000000..21eb009 --- /dev/null +++ b/_include/include_camp_shirt_types.php @@ -0,0 +1,28 @@ +is_id()) { + + # TÁBORI PÓLÓ SZERKESZTÉSE + $camp_shirt_query = "SELECT * FROM camp_shirt WHERE cshirt_id = " . $this->get_id(); + $camp_shirt_assoc_array = $sql->assoc_array($camp_shirt_query); + $smarty->assign('camp_shirt_array',$camp_shirt_assoc_array[0]); + $smarty->display('camp_shirt_data_edit.tpl'); +} + +else { + + # TÁBORI PÓLÓ LISTA + + $camp_shirt_query = "SELECT * FROM camp_shirt WHERE cshirt_deleted = 0 ORDER BY cshirt_id DESC"; + $shirt_assoc_array = $sql->assoc_array($camp_shirt_query); + + $smarty->assign('shirt_assoc_array',$shirt_assoc_array); + $smarty->display('camp_shirt_list.tpl'); + + +} + +?> diff --git a/_include/include_camp_types.php b/_include/include_camp_types.php new file mode 100644 index 0000000..270e3e5 --- /dev/null +++ b/_include/include_camp_types.php @@ -0,0 +1,37 @@ +is_id()) { + + # TÁBOR_TÍPUS SZERKESZTÉSE + + +} + +else { + + # TÁBOR_TÍPUS LISTA + + $ct_query = "SELECT * FROM camp_type WHERE ct_deleted = 0 ORDER BY ct_name ASC"; + $ct_assoc_array = $sql->assoc_array($ct_query); + + $ct_array = array(); + foreach ($ct_assoc_array as $value) { + $new_ct = new camp_type(); + $new_ct->set_ct_data_by_id($value['ct_id']); + $ct_array[] = $new_ct; + } + + $smarty->assign('ct_array',$ct_array); + $smarty->display('camp_type_list.tpl'); + + +} + + + + + +?> \ No newline at end of file diff --git a/_include/include_camps.php b/_include/include_camps.php new file mode 100644 index 0000000..966abb3 --- /dev/null +++ b/_include/include_camps.php @@ -0,0 +1,140 @@ +is_id()) { + + # TÁBOR SZERKESZTÉSE + + $camp = new camp(); + $camp->set_camp_data_by_id($this->get_id()); + + //labda típusok hozzáadása + $shuttle_assoc_array = $sql->assoc_array("SELECT * FROM camp_shuttle_type WHERE cst_deleted = 0 ORDER BY cst_id ASC"); + $shuttle_array = array(); + foreach ($shuttle_assoc_array as $shuttle_type) { + $new_cst = new camp_shuttle_type(); + $new_cst->set_cst_data_by_id($shuttle_type['cst_id']); + $shuttle_array[] = $new_cst; + } + $smarty->assign('shuttle_array', $shuttle_array); + + + //ottalvós opciók hozzáadása + $accomodation_assoc = $sql->assoc_array("SELECT * FROM camp_accomodation_type WHERE cat_deleted = 0 ORDER BY cat_id ASC"); + $accomodation_array = array(); + foreach ($accomodation_assoc as $accomodation_type) { + $new_cat = new camp_accomodation_type(); + $new_cat->set_cat_data_by_id($accomodation_type['cat_id']); + $accomodation_array[] = $new_cat; + } + $smarty->assign('accomodation_array', $accomodation_array); + + + //tábor típusok + $ct_assoc_array = $sql->assoc_array("SELECT * FROM camp_type WHERE ct_deleted = 0 ORDER BY ct_name ASC"); + $camp_type_array = array(); + foreach ($ct_assoc_array as $ct) { + $new_ct = new camp_type(); + $new_ct->set_ct_data_by_id($ct['ct_id']); + $camp_type_array[] = $new_ct; + } + $smarty->assign('camp_type_array', $camp_type_array); + + + + //shuttles + $shuttles_assoc_array = $sql->assoc_array('SELECT * FROM camp_shuttle WHERE cs_camp_id = ' . $this->get_id()); + $shuttles = array(); + foreach ($shuttles_assoc_array as $shuttle) { + $new_sh = new camp_shuttle_type(); + $new_sh->set_cst_data_by_id($shuttle['cs_shuttle_id']); + $shuttles[] = $new_sh->get_cst_id(); //csak az id-t rakjuk bele, hogy in_array-jel könnyebb legyen keresni + } + + //accomodations + $accom_assoc_array = $sql->assoc_array('SELECT * FROM camp_accomodation WHERE ca_camp_id = ' . $this->get_id()); + $accoms = array(); + foreach ($accom_assoc_array as $accom) { + $new_ac = new camp_accomodation_type(); + $new_ac->set_cat_data_by_id($accom['ca_accomodation_id']); + $accoms[] = $new_ac->get_cat_id(); //csak az id-t rakjuk bele, hogy in_array-jel könnyebb legyen keresni + } + + //visszaigazolt jelentkezések + $accepted_applies = $sql->assoc_array("SELECT * FROM camp_apply JOIN camp_kid on ck_id = capp_camp_kid_ck_id WHERE capp_camp_id = " . $this->get_id() . " AND capp_status in (3,4) ORDER BY ck_name ASC;"); + $color = ""; + $apply_array = array(); + foreach ($accepted_applies as $apply) { + $new_apply = new camp_apply(); + $new_apply->set_capp_data_by_id($apply['capp_id']); + //lekérjük a státuszt + //TODO: objektummal + $status = $sql->single_variable('SELECT cas_name FROM camp_apply_status WHERE cas_id = ' . $new_apply->get_capp_status()); + $new_apply->set_capp_status($status); + $apply_array[] = $new_apply; + } + + //lekérjük az elfogadásra váró jelentkezéseket + $pending_applies = $sql->assoc_array("SELECT * FROM camp_apply JOIN camp_kid on ck_id = capp_camp_kid_ck_id WHERE capp_camp_id = " . $this->get_id() . " AND capp_status = 2 ORDER BY capp_date DESC;;"); + + $apply_array_2 = array(); + foreach ($pending_applies as $apply) { + $new_apply = new camp_apply(); + $new_apply->set_capp_data_by_id($apply['capp_id']); + $apply_array_2[] = $new_apply; + } + + //lekérjük a töröltó jelentkezéseket + $pending_applies = $sql->assoc_array("SELECT * FROM camp_apply JOIN camp_kid on ck_id = capp_camp_kid_ck_id WHERE capp_camp_id = " . $this->get_id() . " AND capp_status = 5 ORDER BY capp_accept_date DESC;;"); + + $apply_array_3 = array(); + foreach ($pending_applies as $apply) { + $new_apply = new camp_apply(); + $new_apply->set_capp_data_by_id($apply['capp_id']); + $apply_array_3[] = $new_apply; + } + + //var_dump($apply_array_3); + + $smarty->assign('apply_array', $apply_array); + $smarty->assign('pending_apply_array', $apply_array_2); + $smarty->assign('deleted_apply_array', $apply_array_3); + + $smarty->assign('camp', $camp); + $smarty->assign('shuttles', $shuttles); + $smarty->assign('accomodations', $accoms); + + + $smarty->display('camp_data_update.tpl'); + +} + +else { + + # TÁBOR LISTA + + //tábor adatok + $camp_query = "SELECT * FROM camp WHERE camp_deleted = 0 ORDER BY camp_from DESC"; + $camp_assoc_array = $sql->assoc_array($camp_query); + + $camp_array = array(); + foreach ($camp_assoc_array as $camp_data) { + $new_camp = new camp(); + $new_camp->set_camp_data_by_id($camp_data['camp_id']); + $camp_array[] = $new_camp; + } + + + $smarty->assign('camp_array',$camp_array); + $smarty->display('camp_list.tpl'); + + +} + + + + + +?> \ No newline at end of file diff --git a/_include/include_create.php b/_include/include_create.php index c90c0a6..0e7989a 100644 --- a/_include/include_create.php +++ b/_include/include_create.php @@ -217,6 +217,56 @@ switch ($this->get_id()) { $smarty->display('lease_create.tpl'); break; + case 'camp_type': + # ÚJ TÁBOR TÍPUS + $smarty->display('camp_type_create.tpl'); + break; + case 'camp': + # ÚJ TÁBOR + + //tábor típusok + $ct_assoc_array = $sql->assoc_array("SELECT * FROM camp_type WHERE ct_deleted = 0 ORDER BY ct_name ASC"); + $camp_type_array = array(); + foreach ($ct_assoc_array as $ct) { + $new_ct = new camp_type(); + $new_ct->set_ct_data_by_id($ct['ct_id']); + $camp_type_array[] = $new_ct; + } + $smarty->assign('camp_type_array', $camp_type_array); + + + //labda típusok hozzáadása + $shuttle_assoc_array = $sql->assoc_array("SELECT * FROM camp_shuttle_type WHERE cst_deleted = 0 ORDER BY cst_id ASC"); + $shuttle_array = array(); + foreach ($shuttle_assoc_array as $shuttle_type) { + $new_cst = new camp_shuttle_type(); + $new_cst->set_cst_data_by_id($shuttle_type['cst_id']); + $shuttle_array[] = $new_cst; + } + $smarty->assign('shuttle_array', $shuttle_array); + + + //ottalvós opciók hozzáadása + $accomodation_assoc = $sql->assoc_array("SELECT * FROM camp_accomodation_type WHERE cat_deleted = 0 ORDER BY cat_id ASC"); + $accomodation_array = array(); + foreach ($accomodation_assoc as $accomodation_type) { + $new_cat = new camp_accomodation_type(); + $new_cat->set_cat_data_by_id($accomodation_type['cat_id']); + $accomodation_array[] = $new_cat; + } + $smarty->assign('accomodation_array', $accomodation_array); + + + $smarty->display('camp_create.tpl'); + break; + case 'camp_shirt': + # CAMP SHIRT létrehozása + $smarty->display('camp_shirt_create.tpl'); + break; + case 'user_camp_leader': + # táborvezető létrehozása + $smarty->display('user_camp_leader_create.tpl'); + break; default: # code... break; diff --git a/_include/include_db_conn.php b/_include/include_db_conn.php new file mode 100644 index 0000000..9e37ba7 --- /dev/null +++ b/_include/include_db_conn.php @@ -0,0 +1,5 @@ +is_id()) { + + # JELENTKEZÉS ÁTÁLLÍTÁSA TÖRÖLT STÁTUSZRA + $sql->update_table('camp_apply', array('capp_status' => 5, 'capp_accept_date' => date("Y-m-d H:i:s")), array('capp_id' => $this->get_id())); + header("Location: /tabor/jelentkezesek"); + +} + +else { + + + + +} + + + + + +?> diff --git a/_include/include_delete_camp.php b/_include/include_delete_camp.php new file mode 100644 index 0000000..10bdbe9 --- /dev/null +++ b/_include/include_delete_camp.php @@ -0,0 +1,14 @@ +is_id()) { + //$delete_query = "DELETE FROM user_kid WHERE uk_id = " . $this->get_id() . ";"; + //$sql->execute_query($delete_query); + $sql->update_table('camp', array('camp_deleted' => 1), array('camp_id' => $this->get_id())); + $new_camp = new camp(); + $new_camp->set_camp_data_by_id($this->get_id()); + log::register('delete_camp', $new_camp->get_camp_from() . " (" . $new_camp->get_camp_city() . ")"); + header("Location: /admin/camps"); +} + + +?> \ No newline at end of file diff --git a/_include/include_delete_camp_leader.php b/_include/include_delete_camp_leader.php new file mode 100644 index 0000000..2396a4c --- /dev/null +++ b/_include/include_delete_camp_leader.php @@ -0,0 +1,10 @@ +is_id()) { + $sql->update_table('user_camp_leader', array('ucl_deleted' => 1), array('ucl_id' => $this->get_id())); + log::register('delete_camp_leader', $this->get_id()); + header("Location: /admin/camp_user"); +} + + +?> \ No newline at end of file diff --git a/_include/include_delete_camp_shirt.php b/_include/include_delete_camp_shirt.php new file mode 100644 index 0000000..7f027a0 --- /dev/null +++ b/_include/include_delete_camp_shirt.php @@ -0,0 +1,19 @@ +is_id()) { + + //akiknek ez a shirt_id van beállítva, azoknál null-ra állítjuk + $shirt_query = "SELECT ck_id FROM camp_kid WHERE ck_shirt_size_id = " . $this->get_id(); + $shirt_assoc_array = $sql->assoc_array($shirt_query); + foreach ($shirt_assoc_array as $uk_id) { + $sql->update_table('camp_kid', array('ck_shirt_size_id' => 'null'), array('ck_id' => $uk_id['ck_id'])); + } + + $sql->update_table('camp_shirt', array('cshirt_deleted' => 1), array('cshirt_id' => $this->get_id())); + + log::register('delete_camp_shirt', $this->get_id()); + header("Location: /admin/camp_shirt_type"); +} + + +?> \ No newline at end of file diff --git a/_include/include_delete_camp_type.php b/_include/include_delete_camp_type.php new file mode 100644 index 0000000..4fa395b --- /dev/null +++ b/_include/include_delete_camp_type.php @@ -0,0 +1,12 @@ +is_id()) { + //$delete_query = "DELETE FROM user_kid WHERE uk_id = " . $this->get_id() . ";"; + //$sql->execute_query($delete_query); + $sql->update_table('camp_type', array('ct_deleted' => 1), array('ct_id' => $this->get_id())); + log::register('delete_ct', $this->get_id()); + header("Location: /admin/camp_types"); +} + + +?> \ No newline at end of file diff --git a/_include/include_deny_apply.php b/_include/include_deny_apply.php new file mode 100644 index 0000000..1399bec --- /dev/null +++ b/_include/include_deny_apply.php @@ -0,0 +1,21 @@ +is_id()) { + + # JELENTEKEZÉS ELFOGADÁSA + camp_apply::apply_response($this->get_id(), 4); + $new_apply = new camp_apply(); + $new_apply->set_capp_data_by_id($this->get_id()); + header('Location: /admin/camps/' . $new_apply->get_capp_camp_id()->get_camp_id()); + + +} + + + + + + +?> diff --git a/cegled.sublime-project b/cegled.sublime-project new file mode 100644 index 0000000..24db303 --- /dev/null +++ b/cegled.sublime-project @@ -0,0 +1,8 @@ +{ + "folders": + [ + { + "path": "." + } + ] +} diff --git a/common.php b/common.php index 2d24536..5598098 100644 --- a/common.php +++ b/common.php @@ -98,15 +98,15 @@ $smarty->assign('today', date('Y-m-d')); $smarty->assign('error_msg', $error_msg); //SQL KAPCSOLAT BEÁLLÍTÁSA -if ($_SERVER['HTTP_HOST'] == 'cegledcoach.hu') $sql = new sql('cegled_mysql','root','','badminton_coach'); +if ($_SERVER['HTTP_HOST'] == 'badmintoncoach.hu') $sql = new sql('bc_mysql','root','b4dmint0nc04ch','badminton_coach'); else $sql = new sql('localhost','livingsp_coach','R186er012qw5','livingsp_badminton'); -$dev = $_SERVER['HTTP_HOST'] == 'cegledcoach.hu'; +$dev = $_SERVER['HTTP_HOST'] == 'badmintoncoach.hu'; $config = array(); if ($dev) { - $config['domain'] = 'cegledcoach.hu'; + $config['domain'] = 'badmintoncoach.hu'; } else { $config['domain'] = 'livingsport.hu'; diff --git a/event_handler.php b/event_handler.php index eb46e93..17ef631 100644 --- a/event_handler.php +++ b/event_handler.php @@ -59,6 +59,12 @@ if (isset($_POST['action'])) { log::register('coach_login', $user_coach_id, null, $user_coach_id); header("Location: " . $actual_link); } + elseif ($user_camp_id) { + //sikeres bejelentkezés táborózóként + $login->login_user($user_camp_id, 'badminton_camp_user', 4); + //log::register('camp_login', $user_coach_id, null, $user_coach_id); + header("Location: " . $actual_link); + } else { //die($user_coach_id); //sikertelen bejelentkezés diff --git a/index.php b/index.php index 795b3fe..ba48223 100644 --- a/index.php +++ b/index.php @@ -65,7 +65,7 @@ ob_start(); <?php if ($page->is_page() && ($page->get_page() == 'tabor')) { - echo "Tollaslabda táborok 2018. nyár"; + echo "Tollaslabda táborok 2021. nyár"; } else { echo "Badminton Coach"; diff --git a/queries/202104_camp.sql b/queries/202104_camp.sql new file mode 100644 index 0000000..ae87b93 --- /dev/null +++ b/queries/202104_camp.sql @@ -0,0 +1,17 @@ +INSERT INTO `page` (`page_id`, `page_url`) VALUES ('4', 'camp'); + +INSERT INTO `subpage` (`spage_id`, `spage_url`, `spage_title`, `spage_page_id`) VALUES (NULL, 'jelentkezes', 'Új jelentkezés', '4'), (NULL, 'jelentkezesek', 'Korábbi jelentkezések', '4'), (NULL, 'informaciok', 'Információk', '4'); + +INSERT INTO `setting` (`set_id`, `set_name`, `set_setting_type_st_id`) VALUES (5, 'Tábor - információk', '1') + +INSERT INTO `setting_value` (`setv_id`, `setv_set_date`, `setv_setting_set_id`, `setv_int`, `setv_varchar`, `setv_text`, `setv_date`) VALUES (NULL, '2021-04-10 09:38:07.000000', '5', NULL, '\'\'', NULL, NULL); + +INSERT INTO `subpage` (`spage_id`, `spage_url`, `spage_title`, `spage_page_id`) VALUES (NULL, 'camps', 'Táborok', '1'); + +INSERT INTO `camp_shuttle_type` (`cst_id`, `cst_name`, `cst_deleted`) VALUES (NULL, 'Műanyag labda', '0'), (NULL, 'Toll labda', '0'); + +INSERT INTO `camp_accomodation_type` (`cat_id`, `cat_name`, `cat_deleted`) VALUES (NULL, 'Bejárós', '0'), (NULL, 'Bentlakásos', '0'); + +INSERT INTO `camp_contact_type` (`cct_id`, `cct_name`, `cct_owner`) VALUES (NULL, 'szülő', NULL), (NULL, 'nagyszülő', NULL), (NULL, 'testvér', NULL); + +INSERT INTO `camp_apply_status` (`cas_id`, `cas_name`) VALUES (NULL, 'Kitöltés folyamatban'), (NULL, 'Leadva'), (NULL, 'Elfogadva'), (NULL, 'Elutasítva'), (NULL, 'Törölve'), (NULL, 'Eltávolított'); diff --git a/template/templates/applies.tpl b/template/templates/applies.tpl new file mode 100644 index 0000000..6f8167f --- /dev/null +++ b/template/templates/applies.tpl @@ -0,0 +1,108 @@ +<h1 class="apply">Visszaigazolt jelentkezések</h1> +<p class="center italic">A jelentkezés részleteinek megtekintéséhez kattintson az adatokra!</p> +<div class="outer"> + <table class="apply_table"> + <tr> + <th>#</th> + <th>Táborozó</th> + <th>Tábor helye, ideje</th> + <th>Jelentkezés ideje</th> + <th>Státusz</th> + <th>Visszaigazolás dátuma</th> + <th>Jelentkezés törlése</th> + </tr> + {if !count($apply_array)} + <tr> + <td colspan="7" class="no_data">Nincs még visszaigazolt jelentkezése</td> + </tr> + {else} + {foreach $apply_array as $apply} + <tr> + <td> + <a href="/tabor/jelentkezesek/{$apply->get_capp_id()}">{$apply->get_capp_id()}</a> + </td> + <td> + <a href="/tabor/jelentkezesek/{$apply->get_capp_id()}">{$apply->get_capp_camp_kid_ck_id()->get_ck_name()}</a> + </td> + <td> + <a href="/tabor/jelentkezesek/{$apply->get_capp_id()}">{$apply->get_capp_camp_id()->get_camp_city()} + ({$short_months[$apply->get_capp_camp_id()->get_camp_from()|date_format:"%m"]}. {$apply->get_capp_camp_id()->get_camp_from()|date_format:"%e"}. - + {if $apply->get_capp_camp_id()->get_camp_from()|date_format:"%m" != $apply->get_capp_camp_id()->get_camp_to()|date_format:"%m"} + {$short_months[$apply->get_capp_camp_id()->get_camp_to()|date_format:"%m"]}. + {/if} + {$apply->get_capp_camp_id()->get_camp_to()|date_format:"%e"}.)</a> + </td> + <td> + <a href="/tabor/jelentkezesek/{$apply->get_capp_id()}">{$apply->get_capp_date()|substr:0:16}</a> + </td> + <td style="color: {$color}; font-weight: bold;"> + <a href="/tabor/jelentkezesek/{$apply->get_capp_id()}">{$apply->get_capp_status()}</a> + </td> + <td> + <a href="/tabor/jelentkezesek/{$apply->get_capp_id()}">{$apply->get_capp_accept_date()|substr:0:16}</a> + </td> + <td> + <img id="{$apply->get_capp_id()}" onclick="delete_apply(this);" src="/_image/delete.png"> + </td> + </tr> + {/foreach} + {/if} + </table> +</div> + +<h1 class="apply">Függőben lévő jelentkezések</h1> +<p class="center italic">A jelentkezés részleteinek megtekintéséhez kattintson az adatokra!</p> +<div class="outer"> + <table class="apply_table"> + <tr> + <th>#</th> + <th>Táborozó</th> + <th>Tábor helye, ideje</th> + <th>Jelentkezés ideje</th> + <th>Jelentkezés törlése</th> + </tr> + {if !count($pending_apply_array)} + <tr> + <td colspan="5" class="no_data">Nincs függőben lévő jelentkezése</td> + </tr> + {else} + {foreach $pending_apply_array as $apply} + <tr> + <td> + <a href="/tabor/jelentkezesek/{$apply->get_capp_id()}">{$apply->get_capp_id()}</a> + </td> + <td> + <a href="/tabor/jelentkezesek/{$apply->get_capp_id()}">{$apply->get_capp_camp_kid_ck_id()->get_ck_name()}</a> + </td> + <td> + <a href="/tabor/jelentkezesek/{$apply->get_capp_id()}">{$apply->get_capp_camp_id()->get_camp_city()} + ({$short_months[$apply->get_capp_camp_id()->get_camp_from()|date_format:"%m"]}. {$apply->get_capp_camp_id()->get_camp_from()|date_format:"%e"}. - + {if $apply->get_capp_camp_id()->get_camp_from()|date_format:"%m" != $apply->get_capp_camp_id()->get_camp_to()|date_format:"%m"} + {$short_months[$apply->get_capp_camp_id()->get_camp_to()|date_format:"%m"]}. + {/if} + {$apply->get_capp_camp_id()->get_camp_to()|date_format:"%e"}.)</a> + </td> + <td> + <a href="/tabor/jelentkezesek/{$apply->get_capp_id()}">{$apply->get_capp_date()|substr:0:16}</a> + </td> + <td> + <img id="{$apply->get_capp_id()}" onclick="delete_apply(this);" src="/_image/delete.png"> + </td> + </tr> + {/foreach} + {/if} + </table> +</div> + +<script type="text/javascript"> + + function delete_apply(img) { + var r = confirm("Biztos törli ezt a jelentkezést?"); + if (r == true) { + location.href = '/tabor/delete_apply/' + $(img).attr("id"); + } else { + return false; + } + } + +</script> diff --git a/template/templates/camp_apply.tpl b/template/templates/camp_apply.tpl new file mode 100644 index 0000000..f4390eb --- /dev/null +++ b/template/templates/camp_apply.tpl @@ -0,0 +1,383 @@ + {if $step == 1} + +<div class="form_wrapper"> + <form method="post" id="apply_1"> + <div><div><h1>1/3. Táborozó adatainak megadása</h1></div></div> + <input type="hidden" name="action" id="action" value="apply_1"> + <input type="hidden" name="ck_original_id" id="ck_original_id" value="null"> + <input type="hidden" name="ck_owner_id" id="ck_owner_id" value="{$user_login->get_cu_id()}"> + <div> + <label class="desc" for="ck_list">Korábban megadott adatok:</label> + <div> + <select name="ck_list" id="ck_list"> + <option value="null"> - (új adatok megadása) </option> + {foreach $kids as $kid} + <option value="{$kid->get_ck_id()}"> + {$kid->get_ck_name()} + </option> + {/foreach} + </select> + </div> + </div> + <br> + <div> + <label class="desc" for="ck_name">Táborozó neve:</label> + <div><input type="text" name="ck_name" id="ck_name" required></div> + </div> + <div> + <label class="desc" for="ck_birth_year">Születési év:</label> + <div><input type="text" name="ck_birth_year" id="ck_birth_year" required></div> + </div> + <div> + <label class="desc" for="ck_ss_number">TAJ szám:</label> + <div><input type="text" name="ck_ss_number" id="ck_ss_number" required></div> + </div> + <div> + <label class="desc" for="ck_email">E-mail cím:</label> + <div><input type="text" name="ck_email" id="ck_email"></div> + </div> + <div> + <label class="desc" for="ck_mobile">Telefonszám:</label> + <div><input type="text" name="ck_mobile" id="ck_mobile"></div> + </div> + <div> + <label class="desc" for="ck_badminton_history">Tollaslabda múlt:</label> + <div><textarea rows="5" name="ck_badminton_history" id="ck_badminton_history"></textarea></div> + </div> + <div> + <label class="desc" for="ck_sport_history">Sport múlt:</label> + <div><textarea rows="5" name="ck_sport_history" id="ck_sport_history"></textarea></div> + </div> + <div> + <label class="desc" for="ck_list">Pólóméret:</label> + <div> + <select required="required" name="ck_shirt_size_id" id="ck_shirt_size_id"> + <option value="" disabled selected>Válasszon...</option> + {foreach $shirts as $shirt} + <option value="{$shirt->get_cshirt_id()}"> + {$shirt->get_cshirt_name()} + </option> + {/foreach} + </select> + </div> + </div> + <div> + <label class="desc" for="ck_food_info">Étkezéssel kapcsolatos tudnivalók:</label> + <div><textarea rows="5" name="ck_food_info" id="ck_food_info"></textarea></div> + </div> + <div> + <label class="desc" for="ck_hygiene_info">Tisztálkodással kapcsolatos tudnivalók:</label> + <div><textarea rows="5" name="ck_hygiene_info" id="ck_hygiene_info"></textarea></div> + </div> + <div> + <label class="desc" for="ck_health_info">Egészségügyi tudnivalók:</label> + <div><textarea rows="5" name="ck_health_info" id="ck_health_info"></textarea></div> + </div> + <div> + <label class="desc" for="ck_pharma_info">Rendszeres vagy alkalmi gyógyszer:</label> + <div><textarea rows="5" name="ck_pharma_info" id="ck_pharma_info"></textarea></div> + </div> + <div> + <label class="desc" for="ck_other_info">Egyéb tudnivalók:</label> + <div><textarea rows="5" name="ck_other_info" id="ck_other_info"></textarea></div> + </div> + <div> + <div> + <input class="button black" type="submit" value="Tovább a kapcsolattartó adataihoz"> + </div> + </div> + </form> +</div> + +{elseif $step == 2} + +<h1 class="apply">2/3. Kapcsolattartó adatainak megadása</h1> +<p class="center reset"><a href="/tabor/jelentkezes/1">Jelentkezés újrakezdése</a><img src="/_image/delete.png"></p> +<div class="form_wrapper"> + <form method="post" id="apply_2"> + <input type="hidden" name="action" id="action" value="apply_2"> + <input type="hidden" name="camp_apply_id" id="camp_apply_id" value="{$camp_apply_id}"> + <input type="hidden" name="cc_original_id" id="cc_original_id" value="null"> + <input type="hidden" name="cc_owner_id" id="cc_owner_id" value="{$user_login->get_cu_id()}"> + <input type="hidden" name="add_more" id="add_more" value="0"> + <div> + <label class="desc" for="ck_list">Korábban megadott adatok:</label> + <div> + <select name="cc_list" id="cc_list"> + <option value="null"> - (új adatok megadása) </option> + {foreach $contacts as $contact} + <option value="{$contact->get_cc_id()}"> + {$contact->get_cc_name()} + </option> + {/foreach} + </select> + </div> + </div> + <br> + <div> + <label class="desc" for="cc_name">Kapcsolattartó neve:</label> + <div><input type="text" name="cc_name" id="cc_name" required></div> + </div> + {if !$has_responsible} + <div> + <label class="desc" for="cc_is_responsible">Felelős kapcsolattartó (Táborozónként 1 felelős kapcsolattartó megadása kötelező!):</label> + <div><input type="checkbox" name="cc_is_responsible" id="cc_is_responsible" value="1" checked></div> + </div> + {/if} + <div> + <label class="desc" for="cc_mobile">Telefonszám:</label> + <div><input type="text" name="cc_mobile" id="cc_mobile" required></div> + </div> + <div> + <label class="desc" for="cc_email">E-mail cím:</label> + <div><input type="text" name="cc_email" id="cc_email" required></div> + </div> + <div> + <label class="desc" for="cc_facebook">Facebook:</label> + <div><input type="text" name="cc_facebook" id="cc_facebook"></div> + </div> + <div> + <label class="desc" for="ck_list">Kapcsolat a Táborozóval:</label> + <div> + <select name="cc_camp_contact_type_cct_id" id="cc_camp_contact_type_cct_id"> + {foreach $cct_array as $cct} + <option value="{$cct->get_cct_id()}"> + {$cct->get_cct_name()} + </option> + {/foreach} + <option value="new">- új megadása -</option> + </select> + </div> + <div id="cct_extra_row"><input type="text" name="cct_add_new" id="cct_add_new" placeholder="Új kapcsolat megadása"></div> + </div> + <div> + <div> + <button class="button black" id="add_more_cct">Mentés és új kapcsolattartó hozzáadása</button> + </div> + {if $has_contact} + <div> + <button class="button black" id="move_next">Továbblépés mentés nélkül</button> + </div> + {/if} + <div> + <input class="button black" type="submit" value="Mentés és tovább a tábor adatok megadásához"> + </div> + </div> + </form> +</div> + +{elseif $step == 3} + +<div><h1>2/3. Kapcsolattartó adatainak megadása</h1></div> +<div class="danger">Ön nem adott meg felelős kapcsolattartót. Kérjük, a jelentkezéshez válasszon ki 1 felelős kapcsolattartót!</div> + <form method="post" id="apply_3"> + <input type="hidden" name="action" id="action" value="apply_3"> + <input type="hidden" name="camp_apply_id" id="camp_apply_id" value="{$camp_apply_id}"> + <table> + {foreach $contacts as $contact} + <tr> + <td>{$contact->get_cc_name()}</td> + <td><input type="radio" name="cc_is_responsible" value="{$contact->get_cc_id()}" {if $contact@first} checked{/if}></td> + </tr> + {/foreach} + </table> + <div> + <input class="button black middle" type="submit" value="Tovább a tábor adatok megadásához"> + </div> + </form> + + +{elseif $step == 4} + +<div><h1>3/3. Tábor kiválasztása</h1></div> +<p class="center reset"><a href="/tabor/jelentkezes/1">Jelentkezés újrakezdése</a><img src="/_image/delete.png"></p> +<form method="post" id="apply_4"> + <input type="hidden" name="action" id="action" value="apply_4"> + <input type="hidden" name="camp_apply_id" id="camp_apply_id" value="{$camp_apply_id}"> + <table> + {foreach $camp_array as $camp} + <td>{$camp->get_camp_city()}</td> + <td>({$short_months[$camp->get_camp_from()|date_format:"%m"]}. {$camp->get_camp_from()|date_format:"%e"}. - + {if $camp->get_camp_from()|date_format:"%m" != $camp->get_camp_to()|date_format:"%m"} + {$short_months[$camp->get_camp_to()|date_format:"%m"]}. + {/if} + {$camp->get_camp_to()|date_format:"%e"}.{if $camp->get_camp_type()->get_ct_name() != " "}, {$camp->get_camp_type()->get_ct_name()}{/if})</td> + <td><input id="camp_{$camp->get_camp_id()}" class="camp_id" type="radio" name="camp_id" value="{$camp->get_camp_id()}" {if $camp@first} checked{/if}></td> + </tr> + {/foreach} + </table> + <div id="accom_list"></div> + <div id="shuttle_list"></div> + <table class="accept_terms_box"> + <tr> + <td>Kijelentem, hogy minden, az edzőtábor szempontjából fontos információt megadtam, a gyerek egyesületének edzőjét az edzőtáborról tájékoztattam.</td> + <td><input type="checkbox" name="accept_terms" id="accept_terms"></td> + </tr> + </table> + <div> + <input id="submit_apply" class="button apply middle" type="submit" value="Jelentkezés leadása" disabled="disabled"> + </div> +</form> + +<script type="text/javascript"> + $( document ).ready(function() { + $('.camp_id:checked').trigger('change'); + }); +</script> + +{elseif $step == 5} + +<h1>Jelentkezését sikeresen rögzítettük!</h1><br><br> +<h2>A jelentkezés állapotát a 'Korábbi jelentkezések' menüpont alatt tekintheti meg! + +{/if} + + +<script type="text/javascript"> +$("#cc_camp_contact_type_cct_id" ).change(function() { +if ($(this).val() == 'new') { + $("#cct_extra_row" ).show(); +} +else { + $("#cct_extra_row" ).hide(); +} +}); + + +$("#add_more_cct" ).click(function() { + $("#add_more").val('1'); + $("#apply_2").submit(); +}); + +$("#move_next" ).click(function() { + location.href = "/tabor/move_next"; +}); + +$(".camp_id").change(function() { + $.post("/_ajax/get_camp_shuttle_list.php", + { + camp_id: $(this).val() + }, + function(data, status){ + var pdata = JSON.parse(data); + //console.log(pdata); + if (pdata.length >= 2) { + var content = '<h2>Kérjük, válassza ki a Táborozó által előnyben részesített labda típust!</h2><table>'; + $.each(pdata, function(shuttle_id, shuttle_name){ + content += + '\ + <tr>\ + <td>'+shuttle_name['cst_name']+'</td>\ + <td><input type="radio" name="camp_shuttle" value="'+shuttle_name['cst_id']+ '"' + (shuttle_id==0?' checked':'') +'></td>\ + </tr>\ + ' + }); + content += '</table>'; + document.getElementById('shuttle_list').innerHTML = content; + } + else if (pdata.length == 1) { + content = '<input type="hidden" name="camp_shuttle" value="'+pdata[0]['cst_id']+'">'; + document.getElementById('shuttle_list').innerHTML = content; + } + }); + + $.post("/_ajax/get_camp_accomodation_list.php", + { + camp_id: $(this).val() + + }, + function(data, status){ + var pdata = JSON.parse(data); + //console.log(pdata); + if (pdata.length >= 2) { + var content = '<h2>Kérjük, válassza ki a tábor típusát!</h2><table>'; + $.each(pdata, function(accom_id, accom_data){ + content += + '\ + <tr>\ + <td>'+accom_data['cat_name']+'</td>\ + <td><input type="radio" name="camp_accomodation" value="'+accom_data['cat_id']+ '"' + (accom_id==0?' checked':'') +'></td>\ + </tr>\ + ' + }); + content += '</table>'; + document.getElementById('accom_list').innerHTML = content; + } + else if (pdata.length == 1) { + content = '<input type="hidden" name="camp_accomodation" value="'+pdata[0]['cat_id']+'">'; + document.getElementById('accom_list').innerHTML = content; + } + }); + +}); + +$("#ck_list").change(function() { + if ($("#ck_list").val() == 'null') { + document.getElementById("apply_1").reset(); + } + else { + $.post("/_ajax/get_camp_kid_data.php", + { + camp_kid_id: $(this).val() + }, + function(data, status){ + var pdata = JSON.parse(data); + //console.log(pdata); + + $.each(pdata[0], function(index, ck_data){ + if ( + index != 'ck_deleted' && + index != 'ck_id' && + index != 'ck_original_id' && + index != 'ck_owner_id' + ) { + $("#"+index).val(ck_data); + } + }); + + + + }); + } +}); + +$("#cc_list").change(function() { + if ($("#cc_list").val() == 'null') { + document.getElementById("apply_2").reset(); + } + else { + $.post("/_ajax/get_camp_contact_data.php", + { + camp_contact_id: $(this).val() + }, + function(data, status){ + var pdata = JSON.parse(data); + //console.log(pdata); + $.each(pdata[0], function(index, ck_data){ + if ( + index != 'cc_id' && + index != 'cc_original_id' && + index != 'cc_owner_id' + + ) { + $("#"+index).val(ck_data); + } + }); + + }); + } +}); + + +$("#accept_terms").change(function() { + if ($("#accept_terms").is(':checked')) { + $("#submit_apply").prop('disabled', false); + } + else { + $("#submit_apply").prop('disabled', true); + } + +}); + + +</script> diff --git a/template/templates/camp_create.tpl b/template/templates/camp_create.tpl new file mode 100644 index 0000000..6792317 --- /dev/null +++ b/template/templates/camp_create.tpl @@ -0,0 +1,71 @@ +<div class="form_wrapper"> + <form method="post"> + <input type="hidden" name="action" value="camp_create"> + + <div> + <label class="desc" for="camp_city">Helyszín:</label> + <div><input type="text" name="camp_city" id="camp_city" required></div> + </div> + <div> + <label class="desc" for="camp_from">Tábor kezdete:</label> + <div><input type="text" name="camp_from" id="camp_from" class="datepicker" required></div> + </div> + <div> + <label class="desc" for="camp_to">Tábor vége:</label> + <div><input type="text" name="camp_to" id="camp_to" class="datepicker" required></div> + </div> + <div> + <label class="desc" for="camp_leader">Táborvezető:</label> + <div><input type="text" name="camp_leader" id="camp_leader"></div> + </div> + <div> + <label class="desc" for="camp_helpers">Segítők:</label> + <div><input type="text" name="camp_helpers" id="camp_helpers"></div> + </div> + <div> + <label class="desc" for="camp_is_open">Lehet jelentkezni:</label> + <div><input type="checkbox" name="camp_is_open" id="camp_is_open" value="1" checked></div> + </div> + <div> + <label class="desc" for="camp_camp_type_ct_id">Típus:</label> + <div> + <select name="camp_camp_type_ct_id" id="camp_camp_type_ct_id"> + {foreach $camp_type_array as $camp_type} + <option value="{$camp_type->get_ct_id()}"> + {$camp_type->get_ct_name()} + </option> + {/foreach} + </select> + </div> + </div> + <div> + <label class="desc" for="shuttles">Labda típus:</label> + <table> + {foreach $shuttle_array as $shuttle} + <tr> + <td><input type="checkbox" name="shuttles[]" value="{$shuttle->get_cst_id()}" class="coach_type"></td> + <td class="coach">{$shuttle->get_cst_name()}</td> + </tr> + {/foreach} + </table> + </div> + <div> + <label class="desc" for="shuttles">Bejárás típusa:</label> + <table> + {foreach $accomodation_array as $accomodation} + <tr> + <td><input type="checkbox" name="accomodations[]" value="{$accomodation->get_cat_id()}" class="coach_type"></td> + <td class="coach">{$accomodation->get_cat_name()}</td> + </tr> + {/foreach} + </table> + </div> + + <div> + <div> + <input class="button black" type="submit" value="Létrehozás"> + </div> + </div> + + </form> +</div> diff --git a/template/templates/camp_data_update.tpl b/template/templates/camp_data_update.tpl new file mode 100644 index 0000000..69923b0 --- /dev/null +++ b/template/templates/camp_data_update.tpl @@ -0,0 +1,195 @@ +<div class="form_wrapper"> + <form method="post"> + <div class="buttons"> + <a href="/admin/delete_camp/{$camp->get_camp_id()}" class="addbutton delete-big">Tábor törlése</a> + </div> + <input type="hidden" name="action" value="camp_update"> + <input type="hidden" name="camp_id" value="{$camp->get_camp_id()}"> + + <div> + <label class="desc" for="camp_city">Helyszín:</label> + <div><input type="text" name="camp_city" id="camp_city" value="{$camp->get_camp_city()}" required></div> + </div> + <div> + <label class="desc" for="camp_from">Tábor kezdete:</label> + <div><input type="text" name="camp_from" id="camp_from" value="{$camp->get_camp_from()}" class="datepicker" required></div> + </div> + <div> + <label class="desc" for="camp_to">Tábor vége:</label> + <div><input type="text" name="camp_to" id="camp_to" value="{$camp->get_camp_to()}" class="datepicker" required></div> + </div> + <div> + <label class="desc" for="camp_leader">Táborvezető:</label> + <div><input type="text" name="camp_leader" id="camp_leader" value="{$camp->get_camp_leader()}"></div> + </div> + <div> + <label class="desc" for="camp_helpers">Segítők:</label> + <div><input type="text" name="camp_helpers" id="camp_helpers" value="{$camp->get_camp_helpers()}"></div> + </div> + <div> + <label class="desc" for="camp_is_open">Lehet jelentkezni:</label> + <div><input type="checkbox" name="camp_is_open" id="camp_is_open" value="1" {if 1==$camp->get_camp_is_open()}checked{/if}></div> + </div> + <div> + <label class="desc" for="camp_camp_type_ct_id">Típus:</label> + <div> + <select name="camp_camp_type_ct_id" id="camp_camp_type_ct_id"> + {foreach $camp_type_array as $camp_type} + <option value="{$camp_type->get_ct_id()}" {if $camp->get_camp_camp_type_ct_id() == $camp_type->get_ct_id()}selected{/if}> + {$camp_type->get_ct_name()} + </option> + {/foreach} + </select> + </div> + </div> + <div> + <label class="desc" for="shuttles">Labda típus:</label> + <table> + {foreach $shuttle_array as $shuttle} + <tr> + <td><input type="checkbox" name="shuttles[]" value="{$shuttle->get_cst_id()}" class="coach_type" {if in_array($shuttle->get_cst_id(), $shuttles)}checked{/if}></td> + <td class="coach">{$shuttle->get_cst_name()}</td> + </tr> + {/foreach} + </table> + </div> + <div> + <label class="desc" for="shuttles">Bejárás típusa:</label> + <table> + {foreach $accomodation_array as $accomodation} + <tr> + <td><input type="checkbox" name="accomodations[]" value="{$accomodation->get_cat_id()}" class="coach_type" {if in_array($accomodation->get_cat_id(), $accomodations)}checked{/if}></td> + <td class="coach">{$accomodation->get_cat_name()}</td> + </tr> + {/foreach} + </table> + </div> + + <div> + <div> + <input class="button black" type="submit" value="Mentés"> + </div> + </div> + + </form> +</div> +<br><br> + +<h1 class="apply" id="applies">Függőben lévő jelentkezések</h1> +<div class="outer"> + <table class="apply_table"> + <tr> + <th>#</th> + <th>Jelentkező</th> + <th>Jelentkezés ideje</th> + <th>Elfogadás</th> + <th>Elutasítás</th> + <th>E-mail</th> + </tr> + {if !count($pending_apply_array)} + <tr> + <td colspan="6" class="no_data">Nincs függőben lévő jelentkezés</td> + </tr> + {else} + {foreach $pending_apply_array as $apply} + <tr> + <td> + <a href="/admin/apply/{$apply->get_capp_id()}" class="bold">{$apply->get_capp_id()}</a> + </td> + <td> + {$apply->get_capp_camp_kid_ck_id()->get_ck_name()} + </td> + <td> + {$apply->get_capp_date()|substr:0:16} + </td> + <td> + <a href="/admin/accept_apply/{$apply->get_capp_id()}"><img src="/_image/tick.png"></a> + </td> + <td> + <a href="/admin/deny_apply/{$apply->get_capp_id()}"><img src="/_image/delete.png"></a> + </td> + <td> + <a href='mailto:{$apply->get_responsible_contact()->get_cc_email()}?subject=Tollaslabda tábor {$camp->get_camp_from()|substr:0:4}. {$months[$camp->get_camp_from()|date_format:"%m"]} {$camp->get_camp_from()|date_format:"%e"}{if $camp->get_camp_from()|date_format:"%m" != $camp->get_camp_to()|date_format:"%m"}. - {$months[$camp->get_camp_to()|date_format:"%m"]} {else} - {/if}{$camp->get_camp_to()|date_format:"%e"}. +&body=Kedves {$apply->get_responsible_contact()->get_cc_name()}!'>{$apply->get_responsible_contact()->get_cc_email()}</a> + </td> + </tr> + {/foreach} + {/if} + </table> +</div> + +{if count($deleted_apply_array)} +<h1 class="apply">Törölt jelentkezések</h1> +<div class="outer"> + <table class="apply_table"> + <tr> + <th>#</th> + <th>Jelentkező</th> + <th>Törlés ideje</th> + <th>Eltávolítás a listából</th> + </tr> + {foreach $deleted_apply_array as $apply} + <tr> + <td class="bold"> + <a href="/admin/apply/{$apply->get_capp_id()}" class="bold">{$apply->get_capp_id()}</a> + </td> + <td> + {$apply->get_capp_camp_kid_ck_id()->get_ck_name()} + </td> + <td> + {$apply->get_capp_accept_date()|substr:0:16} + </td> + <td> + <a href="/admin/remove_apply/{$apply->get_capp_id()}"><img src="/_image/delete.png"></a> + </td> + </tr> + {/foreach} + </table> +</div> +{/if} + +<h1 class="apply">Visszaigazolt jelentkezések ({count($camp->get_camp_applies())} fő)</h1> +<div class="outer"> + <table class="apply_table"> + <tr> + <th>#</th> + <th>Jelentkező</th> + <th>Jelentkezés ideje</th> + <th>Státusz</th> + <th>Visszaigazolva</th> + <th>Módosítás</th> + </tr> + {if !count($apply_array)} + <tr> + <td colspan="6" class="no_data">Nincs még visszaigazolt jelentkezés</td> + </tr> + {else} + {foreach $apply_array as $apply} + <tr> + <td class="bold"> + <a href="/admin/apply/{$apply->get_capp_id()}" class="bold">{$apply->get_capp_id()}</a> + </td> + <td> + {$apply->get_capp_camp_kid_ck_id()->get_ck_name()} + </td> + <td> + {$apply->get_capp_date()|substr:0:16} + </td> + <td style="color: {if $apply->get_capp_status() == 'Elfogadva'}green{else}red{/if}; font-weight: bold;"> + {$apply->get_capp_status()} + </td> + <td> + {$apply->get_capp_accept_date()|substr:0:16} + </td> + <td> + {if $apply->get_capp_status() == 'Elutasítva'} + <a href="/admin/accept_apply/{$apply->get_capp_id()}"><img src="/_image/tick.png"></a> + {else} + <a href="/admin/deny_apply/{$apply->get_capp_id()}"><img src="/_image/delete.png"></a> + {/if} + </td> + </tr> + {/foreach} + {/if} + </table> +</div> diff --git a/template/templates/camp_details.tpl b/template/templates/camp_details.tpl new file mode 100644 index 0000000..d6e56be --- /dev/null +++ b/template/templates/camp_details.tpl @@ -0,0 +1,65 @@ +<div class="list full_width camp_list"> +{foreach $camps as $camp} + + <span onclick="block_action('camp_'+{$camp->get_camp_id()})" class="date_separator clickable"> + {$camp->get_camp_from()|substr:0:4}. + {$months[$camp->get_camp_from()|date_format:"%m"]} {$camp->get_camp_from()|date_format:"%e"}. - + {if $camp->get_camp_from()|date_format:"%m" != $camp->get_camp_to()|date_format:"%m"} + {$months[$camp->get_camp_to()|date_format:"%m"]}. + {/if} + {$camp->get_camp_to()|date_format:"%e"}., {$camp->get_camp_type()->get_ct_name()} + + + ({$camp->get_camp_city()}) + <img src="/_image/open_folder.png"> + <div class="float_right"> + {count($camp->get_camp_applies())} fő    + </div> + </span> + + <div id="camp_{$camp->get_camp_id()}" class="month_block"> + {foreach $camp->get_camp_applies() as $apply} + + <a href="/{if $page == 'admin'}admin{else}taborvezeto{/if}/{if $page == 'admin'}apply{else}jelentkezes{/if}/{$apply->get_capp_id()}"> + <div class="list_item"> + <img src="/_image/person.png"> + {$apply->get_capp_camp_kid_ck_id()->get_ck_name()} + </div> + </a> + {/foreach} + </div> +{/foreach} + +</div> + +<script> + +function open_block(block_id) { + $("#"+block_id).slideDown("slow"); +} + +function close_block(block_id) { + $("#"+block_id).slideUp("slow"); +} + +function block_action(block_id) { + if ($("#"+block_id).is(':hidden')) { + open_block(block_id); + } + else { + close_block(block_id); + } +} + + +$( document ).ready(function() { + var divs = $( "div[class=month_block]" ); + $( ".list" ).find( divs ).hide(); + var div_list = $( ".list" ).find( divs ); + + //open_block(div_list[0].id); + +}); + + +</script> \ No newline at end of file diff --git a/template/templates/camp_list.tpl b/template/templates/camp_list.tpl new file mode 100644 index 0000000..90d33d5 --- /dev/null +++ b/template/templates/camp_list.tpl @@ -0,0 +1,95 @@ +<div class="buttons"> + <div class="buttons"> + <a href="/admin/create/camp" class="addbutton add-big">Új tábor létrehozása</a> + <a href="/admin/camp_types" class="addbutton add-big">Tábor típusok</a> + <a href="/admin/camp_shirt_type" class="addbutton add-big">Pólók</a> + <a href="/admin/camp_details" class="addbutton add-big">Turnus lista</a> + </div> +</div> +<div class="list full_width"> + {foreach $camp_array as $camp} + {if + $camp@first || + ( + $camp_array[$camp@index]->get_camp_to()|substr:5:2 != $camp_array[$camp@index-1]->get_camp_to()|substr:5:2 + ) + + } + {if !$camp@first && + $camp_array[$camp@index]->get_camp_to()|substr:5:2 != $camp_array[$camp@index-1]->get_camp_to()|substr:5:2 + } + </div> + {/if} + <span onclick="block_action('block_{$camp->get_camp_to()|substr:0:4}{$camp->get_camp_to()|substr:5:2}');" class="date_separator clickable">{$camp_array[$camp@index]->get_camp_to()|substr:0:4}. + {$months[$camp_array[$camp@index]->get_camp_to()|substr:5:2]} + <img src="/_image/open_folder.png"> + </span> + <div id="block_{$camp->get_camp_to()|substr:0:4}{$camp->get_camp_to()|substr:5:2}" class="month_block"> + {/if} + <a href="/admin/camps/{$camp->get_camp_id()}"> + <div class="list_item" {if $camp->has_pending_apply() || $camp->has_deleted_apply()}style="background-color: #ff9205;"{/if}> + <img src="/_image/camp.png"> + {strip} + {$camp->get_camp_from()|substr:0:4}.  + {$months[$camp->get_camp_from()|date_format:"%m"]} {$camp->get_camp_from()|date_format:"%e"} + {if $camp->get_camp_from()|date_format:"%m" != $camp->get_camp_to()|date_format:"%m"} + . - {$months[$camp->get_camp_to()|date_format:"%m"]}  + {else} +  -  + {/if} + {$camp->get_camp_to()|date_format:"%e"}., {$camp->get_camp_type()->get_ct_name()} + {/strip} + + + ({$camp->get_camp_city()}) + + {if $camp->has_pending_apply()} + <span class="pending">[{$camp->has_pending_apply()} új jelentkezés]</span> + {/if} + {if $camp->has_deleted_apply()} + <span class="pending">[{$camp->has_deleted_apply()} törölt jelentkezés]</span> + {/if} + </div> + </a> + {if $camp@last} + </div> + {/if} + {/foreach} + +</div> + +<script> + +function open_block(block_id) { + $("#"+block_id).slideDown("slow"); +} + +function close_block(block_id) { + $("#"+block_id).slideUp("slow"); +} + +function block_action(block_id) { + if ($("#"+block_id).is(':hidden')) { + open_block(block_id); + } + else { + close_block(block_id); + } +} + + +$( document ).ready(function() { + var divs = $( "div[class=month_block]" ); + $( ".list" ).find( divs ).hide(); + var div_list = $( ".list" ).find( divs ); + + //open_block(div_list[0].id); + //alert(div_list.length); + for (var i = 0; i <= div_list.length - 1; i++) { + open_block(div_list[i].id); + } + +}); + + +</script> diff --git a/template/templates/camp_shirt_create.tpl b/template/templates/camp_shirt_create.tpl new file mode 100644 index 0000000..d5b7069 --- /dev/null +++ b/template/templates/camp_shirt_create.tpl @@ -0,0 +1,17 @@ +<div class="form_wrapper"> + <form method="post"> + <input type="hidden" name="action" value="camp_shirt_create"> + + <div> + <label class="desc" id="title1" for="shirt_name">Póló típus neve:</label> + <div><input type="text" name="shirt_name" id="shirt_name" required></div> + </div> + + <div> + <div> + <input class="button black" type="submit" value="Létrehozás"> + </div> + </div> + + </form> +</div> \ No newline at end of file diff --git a/template/templates/camp_shirt_data_edit.tpl b/template/templates/camp_shirt_data_edit.tpl new file mode 100644 index 0000000..c281b44 --- /dev/null +++ b/template/templates/camp_shirt_data_edit.tpl @@ -0,0 +1,23 @@ +<div class="form_wrapper"> + <form method="post"> + <div class="buttons"> + <a href="/admin/delete_camp_shirt/{$camp_shirt_array.cshirt_id}" class="addbutton delete-big">Póló törlése</a> + </div> + <input type="hidden" name="action" value="camp_shirt_data_edit"> + <input type="hidden" name="shirt_id" value="{$camp_shirt_array.cshirt_id}"> + + <div> + <label class="desc" id="title1" for="shirt_name">Póló típus neve:</label> + <div><input type="text" name="shirt_name" id="shirt_name" value="{$camp_shirt_array.cshirt_name}" required></div> + </div> + + + + <div> + <div> + <input class="button black" type="submit" value="Mentés"> + </div> + </div> + + </form> +</div> \ No newline at end of file diff --git a/template/templates/camp_shirt_list.tpl b/template/templates/camp_shirt_list.tpl new file mode 100644 index 0000000..db2b374 --- /dev/null +++ b/template/templates/camp_shirt_list.tpl @@ -0,0 +1,18 @@ +<div class="buttons"> + + <a href="/admin/create/camp_shirt" class="addbutton add-big">Új póló hozzáadása</a> + +</div> + +<div class="list"> + {foreach $shirt_assoc_array as $shirt} + <a href="/admin/camp_shirt_type/{$shirt.cshirt_id}"> + <div class="list_item"> + <img src="/_image/shirt.png"> + {$shirt.cshirt_name} + </div> + </a> + {/foreach} + +</div> + diff --git a/template/templates/camp_type_create.tpl b/template/templates/camp_type_create.tpl new file mode 100644 index 0000000..f863388 --- /dev/null +++ b/template/templates/camp_type_create.tpl @@ -0,0 +1,17 @@ +<div class="form_wrapper"> + <form method="post"> + <input type="hidden" name="action" value="camp_type_create"> + + <div> + <label class="desc" id="title1" for="ct_name">Tábor típus neve:</label> + <div><input type="text" name="ct_name" id="ct_name" required></div> + </div> + + <div> + <div> + <input class="button black" type="submit" value="Létrehozás"> + </div> + </div> + + </form> +</div> \ No newline at end of file diff --git a/template/templates/camp_type_list.tpl b/template/templates/camp_type_list.tpl new file mode 100644 index 0000000..61f01cb --- /dev/null +++ b/template/templates/camp_type_list.tpl @@ -0,0 +1,23 @@ +<div class="form_wrapper"> + <form method="post"> + <input type="hidden" name="action" value="camp_type_update"> + <div class="buttons"> + <a href="/admin/create/camp_type" class="addbutton add-big">Új tábor típus hozzáadása</a> + </div> + {foreach $ct_array as $ct} + <div> + <div style="float: left;"> + <input type="text" name="ct_{$ct->get_ct_id()}" id="scc_{$ct->get_ct_id()}" value="{$ct->get_ct_name()}"> + <a href="/admin/delete_camp_type/{$ct->get_ct_id()}" class="addbutton delete">Törlés</a> + </div> + </div> + + + {/foreach} + <div> + <div style="float: left;"> + <input class="button black" type="submit" value="Mentés"> + </div> + </div> + </form> +</div> \ No newline at end of file diff --git a/template/templates/login.tpl b/template/templates/login.tpl index b07a3ea..ec956ea 100644 --- a/template/templates/login.tpl +++ b/template/templates/login.tpl @@ -1,4 +1,3 @@ -{if $page == 'tabor'}<div class="danger">Probléma, kérdés, hibás adat esetén kérjük, küldjön üzenetet a <a href="mailto:szucs.zoltan@tollaslabda.info">szucs.zoltan@tollaslabda.info</a> címre!</div>{/if} <div class="login-page"> <div class="form"> <form class="login-form" id="login-form" method="post">