diary
This commit is contained in:
@@ -177,9 +177,13 @@ class page {
|
|||||||
include('include_logout.php');
|
include('include_logout.php');
|
||||||
break;
|
break;
|
||||||
case 'overview':
|
case 'overview':
|
||||||
# áttekintő oldal adatokkal és edzéslistával
|
# áttekintő oldal adatokkal
|
||||||
include('include_overview.php');
|
include('include_overview.php');
|
||||||
break;
|
break;
|
||||||
|
case 'diary':
|
||||||
|
# napló, edzéslista
|
||||||
|
include('include_diary.php');
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
include('include_overview.php');
|
include('include_overview.php');
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ class training {
|
|||||||
private $tr_user_coach_uc_id;
|
private $tr_user_coach_uc_id;
|
||||||
private $tr_duration;
|
private $tr_duration;
|
||||||
private $tr_locked;
|
private $tr_locked;
|
||||||
|
private $coaches = array();
|
||||||
|
|
||||||
|
|
||||||
public function set_tr_id($_tr_id) {
|
public function set_tr_id($_tr_id) {
|
||||||
@@ -74,6 +75,17 @@ class training {
|
|||||||
return $sql->single_variable("SELECT trt_name FROM training_type WHERE trt_id = " . $this->get_tr_training_type_trt_id());
|
return $sql->single_variable("SELECT trt_name FROM training_type WHERE trt_id = " . $this->get_tr_training_type_trt_id());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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 WHERE 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 set_training_data_by_id($_tr_id) {
|
public function set_training_data_by_id($_tr_id) {
|
||||||
global $sql;
|
global $sql;
|
||||||
$training_data_assoc_array = $sql->assoc_array("select * from training where tr_id = " . $_tr_id);
|
$training_data_assoc_array = $sql->assoc_array("select * from training where tr_id = " . $_tr_id);
|
||||||
@@ -82,10 +94,26 @@ class training {
|
|||||||
$function_name = "set_" . $field;
|
$function_name = "set_" . $field;
|
||||||
$this->$function_name($value);
|
$this->$function_name($value);
|
||||||
}
|
}
|
||||||
|
$this->set_tr_coaches();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function create_training($_training_value_array, $_every_week) {
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
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 static function create_training($_training_value_array, $_every_week) {
|
||||||
global $sql;
|
global $sql;
|
||||||
//megnézzük, hogy minden hétre be kell-e rakni
|
//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
|
//ha igen, akkor az adott hónapban, a hét minden azonos napjára létrehozza
|
||||||
@@ -148,7 +176,7 @@ class training {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function update_training($_training_value_array, $_tr_id) {
|
public static function update_training($_training_value_array, $_tr_id) {
|
||||||
global $sql;
|
global $sql;
|
||||||
|
|
||||||
$sql->execute_query("DELETE FROM training_coach WHERE trc_training_tr_id = '" . $_tr_id ."';");
|
$sql->execute_query("DELETE FROM training_coach WHERE trc_training_tr_id = '" . $_tr_id ."';");
|
||||||
|
|||||||
@@ -44,6 +44,14 @@ main #main_content {
|
|||||||
font-style: italic;
|
font-style: italic;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.bold {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.list .list_item .size20 {
|
||||||
|
font-size: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
a:link {
|
a:link {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
@@ -138,10 +146,18 @@ td.create a {
|
|||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.bigger_space {
|
||||||
|
margin: 10px 0px;
|
||||||
|
}
|
||||||
|
|
||||||
.transp {
|
.transp {
|
||||||
opacity: 0.5;
|
opacity: 0.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.line_height14 {
|
||||||
|
line-height: 1.4;
|
||||||
|
}
|
||||||
|
|
||||||
.list .width70 {
|
.list .width70 {
|
||||||
width: 70%;
|
width: 70%;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,8 @@ ul.topnav li a {
|
|||||||
color: #002E4C;
|
color: #002E4C;
|
||||||
}
|
}
|
||||||
|
|
||||||
ul.topnav li a:hover {
|
ul.topnav li a:hover, ul.topnav li a span:hover {
|
||||||
background-color: #f77604;
|
background: transparent;
|
||||||
opacity: 0.6;
|
color: #01112b;
|
||||||
|
text-decoration: underline;
|
||||||
}
|
}
|
||||||
32
_include/include_diary.php
Normal file
32
_include/include_diary.php
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
if ($this->is_id()) {
|
||||||
|
# EMPTY
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
# EDZÉS LISTA
|
||||||
|
|
||||||
|
$training_list_query = "
|
||||||
|
SELECT pr_training_tr_id FROM presence
|
||||||
|
JOIN training ON tr_id = pr_training_tr_id
|
||||||
|
WHERE
|
||||||
|
pr_user_kid_uk_id = ".$user->get_uk_id()."
|
||||||
|
ORDER BY tr_date DESC;
|
||||||
|
";
|
||||||
|
|
||||||
|
$training_assoc_array = $sql->assoc_array($training_list_query);
|
||||||
|
|
||||||
|
$trainings = array();
|
||||||
|
foreach ($training_assoc_array as $training) {
|
||||||
|
$new_training = new training();
|
||||||
|
$new_training->set_training_data_by_id($training['pr_training_tr_id']);
|
||||||
|
$trainings[] = $new_training;
|
||||||
|
}
|
||||||
|
|
||||||
|
$smarty->assign('training_array', $trainings);
|
||||||
|
$smarty->display('user_diary.tpl');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
@@ -7,7 +7,7 @@
|
|||||||
{foreach $school_assoc_array as $school}
|
{foreach $school_assoc_array as $school}
|
||||||
<div>
|
<div>
|
||||||
<div style="float: left;">
|
<div style="float: left;">
|
||||||
<input type="text" name="trt_{$school.sc_id}" id="trt_{$school.sc_id}" value="{$school.sc_name}">
|
<input type="text" name="sc_{$school.sc_id}" id="sc_{$school.sc_id}" value="{$school.sc_name}">
|
||||||
<a href="/admin/delete_school/{$school.sc_id}" class="addbutton delete">Törlés</a>
|
<a href="/admin/delete_school/{$school.sc_id}" class="addbutton delete">Törlés</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
34
template/templates/user_diary.tpl
Normal file
34
template/templates/user_diary.tpl
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
<div class="list">
|
||||||
|
{foreach $training_array as $training}
|
||||||
|
<div class="bigger_space">
|
||||||
|
{if
|
||||||
|
$training@first ||
|
||||||
|
(
|
||||||
|
$training_array[$training@index]->get_tr_date()|substr:5:2 != $training_array[$training@index-1]->get_tr_date()|substr:5:2
|
||||||
|
)
|
||||||
|
|
||||||
|
}
|
||||||
|
<span class="date_separator">{$training_array[$training@index]->get_tr_date()|substr:0:4}.
|
||||||
|
{$months[$training_array[$training@index]->get_tr_date()|substr:5:2]}
|
||||||
|
</span>
|
||||||
|
{/if}
|
||||||
|
<div class="list_item line_height14">
|
||||||
|
<span class="size20 bold">
|
||||||
|
{$training->get_tr_date()|substr:0:4}.
|
||||||
|
{$months[$training_array[$training@index]->get_tr_date()|substr:5:2]}
|
||||||
|
{$training->get_tr_date_day()}.
|
||||||
|
{$days[$training->get_tr_date_day_of_week()]}
|
||||||
|
{$training->get_tr_date_time()}
|
||||||
|
</span>
|
||||||
|
<br>
|
||||||
|
{$training->get_tr_type_name_by_id()} edzés
|
||||||
|
{$training->get_tr_duration()} p
|
||||||
|
{if $training->is_coach()}
|
||||||
|
{foreach $training->get_tr_coaches_name() as $coach_name}
|
||||||
|
{if $coach_name@first}({/if}{$coach_name}{if $coach_name@last}){else}, {/if}
|
||||||
|
{/foreach}
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/foreach}
|
||||||
|
</div>
|
||||||
Reference in New Issue
Block a user