search in user list
loading gif lists can be closed and opened number of trainings at diary
This commit is contained in:
28
_ajax/get_user_list.php
Normal file
28
_ajax/get_user_list.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
//tag listánál ez adja vissza a keresés eredményét
|
||||
ini_set('include_path', '../_class/');
|
||||
include('class_sql.php');
|
||||
if ($_SERVER['HTTP_HOST'] == 'badmintoncoach.hu') $sql = new sql('localhost','root','','badminton_coach');
|
||||
else $sql = new sql('localhost','tollashodos','uprRscU8bGpJ','tollashodos');
|
||||
|
||||
$filter1 = "";
|
||||
if (!empty($_POST['uk_filter_name'])) {
|
||||
$filter1 = "AND uk_name LIKE '%".$_POST['uk_filter_name']."%'";
|
||||
}
|
||||
|
||||
$filter2 = "";
|
||||
if (in_array($_POST['is_active'], array(0,1))) {
|
||||
$filter2 = "AND uk_is_active = " . $_POST['is_active'];
|
||||
}
|
||||
|
||||
$kid_query = "SELECT uk_id, uk_name FROM user_kid WHERE uk_deleted = 0
|
||||
". $filter1 . "
|
||||
". $filter2 . "
|
||||
ORDER BY uk_name ASC";
|
||||
|
||||
$kid_assoc_array = $sql->assoc_array($kid_query);
|
||||
|
||||
|
||||
echo json_encode($kid_assoc_array);
|
||||
|
||||
?>
|
||||
@@ -27,7 +27,7 @@ class login {
|
||||
"
|
||||
SELECT uk_id FROM user_kid WHERE
|
||||
(uk_name = '" . $_user_name . "' AND
|
||||
uk_password = '" . md5($_user_password ) . "')";
|
||||
uk_password = '" . md5($_user_password ) . "') AND uk_deleted = 0 AND uk_is_active = 1";
|
||||
|
||||
if ($sql->num_of_rows($check_query)) return $sql->single_variable($check_query);
|
||||
|
||||
@@ -74,7 +74,7 @@ class login {
|
||||
"
|
||||
SELECT uk_id FROM user_kid WHERE
|
||||
(uk_name = '" . $_user_name . "' AND
|
||||
uk_password = '" . $_user_password . "')";
|
||||
uk_password = '" . $_user_password . "') AND uk_deleted = 0 AND uk_is_active = 1";
|
||||
|
||||
if ($sql->num_of_rows($check_query)) return $sql->single_variable($check_query);
|
||||
|
||||
|
||||
@@ -252,6 +252,21 @@ class user_kid extends user_parent {
|
||||
$this->logged_in = $_login;
|
||||
}
|
||||
|
||||
public function get_training_number_in_month($_year, $_month) {
|
||||
//évet és hónapot kap paraméterül, az edzések számát adja vissza
|
||||
global $sql;
|
||||
//var_dump($_date);
|
||||
return $sql->single_variable(
|
||||
"SELECT count( DISTINCT pr_id )
|
||||
FROM `presence`
|
||||
JOIN `training` ON `tr_id` = `pr_training_tr_id`
|
||||
WHERE `pr_user_kid_uk_id` = ". $this->get_uk_id()."
|
||||
AND `tr_date` LIKE '".$_year."-".$_month."%'
|
||||
AND tr_deleted = 0
|
||||
;"
|
||||
);
|
||||
}
|
||||
|
||||
public function update_login_time($_uk_id = null) {
|
||||
global $sql;
|
||||
//az adott user_id-n updateli a login_time-ot
|
||||
|
||||
100
_css/default.css
100
_css/default.css
@@ -12,6 +12,7 @@ body {
|
||||
margin: 0px;
|
||||
min-height: 100%;
|
||||
background-color: #aaaaaa;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
#pageContainer {
|
||||
@@ -40,6 +41,26 @@ main #main_content {
|
||||
|
||||
}
|
||||
|
||||
|
||||
main #loading {
|
||||
|
||||
width: 100%;
|
||||
min-height: 100vh;
|
||||
background-color: #fff;
|
||||
padding: 30px 10px 10px 10px;
|
||||
|
||||
webkit-box-shadow: 0px 0px 11px 4px rgba(0,0,0,0.75);
|
||||
-moz-box-shadow: 0px 0px 11px 4px rgba(0,0,0,0.75);
|
||||
box-shadow: 0px 0px 11px 4px rgba(0,0,0,0.75);
|
||||
|
||||
|
||||
z-index: 100;
|
||||
|
||||
background-image: url("/_image/spinner.gif");
|
||||
background-repeat: no-repeat;
|
||||
background-position: center;
|
||||
}
|
||||
|
||||
.italic {
|
||||
font-style: italic;
|
||||
}
|
||||
@@ -48,10 +69,51 @@ main #main_content {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.danger {
|
||||
background-color: #ffdddd;
|
||||
border-left: 6px solid #002E4C;
|
||||
padding: 6px 10px;
|
||||
margin-top: 16px;
|
||||
margin-bottom: 16px;
|
||||
width: 100%;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
|
||||
ul.topnav span {
|
||||
color: #f2f2f2;
|
||||
}
|
||||
|
||||
.user_filter {
|
||||
width: 100%;
|
||||
clear: both;
|
||||
margin: 15px 0px;
|
||||
}
|
||||
|
||||
.user_filter input {
|
||||
|
||||
}
|
||||
|
||||
.user_filter select, .user_filter input {
|
||||
height: 40px;
|
||||
width: 100%;
|
||||
border-top: 1px solid #ccc;
|
||||
border-left: 1px solid #ccc;
|
||||
border-right: 1px solid #eee;
|
||||
border-bottom: 1px solid #eee;
|
||||
margin: 0px 0px 10px 0px;
|
||||
}
|
||||
|
||||
.user_filter select:focus, .user_filter input:focus {
|
||||
outline: 0;
|
||||
color: #333;
|
||||
border-color: rgba(41, 92, 161, 0.4);
|
||||
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) inset, 0 0 8px rgba(41, 92, 161, 0.6);
|
||||
-moz-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) inset, 0 0 8px rgba(41, 92, 161, 0.6);
|
||||
-webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) inset, 0 0 8px rgba(41, 92, 161, 0.6);
|
||||
outline: 0 none;
|
||||
}
|
||||
|
||||
.list .list_item .size20 {
|
||||
font-size: 20px;
|
||||
}
|
||||
@@ -151,7 +213,7 @@ td.create a {
|
||||
}
|
||||
|
||||
.bigger_space {
|
||||
margin: 10px 0px;
|
||||
margin: 10px 0px !important;
|
||||
}
|
||||
|
||||
.transp {
|
||||
@@ -212,15 +274,49 @@ table.log tr.delete:hover {
|
||||
background-color: #f02a2a;
|
||||
}
|
||||
|
||||
.date_separator img {
|
||||
width: 20px;
|
||||
float: right;
|
||||
margin-top: 4px;
|
||||
margin-right: 10px;
|
||||
border: 0;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#main_content {
|
||||
display: none;
|
||||
}
|
||||
|
||||
@media (min-width: 680px) {
|
||||
|
||||
|
||||
|
||||
main #main_content {
|
||||
main #main_content, main #loading {
|
||||
width: 80%;
|
||||
margin: 0px auto;
|
||||
}
|
||||
|
||||
.user_filter {
|
||||
width: 90%;
|
||||
}
|
||||
|
||||
.user_filter select {
|
||||
width: 40%;
|
||||
max-width: 200px;
|
||||
}
|
||||
|
||||
.user_filter input {
|
||||
width: 40%;
|
||||
float: left;
|
||||
margin: 0px 10px 0px 0px;
|
||||
}
|
||||
|
||||
.danger {
|
||||
width: 90%;
|
||||
}
|
||||
|
||||
.list {
|
||||
width: 40%;
|
||||
}
|
||||
|
||||
@@ -6,6 +6,16 @@ main {
|
||||
background-color: #002E4C;
|
||||
}
|
||||
|
||||
.danger a:link {
|
||||
color: #002E4C;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.danger a:visited {
|
||||
color: #002E4C;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
ul.topnav {
|
||||
background-color: #FD9500;
|
||||
}
|
||||
|
||||
@@ -46,17 +46,7 @@ if ($this->is_id()) {
|
||||
else {
|
||||
# TAG LISTA
|
||||
|
||||
$user_list_query = "SELECT * FROM user_kid WHERE uk_deleted = 0 ORDER BY uk_name ASC;";
|
||||
$user_list_assoc_array = $sql->assoc_array($user_list_query);
|
||||
//végigmegyünk a tömbbön, objektumot csinálunk belőlük, és átadjuk egy array-ben a template-nek
|
||||
$user_array = array();
|
||||
foreach ($user_list_assoc_array as $user_list_array) {
|
||||
$current_user = new user_kid();
|
||||
$current_user->set_user_data_by_id($user_list_array['uk_id']);
|
||||
$user_array[] = $current_user;
|
||||
}
|
||||
$smarty->assign('edit', $tpl == "edit");
|
||||
$smarty->assign('user_array', $user_array);
|
||||
$smarty->display('user_list.tpl');
|
||||
//var_dump($user_array);
|
||||
}
|
||||
|
||||
@@ -48,6 +48,7 @@ if ($this->is_id()) {
|
||||
IN ( " . implode(',', $tr_ids) . " )
|
||||
AND `uk_deleted` = 0
|
||||
AND `tr_deleted` = 0
|
||||
AND `uk_is_active` = 1
|
||||
GROUP BY `pr_user_kid_uk_id`
|
||||
ORDER BY count( `pr_id` ) DESC, uk_name ASC;
|
||||
";
|
||||
@@ -69,7 +70,7 @@ if ($this->is_id()) {
|
||||
$exeptions[] = $user->get_uk_id();
|
||||
}
|
||||
|
||||
if (!empty($exeptions)) $rest_user_query = "SELECT * FROM user_kid WHERE uk_id NOT IN (" . implode(',', $exeptions) . ") AND uk_deleted = 0 ORDER BY uk_name ASC;"; //ha vannak kiemelt userek
|
||||
if (!empty($exeptions)) $rest_user_query = "SELECT * FROM user_kid WHERE uk_id NOT IN (" . implode(',', $exeptions) . ") AND uk_deleted = 0 AND uk_is_active = 1 ORDER BY uk_name ASC;"; //ha vannak kiemelt userek
|
||||
else $rest_user_query = "SELECT * FROM user_kid WHERE uk_deleted = 0 ORDER BY uk_name;"; //ha nincsenek kiemelt userek
|
||||
$rest_user_assoc_array = $sql->assoc_array($rest_user_query);
|
||||
foreach ($rest_user_assoc_array as $rest_user) {
|
||||
|
||||
32
index.php
32
index.php
@@ -15,11 +15,7 @@ setlocale(LC_ALL, 'hu_HU');
|
||||
</style>
|
||||
<script src="/jquery-3.1.1.min.js"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
$( document ).ready(function() {
|
||||
console.log( "ready!" );
|
||||
});
|
||||
</script>
|
||||
|
||||
<meta charset="utf-8">
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
@@ -51,12 +47,36 @@ setlocale(LC_ALL, 'hu_HU');
|
||||
<?= $page->get_page_nav();?>
|
||||
</nav>
|
||||
<main>
|
||||
<div id="loading"></div>
|
||||
<div id="main_content">
|
||||
<?= $page->get_page_content();?>
|
||||
</div>
|
||||
</main>
|
||||
<footer></footer>
|
||||
</div>
|
||||
<script>
|
||||
|
||||
function onReady(callback) {
|
||||
var intervalID = window.setInterval(checkReady, 1000);
|
||||
function checkReady() {
|
||||
if (document.getElementsByTagName('body')[0] !== undefined) {
|
||||
window.clearInterval(intervalID);
|
||||
callback.call(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function show(id, value) {
|
||||
document.getElementById(id).style.display = value ? 'block' : 'none';
|
||||
}
|
||||
|
||||
onReady(function () {
|
||||
show('main_content', true);
|
||||
show('loading', false);
|
||||
});
|
||||
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
</html>
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
|
||||
|
||||
<div class="list">
|
||||
|
||||
{foreach $training_array as $training}
|
||||
{if
|
||||
$training@first ||
|
||||
@@ -10,9 +9,16 @@
|
||||
)
|
||||
|
||||
}
|
||||
<span class="date_separator">{$training_array[$training@index]->get_tr_date()|substr:0:4}.
|
||||
{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 class="date_separator">{$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" onclick="block_action('block_{$training->get_tr_date()|substr:0:4}{$training->get_tr_date()|substr:5:2}');">
|
||||
</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">
|
||||
@@ -25,6 +31,41 @@
|
||||
{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>
|
||||
</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>
|
||||
@@ -12,9 +12,16 @@
|
||||
)
|
||||
|
||||
}
|
||||
{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 class="date_separator">{$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" onclick="block_action('block_{$training->get_tr_date()|substr:0:4}{$training->get_tr_date()|substr:5:2}');">
|
||||
</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">
|
||||
@@ -27,6 +34,41 @@
|
||||
{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>
|
||||
</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>
|
||||
@@ -1,6 +1,6 @@
|
||||
<div class="list">
|
||||
{foreach $training_array as $training}
|
||||
<div class="bigger_space">
|
||||
|
||||
{if
|
||||
$training@first ||
|
||||
(
|
||||
@@ -8,11 +8,19 @@
|
||||
)
|
||||
|
||||
}
|
||||
{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 class="date_separator">{$training_array[$training@index]->get_tr_date()|substr:0:4}.
|
||||
{$months[$training_array[$training@index]->get_tr_date()|substr:5:2]}
|
||||
({$user_login->get_training_number_in_month({$training->get_tr_date()|substr:0:4},{$training->get_tr_date()|substr:5:2})} edzés)
|
||||
<img src="/_image/open_folder.png" onclick="block_action('block_{$training->get_tr_date()|substr:0:4}{$training->get_tr_date()|substr:5:2}');">
|
||||
</span>
|
||||
<div id="block_{$training->get_tr_date()|substr:0:4}{$training->get_tr_date()|substr:5:2}" class="month_block">
|
||||
{/if}
|
||||
<div class="list_item line_height14">
|
||||
<div class="list_item line_height14 bigger_space">
|
||||
<span class="size20 bold">
|
||||
{$training->get_tr_date()|substr:0:4}.
|
||||
{$months[$training_array[$training@index]->get_tr_date()|substr:5:2]}
|
||||
@@ -29,6 +37,40 @@
|
||||
{/foreach}
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
{if $training@last}
|
||||
</div>
|
||||
{/if}
|
||||
{/foreach}
|
||||
</div>
|
||||
</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>
|
||||
@@ -1,24 +1,72 @@
|
||||
<div class="buttons">
|
||||
|
||||
<a href="/admin/create/member" class="addbutton add-big">Új tag hozzáadása</a>
|
||||
<a href="/admin/parents" class="addbutton add-big">Szülők</a>
|
||||
<a href="/admin/shirts" class="addbutton add-big">Pólók</a>
|
||||
<a href="/admin/cities" class="addbutton add-big">Települések</a>
|
||||
<a href="/admin/schools" class="addbutton add-big">Iskolák</a>
|
||||
<a href="/admin/regions" class="addbutton add-big">Diákolimpia körzetek</a>
|
||||
<!-- a href="/admin/school" class="addbutton add-big">Iskolák</a -->
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="user_filter">
|
||||
<input name="uk_filter_name" id="uk_filter_name" placeholder="Keresés...">
|
||||
<select name="is_active" id="is_active">
|
||||
<option value="1">Aktív tagok</option>
|
||||
<option value="0">Passzív tagok</option>
|
||||
<option value="3">Minden tag</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="list" id="user_list">
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="list">
|
||||
{foreach $user_array as $user}
|
||||
<a href="/admin/{if !$edit}members{else}edit_member{/if}/{$user->get_uk_id()}">
|
||||
<div class="list_item">
|
||||
<img src="/_image/shuttlecock.png">
|
||||
{$user->get_uk_name()}
|
||||
</div>
|
||||
</a>
|
||||
{/foreach}
|
||||
<script>
|
||||
|
||||
</div>
|
||||
var Timer;
|
||||
|
||||
$( document ).ready(function() {
|
||||
$("#is_active").trigger("change");
|
||||
});
|
||||
|
||||
|
||||
$("#is_active").change(search);
|
||||
$("#uk_filter_name").keypress(function() {
|
||||
document.getElementById('user_list').innerHTML = 'Betöltés...';
|
||||
clearTimeout(Timer);
|
||||
Timer = window.setTimeout(search, 1000);
|
||||
|
||||
});
|
||||
|
||||
function search() {
|
||||
document.getElementById('user_list').innerHTML = 'Betöltés...';
|
||||
$("#is_active").prop("disabled",true);
|
||||
$.post("/_ajax/get_user_list.php",
|
||||
{
|
||||
uk_filter_name: $("#uk_filter_name").val(),
|
||||
is_active: $("#is_active").val()
|
||||
|
||||
},
|
||||
function(data, status){
|
||||
var pdata = JSON.parse(data);
|
||||
var content = '';
|
||||
for (var i=0; i<pdata.length; ++i) {
|
||||
//console.log(pdata[i]['uk_id']);
|
||||
//add_list_item(pdata[i]['uk_id'],pdata[i]['uk_name']);
|
||||
content +=
|
||||
'<a href="/admin/members/'+pdata[i]['uk_id']+'">\
|
||||
<div class="list_item">\
|
||||
<img src="/_image/shuttlecock.png">\
|
||||
'+pdata[i]['uk_name']+'\
|
||||
</div>\
|
||||
</a>';
|
||||
}
|
||||
document.getElementById('user_list').innerHTML = content;
|
||||
$("#is_active").prop("disabled",false);
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
@@ -1,3 +1,8 @@
|
||||
<div class="danger">
|
||||
|
||||
Változás, téves vagy hiányzó adat esetén a helyes információt e-mail-ben kérjük megadni: <a href="mailto:szucs.zoltan@interware.hu?subject={$user_login->get_uk_name()}">szucs.zoltan@interware.hu</a>
|
||||
|
||||
</div>
|
||||
<div class="list">
|
||||
<div class="list_item">
|
||||
<label class="desc">
|
||||
|
||||
Reference in New Issue
Block a user