export trainings
This commit is contained in:
@@ -264,6 +264,14 @@ class page {
|
||||
# GYEREKLISTA EXPORTÁLÁSA
|
||||
include('include_export_users.php');
|
||||
break;
|
||||
case 'traininglist':
|
||||
# EDZÉS ADATLISTA
|
||||
include('include_traininglist.php');
|
||||
break;
|
||||
case 'export_trainings':
|
||||
# EDZÉSLISTA EXPORTÁLÁSA
|
||||
include('include_export_trainings.php');
|
||||
break;
|
||||
case 'set_credit_to_zero':
|
||||
# HITELALKALOM NULLÁZÁS
|
||||
include('include_set_credit_to_zero.php');
|
||||
|
||||
38
_include/include_export_trainings.php
Normal file
38
_include/include_export_trainings.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
$trainingAssocArray = $sql->assoc_array("
|
||||
SELECT
|
||||
tr_id 'Azonosító',
|
||||
substring(tr_date,1,16) 'Időpont',
|
||||
trt_name 'Típus',
|
||||
GROUP_CONCAT(DISTINCT ua_name) 'Edzők',
|
||||
COUNT(pr_id) 'Létszám'
|
||||
FROM
|
||||
training
|
||||
JOIN
|
||||
training_type ON trt_id = tr_training_type_trt_id
|
||||
JOIN
|
||||
training_coach ON trc_training_tr_id = tr_id
|
||||
JOIN
|
||||
user_coach ON ua_id = trc_coach_uc_id
|
||||
JOIN
|
||||
presence ON pr_training_tr_id = tr_id
|
||||
WHERE
|
||||
tr_deleted = 0
|
||||
GROUP BY tr_id
|
||||
ORDER BY tr_date ASC;
|
||||
");
|
||||
|
||||
$filename = "edzeslista.csv";
|
||||
$fp = fopen('php://output', 'w');
|
||||
|
||||
ob_end_clean();
|
||||
fputcsv($fp, array_keys(reset($trainingAssocArray)), ';');
|
||||
|
||||
header('Content-type: application/csv');
|
||||
header('Content-Disposition: attachment; filename='.$filename);
|
||||
|
||||
foreach($trainingAssocArray as $row) {
|
||||
fputcsv($fp, $row, ';');
|
||||
}
|
||||
exit(1);
|
||||
@@ -34,8 +34,8 @@ $userAssocArray = $sql->assoc_array("
|
||||
$filename = "taglista.csv";
|
||||
$fp = fopen('php://output', 'w');
|
||||
|
||||
fputcsv($fp, array_keys(reset($userAssocArray)), ';');
|
||||
ob_end_clean();
|
||||
fputcsv($fp, array_keys(reset($userAssocArray)), ';');
|
||||
|
||||
header('Content-type: application/csv');
|
||||
header('Content-Disposition: attachment; filename='.$filename);
|
||||
@@ -43,3 +43,4 @@ header('Content-Disposition: attachment; filename='.$filename);
|
||||
foreach($userAssocArray as $row) {
|
||||
fputcsv($fp, $row, ';');
|
||||
}
|
||||
exit(1);
|
||||
|
||||
27
_include/include_traininglist.php
Normal file
27
_include/include_traininglist.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
$trainingAssocArray = $sql->assoc_array("
|
||||
SELECT
|
||||
tr_id id,
|
||||
substring(tr_date,1,16) 'date',
|
||||
trt_name 'name',
|
||||
GROUP_CONCAT(DISTINCT ua_name) 'coaches',
|
||||
COUNT(pr_id) 'count'
|
||||
FROM
|
||||
training
|
||||
JOIN
|
||||
training_type ON trt_id = tr_training_type_trt_id
|
||||
JOIN
|
||||
training_coach ON trc_training_tr_id = tr_id
|
||||
JOIN
|
||||
user_coach ON ua_id = trc_coach_uc_id
|
||||
JOIN
|
||||
presence ON pr_training_tr_id = tr_id
|
||||
WHERE
|
||||
tr_deleted = 0
|
||||
GROUP BY tr_id
|
||||
ORDER BY tr_date ASC;
|
||||
");
|
||||
|
||||
$smarty->assign("trainings", $trainingAssocArray);
|
||||
$smarty->display("training_export_list.tpl");
|
||||
26
template/templates/training_export_list.tpl
Normal file
26
template/templates/training_export_list.tpl
Normal file
@@ -0,0 +1,26 @@
|
||||
<div class="buttons">
|
||||
<a href="/admin/trainings" class="addbutton big">Vissza</a>
|
||||
<a href="/admin/export_trainings" class="addbutton add-big">Exportálás CSV-be</a>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="outer export">
|
||||
<table class="user_export">
|
||||
<tr>
|
||||
<th>Azonosító</th>
|
||||
<th>Időpont</th>
|
||||
<th>Típus</th>
|
||||
<th>Edzők</th>
|
||||
<th>Létszám</th>
|
||||
</tr>
|
||||
{foreach $trainings as $training}
|
||||
<tr>
|
||||
<td>#{$training['id']}</td>
|
||||
<td>{$training['date']}</td>
|
||||
<td>{$training['name']}</td>
|
||||
<td>{$training['coaches']}</td>
|
||||
<td>{$training['count']}</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</table>
|
||||
</div>
|
||||
@@ -1,75 +1,72 @@
|
||||
<div class="buttons">
|
||||
<a href="/admin/create/training" class="addbutton add-big">Új edzés hozzáadása</a>
|
||||
<a href="/admin/training_types" class="addbutton add-big">Edzés típusok szerkesztése</a>
|
||||
<a href="/admin/training_templates" class="addbutton add-big">Edzés sablonok szerkesztése</a>
|
||||
<a href="/admin/create/training" class="addbutton add-big">Új edzés hozzáadása</a>
|
||||
<a href="/admin/training_types" class="addbutton add-big">Edzés típusok szerkesztése</a>
|
||||
<a href="/admin/training_templates" class="addbutton add-big">Edzés sablonok szerkesztése</a>
|
||||
<a href="/admin/traininglist" class="addbutton add-big">Lista export</a>
|
||||
</div>
|
||||
|
||||
<div class="list">
|
||||
{foreach $training_array as $training}
|
||||
{if
|
||||
$training@first ||
|
||||
(
|
||||
$training_array[$training@index]->get_tr_date()|substr:5:2 != $training_array[$training@index-1]->get_tr_date()|substr:5:2
|
||||
)
|
||||
{if
|
||||
$training@first ||
|
||||
(
|
||||
$training_array[$training@index]->get_tr_date()|substr:5:2 != $training_array[$training@index-1]->get_tr_date()|substr:5:2
|
||||
)
|
||||
|
||||
}
|
||||
{if !$training@first &&
|
||||
$training_array[$training@index]->get_tr_date()|substr:5:2 != $training_array[$training@index-1]->get_tr_date()|substr:5:2
|
||||
}
|
||||
</div>
|
||||
{/if}
|
||||
<span onclick="block_action('block_{$training->get_tr_date()|substr:0:4}{$training->get_tr_date()|substr:5:2}');" class="date_separator clickable">{$training_array[$training@index]->get_tr_date()|substr:0:4}.
|
||||
{$months[$training_array[$training@index]->get_tr_date()|substr:5:2]}
|
||||
<img src="/_image/open_folder.png">
|
||||
</span>
|
||||
<div id="block_{$training->get_tr_date()|substr:0:4}{$training->get_tr_date()|substr:5:2}" class="month_block">
|
||||
{/if}
|
||||
<a href="/admin/{if $edit=='edit'}edit_training{elseif $edit=='view'}trainings{else}presence{/if}/{$training->get_tr_id()}">
|
||||
<div class="list_item">
|
||||
<img src="/_image/training.png">
|
||||
{$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()}
|
||||
{if $training->get_tr_training_type_trt_id()}({$training->get_tr_type_name_by_id()}){/if}
|
||||
</div>
|
||||
</a>
|
||||
{if $training@last}
|
||||
</div>
|
||||
{/if}
|
||||
}
|
||||
{if !$training@first &&
|
||||
$training_array[$training@index]->get_tr_date()|substr:5:2 != $training_array[$training@index-1]->get_tr_date()|substr:5:2
|
||||
}
|
||||
</div>
|
||||
{/if}
|
||||
<span onclick="block_action('block_{$training->get_tr_date()|substr:0:4}{$training->get_tr_date()|substr:5:2}');" class="date_separator clickable">{$training_array[$training@index]->get_tr_date()|substr:0:4}.
|
||||
{$months[$training_array[$training@index]->get_tr_date()|substr:5:2]}
|
||||
<img src="/_image/open_folder.png">
|
||||
</span>
|
||||
<div id="block_{$training->get_tr_date()|substr:0:4}{$training->get_tr_date()|substr:5:2}" class="month_block">
|
||||
{/if}
|
||||
<a href="/admin/{if $edit=='edit'}edit_training{elseif $edit=='view'}trainings{else}presence{/if}/{$training->get_tr_id()}">
|
||||
<div class="list_item">
|
||||
<img src="/_image/training.png">
|
||||
{$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()}
|
||||
{if $training->get_tr_training_type_trt_id()}({$training->get_tr_type_name_by_id()}){/if}
|
||||
</div>
|
||||
</a>
|
||||
{if $training@last}
|
||||
</div>
|
||||
{/if}
|
||||
{/foreach}
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
function open_block(block_id) {
|
||||
$("#"+block_id).slideDown("slow");
|
||||
$("#"+block_id).slideDown("slow");
|
||||
}
|
||||
|
||||
function close_block(block_id) {
|
||||
$("#"+block_id).slideUp("slow");
|
||||
$("#"+block_id).slideUp("slow");
|
||||
}
|
||||
|
||||
function block_action(block_id) {
|
||||
if ($("#"+block_id).is(':hidden')) {
|
||||
open_block(block_id);
|
||||
}
|
||||
else {
|
||||
close_block(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 );
|
||||
$( ".list" ).find( divs ).hide();
|
||||
var div_list = $( ".list" ).find( divs );
|
||||
|
||||
open_block(div_list[0].id);
|
||||
open_block(div_list[0].id);
|
||||
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user