added money_expense to coach preview
This commit is contained in:
@@ -3,7 +3,8 @@
|
|||||||
|
|
||||||
class money_expense {
|
class money_expense {
|
||||||
private $mox_id;
|
private $mox_id;
|
||||||
private $mox_name;
|
private $mox_user_coach_ua_id;
|
||||||
|
private $mox_coach = null; //user obj
|
||||||
private $mox_date;
|
private $mox_date;
|
||||||
private $mox_item;
|
private $mox_item;
|
||||||
private $mox_sum;
|
private $mox_sum;
|
||||||
@@ -16,8 +17,8 @@ class money_expense {
|
|||||||
$this->mox_id = $_item;
|
$this->mox_id = $_item;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function set_mox_name($_item) {
|
public function set_mox_user_coach_ua_id($_item) {
|
||||||
$this->mox_name = $_item;
|
$this->mox_user_coach_ua_id = $_item;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function set_mox_date($_item) {
|
public function set_mox_date($_item) {
|
||||||
@@ -40,6 +41,10 @@ class money_expense {
|
|||||||
$this->mox_moxc = $_item;
|
$this->mox_moxc = $_item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function set_mox_coach($_item) {
|
||||||
|
$this->mox_coach = $_item;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public function set_mox_deleted($_item) {
|
public function set_mox_deleted($_item) {
|
||||||
$this->mox_deleted = $_item;
|
$this->mox_deleted = $_item;
|
||||||
@@ -49,12 +54,18 @@ class money_expense {
|
|||||||
return $this->mox_id;
|
return $this->mox_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function get_mox_name() {
|
public function get_mox_user_coach_ua_id() {
|
||||||
return $this->mox_name;
|
return $this->mox_user_coach_ua_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function get_mox_date() {
|
public function get_mox_date($_formatted = false) {
|
||||||
return $this->mox_date;
|
return !$_formatted ? $this->mox_date : date("Y. F d. H:i", strtotime($this->mox_date));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function get_mox_date_day() {
|
||||||
|
$day = date("d", strtotime($this->mox_date));
|
||||||
|
if (substr($day, 0, 1) == '0') return substr($day, 1, 1);
|
||||||
|
return date("d", strtotime($this->mox_date));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function get_mox_item() {
|
public function get_mox_item() {
|
||||||
@@ -69,6 +80,10 @@ class money_expense {
|
|||||||
return $this->mox_moxc;
|
return $this->mox_moxc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function get_mox_coach() {
|
||||||
|
return $this->mox_coach;
|
||||||
|
}
|
||||||
|
|
||||||
public function get_mox_money_expense_category_moxc_id() {
|
public function get_mox_money_expense_category_moxc_id() {
|
||||||
return $this->mox_moxc_id;
|
return $this->mox_moxc_id;
|
||||||
}
|
}
|
||||||
@@ -77,6 +92,20 @@ class money_expense {
|
|||||||
return $this->mox_deleted;
|
return $this->mox_deleted;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static function name_to_ua_id($_ua_name) {
|
||||||
|
global $sql;
|
||||||
|
//a paraméterül kapott nevet megpróbálja coach ID-ra alakítani
|
||||||
|
//ha sikerül, akkor visszaadja a coach ID-t
|
||||||
|
//egyébként beszúr egy újat, törölt stáusszal, majd visszatér annak az id-jával
|
||||||
|
if ($sql->num_of_rows("select ua_id from user_coach where ua_name = '".$_ua_name."';")) {
|
||||||
|
return $sql->single_variable("select ua_id from user_coach where ua_name = '".$_ua_name."';");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return $sql->insert_into('user_coach', array('ua_name' => $_ua_name, 'ua_deleted' => 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public function set_mox_data_by_id($_id) {
|
public function set_mox_data_by_id($_id) {
|
||||||
global $sql;
|
global $sql;
|
||||||
$set_data_assoc_array = $sql->assoc_array("select * from money_expense where mox_id = " . $_id);
|
$set_data_assoc_array = $sql->assoc_array("select * from money_expense where mox_id = " . $_id);
|
||||||
@@ -90,6 +119,12 @@ class money_expense {
|
|||||||
$new_moxc->set_moxc_data_by_id($value);
|
$new_moxc->set_moxc_data_by_id($value);
|
||||||
$this->set_mox_moxc($new_moxc);
|
$this->set_mox_moxc($new_moxc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($field == 'mox_user_coach_ua_id' && $value != null) {
|
||||||
|
$new_user = new user();
|
||||||
|
$new_user->set_user_data_by_id($value);
|
||||||
|
$this->set_mox_coach($new_user);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -98,7 +133,7 @@ class money_expense {
|
|||||||
global $sql;
|
global $sql;
|
||||||
|
|
||||||
return $sql->insert_into('money_expense', array(
|
return $sql->insert_into('money_expense', array(
|
||||||
'mox_name' => $_name,
|
'mox_user_coach_ua_id' => (empty($_name)?'null':self::name_to_ua_id($_name)),
|
||||||
'mox_date' => $_date,
|
'mox_date' => $_date,
|
||||||
'mox_item' => $_item,
|
'mox_item' => $_item,
|
||||||
'mox_sum' => $_sum,
|
'mox_sum' => $_sum,
|
||||||
@@ -111,7 +146,7 @@ class money_expense {
|
|||||||
|
|
||||||
$sql->update_table('money_expense',
|
$sql->update_table('money_expense',
|
||||||
array(
|
array(
|
||||||
'mox_name' => $_name,
|
'mox_user_coach_ua_id' => (empty($_name)?'null':self::name_to_ua_id($_name)),
|
||||||
'mox_date' => $_date,
|
'mox_date' => $_date,
|
||||||
'mox_item' => $_item,
|
'mox_item' => $_item,
|
||||||
'mox_sum' => $_sum,
|
'mox_sum' => $_sum,
|
||||||
|
|||||||
@@ -30,13 +30,13 @@ ul.topnav li a:hover, ul.topnav li a span:hover {
|
|||||||
}
|
}
|
||||||
|
|
||||||
div.list div.money_deposit {
|
div.list div.money_deposit {
|
||||||
background-color: #0F1953;
|
background-color: #9FC0E1;
|
||||||
border-left: 2px solid #2281DD;
|
border-left: 2px solid #002E4C;
|
||||||
color: #020372;
|
color: #101469;
|
||||||
}
|
}
|
||||||
|
|
||||||
.list .money_deposit:hover {
|
.list .money_deposit:hover {
|
||||||
background-color: #F3BF75;
|
background-color: #5D5FDB;
|
||||||
border-left: 2px solid #000;
|
border-left: 2px solid #000;
|
||||||
color: #2281DD;
|
color: #fff;
|
||||||
}
|
}
|
||||||
@@ -1,43 +1,87 @@
|
|||||||
<div class="list half_width">
|
<div class="list half_width">
|
||||||
{foreach $trainings as $training}
|
{foreach $actions as $action}
|
||||||
{if
|
{if $actions[$action@index]|is_a:'training'}
|
||||||
$training@first ||
|
{if !$action@first &&
|
||||||
(
|
$actions[$action@index-1]|is_a:'training' &&
|
||||||
$trainings[$training@index]->get_tr_date()|substr:5:2 != $trainings[$training@index-1]->get_tr_date()|substr:5:2
|
$actions[$action@index]->get_tr_date()|substr:5:2 != $actions[$action@index-1]->get_tr_date()|substr:5:2
|
||||||
)
|
|
||||||
|
|
||||||
}
|
||
|
||||||
{if !$training@first &&
|
|
||||||
$trainings[$training@index]->get_tr_date()|substr:5:2 != $trainings[$training@index-1]->get_tr_date()|substr:5:2
|
!$action@first &&
|
||||||
}
|
$actions[$action@index-1]|is_a:'money_expense' &&
|
||||||
</div>
|
$actions[$action@index]->get_tr_date()|substr:5:2 != $actions[$action@index-1]->get_mox_date()|substr:5:2
|
||||||
{/if}
|
|
||||||
<span onclick="block_action('block_{$training->get_tr_date()|substr:0:4}{$training->get_tr_date()|substr:5:2}');" class="date_separator clickable">{$trainings[$training@index]->get_tr_date()|substr:0:4}.
|
}
|
||||||
{$months[$trainings[$training@index]->get_tr_date()|substr:5:2]} ({$user_login->get_training_count_in_month($training->get_tr_date()|substr:0:4,$training->get_tr_date()|substr:5:2)})
|
</div>
|
||||||
<img src="/_image/open_folder.png">
|
|
||||||
</span>
|
<span onclick="block_action('block_{$action->get_tr_date()|substr:0:4}{$action->get_tr_date()|substr:5:2}');" class="date_separator clickable">{$actions[$action@index]->get_tr_date()|substr:0:4}.
|
||||||
<div id="block_{$training->get_tr_date()|substr:0:4}{$training->get_tr_date()|substr:5:2}" class="month_block">
|
{$months[$actions[$action@index]->get_tr_date()|substr:5:2]} ({$user_login->get_training_count_in_month($action->get_tr_date()|substr:0:4,$action->get_tr_date()|substr:5:2)} edzés)
|
||||||
{/if}
|
<img src="/_image/open_folder.png">
|
||||||
<div class="list_item line_height14 bigger_space">
|
|
||||||
<span class="size20 bold">
|
|
||||||
{$training->get_tr_date()|substr:0:4}.
|
|
||||||
{$months[$trainings[$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>
|
</span>
|
||||||
<br>
|
<div id="block_{$action->get_tr_date()|substr:0:4}{$action->get_tr_date()|substr:5:2}" class="month_block">
|
||||||
{if $training->get_tr_training_type_trt_id()}{$training->get_tr_type_name_by_id()} edzés{/if}
|
{elseif $action@first}
|
||||||
{$training->get_tr_duration()} p
|
<span onclick="block_action('block_{$action->get_tr_date()|substr:0:4}{$action->get_tr_date()|substr:5:2}');" class="date_separator clickable">{$actions[$action@index]->get_tr_date()|substr:0:4}.
|
||||||
{if $training->is_coach()}
|
{$months[$actions[$action@index]->get_tr_date()|substr:5:2]} ({$user_login->get_training_count_in_month($action->get_tr_date()|substr:0:4,$action->get_tr_date()|substr:5:2)} edzés)
|
||||||
{foreach $training->get_tr_coaches_name() as $coach_name}
|
<img src="/_image/open_folder.png">
|
||||||
{if $coach_name@first}({/if}{$coach_name}{if $coach_name@last}){else}, {/if}
|
</span>
|
||||||
{/foreach}
|
<div id="block_{$action->get_tr_date()|substr:0:4}{$action->get_tr_date()|substr:5:2}" class="month_block">
|
||||||
{/if}
|
{/if}
|
||||||
|
<div class="list_item line_height14 bigger_space">
|
||||||
|
<span class="size20 bold">
|
||||||
|
{$action->get_tr_date()|substr:0:4}.
|
||||||
|
{$months[$actions[$action@index]->get_tr_date()|substr:5:2]}
|
||||||
|
{$action->get_tr_date_day()}.
|
||||||
|
{$days[$action->get_tr_date_day_of_week()]}
|
||||||
|
{$action->get_tr_date_time()}
|
||||||
|
</span>
|
||||||
|
<br>
|
||||||
|
{if $action->get_tr_training_type_trt_id()}{$action->get_tr_type_name_by_id()} edzés{/if}
|
||||||
|
{$action->get_tr_duration()} p
|
||||||
|
{if $action->is_coach()}
|
||||||
|
{foreach $action->get_tr_coaches_name() as $coach_name}
|
||||||
|
{if $coach_name@first}({/if}{$coach_name}{if $coach_name@last}){else}, {/if}
|
||||||
|
{/foreach}
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
{elseif $actions[$action@index]|is_a:'money_expense'}
|
||||||
|
{if !$action@first &&
|
||||||
|
$actions[$action@index-1]|is_a:'training' &&
|
||||||
|
$actions[$action@index]->get_mox_date()|substr:5:2 != $actions[$action@index-1]->get_tr_date()|substr:5:2
|
||||||
|
|
||||||
|
||
|
||||||
|
|
||||||
</div>
|
!$action@first &&
|
||||||
{if $training@last}
|
$actions[$action@index-1]|is_a:'money_expense' &&
|
||||||
|
$actions[$action@index]->get_mox_date()|substr:5:2 != $actions[$action@index-1]->get_mox_date()|substr:5:2
|
||||||
|
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<span onclick="block_action('block_{$action->get_mox_date()|substr:0:4}{$action->get_mox_date()|substr:5:2}');" class="date_separator clickable">{$actions[$action@index]->get_mox_date()|substr:0:4}.
|
||||||
|
{$months[$actions[$action@index]->get_mox_date()|substr:5:2]} ({$user_login->get_training_count_in_month($action->get_mox_date()|substr:0:4,$action->get_mox_date()|substr:5:2)} edzés)
|
||||||
|
<img src="/_image/open_folder.png">
|
||||||
|
</span>
|
||||||
|
<div id="block_{$action->get_mox_date()|substr:0:4}{$action->get_mox_date()|substr:5:2}" class="month_block">
|
||||||
|
{elseif $action@first}
|
||||||
|
<span onclick="block_action('block_{$action->get_mox_date()|substr:0:4}{$action->get_mox_date()|substr:5:2}');" class="date_separator clickable">{$actions[$action@index]->get_mox_date()|substr:0:4}.
|
||||||
|
{$months[$actions[$action@index]->get_mox_date()|substr:5:2]} ({$user_login->get_training_count_in_month($action->get_mox_date()|substr:0:4,$action->get_mox_date()|substr:5:2)} edzés)
|
||||||
|
<img src="/_image/open_folder.png">
|
||||||
|
</span>
|
||||||
|
<div id="block_{$action->get_mox_date()|substr:0:4}{$action->get_mox_date()|substr:5:2}" class="month_block">
|
||||||
|
{/if}
|
||||||
|
<div class="list_item line_height14 bigger_space money_deposit">
|
||||||
|
<span class="size20 bold">
|
||||||
|
{$action->get_mox_date()|substr:0:4}.
|
||||||
|
{$months[$actions[$action@index]->get_mox_date()|substr:5:2]}
|
||||||
|
{$action->get_mox_date_day()}.
|
||||||
|
</span>
|
||||||
|
<br>
|
||||||
|
{$action->get_mox_item()}
|
||||||
|
<br>
|
||||||
|
{$action->get_mox_sum()|number_format:0:'':' '} Ft
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
{if $action@last}
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
{/foreach}
|
{/foreach}
|
||||||
|
|||||||
@@ -34,7 +34,9 @@
|
|||||||
{if $mox->get_mox_money_expense_category_moxc_id()}{$mox->get_mox_moxc()->get_moxc_name()}{else}<span class="italic">nincs megadva</span>{/if}
|
{if $mox->get_mox_money_expense_category_moxc_id()}{$mox->get_mox_moxc()->get_moxc_name()}{else}<span class="italic">nincs megadva</span>{/if}
|
||||||
</td>
|
</td>
|
||||||
<td class="no_mobile_show quarter_width">
|
<td class="no_mobile_show quarter_width">
|
||||||
{$mox->get_mox_name()}
|
{if $mox->get_mox_coach()|is_a:'user'}
|
||||||
|
{$mox->get_mox_coach()->get_ua_name()}
|
||||||
|
{/if}
|
||||||
</td>
|
</td>
|
||||||
<td class="quarter_width">
|
<td class="quarter_width">
|
||||||
{$mox->get_mox_item()}
|
{$mox->get_mox_item()}
|
||||||
|
|||||||
@@ -9,9 +9,8 @@
|
|||||||
|
|
||||||
<div>
|
<div>
|
||||||
<label for="mox_date">Dátum:</label>
|
<label for="mox_date">Dátum:</label>
|
||||||
<div><input type="text" name="mox_date" id="mox_date" placeholder="ÉÉÉÉ-HH-NN" required></div>
|
<div><input type="text" name="mox_date" id="mox_date" placeholder="ÉÉÉÉ-HH-NN" value="{$today}" required></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<label for="mox_item">Tétel:</label>
|
<label for="mox_item">Tétel:</label>
|
||||||
<div><input type="text" name="mox_item" id="mox_item" required></div>
|
<div><input type="text" name="mox_item" id="mox_item" required></div>
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
<div>
|
<div>
|
||||||
<label for="mox_name">Név:</label>
|
<label for="mox_name">Név:</label>
|
||||||
<div><input type="text" name="mox_name" id="mox_name" value="{$mox->get_mox_name()}"></div>
|
<div><input type="text" name="mox_name" id="mox_name" value="{if $mox->get_mox_coach()|is_a:'user'}{$mox->get_mox_coach()->get_ua_name()}{/if}"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
|
|||||||
Reference in New Issue
Block a user