From 9abbc575320a29abfd0b2f006f6cbdf789c20822 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?T=C3=B3th=20Rich=C3=A1rd?= Date: Thu, 14 Feb 2019 16:53:40 +0100 Subject: [PATCH] milestone fix; maybe not perfect --- _class/class_milestone.php | 148 ++- _class/class_milestone_camp.php | 17 +- _class/class_milestone_competition.php | 17 +- _class/class_milestone_ranking.php | 117 ++ _class/class_milestone_training.php | 17 +- _class/class_training.php | 406 +++--- _css/default_view.css | 81 +- _image/ranking.png | Bin 0 -> 18229 bytes _include/include_lock_training.php | 2 + _include/include_members.php | 88 +- _include/include_profile.php | 1 + event_handler.php | 1116 ++++++++--------- index.php | 226 ++-- template/templates/presence.tpl | 2 +- .../templates/user_diary_with_helpers.tpl | 210 ++++ template/templates/user_profile.tpl | 33 +- 16 files changed, 1492 insertions(+), 989 deletions(-) create mode 100644 _class/class_milestone_ranking.php create mode 100644 _image/ranking.png create mode 100644 template/templates/user_diary_with_helpers.tpl diff --git a/_class/class_milestone.php b/_class/class_milestone.php index bf194ba..572d557 100644 --- a/_class/class_milestone.php +++ b/_class/class_milestone.php @@ -10,16 +10,20 @@ class milestone private $ms_training_mst_id = null; private $ms_competition_msc_id = null; private $ms_camp_msca_id = null; + private $ms_ranking_msr_id = null; private $ms_user_kid_uk_id; + private $ms_sums; //text + + private $season; public function set_ms_data_by_id($_ms_id) { - global $sql; - $cat_assoc_array = $sql->assoc_array("select * from milestone where ms_id = " . $_ms_id); - $cat_array = $cat_assoc_array[0]; + global $sql; + $cat_assoc_array = $sql->assoc_array("select * from milestone where ms_id = " . $_ms_id); + $cat_array = $cat_assoc_array[0]; //alapadatok - foreach ($cat_array as $field => $value) { - $function_name = "set_" . $field; - $this->$function_name($value); + foreach ($cat_array as $field => $value) { + $function_name = "set_" . $field; + $this->$function_name($value); if ($field == 'ms_type_mt_id' && $value != null) { $new_mt = new milestone_type(); @@ -44,18 +48,27 @@ class milestone $new_msca->set_msca_data_by_id($value); $this->set_ms_camp_msca_id($new_msca); } - } + + if ($field == 'ms_ranking_msr_id' && $value != null) { + $new_msr = new milestone_ranking(); + $new_msr->set_msr_data_by_id($value); + $this->set_ms_ranking_msr_id($new_msr); + } + } } - public static function create_ms($_mt, $_uk, $_mst = null, $_msc = null, $_msca = null) + public static function create_ms($_mt, $_season, $_uk, $_mst = null, $_msc = null, $_msca = null, $_msr = null, $_sums = null) { global $sql; return $sql->insert_into('milestone', array( 'ms_type_mt_id' => $_mt, 'ms_training_mst_id' => $_mst, 'ms_competition_msc_id' => $_msc, + 'ms_ranking_msr_id' => $_msr, 'ms_camp_msca_id' => $_msca, 'ms_user_kid_uk_id' => $_uk, + 'ms_season' => $_season, + 'ms_sums' => $_sums, ), false); } @@ -93,6 +106,26 @@ class milestone return $this; } + /** + * @return mixed + */ + public function get_ms_season() + { + return $this->ms_season; + } + + /** + * @param mixed $ms_season + * + * @return self + */ + public function set_ms_season($ms_season) + { + $this->ms_season = $ms_season; + + return $this; + } + /** * @return mixed */ @@ -173,6 +206,26 @@ class milestone return $this; } + /** + * @return mixed + */ + public function get_ms_ranking_msr_id() + { + return $this->ms_ranking_msr_id; + } + + /** + * @param mixed $ms_ranking_msr_id + * + * @return self + */ + public function set_ms_ranking_msr_id($ms_ranking_msr_id) + { + $this->ms_ranking_msr_id = $ms_ranking_msr_id; + + return $this; + } + /** * @return mixed */ @@ -193,6 +246,26 @@ class milestone return $this; } + /** + * @return mixed + */ + public function get_ms_sums() + { + return $this->ms_sums; + } + + /** + * @param mixed $ms_sums + * + * @return self + */ + public function set_ms_sums($ms_sums) + { + $this->ms_sums = $ms_sums; + + return $this; + } + public static function upload_file($file) { global $sql; @@ -209,27 +282,46 @@ class milestone $sql->execute_query('DELETE milestone_training FROM milestone_training JOIN milestone ON ms_training_mst_id = mst_id WHERE ms_user_kid_uk_id = ' . $kid); $sql->execute_query('DELETE milestone_competition FROM milestone_competition JOIN milestone ON ms_competition_msc_id = msc_id WHERE ms_user_kid_uk_id = ' . $kid); $sql->execute_query('DELETE milestone_camp FROM milestone_camp JOIN milestone ON ms_camp_msca_id= msca_id WHERE ms_user_kid_uk_id = ' . $kid); + $sql->execute_query('DELETE milestone_ranking FROM milestone_ranking JOIN milestone ON ms_ranking_msr_id= msr_id WHERE ms_user_kid_uk_id = ' . $kid); $content = file($_FILES['fileToUpload']['tmp_name']); //makes array for ($i=0; $i < count($content); $i++) { $line = $content[$i]; - - if (empty(trim($line))) { //ha üres sor volt - if (empty(trim($content[$i+1]))) { +//var_dump($line); + if ($i === 0 || empty(trim($line))) { //ha üres sor volt + if (empty(trim($line))) { + ++$i; + } + if (empty(trim($content[$i]))) { //a következő sor is üres, átugroható continue; } - $firstLineParts = explode(' ', trim($content[$i+1])); + $firstLineParts = explode(' ', trim($content[$i])); + $typeLetter = $firstLineParts[0]; - $month = $firstLineParts[1] . '-01'; - ++$i; + //$month = $firstLineParts[1] . '-01'; //$ms = new milestone(); $mst_id = 'null'; $msc_id = 'null'; $msca_id = 'null'; + $msr_id = 'null'; + $actual_season = 'null'; + + if ('s' == $typeLetter) { + $season = $firstLineParts[1]; + $sums = ""; + $j = $i + 1; + while(isset($content[$j]) && !empty(trim($content[$j]))) { + $sums .= trim($content[$j]) . '\n'; + ++$i; + $j = $i + 1; + } + continue; + } + $type = $sql->single_variable('SELECT mt_id FROM milestone_type WHERE mt_short_name = "' . $typeLetter . '";'); if (null === $type) { @@ -254,7 +346,7 @@ class milestone $j = $i + 1; } - $mst_id = milestone_training::create_mst($mst_date, $mst_count, $month, $mst_trainings); + $mst_id = milestone_training::create_mst($mst_date, $mst_count, $mst_trainings); //var_dump($mst_trainings); break; @@ -289,7 +381,7 @@ class milestone $matches = 'null'; } - $msc_id = milestone_competition::create_msc($msc_date, $msc_name, $msc_category, $msc_location, $msc_place, $month, $matches); + $msc_id = milestone_competition::create_msc($msc_date, $msc_name, $msc_category, $msc_location, $msc_place, $matches); break; case 't': @@ -301,7 +393,27 @@ class milestone ++$i; $msca_place = trim($content[$i]); - $msca_id = milestone_camp::create_msca($msca_date, $msca_place, $month); + $msca_id = milestone_camp::create_msca($msca_date, $msca_place); + + break; + + case 'r': + # ranking + + //get season after 'r' + $msr_season = trim(substr($content[$i], 2)); + + ++$i; + $msr_date = trim($content[$i]); + + ++$i; + $rankings = ''; + do { + $rankings .= trim($content[$i]) . '\n'; + ++$i; + } while (isset($content[$i]) && !empty(trim($content[$i]))); + + $msr_id = milestone_ranking::create_msr($msr_date, $rankings, $msr_season); break; @@ -311,7 +423,7 @@ class milestone } if (null !== $type) { - self::create_ms($type, $kid, $mst_id, $msc_id, $msca_id); + self::create_ms($type, $season, $kid, $mst_id, $msc_id, $msca_id, $msr_id, $sums); } } } diff --git a/_class/class_milestone_camp.php b/_class/class_milestone_camp.php index d375811..1a82c4c 100644 --- a/_class/class_milestone_camp.php +++ b/_class/class_milestone_camp.php @@ -12,23 +12,22 @@ class milestone_camp public function set_msca_data_by_id($_msca_id) { - global $sql; - $cat_assoc_array = $sql->assoc_array("select * from milestone_camp where msca_id = " . $_msca_id); - $cat_array = $cat_assoc_array[0]; + global $sql; + $cat_assoc_array = $sql->assoc_array("select * from milestone_camp where msca_id = " . $_msca_id); + $cat_array = $cat_assoc_array[0]; //alapadatok - foreach ($cat_array as $field => $value) { - $function_name = "set_" . $field; - $this->$function_name($value); - } + foreach ($cat_array as $field => $value) { + $function_name = "set_" . $field; + $this->$function_name($value); + } } - public static function create_msca($_date, $_place, $_month) + public static function create_msca($_date, $_place) { global $sql; return $sql->insert_into('milestone_camp', array( 'msca_date' => $_date, 'msca_place' => $_place, - 'msca_month' => $_month, )); } diff --git a/_class/class_milestone_competition.php b/_class/class_milestone_competition.php index bc3cd91..8ebfe1c 100644 --- a/_class/class_milestone_competition.php +++ b/_class/class_milestone_competition.php @@ -17,17 +17,17 @@ class milestone_competition public function set_msc_data_by_id($_msc_id) { - global $sql; - $cat_assoc_array = $sql->assoc_array("select * from milestone_competition where msc_id = " . $_msc_id); - $cat_array = $cat_assoc_array[0]; + global $sql; + $cat_assoc_array = $sql->assoc_array("select * from milestone_competition where msc_id = " . $_msc_id); + $cat_array = $cat_assoc_array[0]; //alapadatok - foreach ($cat_array as $field => $value) { - $function_name = "set_" . $field; - $this->$function_name($value); - } + foreach ($cat_array as $field => $value) { + $function_name = "set_" . $field; + $this->$function_name($value); + } } - public static function create_msc($_date, $_name, $_category, $_location, $_place, $_month, $_matches = NULL) + public static function create_msc($_date, $_name, $_category, $_location, $_place, $_matches = NULL) { global $sql; return $sql->insert_into('milestone_competition', array( @@ -36,7 +36,6 @@ class milestone_competition 'msc_category' => $_category, 'msc_location' => $_location, 'msc_place' => $_place, - 'msc_month' => $_month, 'msc_matches' => $_matches, )); } diff --git a/_class/class_milestone_ranking.php b/_class/class_milestone_ranking.php new file mode 100644 index 0000000..3db24ea --- /dev/null +++ b/_class/class_milestone_ranking.php @@ -0,0 +1,117 @@ +assoc_array("select * from milestone_ranking where msr_id = " . $_msr_id); + $msr_array = $msr_assoc_array[0]; + //alapadatok + foreach ($msr_array as $field => $value) { + $function_name = "set_" . $field; + $this->$function_name($value); + } + } + + public static function create_msr($_date, $_rankings, $_season = 'null') + { + global $sql; + return $sql->insert_into('milestone_ranking', array( + 'msr_date' => $_date, + 'msr_rankings' => $_rankings, + 'msr_season' => $_season, + )); + } + + /** + * @return mixed + */ + public function get_msr_id() + { + return $this->msr_id; + } + + /** + * @param mixed $msr_id + * + * @return self + */ + public function set_msr_id($msr_id) + { + $this->msr_id = $msr_id; + + return $this; + } + + /** + * @return mixed + */ + public function get_msr_season() + { + return $this->msr_season; + } + + /** + * @param mixed $msr_season + * + * @return self + */ + public function set_msr_season($msr_season) + { + $this->msr_season = $msr_season; + + return $this; + } + + /** + * @return mixed + */ + public function get_msr_date() + { + return $this->msr_date; + } + + /** + * @param mixed $msr_date + * + * @return self + */ + public function set_msr_date($msr_date) + { + $this->msr_date = $msr_date; + + return $this; + } + + /** + * @return mixed + */ + public function get_msr_rankings() + { + return $this->msr_rankings; + } + + /** + * @param mixed $msr_rankings + * + * @return self + */ + public function set_msr_rankings($msr_rankings) + { + $this->msr_rankings = $msr_rankings; + + return $this; + } +} + + +?> diff --git a/_class/class_milestone_training.php b/_class/class_milestone_training.php index 4bc1573..0ba28a8 100644 --- a/_class/class_milestone_training.php +++ b/_class/class_milestone_training.php @@ -13,23 +13,22 @@ class milestone_training public function set_mst_data_by_id($_mst_id) { - global $sql; - $cat_assoc_array = $sql->assoc_array("select * from milestone_training where mst_id = " . $_mst_id); - $cat_array = $cat_assoc_array[0]; + global $sql; + $cat_assoc_array = $sql->assoc_array("select * from milestone_training where mst_id = " . $_mst_id); + $cat_array = $cat_assoc_array[0]; //alapadatok - foreach ($cat_array as $field => $value) { - $function_name = "set_" . $field; - $this->$function_name($value); - } + foreach ($cat_array as $field => $value) { + $function_name = "set_" . $field; + $this->$function_name($value); + } } - public static function create_mst($_date, $_count, $_month, $_trainings = NULL) + public static function create_mst($_date, $_count, $_trainings = NULL) { global $sql; return $sql->insert_into('milestone_training', array( 'mst_date' => $_date, 'mst_count' => $_count, - 'mst_month' => $_month, 'mst_trainings' => $_trainings, )); } diff --git a/_class/class_training.php b/_class/class_training.php index 5ac769e..5b9d176 100644 --- a/_class/class_training.php +++ b/_class/class_training.php @@ -1,235 +1,259 @@ tr_id = $_tr_id; - } - public function set_tr_date($_tr_date) { - $this->tr_date = $_tr_date; - } + public function set_tr_id($_tr_id) { + $this->tr_id = $_tr_id; + } - public function set_tr_training_type_trt_id($_tr_training_type_trt_id) { - $this->tr_training_type_trt_id = $_tr_training_type_trt_id; - } + public function set_tr_date($_tr_date) { + $this->tr_date = $_tr_date; + } - public function set_tr_duration($_tr_duration) { - $this->tr_duration = $_tr_duration; - } + public function set_tr_training_type_trt_id($_tr_training_type_trt_id) { + $this->tr_training_type_trt_id = $_tr_training_type_trt_id; + } - public function set_tr_note($_tr_note) { - $this->tr_note = $_tr_note; - } + public function set_tr_duration($_tr_duration) { + $this->tr_duration = $_tr_duration; + } - public function set_tr_locked($_tr_locked) { - $this->tr_locked = $_tr_locked; - } + public function set_tr_note($_tr_note) { + $this->tr_note = $_tr_note; + } - public function set_tr_deleted($_tr_deleted) { - $this->tr_deleted = $_tr_deleted; - } + public function set_tr_locked($_tr_locked) { + $this->tr_locked = $_tr_locked; + } - public function get_tr_id() { - return $this->tr_id; - } + public function set_tr_deleted($_tr_deleted) { + $this->tr_deleted = $_tr_deleted; + } - public function get_tr_date($_formatted = false) { - return !$_formatted ? $this->tr_date : date("Y. F d. H:i", strtotime($this->tr_date)); - } + public function get_tr_id() { + return $this->tr_id; + } - public function get_tr_date_day() { - $day = date("d", strtotime($this->tr_date)); - if (substr($day, 0, 1) == '0') return substr($day, 1, 1); - return date("d", strtotime($this->tr_date)); - } + public function get_tr_date($_formatted = false) { + return !$_formatted ? $this->tr_date : date("Y. F d. H:i", strtotime($this->tr_date)); + } - public function get_tr_date_day_of_week() { - return date("w", strtotime($this->tr_date)); - } + public function get_tr_date_day() { + $day = date("d", strtotime($this->tr_date)); + if (substr($day, 0, 1) == '0') return substr($day, 1, 1); + return date("d", strtotime($this->tr_date)); + } - public function get_tr_date_time() { - return date("H:i", strtotime($this->tr_date)); - } + public function get_tr_date_day_of_week() { + return date("w", strtotime($this->tr_date)); + } - public function get_tr_training_type_trt_id() { - return $this->tr_training_type_trt_id; - } + public function get_tr_date_time() { + return date("H:i", strtotime($this->tr_date)); + } - public function get_tr_duration() { - return $this->tr_duration; - } + public function get_tr_training_type_trt_id() { + return $this->tr_training_type_trt_id; + } - public function get_tr_note() { - return $this->tr_note; - } + public function get_tr_duration() { + return $this->tr_duration; + } - public function get_tr_locked() { - return $this->tr_locked; - } + public function get_tr_note() { + return $this->tr_note; + } - public function get_tr_deleted() { - return $this->tr_deleted; - } + public function get_tr_locked() { + return $this->tr_locked; + } - public function get_tr_type_name_by_id() { - global $sql; - return $sql->single_variable("SELECT trt_name FROM training_type WHERE trt_id = " . $this->get_tr_training_type_trt_id()); - } + public function get_tr_deleted() { + return $this->tr_deleted; + } - public function set_tr_coaches() { - //beállítja a tr_coaches array-be a coach-okat - //EZ CSAK AZ EDZŐKET ÁLLÍTJA BE, A SEGÉDEDZŐKET NEM - global $sql; - $coach_ids = $sql->assoc_array("SELECT trc_coach_uc_id FROM training_coach JOIN user_coach ON ua_id = trc_coach_uc_id WHERE ua_deleted = 0 AND trc_helper = 0 AND trc_training_tr_id = " . $this->get_tr_id()); - $this->tr_coaches = array(); - foreach ($coach_ids as $trc) { - $this->tr_coaches[] = $trc['trc_coach_uc_id']; - } - } + public function get_tr_type_name_by_id() { + global $sql; + return $sql->single_variable("SELECT trt_name FROM training_type WHERE trt_id = " . $this->get_tr_training_type_trt_id()); + } - public function set_training_data_by_id($_tr_id) { - global $sql; - $training_data_assoc_array = $sql->assoc_array("select * from training where tr_id = " . $_tr_id); - $training_data_array = $training_data_assoc_array[0]; - foreach ($training_data_array as $field => $value) { - $function_name = "set_" . $field; - $this->$function_name($value); - } - $this->set_tr_coaches(); - } + public function set_tr_coaches() { + //beállítja a tr_coaches array-be a coach-okat + global $sql; + $coach_ids = $sql->assoc_array("SELECT trc_coach_uc_id FROM training_coach JOIN user_coach ON ua_id = trc_coach_uc_id WHERE ua_deleted = 0 AND trc_helper = 0 AND trc_training_tr_id = " . $this->get_tr_id()); + $this->tr_coaches = array(); + foreach ($coach_ids as $trc) { + $this->tr_coaches[] = $trc['trc_coach_uc_id']; + } - public function is_coach() { - //megadja, hogy van-e beállítva edző az edzéshez - //TRUE HA IGEN, FALSE EGYÉBKÉNT - return !empty($this->tr_coaches); - } + $helper_ids = $sql->assoc_array("SELECT trc_coach_uc_id FROM training_coach JOIN user_coach ON ua_id = trc_coach_uc_id WHERE ua_deleted = 0 AND trc_helper = 1 AND trc_training_tr_id = " . $this->get_tr_id()); + $this->tr_helpers = array(); + foreach ($helper_ids as $trc) { + $this->tr_helpers[] = $trc['trc_coach_uc_id']; + } + } - public function get_tr_coaches_name() { - //tömböt ad vissza az edzők neveivel - global $sql; - $coach_names = array(); - foreach ($this->tr_coaches as $ua_id) { - $coach_names[] = $sql->single_variable('SELECT ua_name FROM user_coach WHERE ua_id = ' . $ua_id); - } - return $coach_names; - } + public function set_training_data_by_id($_tr_id) { + global $sql; + $training_data_assoc_array = $sql->assoc_array("select * from training where tr_id = " . $_tr_id); + $training_data_array = $training_data_assoc_array[0]; + foreach ($training_data_array as $field => $value) { + $function_name = "set_" . $field; + $this->$function_name($value); + } + $this->set_tr_coaches(); + } - public static function create_training($_training_value_array, $_every_week) { - global $sql; - //megnézzük, hogy minden hétre be kell-e rakni - //ha igen, akkor az adott hónapban, a hét minden azonos napjára létrehozza - if ($_every_week) { - //megnézzük milyen nap van a megadott dátumon - $day_of_week = date('N', strtotime($_training_value_array['tr_date'])); - //kigyűjtük a hónap további ilyen napjait - $last_day = date("t", strtotime($_training_value_array['tr_date'])); + public function is_coach() { + //megadja, hogy van-e beállítva edző az edzéshez + //TRUE HA IGEN, FALSE EGYÉBKÉNT + return !empty($this->tr_coaches); + } - for ($actual_day=date('d', strtotime($_training_value_array['tr_date'])); $actual_day <= $last_day; $actual_day=$actual_day+7) { - $new_tr_id = $sql->insert_into('training', - array( - 'tr_date' => date('Y-m', strtotime($_training_value_array['tr_date'])) . '-' . $actual_day . ' ' . date('H:i', strtotime($_training_value_array['tr_date'])), - 'tr_training_type_trt_id' => $_training_value_array['tr_training_type_trt_id'], - 'tr_duration' => $_training_value_array['tr_duration'], - 'tr_note' => $_training_value_array['tr_note'] - ) - ); - log::register('new_training', $new_tr_id); - //itt rakjuk be a coach-okat - if (isset($_training_value_array['coaches'])) { - foreach ($_training_value_array['coaches'] as $coach_id) { - # beilleszt minden edzőt ehhez az edzéshez - $sql->insert_into('training_coach', array('trc_training_tr_id' => $new_tr_id, 'trc_coach_uc_id' => $coach_id)); - } - } - //itt rakjuk be a segédedzőket - if (isset($_training_value_array['helpets'])) { - foreach ($_training_value_array['helpets'] as $coach_id) { - # beilleszt minden edzőt ehhez az edzéshez - $sql->insert_into('training_coach', array('trc_training_tr_id' => $new_tr_id, 'trc_coach_uc_id' => $coach_id, 'trc_helper' => 1)); - } - } - } - //var_dump($day_array); - } - else { - //coaches - if (isset($_training_value_array['coaches'])) { - $coaches = $_training_value_array['coaches']; - unset($_training_value_array['coaches']); - } - //helpers - if (isset($_training_value_array['helpers'])) { - $helpers = $_training_value_array['helpers']; - unset($_training_value_array['helpers']); - } + public function is_helper() { + //megadja, hogy van-e beállítva segédedző az edzéshez + //TRUE HA IGEN, FALSE EGYÉBKÉNT + return !empty($this->tr_helpers); + } - if ($_training_value_array['tr_note'] == "") { - $_training_value_array['tr_note'] = null; - } - $new_tr_id = $sql->insert_into('training', $_training_value_array); - log::register('new_training', $new_tr_id); - if (isset($coaches)) { - foreach ($coaches as $coach_id) { - # beilleszt minden edzőt ehhez az edzéshez - $new_trc_id = $sql->insert_into('training_coach', array('trc_training_tr_id' => $new_tr_id, 'trc_coach_uc_id' => $coach_id)); - } - } - if (isset($helpers)) { - foreach ($helpers as $coach_id) { - # beilleszt minden edzőt ehhez az edzéshez - $sql->insert_into('training_coach', array('trc_training_tr_id' => $new_tr_id, 'trc_coach_uc_id' => $coach_id, 'trc_helper' => 1)); - } - } - } + public function get_tr_coaches_name() { + //tömböt ad vissza az edzők neveivel + global $sql; + $coach_names = array(); + foreach ($this->tr_coaches as $ua_id) { + $coach_names[] = $sql->single_variable('SELECT ua_name FROM user_coach WHERE ua_id = ' . $ua_id); + } + return $coach_names; + } - return $new_tr_id; + public function get_tr_helpers_name() { + //tömböt ad vissza a segédedzők neveivel + global $sql; + $helper_names = array(); + foreach ($this->tr_helpers as $ua_id) { + $helper_names[] = $sql->single_variable('SELECT ua_name FROM user_coach WHERE ua_id = ' . $ua_id); + } + return $helper_names; + } - } + public static function create_training($_training_value_array, $_every_week) { + global $sql; + //megnézzük, hogy minden hétre be kell-e rakni + //ha igen, akkor az adott hónapban, a hét minden azonos napjára létrehozza + if ($_every_week) { + //megnézzük milyen nap van a megadott dátumon + $day_of_week = date('N', strtotime($_training_value_array['tr_date'])); + //kigyűjtük a hónap további ilyen napjait + $last_day = date("t", strtotime($_training_value_array['tr_date'])); - public static function update_training($_training_value_array, $_tr_id) { - global $sql; + for ($actual_day=date('d', strtotime($_training_value_array['tr_date'])); $actual_day <= $last_day; $actual_day=$actual_day+7) { + $new_tr_id = $sql->insert_into('training', + array( + 'tr_date' => date('Y-m', strtotime($_training_value_array['tr_date'])) . '-' . $actual_day . ' ' . date('H:i', strtotime($_training_value_array['tr_date'])), + 'tr_training_type_trt_id' => $_training_value_array['tr_training_type_trt_id'], + 'tr_duration' => $_training_value_array['tr_duration'], + 'tr_note' => $_training_value_array['tr_note'] + ) + ); + log::register('new_training', $new_tr_id); + //itt rakjuk be a coach-okat + if (isset($_training_value_array['coaches'])) { + foreach ($_training_value_array['coaches'] as $coach_id) { + # beilleszt minden edzőt ehhez az edzéshez + $sql->insert_into('training_coach', array('trc_training_tr_id' => $new_tr_id, 'trc_coach_uc_id' => $coach_id)); + } + } + //itt rakjuk be a segédedzőket + if (isset($_training_value_array['helpets'])) { + foreach ($_training_value_array['helpets'] as $coach_id) { + # beilleszt minden edzőt ehhez az edzéshez + $sql->insert_into('training_coach', array('trc_training_tr_id' => $new_tr_id, 'trc_coach_uc_id' => $coach_id, 'trc_helper' => 1)); + } + } + } + //var_dump($day_array); + } + else { + //coaches + if (isset($_training_value_array['coaches'])) { + $coaches = $_training_value_array['coaches']; + unset($_training_value_array['coaches']); + } + //helpers + if (isset($_training_value_array['helpers'])) { + $helpers = $_training_value_array['helpers']; + unset($_training_value_array['helpers']); + } - $sql->execute_query("DELETE FROM training_coach WHERE trc_training_tr_id = '" . $_tr_id ."';"); - if (isset($_training_value_array['coaches'])) { - //coaches handler -> kitoroljuk mindet és újra insertaljuk - foreach ($_training_value_array['coaches'] as $coach_id) { - $sql->insert_into('training_coach', array('trc_training_tr_id' => $_tr_id, 'trc_coach_uc_id' => $coach_id)); - } + if ($_training_value_array['tr_note'] == "") { + $_training_value_array['tr_note'] = null; + } + $new_tr_id = $sql->insert_into('training', $_training_value_array); + log::register('new_training', $new_tr_id); + if (isset($coaches)) { + foreach ($coaches as $coach_id) { + # beilleszt minden edzőt ehhez az edzéshez + $new_trc_id = $sql->insert_into('training_coach', array('trc_training_tr_id' => $new_tr_id, 'trc_coach_uc_id' => $coach_id)); + } + } + if (isset($helpers)) { + foreach ($helpers as $coach_id) { + # beilleszt minden edzőt ehhez az edzéshez + $sql->insert_into('training_coach', array('trc_training_tr_id' => $new_tr_id, 'trc_coach_uc_id' => $coach_id, 'trc_helper' => 1)); + } + } + } - unset($_training_value_array['coaches']); - } - if (isset($_training_value_array['helpers'])) { - //helper handler -> kitoroljuk mindet és újra insertaljuk - foreach ($_training_value_array['helpers'] as $coach_id) { - $sql->insert_into('training_coach', array('trc_training_tr_id' => $_tr_id, 'trc_coach_uc_id' => $coach_id, 'trc_helper' => 1)); - } + return $new_tr_id; - unset($_training_value_array['helpers']); - } - if ($_training_value_array['tr_note'] == "") { - $_training_value_array['tr_note'] = null; - } - $sql->update_table('training', $_training_value_array, array('tr_id' => $_tr_id)); - } + } + + public static function update_training($_training_value_array, $_tr_id) { + global $sql; + + $sql->execute_query("DELETE FROM training_coach WHERE trc_training_tr_id = '" . $_tr_id ."';"); + if (isset($_training_value_array['coaches'])) { + //coaches handler -> kitoroljuk mindet és újra insertaljuk + foreach ($_training_value_array['coaches'] as $coach_id) { + $sql->insert_into('training_coach', array('trc_training_tr_id' => $_tr_id, 'trc_coach_uc_id' => $coach_id)); + } + + unset($_training_value_array['coaches']); + } + if (isset($_training_value_array['helpers'])) { + //helper handler -> kitoroljuk mindet és újra insertaljuk + foreach ($_training_value_array['helpers'] as $coach_id) { + $sql->insert_into('training_coach', array('trc_training_tr_id' => $_tr_id, 'trc_coach_uc_id' => $coach_id, 'trc_helper' => 1)); + } + + unset($_training_value_array['helpers']); + } + if ($_training_value_array['tr_note'] == "") { + $_training_value_array['tr_note'] = null; + } + $sql->update_table('training', $_training_value_array, array('tr_id' => $_tr_id)); + } } diff --git a/_css/default_view.css b/_css/default_view.css index 79d0415..0a03ae8 100644 --- a/_css/default_view.css +++ b/_css/default_view.css @@ -1,82 +1,99 @@ body { - background-color: #002E4C; + background-color: #002E4C; } main { - background-color: #002E4C; + background-color: #002E4C; } .danger a:link { - color: #002E4C; - text-decoration: underline; + color: #002E4C; + text-decoration: underline; } .danger a:visited { - color: #002E4C; - text-decoration: underline; + color: #002E4C; + text-decoration: underline; } ul.topnav { - background-color: #FD9500; + background-color: #FD9500; } ul.topnav li a, ul.topnav span { - color: #002E4C; + color: #002E4C; } ul.topnav li a:hover, ul.topnav li a span:hover { - background: transparent; - color: #01112b; - text-decoration: underline; + background: transparent; + color: #01112b; + text-decoration: underline; } div.list div.money_deposit { - background-color: #FD9500; - border-left: 2px solid #002E4C; - color: #020372; + background-color: #FD9500; + border-left: 2px solid #002E4C; + color: #020372; } .list .money_deposit:hover { - background-color: #F3BF75; - border-left: 2px solid #000; - color: #002E4C; + background-color: #F3BF75; + border-left: 2px solid #000; + color: #002E4C; } div.list div.actual_balance { - background-color: #020372; - border-left: 2px solid #FD9500; - color: white; + background-color: #020372; + border-left: 2px solid #FD9500; + color: white; } div.list div.actual_balance:hover { - background-color: #020372; - border-left: 2px solid #FD9500; - color: white; + background-color: #020372; + border-left: 2px solid #FD9500; + color: white; } .list_item.training { - background-color: #a1ffff; - border-left: 2px solid #0a40ff; + background-color: #a1ffff; + border-left: 2px solid #0a40ff; } .list_item.training:hover { - background-color: #5ecfcf; + background-color: #5ecfcf; } .list_item.competition { - background-color: #f6bea0; - border-left: 2px solid #ef4710; + background-color: #f6bea0; + border-left: 2px solid #ef4710; } .list_item.competition:hover { - background-color: #f0a278; + background-color: #f0a278; } .list_item.camp { - background-color: #97fc7e; - border-left: 2px solid #278310; + background-color: #97fc7e; + border-left: 2px solid #278310; } .list_item.camp:hover { - background-color: #69de4c; + background-color: #69de4c; +} + +.list_item.ranking { + background-color: #f6f6bf; + border-left: 2px solid #000; +} + +.list_item.ranking:hover { + background-color: #eded8b; +} + +.short { + display: none; +} + +.full { + display: inline-block; } diff --git a/_image/ranking.png b/_image/ranking.png new file mode 100644 index 0000000000000000000000000000000000000000..9cfdacaa2b8a98a5e9680f73c99a93e4b29fd035 GIT binary patch literal 18229 zcmeIac|6qH{|El2i?UW?Dxz)+B_=77LAy$&O)3nnld=@WFc@XKCDfHv7!|HIBt)4p z6CsI-vS%1$E5^)NW`@~*=RHH+&%O8ic>MnP{r7wS(K6?}U*~mR=lNRCIq&QH_t~i_ zFI0vgNNv~7Z3iJp9{f`tnyCo>8pD2_grFV5UE4Mv#%A&^l zT`i}F&Os^5-zdJ7jlHgHnzUEF>x|=v9qH=z9f|kWS1(*|5!=c>H+RqFGmXnutT=XR z-Gjzus{0k^t)KJt$<>F0UfU~F=FF~p#FI2Q`kkNL6W|ok>@0a!R62@cX_k)#_l@D6 zcH*Bs|FJ#_S<3H@f&aMBmTO>R+Oo`RNxeB;_9WIMbCa5*bo8VT`VGO#D>7?5=HGQn{|e74Ikb%gxW5f%fz;lgnkU2b9g&|JO+IlE#9Ii9azJm zIYuR{t_2kz`s8l0-7R*Nbmm66&GuK++#W+uG{rK`GkFaiq$ERVCSEqqGpygR;Wi9I zxqP0!+Kxh;)_36`5pD%KQ@cTT^$TSuIIuBfxJ#ZF>}^tQu`0yJ?d zUs`3X_l~q3a5jQgI4Z|nmw#wK&2!!0wm>}uG`=fsPJyNZWo~M0H2gSiMAos3p>sE_ z#@*sqMHE8=pQq?#j&|qsF3Ejfh!7V(*?4Y+4f5d>=O6pW=PGQ%HEhRM%RfwW<4~{=52zuP8H_1v5J?m0lUh}!cxeb#cx?hl%=)byZ z2I}?9%5r-wCMAz*llWs+gUzOvuE61t&n60SO4tZnbg#ALIXz@&D3TuLWXcMuZ#9wq zK2D5`jMTsFgO9mLdH#gw<$<__qJYI(r7cc2(c!h)fc|q>UEL=I3c7CWnRwzeVK3RO zRJ52L7R|f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&h&-!)_;_V!F4AX zcJxFuILGIxFu;-SY5FcxrKP2;pE2EgDM-NvMVZ-!1vXObR!j44KUYu6R9i1=IUKav zj95aPe);O3m)ecei%OySwv4jQ<69a?xW7X-)}CcbzM5Fkui0je)o4Z1`NdyrC{-Ob!9Y_({W?>d&RXght2e>dx( zGvs;OUw>M@vsii_)|w%%Tl-~vI+o$`cLk@eVnS0r`U`ns1)8;=n@o9>bs5L2+-tb4F$fDTQGlweCsZP@omx%j$+s=3$U-%#g^XTIcVf*b78CsR#g z#^_2qlJI)Xk3E!K4K@oTFGC)KE4s2(|M*30u&j)1^Ay4kJb)&alb6#a6!vK3_o>f0 zl({h_5BO#hLvRp7M|!2%v*T^=r?dGS|A}7S^dOP=57gv@qRH)nH0jyRKr-Wm*3-Yshk0VajAw>hWtYt6QNE$z{>xt?@@4C1>hWVtcv9L;YI5-(-702 zQ|KN2b@_A6+k?~JQn)b;4sT*S33k%UC_DL6_-y{$wN9ySG~m7u!}rpsk>n`5vk6gmxPrgRAuSn+|r@nLAic$Mi-r@&udG2qP{ILj_} zms&FvQI~WqG|+$(OwUx+L)?@qKy*^N1rynMr)8is_id()) { log::register(($locked?'training_open':'training_close'), $this->get_id()); //SEND NOTIFICATION + /* if (!$locked) { //get kids from training $kid_ids = $sql->assoc_array('SELECT pr_user_kid_uk_id FROM presence WHERE pr_training_tr_id = ' . $this->get_id()); @@ -132,6 +133,7 @@ if ($this->is_id()) { } } } + */ header('Location: /admin/presence/' . $this->get_id()); } diff --git a/_include/include_members.php b/_include/include_members.php index e5baecc..44e6cd3 100644 --- a/_include/include_members.php +++ b/_include/include_members.php @@ -3,52 +3,52 @@ # HA NINCS ID, AKKOR TAGLISTA # HA VAN ID, AKKOR TAG ADATAINAK MEGJELENÍTÉSE/SZERKESZTÉSE if ($this->is_id()) { - # ADOTT TAG ADATAINAK MEGJELENÍTÉSE - //user adatok - $user_data_query = "SELECT * FROM user_kid WHERE uk_id = " . $this->get_id(); - $user_data_assoc_array = $sql->assoc_array($user_data_query); - //pólóméret array - $shirt_size_query = "SELECT * FROM shirt WHERE shirt_deleted = 0;"; - $shirt_size_assoc_array = $sql->assoc_array($shirt_size_query); - //szülő array - $parent_query = "SELECT * FROM user_parent WHERE up_deleted = 0 ORDER BY up_name ASC;"; - $parent_assoc_array = $sql->assoc_array($parent_query); - //SCHOOL ARRAY - $school_query = "SELECT * FROM school WHERE sc_deleted = 0 ORDER BY sc_name ASC;"; - $school_assoc_array = $sql->assoc_array($school_query); - $schools = array(); - foreach ($school_assoc_array as $key => $value) { - $new_school = new school(); - $new_school->set_school_data_by_id($value['sc_id']); - $schools[] = $new_school; - } - //SCHOOL CITY ARRAY - $school_city_query = "SELECT * FROM school_city WHERE scc_deleted = 0 ORDER BY - scc_order DESC, scc_city ASC;"; - $school_city_assoc_array = $sql->assoc_array($school_city_query); - $school_cities = array(); - foreach ($school_city_assoc_array as $key => $value) { - $new_scc = new school_city(); - $new_scc->set_school_city_data_by_id($value['scc_id']); - $school_cities[] = $new_scc; - } - //REGION ARRAY - $region_query = "SELECT * FROM region WHERE reg_deleted = 0 ORDER BY reg_name ASC;"; - $region_assoc_array = $sql->assoc_array($region_query); - //smarty thingz - $smarty->assign('school_assoc_array', $schools); - $smarty->assign('school_city_assoc_array', $school_cities); - $smarty->assign('region_assoc_array', $region_assoc_array); - $smarty->assign('user_data', $user_data_assoc_array[0]); - $smarty->assign('shirt_size_assoc_array', $shirt_size_assoc_array); - $smarty->assign('parent_assoc_array', $parent_assoc_array); - $smarty->display('user_data_'.$tpl.'.tpl'); + # ADOTT TAG ADATAINAK MEGJELENÍTÉSE + //user adatok + $user_data_query = "SELECT * FROM user_kid WHERE uk_id = " . $this->get_id(); + $user_data_assoc_array = $sql->assoc_array($user_data_query); + //pólóméret array + $shirt_size_query = "SELECT * FROM shirt WHERE shirt_deleted = 0;"; + $shirt_size_assoc_array = $sql->assoc_array($shirt_size_query); + //szülő array + $parent_query = "SELECT * FROM user_parent WHERE up_deleted = 0 ORDER BY up_name ASC;"; + $parent_assoc_array = $sql->assoc_array($parent_query); + //SCHOOL ARRAY + $school_query = "SELECT * FROM school WHERE sc_deleted = 0 ORDER BY sc_name ASC;"; + $school_assoc_array = $sql->assoc_array($school_query); + $schools = array(); + foreach ($school_assoc_array as $key => $value) { + $new_school = new school(); + $new_school->set_school_data_by_id($value['sc_id']); + $schools[] = $new_school; + } + //SCHOOL CITY ARRAY + $school_city_query = "SELECT * FROM school_city WHERE scc_deleted = 0 ORDER BY - scc_order DESC, scc_city ASC;"; + $school_city_assoc_array = $sql->assoc_array($school_city_query); + $school_cities = array(); + foreach ($school_city_assoc_array as $key => $value) { + $new_scc = new school_city(); + $new_scc->set_school_city_data_by_id($value['scc_id']); + $school_cities[] = $new_scc; + } + //REGION ARRAY + $region_query = "SELECT * FROM region WHERE reg_deleted = 0 ORDER BY reg_name ASC;"; + $region_assoc_array = $sql->assoc_array($region_query); + //smarty thingz + $smarty->assign('school_assoc_array', $schools); + $smarty->assign('school_city_assoc_array', $school_cities); + $smarty->assign('region_assoc_array', $region_assoc_array); + $smarty->assign('user_data', $user_data_assoc_array[0]); + $smarty->assign('shirt_size_assoc_array', $shirt_size_assoc_array); + $smarty->assign('parent_assoc_array', $parent_assoc_array); + $smarty->display('user_data_'.$tpl.'.tpl'); } else { - # TAG LISTA + # TAG LISTA - $smarty->assign('edit', $tpl == "edit"); - $smarty->display('user_list.tpl'); - //var_dump($user_array); + $smarty->assign('edit', $tpl == "edit"); + $smarty->display('user_list.tpl'); + //var_dump($user_array); } -?> \ No newline at end of file +?> diff --git a/_include/include_profile.php b/_include/include_profile.php index 6233290..ce66305 100644 --- a/_include/include_profile.php +++ b/_include/include_profile.php @@ -12,6 +12,7 @@ foreach ($ms_assoc_array as $key => $ms) { $smarty->assign('ms_array', $ms_array); + $smarty->display('user_profile.tpl'); ?> diff --git a/event_handler.php b/event_handler.php index baf426f..4d5460a 100644 --- a/event_handler.php +++ b/event_handler.php @@ -3,593 +3,593 @@ if (isset($_POST['action'])) { - $actual_link = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; - switch ($_POST['action']) { - case 'user_register': - # REGISZTRÁCIÓ - $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, 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; - case 'login': - # login - /* - USER TYPES: 1 - coach, 2 - kid, 3 - parent - */ - $login = new login(); + $actual_link = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; + switch ($_POST['action']) { + case 'user_register': + # REGISZTRÁCIÓ + $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, 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; + case 'login': + # login + /* + USER TYPES: 1 - coach, 2 - kid, 3 - parent + */ + $login = new login(); - $user_admin_id = null; - $user_kid_id = null; - $user_coach_id = null; - $user_camp_id = null; - $user_camp_leader_id = null; + $user_admin_id = null; + $user_kid_id = null; + $user_coach_id = null; + $user_camp_id = null; + $user_camp_leader_id = null; - if ($_REQUEST['page'] == 'admin') $user_admin_id = $login->check_admin_login($_POST['user_name'], $_POST['user_password']); - if ($_REQUEST['page'] == 'view') $user_kid_id = $login->check_kid_login($_POST['user_name'], $_POST['user_password']); - if ($_REQUEST['page'] == 'coach') $user_coach_id = $login->check_coach_login($_POST['user_name'], $_POST['user_password']); - if ($_REQUEST['page'] == 'tabor') $user_camp_id = $login->check_camp_login($_POST['user_name'], $_POST['user_password']); - if ($_REQUEST['page'] == 'taborvezeto') $user_camp_leader_id = $login->check_camp_leader_login($_POST['user_name'], $_POST['user_password']); + if ($_REQUEST['page'] == 'admin') $user_admin_id = $login->check_admin_login($_POST['user_name'], $_POST['user_password']); + if ($_REQUEST['page'] == 'view') $user_kid_id = $login->check_kid_login($_POST['user_name'], $_POST['user_password']); + if ($_REQUEST['page'] == 'coach') $user_coach_id = $login->check_coach_login($_POST['user_name'], $_POST['user_password']); + if ($_REQUEST['page'] == 'tabor') $user_camp_id = $login->check_camp_login($_POST['user_name'], $_POST['user_password']); + if ($_REQUEST['page'] == 'taborvezeto') $user_camp_leader_id = $login->check_camp_leader_login($_POST['user_name'], $_POST['user_password']); - if ($user_admin_id) { - //sikeres bejelentkezés adminként - $login->login_user($user_admin_id, 'badminton_admin_user', 1); - log::register('admin_login', $user_admin_id, null, $user_admin_id); - header("Location: " . $actual_link); - } - elseif ($user_kid_id) { - //sikeres bejelentkezés szülőként - $login->login_user($user_kid_id, 'badminton_parent_user', 2); - log::register('kid_login', $user_kid_id, null, $user_kid_id); - header("Location: " . $actual_link); - } - elseif ($user_coach_id) { - //sikeres bejelentkezés szülőként - $login->login_user($user_coach_id, 'badminton_coach_user', 3); - log::register('coach_login', $user_coach_id, null, $user_coach_id); - header("Location: " . $actual_link); - } - elseif ($user_camp_id) { - //sikeres bejelentkezés szülőként - $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); - } - elseif ($user_camp_leader_id) { - //sikeres bejelentkezés szülőként - $login->login_user($user_camp_leader_id, 'badminton_camp_leader', 5); - log::register('camp_leader_login', $user_camp_leader_id, null, $user_camp_leader_id); - header("Location: " . $actual_link); - } - else { - //die($user_coach_id); - //sikertelen bejelentkezés - } - /* - $user_id = $login->check_login($_POST['user_name'], $_POST['user_password']); - if ($user_id) { - //sikeres bejelentkezés - $login->login_user($user_id, $_POST['user_type']); - header("Location: " . $actual_link); - } - */ - break; + if ($user_admin_id) { + //sikeres bejelentkezés adminként + $login->login_user($user_admin_id, 'badminton_admin_user', 1); + log::register('admin_login', $user_admin_id, null, $user_admin_id); + header("Location: " . $actual_link); + } + elseif ($user_kid_id) { + //sikeres bejelentkezés szülőként + $login->login_user($user_kid_id, 'badminton_parent_user', 2); + log::register('kid_login', $user_kid_id, null, $user_kid_id); + header("Location: " . $actual_link); + } + elseif ($user_coach_id) { + //sikeres bejelentkezés szülőként + $login->login_user($user_coach_id, 'badminton_coach_user', 3); + log::register('coach_login', $user_coach_id, null, $user_coach_id); + header("Location: " . $actual_link); + } + elseif ($user_camp_id) { + //sikeres bejelentkezés szülőként + $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); + } + elseif ($user_camp_leader_id) { + //sikeres bejelentkezés szülőként + $login->login_user($user_camp_leader_id, 'badminton_camp_leader', 5); + log::register('camp_leader_login', $user_camp_leader_id, null, $user_camp_leader_id); + header("Location: " . $actual_link); + } + else { + //die($user_coach_id); + //sikertelen bejelentkezés + } + /* + $user_id = $login->check_login($_POST['user_name'], $_POST['user_password']); + if ($user_id) { + //sikeres bejelentkezés + $login->login_user($user_id, $_POST['user_type']); + header("Location: " . $actual_link); + } + */ + break; - case 'user_data_edit': - switch ($_POST['user_type']) { - case '1': - # KID - unset($_POST['user_type']); - unset($_POST['action']); - $uid = $_POST['uk_id']; - unset($_POST['uk_id']); - user_kid::update_user($_POST, $uid); - //filter_update - $kid = new user_kid(); - $kid->set_user_data_by_id($uid); - $kid->update_filters(); - //filter update end - log::register('update_member', $uid); - header("Location: " . $actual_link); - break; + case 'user_data_edit': + switch ($_POST['user_type']) { + case '1': + # KID + unset($_POST['user_type']); + unset($_POST['action']); + $uid = $_POST['uk_id']; + unset($_POST['uk_id']); + user_kid::update_user($_POST, $uid); + //filter_update + $kid = new user_kid(); + $kid->set_user_data_by_id($uid); + $kid->update_filters(); + //filter update end + log::register('update_member', $uid); + header("Location: " . $actual_link); + break; - default: - # code... - break; - } - break; - case 'user_data_create': - # user létrehozása - # nincs elágazás user_type szerint - unset($_POST['action']); - //var_dump($_POST); - //die("aaa"); - $new_user_id = user_kid::create_user($_POST); - //filter_update - $kid = new user_kid(); - $kid->set_user_data_by_id($new_user_id); - $kid->update_filters(); - //filter update end - log::register('new_member', $new_user_id); - header("Location: /admin/edit_member/" . $new_user_id); - break; + default: + # code... + break; + } + break; + case 'user_data_create': + # user létrehozása + # nincs elágazás user_type szerint + unset($_POST['action']); + //var_dump($_POST); + //die("aaa"); + $new_user_id = user_kid::create_user($_POST); + //filter_update + $kid = new user_kid(); + $kid->set_user_data_by_id($new_user_id); + $kid->update_filters(); + //filter update end + log::register('new_member', $new_user_id); + header("Location: /admin/edit_member/" . $new_user_id); + break; - case 'parent_create': - # parent létrehozása - unset($_POST['action']); - if (!isset($_POST['up_email'])) $_POST['up_email'] = null; - if (!isset($_POST['up_phone'])) $_POST['up_phone'] = null; - if (!isset($_POST['up_facebook'])) $_POST['up_facebook'] = null; - $new_parent_id = user_parent::create_parent($_POST['up_name'], $_POST['up_email'], $_POST['up_facebook'], $_POST['up_phone']); - log::register('new_parent', $new_parent_id); - header("Location: /admin/parents"); - break; + case 'parent_create': + # parent létrehozása + unset($_POST['action']); + if (!isset($_POST['up_email'])) $_POST['up_email'] = null; + if (!isset($_POST['up_phone'])) $_POST['up_phone'] = null; + if (!isset($_POST['up_facebook'])) $_POST['up_facebook'] = null; + $new_parent_id = user_parent::create_parent($_POST['up_name'], $_POST['up_email'], $_POST['up_facebook'], $_POST['up_phone']); + log::register('new_parent', $new_parent_id); + header("Location: /admin/parents"); + break; - case 'parent_data_update': - # parent updatelés - unset($_POST['action']); - $up_id = $_POST['up_id']; - unset($_POST['up_id']); - if (!isset($_POST['up_email'])) $_POST['up_email'] = null; - if (!isset($_POST['up_phone'])) $_POST['up_phone'] = null; - if (!isset($_POST['up_facebook'])) $_POST['up_facebook'] = null; - user_parent::update_parent($_POST, $up_id); - log::register('update_parent', $up_id); - header("Location: /admin/parents/" . $up_id); - break; + case 'parent_data_update': + # parent updatelés + unset($_POST['action']); + $up_id = $_POST['up_id']; + unset($_POST['up_id']); + if (!isset($_POST['up_email'])) $_POST['up_email'] = null; + if (!isset($_POST['up_phone'])) $_POST['up_phone'] = null; + if (!isset($_POST['up_facebook'])) $_POST['up_facebook'] = null; + user_parent::update_parent($_POST, $up_id); + log::register('update_parent', $up_id); + header("Location: /admin/parents/" . $up_id); + break; - case 'training_data_edit': - #training edit - $tr_id = $_POST['tr_id']; - unset($_POST['tr_id']); - unset($_POST['action']); - //var_dump($_POST); - training::update_training($_POST, $tr_id); - log::register('update_training', $tr_id); - header("Location: " . $actual_link); - break; + case 'training_data_edit': + #training edit + $tr_id = $_POST['tr_id']; + unset($_POST['tr_id']); + unset($_POST['action']); + //var_dump($_POST); + training::update_training($_POST, $tr_id); + log::register('update_training', $tr_id); + header("Location: " . $actual_link); + break; - case 'training_data_create': - # training create - # a training_list-re ugrik vissza, mert lehet h többet is létrehoz - unset($_POST['action']); - unset($_POST['training_templates']); + case 'training_data_create': + # training create + # a training_list-re ugrik vissza, mert lehet h többet is létrehoz + unset($_POST['action']); + unset($_POST['training_templates']); - $every_week = isset($_POST['every_week']); - $jumpTo = $_POST['jumpTo']; - unset($_POST['jumpTo']); - if ($every_week) unset($_POST['every_week']); - $tr_id = training::create_training($_POST, $every_week); + $every_week = isset($_POST['every_week']); + $jumpTo = $_POST['jumpTo']; + unset($_POST['jumpTo']); + if ($every_week) unset($_POST['every_week']); + $tr_id = training::create_training($_POST, $every_week); - if (!$jumpTo) { - header("Location: /admin/trainings/"); - } - else { - header("Location: /admin/presence/".$tr_id); - } + if (!$jumpTo) { + header("Location: /admin/trainings/"); + } + else { + header("Location: /admin/presence/".$tr_id); + } - break; - case 'training_type_create': - # edzés típus létrehozása - unset($_POST['action']); - $new_trt_id = training_type::create_training_type($_POST); - log::register('new_training_type', $new_trt_id); - header("Location: /admin/training_types"); + break; + case 'training_type_create': + # edzés típus létrehozása + unset($_POST['action']); + $new_trt_id = training_type::create_training_type($_POST); + log::register('new_training_type', $new_trt_id); + header("Location: /admin/training_types"); - break; - case 'training_type_update': - # edzés típus lista updatelése ABí-ba - unset($_POST['action']); - foreach ($_POST as $key => $value) { - $key_parts = explode('_', $key); - $trt_id = $key_parts[1]; - $sql->update_table('training_type', array('trt_name' => $value), array('trt_id' => $trt_id)); - } - log::register('update_training_type', 'update all'); - header("Location: " . $actual_link); - break; - case 'coach_create': - # edző létrehozása - if (isset($_POST['ua_can_login']) && !empty($_POST['ua_can_login'])) { - $psw = md5($_POST['ua_password']); - } - else { - $psw = "null"; - } + break; + case 'training_type_update': + # edzés típus lista updatelése ABí-ba + unset($_POST['action']); + foreach ($_POST as $key => $value) { + $key_parts = explode('_', $key); + $trt_id = $key_parts[1]; + $sql->update_table('training_type', array('trt_name' => $value), array('trt_id' => $trt_id)); + } + log::register('update_training_type', 'update all'); + header("Location: " . $actual_link); + break; + case 'coach_create': + # edző létrehozása + if (isset($_POST['ua_can_login']) && !empty($_POST['ua_can_login'])) { + $psw = md5($_POST['ua_password']); + } + else { + $psw = "null"; + } - $new_coach_id = user::create_user($_POST['ua_name'], $psw); - log::register('new_coach', $new_coach_id); - header("Location: /admin/coaches"); - break; - case 'coach_data_edit': - # edző update - if (!empty($_POST['ua_password'])) { - $psw = md5($_POST['ua_password']); - } - else { - $psw = "-1"; //ez jelzi h nem szabad updatelni - } + $new_coach_id = user::create_user($_POST['ua_name'], $psw); + log::register('new_coach', $new_coach_id); + header("Location: /admin/coaches"); + break; + case 'coach_data_edit': + # edző update + if (!empty($_POST['ua_password'])) { + $psw = md5($_POST['ua_password']); + } + else { + $psw = "-1"; //ez jelzi h nem szabad updatelni + } - user::update_user($_POST['ua_name'], $psw, isset($_POST['ua_admin']), $_POST['ua_id']); - log::register('update_coach', $_POST['ua_id']); - header("Location: /admin/coaches"); - break; - case 'shirt_create': - # póló létrehozása - //todo: shirt object - $new_shirt_id = $sql->insert_into('shirt', array( - 'shirt_name' => $_POST['shirt_name'] - ) - ); - log::register('new_shirt', $new_shirt_id); - header("Location: /admin/shirts"); - break; - case 'shirt_data_edit': - # shirt update - //todo: shirt object - $sql->update_table('shirt', array( - 'shirt_name' => $_POST['shirt_name'], - ), - array( - 'shirt_id' => $_POST['shirt_id'] - ) - ); - log::register('update_shirt', $_POST['shirt_id']); - header("Location: /admin/shirts"); - break; - case 'city_create': - # település létrehozása - $new_city_id = school_city::create_school_city($_POST['scc_city']); - log::register('new_city', $new_city_id); - header("Location: /admin/cities"); - break; - case 'city_update': - # city lista updatelése AB-ba - unset($_POST['action']); - foreach ($_POST as $key => $value) { - $key_parts = explode('_', $key); - $scc_id = $key_parts[1]; - if ($key_parts[0] != "order") { - $sql->update_table('school_city', array('scc_city' => $value), array('scc_id' => $scc_id)); - } - else { - $sql->update_table('school_city', array('scc_order' => ($value==0?'null':$value)), array('scc_id' => $scc_id)); - } - } - log::register('update_city', 'update all'); - header("Location: /admin/cities"); - break; - case 'region_create': - # körzet létrehozása - //todo: körzet object - $new_reg_id = $sql->insert_into('region', array( - 'reg_name' => $_POST['reg_name'], - ) - ); - log::register('new_region', $new_reg_id); - header("Location: /admin/regions"); - break; - case 'region_update': - # region lista updatelése AB-ba - unset($_POST['action']); - foreach ($_POST as $key => $value) { - $key_parts = explode('_', $key); - $reg_id = $key_parts[1]; - $sql->update_table('region', array('reg_name' => $value), array('reg_id' => $reg_id)); - } - log::register('update_region', 'update all'); - header("Location: /admin/regions"); - break; - case 'school_data_create': - # iskola létrehozása - $new_school_id = school::create_school($_POST['sc_name'], $_POST['sc_school_city_scc_id']); - log::register('new_school', $new_school_id); - header("Location: /admin/schools"); - break; - case 'school_data_edit': - # iskola módosítása - unset($_POST['action']); - school::update_school($_POST['sc_id'], $_POST['sc_name'], $_POST['sc_school_city_scc_id']); - log::register('update_school', $_POST['sc_id']); - header("Location: /admin/schools"); - break; - case 'money_deposit_create': - # új befizetés létrehozása - $new_mod_id = money_deposit::create_money_deposit($_POST['mod_user_kid_uk_id'], $_POST['mod_date'], $_POST['mod_sum'], $_POST['mod_payment_type']); - $tmp_user = new user_kid(); - $tmp_user->set_user_data_by_id($_POST['mod_user_kid_uk_id']); - log::register('new_money_deposit', $tmp_user->get_uk_name() . ': ' . $_POST['mod_sum']. ' Ft (' . $_POST['mod_date'] . ')'); - header("Location: /admin/money_deposit"); - break; - case 'money_deposit_update': - # befizetés módosítás - money_deposit::update_money_deposit($_POST['mod_user_kid_uk_id'], $_POST['mod_date'], $_POST['mod_sum'], $_POST['mod_id'], $_POST['mod_payment_type'], $_POST['mi_id']); - $tmp_user = new user_kid(); - $tmp_user->set_user_data_by_id($_POST['mod_user_kid_uk_id']); - log::register('update_money_deposit', $tmp_user->get_uk_name() . ': ' . $_POST['mod_sum']. ' Ft (' . $_POST['mod_date'] . ')'); - header("Location: /admin/money_deposit"); - break; - case 'moxc_create': - # kiadás kategória létrehozása - $new_moxc_id = money_expense_category::create_money_expense_category($_POST['moxc_name']); - log::register('new_moxc', $new_moxc_id); - header("Location: /admin/money_expense_category"); - break; - case 'moxc_update': - # kiadás kategória módosítása - money_expense_category::update_money_expense_category($_POST['moxc_name'], $_POST['moxc_id']); - log::register('update_moxc', $_POST['moxc_id']); - header("Location: /admin/money_expense_category"); - break; - case 'mox_create': - # kiadás létrehozása - $new_mox_id = money_expense::create_money_expense($_POST['mox_name'], $_POST['mox_date'], $_POST['mox_item'], $_POST['mox_sum'], $_POST['mox_moxc_id'], $_POST['mox_payment_type']); - log::register('new_mox', $_POST['mox_item'] . ": " . $_POST['mox_sum'] . " Ft"); - header("Location: /admin/money_expense"); - break; - case 'mox_update': - # kiadás módosítása - money_expense::update_money_expense($_POST['mox_name'], $_POST['mox_date'], $_POST['mox_item'], $_POST['mox_sum'], $_POST['mox_moxc_id'], $_POST['mox_id'], $_POST['mox_payment_type']); - log::register('update_mox', $_POST['mox_item'] . ": " . $_POST['mox_sum'] . " Ft"); - header("Location: /admin/money_expense"); - break; - case 'mic_create': - # bevétel kategória létrehozása - $new_mic_id = money_income_category::create_money_income_category($_POST['mic_name']); - log::register('new_mic', $new_mic_id); - header("Location: /admin/money_income_category"); - break; - case 'mi_create': - # bevétel létrehozása - $new_mi_id = money_income::create_money_income($_POST['mi_date'], $_POST['mi_item'], $_POST['mi_sum'], $_POST['mi_mic_id'], $_POST['mi_payment_type']); - log::register('new_mi', $_POST['mi_item'] . ": " . $_POST['mi_sum'] . " Ft"); - header("Location: /admin/money_income"); - break; - case 'mic_update': - # bevétel kategória módosítása - money_income_category::update_money_income_category($_POST['mic_name'], $_POST['mic_id']); - log::register('update_mic', $_POST['mic_id']); - header("Location: /admin/money_income_category"); - break; - case 'mi_update': - # bevétel módosítása - money_income::update_money_income($_POST['mi_date'], $_POST['mi_item'], $_POST['mi_sum'], $_POST['mi_mic_id'], $_POST['mi_id'], $_POST['mi_payment_type']); - log::register('update_mi', $_POST['mi_item'] . ": " . $_POST['mi_sum'] . " Ft"); - header("Location: /admin/money_income"); - break; - case 'settings_data_edit': - $sql->update_table('setting_value', - array( - 'setv_'.$_POST['st_name'] => $_POST['set_val'], - 'setv_set_date' => date("Y-m-d H:i:s") - ), - array( - 'setv_id' => $_POST['setv_id'] - ) + user::update_user($_POST['ua_name'], $psw, isset($_POST['ua_admin']), $_POST['ua_id']); + log::register('update_coach', $_POST['ua_id']); + header("Location: /admin/coaches"); + break; + case 'shirt_create': + # póló létrehozása + //todo: shirt object + $new_shirt_id = $sql->insert_into('shirt', array( + 'shirt_name' => $_POST['shirt_name'] + ) + ); + log::register('new_shirt', $new_shirt_id); + header("Location: /admin/shirts"); + break; + case 'shirt_data_edit': + # shirt update + //todo: shirt object + $sql->update_table('shirt', array( + 'shirt_name' => $_POST['shirt_name'], + ), + array( + 'shirt_id' => $_POST['shirt_id'] + ) + ); + log::register('update_shirt', $_POST['shirt_id']); + header("Location: /admin/shirts"); + break; + case 'city_create': + # település létrehozása + $new_city_id = school_city::create_school_city($_POST['scc_city']); + log::register('new_city', $new_city_id); + header("Location: /admin/cities"); + break; + case 'city_update': + # city lista updatelése AB-ba + unset($_POST['action']); + foreach ($_POST as $key => $value) { + $key_parts = explode('_', $key); + $scc_id = $key_parts[1]; + if ($key_parts[0] != "order") { + $sql->update_table('school_city', array('scc_city' => $value), array('scc_id' => $scc_id)); + } + else { + $sql->update_table('school_city', array('scc_order' => ($value==0?'null':$value)), array('scc_id' => $scc_id)); + } + } + log::register('update_city', 'update all'); + header("Location: /admin/cities"); + break; + case 'region_create': + # körzet létrehozása + //todo: körzet object + $new_reg_id = $sql->insert_into('region', array( + 'reg_name' => $_POST['reg_name'], + ) + ); + log::register('new_region', $new_reg_id); + header("Location: /admin/regions"); + break; + case 'region_update': + # region lista updatelése AB-ba + unset($_POST['action']); + foreach ($_POST as $key => $value) { + $key_parts = explode('_', $key); + $reg_id = $key_parts[1]; + $sql->update_table('region', array('reg_name' => $value), array('reg_id' => $reg_id)); + } + log::register('update_region', 'update all'); + header("Location: /admin/regions"); + break; + case 'school_data_create': + # iskola létrehozása + $new_school_id = school::create_school($_POST['sc_name'], $_POST['sc_school_city_scc_id']); + log::register('new_school', $new_school_id); + header("Location: /admin/schools"); + break; + case 'school_data_edit': + # iskola módosítása + unset($_POST['action']); + school::update_school($_POST['sc_id'], $_POST['sc_name'], $_POST['sc_school_city_scc_id']); + log::register('update_school', $_POST['sc_id']); + header("Location: /admin/schools"); + break; + case 'money_deposit_create': + # új befizetés létrehozása + $new_mod_id = money_deposit::create_money_deposit($_POST['mod_user_kid_uk_id'], $_POST['mod_date'], $_POST['mod_sum'], $_POST['mod_payment_type']); + $tmp_user = new user_kid(); + $tmp_user->set_user_data_by_id($_POST['mod_user_kid_uk_id']); + log::register('new_money_deposit', $tmp_user->get_uk_name() . ': ' . $_POST['mod_sum']. ' Ft (' . $_POST['mod_date'] . ')'); + header("Location: /admin/money_deposit"); + break; + case 'money_deposit_update': + # befizetés módosítás + money_deposit::update_money_deposit($_POST['mod_user_kid_uk_id'], $_POST['mod_date'], $_POST['mod_sum'], $_POST['mod_id'], $_POST['mod_payment_type'], $_POST['mi_id']); + $tmp_user = new user_kid(); + $tmp_user->set_user_data_by_id($_POST['mod_user_kid_uk_id']); + log::register('update_money_deposit', $tmp_user->get_uk_name() . ': ' . $_POST['mod_sum']. ' Ft (' . $_POST['mod_date'] . ')'); + header("Location: /admin/money_deposit"); + break; + case 'moxc_create': + # kiadás kategória létrehozása + $new_moxc_id = money_expense_category::create_money_expense_category($_POST['moxc_name']); + log::register('new_moxc', $new_moxc_id); + header("Location: /admin/money_expense_category"); + break; + case 'moxc_update': + # kiadás kategória módosítása + money_expense_category::update_money_expense_category($_POST['moxc_name'], $_POST['moxc_id']); + log::register('update_moxc', $_POST['moxc_id']); + header("Location: /admin/money_expense_category"); + break; + case 'mox_create': + # kiadás létrehozása + $new_mox_id = money_expense::create_money_expense($_POST['mox_name'], $_POST['mox_date'], $_POST['mox_item'], $_POST['mox_sum'], $_POST['mox_moxc_id'], $_POST['mox_payment_type']); + log::register('new_mox', $_POST['mox_item'] . ": " . $_POST['mox_sum'] . " Ft"); + header("Location: /admin/money_expense"); + break; + case 'mox_update': + # kiadás módosítása + money_expense::update_money_expense($_POST['mox_name'], $_POST['mox_date'], $_POST['mox_item'], $_POST['mox_sum'], $_POST['mox_moxc_id'], $_POST['mox_id'], $_POST['mox_payment_type']); + log::register('update_mox', $_POST['mox_item'] . ": " . $_POST['mox_sum'] . " Ft"); + header("Location: /admin/money_expense"); + break; + case 'mic_create': + # bevétel kategória létrehozása + $new_mic_id = money_income_category::create_money_income_category($_POST['mic_name']); + log::register('new_mic', $new_mic_id); + header("Location: /admin/money_income_category"); + break; + case 'mi_create': + # bevétel létrehozása + $new_mi_id = money_income::create_money_income($_POST['mi_date'], $_POST['mi_item'], $_POST['mi_sum'], $_POST['mi_mic_id'], $_POST['mi_payment_type']); + log::register('new_mi', $_POST['mi_item'] . ": " . $_POST['mi_sum'] . " Ft"); + header("Location: /admin/money_income"); + break; + case 'mic_update': + # bevétel kategória módosítása + money_income_category::update_money_income_category($_POST['mic_name'], $_POST['mic_id']); + log::register('update_mic', $_POST['mic_id']); + header("Location: /admin/money_income_category"); + break; + case 'mi_update': + # bevétel módosítása + money_income::update_money_income($_POST['mi_date'], $_POST['mi_item'], $_POST['mi_sum'], $_POST['mi_mic_id'], $_POST['mi_id'], $_POST['mi_payment_type']); + log::register('update_mi', $_POST['mi_item'] . ": " . $_POST['mi_sum'] . " Ft"); + header("Location: /admin/money_income"); + break; + case 'settings_data_edit': + $sql->update_table('setting_value', + array( + 'setv_'.$_POST['st_name'] => $_POST['set_val'], + 'setv_set_date' => date("Y-m-d H:i:s") + ), + array( + 'setv_id' => $_POST['setv_id'] + ) - ); - header("Location: /admin/settings/".$_POST['set_id']); - break; - case 'camp_type_create': - # tábor típus létrehozása - $new_ct_id = camp_type::create_camp_type($_POST['ct_name']); - log::register('new_ct', $new_ct_id); - header("Location: /admin/camp_types"); - break; - case 'camp_type_update': - # tábor típus módosítása - unset($_POST['action']); - foreach ($_POST as $key => $value) { - $key_parts = explode('_', $key); - $ct_id = $key_parts[1]; - //$sql->update_table('region', array('reg_name' => $value), array('reg_id' => $reg_id)); - camp_type::update_camp_type($ct_id, $value); - } - log::register('update_ct', 'update all'); - header("Location: /admin/camp_types"); - break; - case 'camp_create': - # tábor létrehozása - unset($_POST['action']); - //meg kell vizsgálni, hogy a checkboxos mezők léteznek-e - $shuttles = array(); - if (!empty($_POST['shuttles'])) { - $shuttles = $_POST['shuttles']; - } + ); + header("Location: /admin/settings/".$_POST['set_id']); + break; + case 'camp_type_create': + # tábor típus létrehozása + $new_ct_id = camp_type::create_camp_type($_POST['ct_name']); + log::register('new_ct', $new_ct_id); + header("Location: /admin/camp_types"); + break; + case 'camp_type_update': + # tábor típus módosítása + unset($_POST['action']); + foreach ($_POST as $key => $value) { + $key_parts = explode('_', $key); + $ct_id = $key_parts[1]; + //$sql->update_table('region', array('reg_name' => $value), array('reg_id' => $reg_id)); + camp_type::update_camp_type($ct_id, $value); + } + log::register('update_ct', 'update all'); + header("Location: /admin/camp_types"); + break; + case 'camp_create': + # tábor létrehozása + unset($_POST['action']); + //meg kell vizsgálni, hogy a checkboxos mezők léteznek-e + $shuttles = array(); + if (!empty($_POST['shuttles'])) { + $shuttles = $_POST['shuttles']; + } - $accoms = array(); - if (!empty($_POST['accomodations'])) { - $accoms = $_POST['accomodations']; - } + $accoms = array(); + if (!empty($_POST['accomodations'])) { + $accoms = $_POST['accomodations']; + } - camp::create_camp($_POST['camp_city'], $_POST['camp_from'], $_POST['camp_to'], $_POST['camp_leader'], $_POST['camp_helpers'], (!empty($_POST['camp_is_open'])?1:0), $_POST['camp_camp_type_ct_id'], $shuttles, $accoms); - log::register('new_camp', $_POST['camp_from'] . " (" . $_POST['camp_city'] . ")"); - header("Location: /admin/camps"); - break; - case 'camp_update': - # tábor módosítás - $shuttles = array(); - if (!empty($_POST['shuttles'])) { - $shuttles = $_POST['shuttles']; - } + camp::create_camp($_POST['camp_city'], $_POST['camp_from'], $_POST['camp_to'], $_POST['camp_leader'], $_POST['camp_helpers'], (!empty($_POST['camp_is_open'])?1:0), $_POST['camp_camp_type_ct_id'], $shuttles, $accoms); + log::register('new_camp', $_POST['camp_from'] . " (" . $_POST['camp_city'] . ")"); + header("Location: /admin/camps"); + break; + case 'camp_update': + # tábor módosítás + $shuttles = array(); + if (!empty($_POST['shuttles'])) { + $shuttles = $_POST['shuttles']; + } - $accoms = array(); - if (!empty($_POST['accomodations'])) { - $accoms = $_POST['accomodations']; - } + $accoms = array(); + if (!empty($_POST['accomodations'])) { + $accoms = $_POST['accomodations']; + } - camp::update_camp($_POST['camp_city'], $_POST['camp_from'], $_POST['camp_to'], $_POST['camp_leader'], $_POST['camp_helpers'], (!empty($_POST['camp_is_open'])?1:0), $_POST['camp_camp_type_ct_id'], $shuttles, $accoms, $_POST['camp_id']); - log::register('update_camp', $_POST['camp_from'] . " (" . $_POST['camp_city'] . ")"); - header('Location: /admin/camps/' . $_POST['camp_id']); + camp::update_camp($_POST['camp_city'], $_POST['camp_from'], $_POST['camp_to'], $_POST['camp_leader'], $_POST['camp_helpers'], (!empty($_POST['camp_is_open'])?1:0), $_POST['camp_camp_type_ct_id'], $shuttles, $accoms, $_POST['camp_id']); + log::register('update_camp', $_POST['camp_from'] . " (" . $_POST['camp_city'] . ")"); + header('Location: /admin/camps/' . $_POST['camp_id']); - break; - case 'camp_shirt_create': - # tábori póló létrehozása - //todo: shirt object - $new_shirt_id = $sql->insert_into('camp_shirt', array( - 'cshirt_name' => $_POST['shirt_name'] - ) - ); - log::register('new_camp_shirt', $new_shirt_id); - header("Location: /admin/camp_shirt_type"); - break; - case 'camp_shirt_data_edit': - # camp shirt update - //todo: shirt object - $sql->update_table('camp_shirt', array( - 'cshirt_name' => $_POST['shirt_name'], - ), - array( - 'cshirt_id' => $_POST['shirt_id'] - ) - ); - log::register('update_camp_shirt', $_POST['shirt_id']); - header("Location: /admin/camp_shirt_type"); - break; - case 'apply_1': - //jelentkezés 1. lépés - jelentkező adatai + break; + case 'camp_shirt_create': + # tábori póló létrehozása + //todo: shirt object + $new_shirt_id = $sql->insert_into('camp_shirt', array( + 'cshirt_name' => $_POST['shirt_name'] + ) + ); + log::register('new_camp_shirt', $new_shirt_id); + header("Location: /admin/camp_shirt_type"); + break; + case 'camp_shirt_data_edit': + # camp shirt update + //todo: shirt object + $sql->update_table('camp_shirt', array( + 'cshirt_name' => $_POST['shirt_name'], + ), + array( + 'cshirt_id' => $_POST['shirt_id'] + ) + ); + log::register('update_camp_shirt', $_POST['shirt_id']); + header("Location: /admin/camp_shirt_type"); + break; + case 'apply_1': + //jelentkezés 1. lépés - jelentkező adatai - $new_camp_kid_id = camp_kid::create_camp_kid( - $_POST['ck_name'], - $_POST['ck_birth_year'], - $_POST['ck_ss_number'], - $_POST['ck_email'], - $_POST['ck_mobile'], - $_POST['ck_shirt_size_id'], - array( - 'ck_sport_history' => $_POST['ck_sport_history'], - 'ck_badminton_history' => $_POST['ck_badminton_history'], - 'ck_food_info' => $_POST['ck_food_info'], - 'ck_hygiene_info' => $_POST['ck_hygiene_info'], - 'ck_health_info' => $_POST['ck_health_info'], - 'ck_pharma_info' => $_POST['ck_pharma_info'], - 'ck_other_info' => $_POST['ck_other_info'], - ), - $_POST['ck_list'], - $_POST['ck_owner_id'] - ); - //létrehozzuk az apply objektumot és berakjuk cookieba az id-t, azzal azonosítjuk a sessiont - $new_apply_id = camp_apply::create_camp_apply($new_camp_kid_id); - setcookie('badminton_camp_session_id', $new_apply_id, time()+60*60, '/'); - header('Location: /tabor/jelentkezes/2'); - break; - case 'apply_2': - # jelentkezés 2. lépés - kapcsolattartó adatai + $new_camp_kid_id = camp_kid::create_camp_kid( + $_POST['ck_name'], + $_POST['ck_birth_year'], + $_POST['ck_ss_number'], + $_POST['ck_email'], + $_POST['ck_mobile'], + $_POST['ck_shirt_size_id'], + array( + 'ck_sport_history' => $_POST['ck_sport_history'], + 'ck_badminton_history' => $_POST['ck_badminton_history'], + 'ck_food_info' => $_POST['ck_food_info'], + 'ck_hygiene_info' => $_POST['ck_hygiene_info'], + 'ck_health_info' => $_POST['ck_health_info'], + 'ck_pharma_info' => $_POST['ck_pharma_info'], + 'ck_other_info' => $_POST['ck_other_info'], + ), + $_POST['ck_list'], + $_POST['ck_owner_id'] + ); + //létrehozzuk az apply objektumot és berakjuk cookieba az id-t, azzal azonosítjuk a sessiont + $new_apply_id = camp_apply::create_camp_apply($new_camp_kid_id); + setcookie('badminton_camp_session_id', $new_apply_id, time()+60*60, '/'); + header('Location: /tabor/jelentkezes/2'); + break; + case 'apply_2': + # jelentkezés 2. lépés - kapcsolattartó adatai - //leellenőrizzük, hogy új kapcsolat típust adott-e meg, ha igen, fetöltjük, és kivesszük az id-t - if ($_POST['cc_camp_contact_type_cct_id'] == 'new') { - $new_cct_id = $sql->insert_into('camp_contact_type', array('cct_name' => $_POST['cct_add_new'], 'cct_owner' => $_POST['cc_owner_id'])); - $_POST['cc_camp_contact_type_cct_id'] = $new_cct_id; - } + //leellenőrizzük, hogy új kapcsolat típust adott-e meg, ha igen, fetöltjük, és kivesszük az id-t + if ($_POST['cc_camp_contact_type_cct_id'] == 'new') { + $new_cct_id = $sql->insert_into('camp_contact_type', array('cct_name' => $_POST['cct_add_new'], 'cct_owner' => $_POST['cc_owner_id'])); + $_POST['cc_camp_contact_type_cct_id'] = $new_cct_id; + } - $new_cc_id = camp_contact::create_camp_contact( - $_POST['cc_name'], - $_POST['cc_mobile'], - $_POST['cc_email'], - $_POST['cc_facebook'], - $_POST['cc_camp_contact_type_cct_id'], - $_POST['cc_owner_id'], - $_POST['cc_list'] - ); + $new_cc_id = camp_contact::create_camp_contact( + $_POST['cc_name'], + $_POST['cc_mobile'], + $_POST['cc_email'], + $_POST['cc_facebook'], + $_POST['cc_camp_contact_type_cct_id'], + $_POST['cc_owner_id'], + $_POST['cc_list'] + ); - //hozzáadjuk a jelentkezéshez az új contact-ot - $sql->insert_into('camp_apply_contact', array( - 'cac_camp_apply_capp_id' => $_COOKIE['badminton_camp_session_id'], - 'cac_camp_contact_cc_id' => $new_cc_id, - 'cac_is_responsible' => (!empty($_POST['cc_is_responsible'])?1:0), - ) - ); + //hozzáadjuk a jelentkezéshez az új contact-ot + $sql->insert_into('camp_apply_contact', array( + 'cac_camp_apply_capp_id' => $_COOKIE['badminton_camp_session_id'], + 'cac_camp_contact_cc_id' => $new_cc_id, + 'cac_is_responsible' => (!empty($_POST['cc_is_responsible'])?1:0), + ) + ); - //megnézzük, hogy továbblépünk, vagy vissza a contact megadós oldalra - if (1 == $_POST['add_more']) { - header('Location: /tabor/jelentkezes/2'); - } - else { - //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'); - } + //megnézzük, hogy továbblépünk, vagy vissza a contact megadós oldalra + if (1 == $_POST['add_more']) { + header('Location: /tabor/jelentkezes/2'); + } + else { + //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'); + } - } + } - break; - case 'apply_3': - # kiválasztott felelős kapcsolattartó beállítása - camp_apply::make_contact_responsible($_COOKIE['badminton_camp_session_id'], $_POST['cc_is_responsible'], true); - header("Location: /tabor/jelentkezes/4"); - break; - case 'apply_4': - # jelentkezés lezárása - camp_apply::update_camp_apply($_POST['camp_apply_id'], 2, $_POST['camp_accomodation'], $_POST['camp_shuttle'], date('Y-m-d H:i:s'), 'null', $_POST['camp_id']); - header('Location: /tabor/jelentkezes/5'); - break; - case 'user_camp_leader_create': - # táborvezető létrehozása - $new_ucl_id = user_camp_leader::create_camp_leader($_POST['ucl_name'], $_POST['ucl_password']); - log::register('new_camp_leader', $new_ucl_id); - header('Location: /admin/camp_user'); - break; - case 'user_camp_leader_update': - # táborvezető update - if (empty($_POST['ucl_password'])) { - $_POST['ucl_password'] = null; - } - $new_ucl_id = user_camp_leader::update_camp_leader($_POST['ucl_name'], $_POST['ucl_password'], $_POST['ucl_id']); - log::register('update_camp_leader', $_POST['ucl_id']); - header('Location: /admin/camp_user'); - break; - case 'user_group_create': - # új csoport - $new_ug_id = user_group::create_user_group($_POST['ug_name'], $_POST['ug_description'], $_POST['ug_is_automatic']); - log::register('new_user_group', $new_ug_id); - header('Location: /admin/user_groups'); - break; - case 'user_group_update': - # csoport update - user_group::update_user_group($_POST['ug_name'], $_POST['ug_description'], $_POST['ug_id'], $_POST['ug_automatic']); - log::register('update_user_group', $_POST['ug_id']); - header('Location: /admin/user_groups/'.$_POST['ug_id']); - break; - case 'upload_milestone': - $statusCode = milestone::upload_file($_FILES['fileToUpload']); - if (0 !== $statusCode) { - header('Location: /admin/milestones/'.$statusCode); - } - else { - header('Location: /admin/milestones/success'); - } - break; - case 'training_template_create': - # új edzés salon - $new_tt_id = training_template::create_tt($_POST['tt_name'], $_POST['tt_time'], $_POST['tt_training_type'], $_POST['tt_duration']); - log::register('new_training_template', $new_tt_id); - header('Location: /admin/training_templates/'.$new_tt_id); - break; - case 'training_template_update': - # edzés salon update - training_template::update_tt($_POST['tt_name'], $_POST['tt_time'], $_POST['tt_training_type'], $_POST['tt_duration'], $_POST['tt_id']); - log::register('update_training_template', $_POST['tt_id']); - header('Location: /admin/training_templates/'.$_POST['tt_id']); - break; - default: - # code... - break; - } + break; + case 'apply_3': + # kiválasztott felelős kapcsolattartó beállítása + camp_apply::make_contact_responsible($_COOKIE['badminton_camp_session_id'], $_POST['cc_is_responsible'], true); + header("Location: /tabor/jelentkezes/4"); + break; + case 'apply_4': + # jelentkezés lezárása + camp_apply::update_camp_apply($_POST['camp_apply_id'], 2, $_POST['camp_accomodation'], $_POST['camp_shuttle'], date('Y-m-d H:i:s'), 'null', $_POST['camp_id']); + header('Location: /tabor/jelentkezes/5'); + break; + case 'user_camp_leader_create': + # táborvezető létrehozása + $new_ucl_id = user_camp_leader::create_camp_leader($_POST['ucl_name'], $_POST['ucl_password']); + log::register('new_camp_leader', $new_ucl_id); + header('Location: /admin/camp_user'); + break; + case 'user_camp_leader_update': + # táborvezető update + if (empty($_POST['ucl_password'])) { + $_POST['ucl_password'] = null; + } + $new_ucl_id = user_camp_leader::update_camp_leader($_POST['ucl_name'], $_POST['ucl_password'], $_POST['ucl_id']); + log::register('update_camp_leader', $_POST['ucl_id']); + header('Location: /admin/camp_user'); + break; + case 'user_group_create': + # új csoport + $new_ug_id = user_group::create_user_group($_POST['ug_name'], $_POST['ug_description'], $_POST['ug_is_automatic']); + log::register('new_user_group', $new_ug_id); + header('Location: /admin/user_groups'); + break; + case 'user_group_update': + # csoport update + user_group::update_user_group($_POST['ug_name'], $_POST['ug_description'], $_POST['ug_id'], $_POST['ug_automatic']); + log::register('update_user_group', $_POST['ug_id']); + header('Location: /admin/user_groups/'.$_POST['ug_id']); + break; + case 'upload_milestone': + $statusCode = milestone::upload_file($_FILES['fileToUpload']); + if (0 !== $statusCode) { + //header('Location: /admin/milestones/'.$statusCode); + } + else { + //header('Location: /admin/milestones/success'); + } + break; + case 'training_template_create': + # új edzés salon + $new_tt_id = training_template::create_tt($_POST['tt_name'], $_POST['tt_time'], $_POST['tt_training_type'], $_POST['tt_duration']); + log::register('new_training_template', $new_tt_id); + header('Location: /admin/training_templates/'.$new_tt_id); + break; + case 'training_template_update': + # edzés salon update + training_template::update_tt($_POST['tt_name'], $_POST['tt_time'], $_POST['tt_training_type'], $_POST['tt_duration'], $_POST['tt_id']); + log::register('update_training_template', $_POST['tt_id']); + header('Location: /admin/training_templates/'.$_POST['tt_id']); + break; + default: + # code... + break; + } } diff --git a/index.php b/index.php index ec5dba9..e902cf1 100644 --- a/index.php +++ b/index.php @@ -9,140 +9,140 @@ setlocale(LC_ALL, 'hu_HU'); ?> - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + - - + '; - ?> - - - - - - is_page() && in_array($page->get_page(), array('view', 'preview'))) { - echo ''; - } + echo ''; + ?> + + + + + + is_page() && in_array($page->get_page(), array('view', 'preview'))) { + echo ''; + } - if (in_array($page->get_page(), array('view','preview')) && $page->is_subpage() && $page->get_subpage() == "diary"|| $page->get_page() == "view" && !$page->is_subpage()) - echo ''; + if (in_array($page->get_page(), array('view','preview')) && $page->is_subpage() && $page->get_subpage() == "diary"|| $page->get_page() == "view" && !$page->is_subpage()) + echo ''; - if ($page->is_page() && ($page->get_page() == 'coach' || $page->get_page() == 'coach_preview')) { - echo ''; - } + if ($page->is_page() && ($page->get_page() == 'coach' || $page->get_page() == 'coach_preview')) { + echo ''; + } - if ($page->is_page() && ($page->get_page() == 'tabor')) { - echo ''; - } + if ($page->is_page() && ($page->get_page() == 'tabor')) { + echo ''; + } - if ($page->is_page() && ($page->get_page() == 'taborvezeto')) { - echo ''; - } + if ($page->is_page() && ($page->get_page() == 'taborvezeto')) { + echo ''; + } - ?> + ?> - - <?php - if ($page->is_page() && ($page->get_page() == 'tabor')) { - echo "Tollaslabda táborok 2018. nyár"; - } - else { - echo "Badminton Coach"; - } - ?> - - + + <?php + if ($page->is_page() && ($page->get_page() == 'tabor')) { + echo "Tollaslabda táborok 2018. nyár"; + } + else { + echo "Badminton Coach"; + } + ?> + + - -
- -
-
-
- get_page_content();?> -
-
-
-
- - is_page() && ($page->get_page() == 'tabor' && !$dev)) { - ?> - - - + + is_page() && ($page->get_page() == 'tabor' && !$dev)) { + ?> + + + - - - + + gtag('config', 'UA-72772703-2'); + diff --git a/template/templates/presence.tpl b/template/templates/presence.tpl index 47ded6c..a9dbfeb 100644 --- a/template/templates/presence.tpl +++ b/template/templates/presence.tpl @@ -41,7 +41,7 @@
{$training->get_tr_duration()} perc
- {if $trc_coaches} + {if $trc_coaches || $trc_helpers}
+
{/if} {if $ms->get_ms_training_mst_id() != null} @@ -53,6 +61,15 @@ {$ms->get_ms_camp_msca_id()->get_msca_place()}
+ {elseif $ms->get_ms_ranking_msr_id() != null} + +
+ + Ranglista
+ {$ms->get_ms_ranking_msr_id()->get_msr_date()}
+ {nl2br($ms->get_ms_ranking_msr_id()->get_msr_rankings())} +
+
{/if} @@ -67,10 +84,16 @@ function open_block(block_id) { $("#"+block_id).slideDown("slow"); + $(".full_"+block_id).hide(); + $(".short_"+block_id).show(); + $(".short_"+block_id).css('display', 'inline-block'); } function close_block(block_id) { $("#"+block_id).slideUp("slow"); + $(".full_"+block_id).show(); + $(".short_"+block_id).hide(); + $(".full_"+block_id).css('display', 'inline-block'); } function block_action(block_id) {