created profile in parent view

This commit is contained in:
Tóth Richárd
2018-06-11 23:51:23 +02:00
parent f98f1fe6e2
commit a50eab7528
8 changed files with 202 additions and 9 deletions

View File

@@ -7,9 +7,9 @@ class milestone
{ {
private $ms_id; private $ms_id;
private $ms_type_mt_id; private $ms_type_mt_id;
private $ms_training_mst_id; private $ms_training_mst_id = null;
private $ms_competition_msc_id; private $ms_competition_msc_id = null;
private $ms_camp_msca_id; private $ms_camp_msca_id = null;
private $ms_user_kid_uk_id; private $ms_user_kid_uk_id;
public function set_ms_data_by_id($_ms_id) { public function set_ms_data_by_id($_ms_id) {
@@ -20,9 +20,31 @@ class milestone
foreach ($cat_array as $field => $value) { foreach ($cat_array as $field => $value) {
$function_name = "set_" . $field; $function_name = "set_" . $field;
$this->$function_name($value); $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) public static function create_ms($_mt, $_uk, $_mst = null, $_msc = null, $_msca = null)
@@ -37,6 +59,18 @@ class milestone
), false); ), 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); $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 $content = file($_FILES['fileToUpload']['tmp_name']); //makes array
//var_dump($content);
for ($i=0; $i < count($content); $i++) { for ($i=0; $i < count($content); $i++) {
$line = $content[$i]; $line = $content[$i];
@@ -247,7 +281,7 @@ class milestone
++$i; //mérkőzések szöveg ++$i; //mérkőzések szöveg
$matches = ''; $matches = '';
do { do {
$matches .= trim($content[$i]); $matches .= trim($content[$i]) . '\n';
++$i; ++$i;
} while (isset($content[$i]) && !empty(trim($content[$i]))); } while (isset($content[$i]) && !empty(trim($content[$i])));
} }

View File

@@ -13,7 +13,7 @@ class milestone_camp
public function set_msca_data_by_id($_msca_id) { public function set_msca_data_by_id($_msca_id) {
global $sql; 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]; $cat_array = $cat_assoc_array[0];
//alapadatok //alapadatok
foreach ($cat_array as $field => $value) { foreach ($cat_array as $field => $value) {

View File

@@ -341,6 +341,10 @@ class page {
# információk # információk
include('include_information.php'); include('include_information.php');
break; break;
case 'profile':
# információk
include('include_profile.php');
break;
default: default:
include('include_diary.php'); include('include_diary.php');
break; break;
@@ -361,6 +365,10 @@ class page {
# információk # információk
include('include_information.php'); include('include_information.php');
break; break;
case 'profile':
# információk
include('include_profile.php');
break;
default: default:
include('include_diary.php'); include('include_diary.php');
break; break;

View File

@@ -40,4 +40,31 @@ div.list div.money_deposit {
background-color: #F3BF75; background-color: #F3BF75;
border-left: 2px solid #000; border-left: 2px solid #000;
color: #002E4C; color: #002E4C;
} }
.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;
}

BIN
_image/competition.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

View File

@@ -0,0 +1,17 @@
<?php
$ms_assoc_array = $sql->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');
?>

View File

@@ -35,6 +35,8 @@ setlocale(LC_ALL, 'hu_HU');
<meta name="theme-color" content="#ffffff"> <meta name="theme-color" content="#ffffff">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<?php <?php
require('common.php'); require('common.php');
@@ -132,5 +134,15 @@ setlocale(LC_ALL, 'hu_HU');
?> ?>
</body> </body>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-72772703-2"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-72772703-2');
</script>
</html> </html>

View File

@@ -0,0 +1,95 @@
<div class="list half_width">
{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
}
</div>
{/if}
<span onclick="block_action('block_{$ms->get_ms_month()|substr:0:4}{$ms->get_ms_month()|substr:5:2}');" class="date_separator clickable">{$ms_array[$ms@index]->get_ms_month()|substr:0:4}.
{$months[$ms_array[$ms@index]->get_ms_month()|substr:5:2]}
<img src="/_image/open_folder.png">
</span>
<div id="block_{$ms->get_ms_month()|substr:0:4}{$ms->get_ms_month()|substr:5:2}" class="month_block">
{/if}
{if $ms->get_ms_training_mst_id() != null}
<a>
<div class="list_item training">
<img src="/_image/training.png">
<strong><span style="display: block;">Edzés</span></strong><br>
{$ms->get_ms_training_mst_id()->get_mst_date()}<br>
{$ms->get_ms_training_mst_id()->get_mst_count()}<br>
{nl2br($ms->get_ms_training_mst_id()->get_mst_trainings())}
</div>
</a>
{elseif $ms->get_ms_competition_msc_id() != null}
<a>
<div class="list_item competition">
<img src="/_image/competition.png">
<strong><span class="bold" style="display: block;">Verseny</span></strong><br>
{$ms->get_ms_competition_msc_id()->get_msc_date()}<br>
{$ms->get_ms_competition_msc_id()->get_msc_name()}<br>
{$ms->get_ms_competition_msc_id()->get_msc_category()}<br>
{$ms->get_ms_competition_msc_id()->get_msc_place()}<br>
{if $ms->get_ms_competition_msc_id()->get_msc_matches() != null}
<span class="bold">Mérkőzések:</span><br>
{nl2br($ms->get_ms_competition_msc_id()->get_msc_matches())}
{/if}
</div>
</a>
{elseif $ms->get_ms_camp_msca_id() != null}
<a>
<div class="list_item camp">
<img src="/_image/camp.png">
<strong><span class="bold" style="display: block;">Edzőtábor</span></strong><br>
{$ms->get_ms_camp_msca_id()->get_msca_date()}<br>
{$ms->get_ms_camp_msca_id()->get_msca_place()}<br>
</div>
</a>
{/if}
{if $ms@last}
</div>
{/if}
{/foreach}
</div>
<script>
function open_block(block_id) {
$("#"+block_id).slideDown("slow");
}
function close_block(block_id) {
$("#"+block_id).slideUp("slow");
}
function block_action(block_id) {
if ($("#"+block_id).is(':hidden')) {
open_block(block_id);
}
else {
close_block(block_id);
}
}
$( document ).ready(function() {
var divs = $( "div[class=month_block]" );
$( ".list" ).find( divs ).hide();
var div_list = $( ".list" ).find( divs );
open_block(div_list[0].id);
});
</script>