</h4> <div class="dataTable_wrapper"> <table class="table table-striped table-bordered table-hover" id="dataTables-example"> <thead> <tr> <th>Ημερομηνία Αίτησης</th> <th>Είδος Άδειας</th> <th>Ημέρες Αδείας</th> <th>Έναρξη Άδειας</th> <th>Λήξη Άδειας</th> <th>Κατάσταση</th> </tr> </thead> <tbody> <?php $my_leaves = get_my_leaves(trim($_POST['userstat'])); //Φόρτωση αιτήσεων άδειας foreach ($my_leaves as $leave) { $class = 'info'; if ($leave['signature_by'] != 0 and $leave['status'] == 1) { $class = 'success'; } if ($leave['signature_by'] != 0 and $leave['status'] == 0) { $class = 'danger'; } //This is canceled.. if ($leave['canceled'] == 1) { $class = 'warning'; } // Show only the approved ones if ($class != 'success') {
<div class="dataTable_wrapper"> <table class="table table-striped table-bordered table-hover" id="dataTables-example"> <thead> <tr> <th>Ημ/νία Υποβολής</th> <th>Είδος Άδειας</th> <th>Αριθ. Ημερών</th> <th>Από</th> <th>Εώς</th> <th>Κατάσταση</th> <th>Ενέργειες</th> </tr> </thead> <tbody> <?php $my_leaves = get_my_leaves(); //Φόρτωση αιτήσεων άδειας foreach ($my_leaves as $leave) { $class = 'info'; if ($leave['signature_by'] != 0 and $leave['status'] == 1) { $class = 'success'; } if ($leave['signature_by'] != 0 and $leave['status'] == 0) { $class = 'danger'; } //This is canceled.. if ($leave['canceled'] == 1) { $class = 'warning'; } echo "<tr class='{$class}'>"; echo "<td>" . printDate($leave['date_submitted']) . "</td>";
function get_my_employees_leaves() { //Εμφάνιση αιτήσεων άδειας των υφισταμένων ενός χρήστη global $db, $user, $message_list, $application_list; if (!empty($user->unit_gd) and trim($user->unit_gd) != 'gram0-6') { if ($user->type == 'proist/nos_diefthyns') { $query = $db->prepare('SELECT * FROM `main_users` where unit_gd = :unit_gd AND afm !=:afm and active=1 ORDER BY last_name ASC'); $query->bindValue(':unit_gd', $user->unit_gd, PDO::PARAM_STR); } elseif ($user->type == 'proist/nos_gen_dieft') { $query = $db->prepare('SELECT * FROM `main_users` where unit_g = :unit_g AND afm !=:afm and active=1 ORDER BY last_name ASC'); $query->bindValue(':unit_g', $user->unit_g, PDO::PARAM_STR); } else { //proist/nos_tmimatos $query = $db->prepare('SELECT * FROM `main_users` where unit_g = :unit_g AND afm !=:afm AND type NOT IN (\'proist/nos_diefthyns\', \'proist/nos_gen_dieft\') and active=1 ORDER BY last_name ASC'); $query->bindValue(':unit_g', $user->unit_g, PDO::PARAM_STR); } $query->bindValue(':afm', $user->afm, PDO::PARAM_STR); $query->execute(); $employees = $query->fetchAll(); $all_leaves = array(); foreach ($employees as $employee) { $cur_leaves = get_my_leaves($employee['afm']); $all_leaves = array_merge($cur_leaves, $all_leaves); } return $all_leaves; // } else if(trim($user->unit_gd) == 'gram0-6') { // This is someone else.. The Overall Administrator } else { if (empty($user->unit_gd)) { // This is someone else.. The Overall Administrator if (trim($user->username) == $application_list['leaves']['in_app_users']['overall']) { $query = $db->prepare('SELECT * FROM `main_users` where active=1 ORDER BY last_name ASC'); $query->execute(); $employees = $query->fetchAll(); $all_leaves = array(); foreach ($employees as $employee) { $cur_leaves = get_my_leaves($employee['afm']); $all_leaves = array_merge($cur_leaves, $all_leaves); } return $all_leaves; } } } }