From fa0e1a6488e2f4a7082608bb64536562019247ad Mon Sep 17 00:00:00 2001 From: Ricsi Date: Mon, 12 Jun 2017 00:31:22 +0200 Subject: [PATCH] camp fixes; cookie box --- _class/class_camp.php | 5 + _class/class_camp_apply.php | 13 ++ _class/class_page.php | 20 ++- _css/button.css | 4 +- _css/camp.css | 61 +++++--- _css/default.css | 23 ++- _include/include_camp_applies.php | 28 +++- _include/include_camp_apply.php | 7 +- _include/include_camps.php | 13 ++ _include/include_delete_apply.php | 23 +++ _include/include_move_next.php | 34 +++++ _include/include_remove_apply.php | 21 +++ common.php | 1 + event_handler.php | 4 +- index.php | 14 +- phpinfo.php | 0 template/templates/applies.tpl | 177 ++++++++++++---------- template/templates/apply.tpl | 24 ++- template/templates/camp_apply.tpl | 58 ++++++-- template/templates/camp_data_update.tpl | 186 ++++++++++++++---------- template/templates/camp_list.tpl | 18 ++- template/templates/login.tpl | 6 + template/templates/nav.tpl | 2 +- 23 files changed, 534 insertions(+), 208 deletions(-) create mode 100644 _include/include_delete_apply.php create mode 100644 _include/include_move_next.php create mode 100644 _include/include_remove_apply.php mode change 100644 => 100755 phpinfo.php diff --git a/_class/class_camp.php b/_class/class_camp.php index 7278e3b..9a002eb 100644 --- a/_class/class_camp.php +++ b/_class/class_camp.php @@ -202,6 +202,11 @@ class camp 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 set_camp_data_by_id($_camp_id) { global $sql; diff --git a/_class/class_camp_apply.php b/_class/class_camp_apply.php index 88e7eed..1189369 100644 --- a/_class/class_camp_apply.php +++ b/_class/class_camp_apply.php @@ -216,6 +216,11 @@ class camp_apply { $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); @@ -246,6 +251,14 @@ class camp_apply { } } + 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; diff --git a/_class/class_page.php b/_class/class_page.php index 3fbaa4a..8b70410 100755 --- a/_class/class_page.php +++ b/_class/class_page.php @@ -198,6 +198,10 @@ class page { # 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'); @@ -355,14 +359,22 @@ class page { include('include_camp_apply.php'); break; case 'jelentkezesek': - # jelentkezés + # 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; @@ -379,11 +391,15 @@ class page { if ('tabor' == $this->get_page() && $this->is_subpage() && 'regisztracio' == $this->get_subpage()) { if (isset($_COOKIE['bc_reg_error'])) { $smarty->assign('error_code', $_COOKIE['bc_reg_error']); - setcookie('bc_reg_error', null, time()-60*60); + setcookie('bc_reg_error', null, time()-60*60*3, '/'); } $smarty->display("register.tpl"); } else { + if (isset($_COOKIE['bc_reg_error'])) { + $smarty->assign('error_code', $_COOKIE['bc_reg_error']); + setcookie('bc_reg_error', null, time()-60*60*2, '/'); + } $smarty->display("login.tpl"); } } diff --git a/_css/button.css b/_css/button.css index 533677b..7f026b9 100644 --- a/_css/button.css +++ b/_css/button.css @@ -22,7 +22,9 @@ padding: 2px 0 0; position: absolute; top: 0; - width: 100%; } + width: 100%; + z-index: -1; + } .button:active::before { padding: 1px 0 0; } diff --git a/_css/camp.css b/_css/camp.css index 211fe26..2ae4a5b 100644 --- a/_css/camp.css +++ b/_css/camp.css @@ -21,7 +21,7 @@ main #main_content, main #loading { display: none; } -#add_more_cct { +#add_more_cct, #move_next { margin-bottom: 15px; } @@ -29,13 +29,16 @@ 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; - cursor: pointer; } form table td { @@ -65,29 +68,49 @@ h2 { margin-top: 50px; } -.apply_table { - width: 80%; - text-align: center; - min-width: 800px; - border-collapse: collapse; - margin: 30px auto 50px auto; +.apply_table img:hover { + cursor: pointer; } -.smaller { - min-width: 588px; - width: 50%; +.reset img { + width: 15px; + display: inline-block; + position: relative; + top: 2px; + left: 5px; } -.apply_table th { - background-color: #000; - color: #fff; - padding: 5px; +.reset a { + color: #000; } -.apply_table td { - padding: 5px; +.reset a:hover { + text-decoration: underline; } -.apply_table tr:hover td{ - background: #eeeeee; +.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; +} + +#submit_apply { + display: none; +} + +.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; } \ No newline at end of file diff --git a/_css/default.css b/_css/default.css index faf1e27..f188c85 100644 --- a/_css/default.css +++ b/_css/default.css @@ -57,6 +57,10 @@ main #loading { background-position: center; } +.center { + text-align: center; +} + .italic { font-style: italic; } @@ -108,6 +112,11 @@ main #loading { font-style: italic; } +.success_msg { + color: #00ff00; + font-style: italic; +} + ul.topnav span { color: #f2f2f2; @@ -242,6 +251,7 @@ td.create a { font-size: 18px; font-family: Arial; border-left: 2px solid #aaa; + min-height: 40px; } .list .list_item:hover { @@ -513,11 +523,11 @@ table.log tr.delete:hover { } .apply_table { - width: 80%; + width: 100%; text-align: center; min-width: 800px; border-collapse: collapse; - margin: 30px 0px 50px 20px; + margin: 0px 0px 20px 0px; } .smaller { @@ -548,7 +558,14 @@ table.log tr.delete:hover { } h1.apply { - margin-left: 20px; + text-align: center; +} + +.outer { + overflow-x: scroll; + width: 80%; + display: block; + margin: 30px auto 50px auto; } diff --git a/_include/include_camp_applies.php b/_include/include_camp_applies.php index 60887a5..5a93ea6 100644 --- a/_include/include_camp_applies.php +++ b/_include/include_camp_applies.php @@ -1,11 +1,31 @@ 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'); } diff --git a/_include/include_camp_apply.php b/_include/include_camp_apply.php index b0e3bc6..8b527f5 100644 --- a/_include/include_camp_apply.php +++ b/_include/include_camp_apply.php @@ -72,14 +72,17 @@ if ($this->is_id()) { $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)); diff --git a/_include/include_camps.php b/_include/include_camps.php index 0897a3f..69476ab 100644 --- a/_include/include_camps.php +++ b/_include/include_camps.php @@ -92,9 +92,22 @@ if ($this->is_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('color', $color); $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); diff --git a/_include/include_delete_apply.php b/_include/include_delete_apply.php new file mode 100644 index 0000000..5d589de --- /dev/null +++ b/_include/include_delete_apply.php @@ -0,0 +1,23 @@ +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 { + + + + +} + + + + + +?> \ No newline at end of file diff --git a/_include/include_move_next.php b/_include/include_move_next.php new file mode 100644 index 0000000..e564b26 --- /dev/null +++ b/_include/include_move_next.php @@ -0,0 +1,34 @@ +is_id()) { + + # VÁROS SZERKESZTÉSE + + +} + +else { + + # VÁROS LISTA + + //megnézzük, hogy adott-e meg felelős kapcsolattartót + //ha nem, akkor a 3-as oldalon kilistázzuk a megadott kapcsolattartókat, és kattintással lehet választani + //ha igen, akkor a negyedik oldalra megyünk + if (camp_apply::has_responsible_contact($_COOKIE['badminton_camp_session_id'])) { + header('Location: /tabor/jelentkezes/4'); + } + else { + header('Location: /tabor/jelentkezes/3'); + } + + +} + + + + + +?> \ No newline at end of file diff --git a/_include/include_remove_apply.php b/_include/include_remove_apply.php new file mode 100644 index 0000000..83f7845 --- /dev/null +++ b/_include/include_remove_apply.php @@ -0,0 +1,21 @@ +is_id()) { + + # JELENTEKEZÉS ELFOGADÁSA + camp_apply::apply_response($this->get_id(), 6); + $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()); + + +} + + + + + + +?> \ No newline at end of file diff --git a/common.php b/common.php index 36c30d1..f81d6c3 100644 --- a/common.php +++ b/common.php @@ -74,6 +74,7 @@ $days = array( $error_msg = array( 1 => 'Ezzel az e-mail címmel már regisztráltak!', + 2 => 'Sikeres regisztráció! Kérjük, jelentkezzen be a megadott adatokkal!', ); //SMARTY BEÁLLÍTÁSA diff --git a/event_handler.php b/event_handler.php index 65fa026..aa94c18 100644 --- a/event_handler.php +++ b/event_handler.php @@ -10,13 +10,14 @@ if (isset($_POST['action'])) { $check_user_exists = $sql->num_of_rows("SELECT * FROM camp_user WHERE cu_email = '" . $_POST['user_email'] . "';"); if ($check_user_exists) { //van már reg ezzel az email címmel - setcookie('bc_reg_error', 1); + setcookie('bc_reg_error', 1, 0, '/'); header("Location: /tabor/regisztracio"); } else { //sikeres reg. visszairányítjuk a bejelentkező felületre $new_camp_user = camp_user::create_camp_user($_POST['user_email'], $_POST['user_password'], date("Y-m-d H:i:s")); log::register('new_camp_user', $new_camp_user, date("Y-m-d H:i:s"), $new_camp_user); + setcookie('bc_reg_error', 2, 0, '/'); header("Location: /tabor"); } break; @@ -57,7 +58,6 @@ if (isset($_POST['action'])) { } elseif ($user_camp_id) { //sikeres bejelentkezés szülőként - var_dump('itt'); $login->login_user($user_camp_id, 'badminton_camp_user', 4); log::register('camp_user_login', $user_camp_id, null, $user_camp_id); header("Location: " . $actual_link); diff --git a/index.php b/index.php index 2b275fb..a40ee5c 100644 --- a/index.php +++ b/index.php @@ -1,5 +1,5 @@ - + - Badminton Coach + + <?php + if ($page->is_page() && ($page->get_page() == 'tabor')) { + echo "Tollaslabda táborok 2017. nyár"; + } + else { + echo "Badminton Coach"; + } + ?> + @@ -94,6 +103,7 @@ setlocale(LC_ALL, 'hu_HU'); }); + diff --git a/phpinfo.php b/phpinfo.php old mode 100644 new mode 100755 diff --git a/template/templates/applies.tpl b/template/templates/applies.tpl index 7157a83..dca95c2 100644 --- a/template/templates/applies.tpl +++ b/template/templates/applies.tpl @@ -1,82 +1,109 @@ +
Probléma, kérdés, hibás adat esetén kérjük, küldjön üzenetet a szucs.zoltan@tollaslabda.info címre!

Visszaigazolt jelentkezések

- - - - - - - - - - {if !count($apply_array)} - - - - {else} - {foreach $apply_array as $apply} +

A jelentkezés részleteinek megtekintéséhez kattintson az adatokra!

+
+
#JelentkezőTábor helye, idejeJelentkezés idejeStátuszVisszaigazolás dátuma
Nincs még visszaigazolt jelentkezése
- - - - - - + + + + + + + - {/foreach} - {/if} -
- {$apply->get_capp_id()} - - {$apply->get_capp_camp_kid_ck_id()->get_ck_name()} - - {$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"}.) - - {$apply->get_capp_date()|substr:0:16} - - {$apply->get_capp_status()} - - {$apply->get_capp_accept_date()|substr:0:16} - #TáborozóTábor helye, idejeJelentkezés idejeStátuszVisszaigazolás dátumaJelentkezés törlése
- + {if !count($apply_array)} + + Nincs még visszaigazolt jelentkezése + + {else} + {foreach $apply_array as $apply} + + + {$apply->get_capp_id()} + + + {$apply->get_capp_camp_kid_ck_id()->get_ck_name()} + + + {$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"}.) + + + {$apply->get_capp_date()|substr:0:16} + + + {$apply->get_capp_status()} + + + {$apply->get_capp_accept_date()|substr:0:16} + + + + + + {/foreach} + {/if} + +

Függőben lévő jelentkezések

- - - - - - - - {if !count($pending_apply_array)} - - - - {else} - {foreach $pending_apply_array as $apply} +

A jelentkezés részleteinek megtekintéséhez kattintson az adatokra!

+
+
#JelentkezőTábor helye, idejeJelentkezés ideje
Nincs függőben lévő jelentkezése
- - - - + + + + + - {/foreach} - {/if} -
- {$apply->get_capp_id()} - - {$apply->get_capp_camp_kid_ck_id()->get_ck_name()} - - {$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"}.) - - {$apply->get_capp_date()|substr:0:16} - #TáborozóTábor helye, idejeJelentkezés idejeJelentkezés törlése
\ No newline at end of file + {if !count($pending_apply_array)} + + Nincs függőben lévő jelentkezése + + {else} + {foreach $pending_apply_array as $apply} + + + {$apply->get_capp_id()} + + + {$apply->get_capp_camp_kid_ck_id()->get_ck_name()} + + + {$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"}.) + + + {$apply->get_capp_date()|substr:0:16} + + + + + + {/foreach} + {/if} + + + + \ No newline at end of file diff --git a/template/templates/apply.tpl b/template/templates/apply.tpl index afc869f..55f8127 100644 --- a/template/templates/apply.tpl +++ b/template/templates/apply.tpl @@ -1,5 +1,5 @@
-

Jelentkező adatai

+

Táborozó adatai