diff --git a/_class/class_milestone.php b/_class/class_milestone.php index 0e7ac02..bf194ba 100644 --- a/_class/class_milestone.php +++ b/_class/class_milestone.php @@ -7,9 +7,9 @@ class milestone { private $ms_id; private $ms_type_mt_id; - private $ms_training_mst_id; - private $ms_competition_msc_id; - private $ms_camp_msca_id; + private $ms_training_mst_id = null; + private $ms_competition_msc_id = null; + private $ms_camp_msca_id = null; private $ms_user_kid_uk_id; public function set_ms_data_by_id($_ms_id) { @@ -20,9 +20,31 @@ class milestone foreach ($cat_array as $field => $value) { $function_name = "set_" . $field; $this->$function_name($value); - } - //todo: egyéb objektumok + if ($field == 'ms_type_mt_id' && $value != null) { + $new_mt = new milestone_type(); + $new_mt->set_mt_data_by_id($value); + $this->set_ms_type_mt_id($new_mt); + } + + if ($field == 'ms_training_mst_id' && $value != null) { + $new_mst = new milestone_training(); + $new_mst->set_mst_data_by_id($value); + $this->set_ms_training_mst_id($new_mst); + } + + if ($field == 'ms_competition_msc_id' && $value != null) { + $new_msc = new milestone_competition(); + $new_msc->set_msc_data_by_id($value); + $this->set_ms_competition_msc_id($new_msc); + } + + if ($field == 'ms_camp_msca_id' && $value != null) { + $new_msca = new milestone_camp(); + $new_msca->set_msca_data_by_id($value); + $this->set_ms_camp_msca_id($new_msca); + } + } } public static function create_ms($_mt, $_uk, $_mst = null, $_msc = null, $_msca = null) @@ -37,6 +59,18 @@ class milestone ), false); } + public function get_ms_month() { + if (null !== $this->ms_competition_msc_id) { + return $this->ms_competition_msc_id->get_msc_month(); + } + elseif (null !== $this->ms_training_mst_id) { + return $this->ms_training_mst_id->get_mst_month(); + } + elseif (null !== $this->ms_camp_msca_id) { + return $this->ms_camp_msca_id->get_msca_month(); + } + } + /** @@ -177,7 +211,7 @@ class milestone $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); $content = file($_FILES['fileToUpload']['tmp_name']); //makes array - //var_dump($content); + for ($i=0; $i < count($content); $i++) { $line = $content[$i]; @@ -247,7 +281,7 @@ class milestone ++$i; //mérkőzések szöveg $matches = ''; do { - $matches .= trim($content[$i]); + $matches .= trim($content[$i]) . '\n'; ++$i; } while (isset($content[$i]) && !empty(trim($content[$i]))); } diff --git a/_class/class_milestone_camp.php b/_class/class_milestone_camp.php index 0da2106..d375811 100644 --- a/_class/class_milestone_camp.php +++ b/_class/class_milestone_camp.php @@ -13,7 +13,7 @@ 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 msc_id = " . $_msca_id); + $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) { diff --git a/_class/class_page.php b/_class/class_page.php index f0148ff..6938b4f 100644 --- a/_class/class_page.php +++ b/_class/class_page.php @@ -341,6 +341,10 @@ class page { # információk include('include_information.php'); break; + case 'profile': + # információk + include('include_profile.php'); + break; default: include('include_diary.php'); break; @@ -361,6 +365,10 @@ class page { # információk include('include_information.php'); break; + case 'profile': + # információk + include('include_profile.php'); + break; default: include('include_diary.php'); break; diff --git a/_css/default_view.css b/_css/default_view.css index 7fe065b..d1224a9 100644 --- a/_css/default_view.css +++ b/_css/default_view.css @@ -40,4 +40,31 @@ div.list div.money_deposit { background-color: #F3BF75; border-left: 2px solid #000; color: #002E4C; -} \ No newline at end of file +} + +.list_item.training { + background-color: #a1ffff; + border-left: 2px solid #0a40ff; +} + +.list_item.training:hover { + background-color: #5ecfcf; +} + +.list_item.competition { + background-color: #f6bea0; + border-left: 2px solid #ef4710; +} + +.list_item.competition:hover { + background-color: #f0a278; +} + +.list_item.camp { + background-color: #97fc7e; + border-left: 2px solid #278310; +} + +.list_item.camp:hover { + background-color: #69de4c; +} diff --git a/_image/competition.png b/_image/competition.png new file mode 100644 index 0000000..ff4ad2a Binary files /dev/null and b/_image/competition.png differ diff --git a/_include/include_profile.php b/_include/include_profile.php new file mode 100644 index 0000000..6233290 --- /dev/null +++ b/_include/include_profile.php @@ -0,0 +1,17 @@ +assoc_array('select * from milestone where ms_user_kid_uk_id = ' . $user->get_uk_id()); + +$ms_array = array(); + +foreach ($ms_assoc_array as $key => $ms) { + $new_ms = new milestone(); + $new_ms->set_ms_data_by_id($ms['ms_id']); + $ms_array[] = $new_ms; +} + +$smarty->assign('ms_array', $ms_array); + +$smarty->display('user_profile.tpl'); + +?> diff --git a/index.php b/index.php index a775481..ec5dba9 100644 --- a/index.php +++ b/index.php @@ -35,6 +35,8 @@ setlocale(LC_ALL, 'hu_HU'); + + + + + + diff --git a/template/templates/user_profile.tpl b/template/templates/user_profile.tpl new file mode 100644 index 0000000..f7b5aa9 --- /dev/null +++ b/template/templates/user_profile.tpl @@ -0,0 +1,95 @@ +
+{foreach $ms_array as $ms} + {if + $ms@first || + ( + $ms_array[$ms@index]->get_ms_month()|substr:5:2 != $ms_array[$ms@index-1]->get_ms_month()|substr:5:2 + ) + + } + {if !$ms@first && + $ms_array[$ms@index]->get_ms_month()|substr:5:2 != $ms_array[$ms@index-1]->get_ms_month()|substr:5:2 + } +
+ {/if} + {$ms_array[$ms@index]->get_ms_month()|substr:0:4}. + {$months[$ms_array[$ms@index]->get_ms_month()|substr:5:2]} + + +
+ {/if} + + {if $ms->get_ms_training_mst_id() != null} + +
+ + Edzés
+ {$ms->get_ms_training_mst_id()->get_mst_date()}
+ {$ms->get_ms_training_mst_id()->get_mst_count()}
+ {nl2br($ms->get_ms_training_mst_id()->get_mst_trainings())} +
+
+ {elseif $ms->get_ms_competition_msc_id() != null} + +
+ + Verseny
+ {$ms->get_ms_competition_msc_id()->get_msc_date()}
+ {$ms->get_ms_competition_msc_id()->get_msc_name()}
+ {$ms->get_ms_competition_msc_id()->get_msc_category()}
+ {$ms->get_ms_competition_msc_id()->get_msc_place()}
+ {if $ms->get_ms_competition_msc_id()->get_msc_matches() != null} + Mérkőzések:
+ {nl2br($ms->get_ms_competition_msc_id()->get_msc_matches())} + {/if} +
+
+ {elseif $ms->get_ms_camp_msca_id() != null} + +
+ + Edzőtábor
+ {$ms->get_ms_camp_msca_id()->get_msca_date()}
+ {$ms->get_ms_camp_msca_id()->get_msca_place()}
+
+
+ {/if} + + + {if $ms@last} +
+ {/if} +{/foreach} + + + +