added user list with export
This commit is contained in:
45
_include/include_export_users.php
Normal file
45
_include/include_export_users.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
$userAssocArray = $sql->assoc_array("
|
||||
SELECT
|
||||
uk_name AS 'Név',
|
||||
GROUP_CONCAT(trt_name) as 'Szint',
|
||||
sc_name as 'Iskola',
|
||||
uk_email as 'Email',
|
||||
uk_phone as 'Telefonszám',
|
||||
p1.up_name as 'Szülő1',
|
||||
p1.up_email as 'Sz1_Email',
|
||||
p1.up_phone as 'Sz1_Telefonszám',
|
||||
p2.up_name as 'Szülő2',
|
||||
p2.up_email as 'Sz2_Email',
|
||||
p2.up_phone as 'Sz2_Telefonszám'
|
||||
FROM
|
||||
user_kid
|
||||
LEFT JOIN
|
||||
user_parent p1 ON p1.up_id = uk_parent_1
|
||||
LEFT JOIN
|
||||
user_parent p2 ON p2.up_id = uk_parent_2
|
||||
LEFT JOIN
|
||||
school ON sc_id = uk_school_sc_id
|
||||
LEFT JOIN
|
||||
user_kid_training_type ON uktt_user_kid_uk_id = uk_id
|
||||
LEFT JOIN
|
||||
training_type ON trt_id = uktt_training_type_tt_id
|
||||
WHERE
|
||||
uk_deleted = 0 AND uk_is_active = 1
|
||||
GROUP BY uk_name
|
||||
ORDER BY uk_name;
|
||||
");
|
||||
|
||||
$filename = "taglista.csv";
|
||||
ob_end_clean();
|
||||
$fp = fopen('php://output', 'w');
|
||||
|
||||
fputcsv($fp, array_keys(reset($userAssocArray)), ';');
|
||||
|
||||
header('Content-type: application/csv');
|
||||
header('Content-Disposition: attachment; filename='.$filename);
|
||||
|
||||
foreach($userAssocArray as $row) {
|
||||
fputcsv($fp, $row, ';');
|
||||
}
|
||||
35
_include/include_userlist.php
Normal file
35
_include/include_userlist.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
$userAssocArray = $sql->assoc_array("
|
||||
SELECT
|
||||
uk_name AS 'Név',
|
||||
GROUP_CONCAT(trt_name) as 'Szint',
|
||||
sc_name as 'Iskola',
|
||||
uk_email as 'Email',
|
||||
uk_phone as 'Telefonszám',
|
||||
p1.up_name as 'Szülő1',
|
||||
p1.up_email as 'Sz1_Email',
|
||||
p1.up_phone as 'Sz1_Telefonszám',
|
||||
p2.up_name as 'Szülő2',
|
||||
p2.up_email as 'Sz2_Email',
|
||||
p2.up_phone as 'Sz2_Telefonszám'
|
||||
FROM
|
||||
user_kid
|
||||
LEFT JOIN
|
||||
user_parent p1 ON p1.up_id = uk_parent_1
|
||||
LEFT JOIN
|
||||
user_parent p2 ON p2.up_id = uk_parent_2
|
||||
LEFT JOIN
|
||||
school ON sc_id = uk_school_sc_id
|
||||
LEFT JOIN
|
||||
user_kid_training_type ON uktt_user_kid_uk_id = uk_id
|
||||
LEFT JOIN
|
||||
training_type ON trt_id = uktt_training_type_tt_id
|
||||
WHERE
|
||||
uk_deleted = 0 AND uk_is_active = 1
|
||||
GROUP BY uk_name
|
||||
ORDER BY uk_name;
|
||||
");
|
||||
|
||||
$smarty->assign("users", $userAssocArray);
|
||||
$smarty->display("user_export_list.tpl");
|
||||
Reference in New Issue
Block a user