Page MenuHomeGRNET

admin_user.php
No OneTemporary

File Metadata

Created
Sun, Nov 24, 3:17 PM

admin_user.php

<html>
<body>
<?php
global $institution;
if ($_POST && isset($_GET['action']) && $_GET['action']=='save'){ // ****************** SAVE USER **********************************************************************
// ***********************************************************************************************************************************************
// ***********************************************************************************************************************************************
// ***********************************************************************************************************************************************
$now = date("Y-m-d H:i:s ");
$sth_complete=false;
$sth_ref_complete = false;
$sth_stations_complete = false;
if(isset($_POST['user_id'])){ // ******** EDIT
if($usergroup == 'Hospital IT'){
//----------------CHECK IF USER IS FROM SAME HOSPITAL WITH ADMIN-----------------//
$sth = $dbh_portal->prepare("SELECT institution FROM db_user WHERE id = ?;");
$sth->bindParam(1, $_POST['user_id'], PDO::PARAM_STR);
$sth->execute();
$sth->setFetchMode(PDO::FETCH_ASSOC);
$row = $sth->fetch();
if($row['institution'] == $institution){
//----------------INSERT REFERRING PHYSICIANS-----------------//
$sth_ref = $dbh_portal->prepare("SELECT * FROM db_ref_phys WHERE user_id = ?;");
$sth_ref->bindParam(1, $_POST['user_id'], PDO::PARAM_STR);
$sth_ref->execute();
if($sth_ref->rowCount() > 0){
$sth_ref = $dbh_portal->prepare("DELETE FROM db_ref_phys WHERE user_id=?;");
$sth_ref->bindParam(1, $_POST['user_id'], PDO::PARAM_STR);
$sth_ref_complete = $sth_ref->execute();
}else{
$sth_ref_complete = true;
}
if($sth_ref_complete){
if(isset($_POST['ref_names'])){
foreach($_POST['ref_names'] as $item){
$sth_ref = $dbh_portal->prepare("INSERT into db_ref_phys (user_id, ref_name, persistent_id) VALUES (?, ?, ?) ;");
$sth_ref->bindParam(1, $_POST['user_id'], PDO::PARAM_STR);
$sth_ref->bindParam(2, $item, PDO::PARAM_STR);
$sth_ref->bindParam(3, $_POST['persistent_id'], PDO::PARAM_STR);
$sth_complete = $sth_ref->execute();
}
}
}
//--------------------INSERT STATIONS---------------------//
$sth_stations = $dbh_portal->prepare("SELECT * FROM db_stations WHERE user_id = ?;");
$sth_stations->bindParam(1, $_POST['user_id'], PDO::PARAM_STR);
$sth_stations->execute();
if($sth_stations->rowCount() > 0){
$sth_stations = $dbh_portal->prepare("DELETE FROM db_stations WHERE user_id=?;");
$sth_stations->bindParam(1, $_POST['user_id'], PDO::PARAM_STR);
$sth_stations_complete = $sth_stations->execute();
}else{
$sth_stations_complete = true;
}
if($sth_stations_complete){
if(isset($_POST['station_names'])){
foreach($_POST['station_names'] as $item1){
$sth_stations = $dbh_portal->prepare("INSERT into db_stations (user_id, station_name, persistent_id) VALUES (?, ?, ?) ;");
$sth_stations->bindParam(1, $_POST['user_id'], PDO::PARAM_STR);
$sth_stations->bindParam(2, $item1, PDO::PARAM_STR);
$sth_stations->bindParam(3, $_POST['persistent_id'], PDO::PARAM_STR);
$sth_complete = $sth_stations->execute();
}
}
}
//--------------------INSERT BODY PART---------------------//
$sth_body_part = $dbh_portal->prepare("SELECT * FROM db_body_part WHERE user_id = ?;");
$sth_body_part->bindParam(1, $_POST['user_id'], PDO::PARAM_STR);
$sth_body_part->execute();
if($sth_body_part->rowCount() > 0){
$sth_body_part = $dbh_portal->prepare("DELETE FROM db_body_part WHERE user_id=?;");
$sth_body_part->bindParam(1, $_POST['user_id'], PDO::PARAM_STR);
$sth_body_part_complete = $sth_body_part->execute();
}else{
$sth_body_part_complete = true;
}
if($sth_body_part_complete){
if(isset($_POST['body_part'])){
foreach($_POST['body_part'] as $item1){
$sth_body_part = $dbh_portal->prepare("INSERT into db_body_part (user_id, body_part, persistent_id) VALUES (?, ?, ?) ;");
$sth_body_part->bindParam(1, $_POST['user_id'], PDO::PARAM_STR);
$sth_body_part->bindParam(2, $item1, PDO::PARAM_STR);
$sth_body_part->bindParam(3, $_POST['persistent_id'], PDO::PARAM_STR);
$sth_complete = $sth_body_part->execute();
}
}
}
//--------------------INSERT DEPARTMENT---------------------//
$sth_department = $dbh_portal->prepare("SELECT * FROM db_department WHERE user_id = ?;");
$sth_department->bindParam(1, $_POST['user_id'], PDO::PARAM_STR);
$sth_department->execute();
if($sth_department->rowCount() > 0){
$sth_department = $dbh_portal->prepare("DELETE FROM db_department WHERE user_id=?;");
$sth_department->bindParam(1, $_POST['user_id'], PDO::PARAM_STR);
$sth_department_complete = $sth_department->execute();
}else{
$sth_department_complete = true;
}
if($sth_department_complete){
if(isset($_POST['department'])){
foreach($_POST['department'] as $item1){
$sth_department = $dbh_portal->prepare("INSERT into db_department (user_id, department, persistent_id) VALUES (?, ?, ?) ;");
$sth_department->bindParam(1, $_POST['user_id'], PDO::PARAM_STR);
$sth_department->bindParam(2, $item1, PDO::PARAM_STR);
$sth_department->bindParam(3, $_POST['persistent_id'], PDO::PARAM_STR);
$sth_complete = $sth_department->execute();
}
}
}
//----------- Update Modalities filter for Doctor user ----------------------//
$sth_mods = $dbh_portal->prepare("SELECT * FROM db_modalities WHERE user_id = ?;");
$sth_mods->bindParam(1, $_POST['user_id'], PDO::PARAM_STR);
$sth_mods->execute();
$modal='';
foreach($_POST['modality'] as $item){
if ($modal=='')
$modal = $item;
else
$modal = $modal.",".$item;
}
if($sth_mods->rowCount() > 0){
$sth_mods = $dbh_portal->prepare("UPDATE db_modalities SET filter_user_modal = ? WHERE user_id = ?;");
$sth_mods->bindParam(1, $modal, PDO::PARAM_STR);
$sth_mods->bindParam(2, $_POST['user_id'], PDO::PARAM_STR);
$sth_complete = $sth_mods->execute();
}
else{
$sth_mods = $dbh_portal->prepare("INSERT into db_modalities (user_id, filter_user_modal, persistent_id) VALUES (?, ?, ?) ;");
$sth_mods->bindParam(1, $_POST['user_id'], PDO::PARAM_STR);
$sth_mods->bindParam(2, $modal, PDO::PARAM_STR);
$sth_mods->bindParam(3, $_POST['persistent_id'], PDO::PARAM_STR);
$sth_complete = $sth_mods->execute();
}
}
}
}
if($sth_complete){
//-----------------------UPDATE DATABASE THAT USER IS NOW AUTHORIZED---------------------------//
$sth = $dbh_portal->prepare("UPDATE db_user SET authorized = '1' WHERE id = ?;");
$sth->bindParam(1, $_POST['user_id'], PDO::PARAM_STR);
$sth_update = $sth->execute();
if($sth_update){ ?>
<script type='text/javascript'>
var _path = location.pathname.split("/");
window.location = location.protocol+'//'+location.hostname+':'+location.port+'/'+_path[1]+'/main.php?cp=admin_user';
</script>
<?php }else{ ?>
<div id="search_examination_container" class="<?php print($additional_class); ?>">
<div id="search_examination_title" class="<?php print($additional_class); ?>">
<?php
echo("Προέκυψε κάποιο σφάλμα κατά την εξουσιοδότηση του χρήστη...Παρακαλούμε προσπαθήστε ξανά");
?>
</div>
<br>
<div style="text-align: center;">
<a class="button_blue <?php print($additional_class); ?>" href='main.php?cp=admin_user'><i class="big_icon fa fa-arrow-left"></i> Επιστροφή</a>
</div>
</div>
<?php }
}else{ ?>
<div id="search_examination_container" class="<?php print($additional_class); ?>">
<div id="search_examination_title" class="<?php print($additional_class); ?>">
<?php
echo("Η αποθήκευση των στοιχείων του χρήστη στο σύστημα απέτυχε...Παρακαλούμε προσπαθήστε ξανά");
?>
</div>
<br>
<div style="text-align: center;">
<a class="button_blue <?php print($additional_class); ?>" href='main.php?cp=admin_user'><i class="big_icon fa fa-arrow-left"></i> Επιστροφή</a>
</div>
</div>
<?php }
}
elseif(isset($_POST['action']) && $_POST['action']=='edit'){
// ****************** EDIT USER ********************************************************************************
// ***********************************************************************************************************************************************
// ***********************************************************************************************************************************************
// ***********************************************************************************************************************************************
$sth = $dbh_portal->prepare("SELECT * FROM db_user WHERE id = ? AND institution = ? ;");
$sth->bindParam(1, $_POST['user_id'], PDO::PARAM_STR);
$sth->bindParam(2, $institution, PDO::PARAM_STR);
$sth->execute();
$sth->setFetchMode(PDO::FETCH_ASSOC);
$user_results = $sth->rowCount();
$row = $sth->fetch();
?>
<script type="text/javascript">
$(function(){
var leave_warn = false;
// **** FUNCTIONS ******
function remove_ref_event(this_remove_btn){
var ref_name = $(this_remove_btn.target).closest('.checked_ref_doc_table').find('.checked_ref_doc').data('ref');
var index = $.inArray(ref_name.toString(), ref_doc_selected);
if(index != -1)
{
ref_doc_selected.splice(index, 1);
}
$(this_remove_btn.target).closest('.checked_ref_doc_table').closest('div').remove();
}
function add_ref_event(){
var ref_name = $('select[name="ref_name"]').val();
if(ref_name != null){
if($.inArray(ref_name, ref_doc_selected) === -1){
ref_doc_selected.push(ref_name);
$('.ref_doc_td_container').append("<div><table class='checked_ref_doc_table'><tr><td><span class='checked_ref_doc' data-ref='"+ref_name+"'>"+ref_name+"</span></td><td><span class='close_btn'>X</span></td></tr></table></div>");
$('.close_btn:last').click(remove_ref_event);
//$("#dialog-ref").dialog("option", "position", { my: "center top", at: "center top+20px", of: window });
}
else{
alert("Η εγγραφή υπάρχει ήδη στη λίστα!");
}
}
else{
alert("Δεν υπάρχει κάποια εξέταση στο σύστημα με τον συγκεκριμένο παραπέμποντα ιατρό");
}
}
function ref_btn_event(){
$("#ref_doc_btn").click(function(){
ref_doc_selected_old = ref_doc_selected.slice(0); // save old ref_doc list
$('<div class="share_dialog"></div>').appendTo('body');
$.ajax({
url: "ajax/constraints/select_ref_phys.php",
type: 'POST',
cache: false,
data: {"action" : "new"},
beforeSend: function(data){
//$( "#dialog-ref" ).dialog( "open" );
$( ".share_dialog").html("<img src='img/loading.gif'>");
},
success: function(data){
$(".share_dialog").html(data);
for(var i = 0; i < ref_doc_selected.length; i++){
$(".ref_doc_td_container").append("<div><table class='checked_ref_doc_table'><tr><td><span class='checked_ref_doc' data-ref='"+ref_doc_selected[i]+"'>"+ref_doc_selected[i]+"</span></td><td><span class='close_btn'>X</span></td></tr></table></div>");
$('.close_btn:last').click(remove_ref_event);
}
//$("#dialog-ref").dialog("option", "position", { my: "center top", at: "center top+20px", of: window });
$('.add_ref_doc').unbind('click');
$('.add_ref_doc').click(add_ref_event);
$('.share_close').click(function(){
ref_doc_selected = ref_doc_selected_old.slice(0);
$('.share_dialog').remove();
});
$('.share_ok').click(function(){
leave_warn = true;
$( ".share_dialog" ).remove();
});
}
});
});
}
// **** FUNCTIONS END ******
ref_btn_event();
$('input[name="ref_checkbox"]').click(function(){
if($(this).get(0).checked == true){
$('#ref_doc_btn').css("opacity", "0.3");
$("#ref_doc_btn").unbind('click');
}
else{
$("#ref_doc_btn").unbind('click');
$('#ref_doc_btn').css("opacity", "1");
ref_btn_event();
}
});
// ******************** Select Ref_Doctors ***********************************
var ref_doc_selected = [];
var ref_doc_selected_old;
// Initialize ref_doc_selected variable
$.ajax({
url: "ajax/constraints/select_ref_phys.php",
type: 'POST',
cache: false,
data: {"action" : "edit", "user_id" : "<?php print(htmlspecialchars($_POST['user_id'], ENT_QUOTES)); ?>"},
success: function(data){
$(data).find(".checked_ref_doc").each(function(){
ref_doc_selected.push($(this).data('ref').toString());
});
<?php if(!isset($_POST['new_user'])) { ?>
if(ref_doc_selected.length==0){
$('input[name="ref_checkbox"]').click();
}
<?php } ?>
}
});
//ref_btn_event();
$("#ref_doc_btn").hover(
function(){
if($('input[name="ref_checkbox"]').get(0).checked == false && ref_doc_selected.length > 0){
$('<div id="info_box"><div id="info_box_title">Έχετε επιλέξει '+ref_doc_selected.length+' παραπέμποντες ιατρούς</div></div>').appendTo('body');
for(var i=0; i<ref_doc_selected.length; i++){
$('#info_box').append('<div><i class="fa fa-check-square-o" style="color:#414959;"></i> '+ref_doc_selected[i]+'</div>');
}
}
if($('input[name="ref_checkbox"]').get(0).checked == false && ref_doc_selected.length == 0){
$('<div id="info_box"><div id="info_box_title">Δεν έχετε επιλέξει κανέναν παραπέμποντα ιατρό</div></div>').appendTo('body');
}
$('#info_box').position({my: "left top", at: "right top", of: "#ref_doc_btn"});
},
function(){
$('#info_box').remove();
}
);
// ******************** Select Ref_Doctors END *******************************
// ******************** Select Modalities *******************************
var modalities = [];
$("#modalities_filter_btn").click(function(){
$.ajax({
url: "ajax/constraints/select_modalities.php",
type: 'POST',
cache: false,
data: {"action": "user_filter"},
beforeSend: function(data){
$( "#dialog-modalities" ).dialog( "open" );
$( "#dialog-modalities").html("<img src='img/loading.gif'>");
},
success: function(data){
$( "#dialog-modalities").html(data);
$(".mob_chk").each(function(){
for(var i = 0; i < modalities.length; i++){
if(modalities[i] == $(this).find("input").val()){
$(this).click();
break;
}
}
});
if(modalities[0]=='all'){
$(".mob_chk.select_all").click();
}
}
});
});
$("#dialog-modalities").dialog({
autoOpen: false,
modal: true,
draggable: true,
resizable: false,
dialogClass: 'select_columns_dialog',
position: { my: "top", at: "top+20px", of: window },
buttons:{
"OK": function(){
leave_warn = true;
modalities = [];
$('#dialog-modalities input[type="checkbox"]:checked').each(function() {
if($(this).val() != ""){
modalities.push($(this).attr("value"));
}
});
$( "#dialog-modalities" ).dialog( "close" );
},
"Κλείσιμο": function(){
$( "#dialog-modalities").empty();
$( "#dialog-modalities" ).dialog( "close" );
}
}
});
$.ajax({
url: "ajax/constraints/select_modalities.php",
type: 'POST',
cache: false,
data: {action: "user_filter",
"edit": "edit",
user_id: "<?php print($_POST['user_id']); ?>"
},
success: function(data){
$( "#dialog-modalities").html(data);
modalities = [];
$('#dialog-modalities input[type="checkbox"]:checked').each(function() {
if($(this).val() != ""){
modalities.push($(this).attr("value"));
}
});
}
});
// ******************** Modalities hover ****************************
$("#modalities_filter_btn").hover(
function(){
if(modalities.length > 0){
$('<div id="info_box"><div id="info_box_title">Έχετε επιλέξει '+modalities.length+' διαγνωστικές μονάδες</div></div>').appendTo('body');
for(var i=0; i<modalities.length; i++){
$('#info_box').append('<div><i class="fa fa-check-square-o" style="color:#414959;"></i> '+modalities[i]+'</div>');
}
$('#info_box').position({my: "left top", at: "right top", of: "#modalities_filter_btn"});
}
},
function(){
$('#info_box').remove();
}
);
// ******************** Select Modalities END ****************************
// ******************** Select Stations ****************************
var station_selected = [];
var station_selected_old;
function remove_station(this_remove_btn){
var station = $(this_remove_btn.target).closest('.checked_station_table').find('.checked_station').data('station');
var index = $.inArray(station.toString(), station_selected);
if(index != -1)
{
station_selected.splice(index, 1);
}
$(this_remove_btn.target).closest('.checked_station_table').closest('div').remove();
}
function add_station(){
var station = $('select[name="station_name"]').val();
if(station != null){
if($.inArray(station, station_selected) === -1){
station_selected.push(station);
$('.station_td_container').append("<div><table class='checked_station_table'><tr><td><span class='checked_station' data-station='"+station+"'>"+station+"</span></td><td><span class='close_station_btn'>X</span></td></tr></table></div>");
$('.close_station_btn:last').click(remove_station);
//$("#dialog-station").dialog("option", "position", { my: "center top", at: "center top+20px", of: window });
}
else{
alert("Η εγγραφή υπάρχει ήδη στη λίστα!");
}
}
else{
alert("Δεν υπάρχει κάποια εξέταση στο σύστημα με το συγκεκριμένο μηχάνημα");
}
}
function station_event(){
$("#station_btn").click(function(){
station_selected_old = station_selected.slice(0); // save old station list
$('<div class="share_dialog"></div>').appendTo('body');
$.ajax({
url: "ajax/constraints/select_station.php",
type: 'POST',
cache: false,
data: {"action" : "new"},
beforeSend: function(data){
//$( "#dialog-station" ).dialog( "open" );
$( ".share_dialog").html("<img src='img/loading.gif'>");
},
success: function(data){
$(".share_dialog").html(data);
for(var i = 0; i < station_selected.length; i++){
$(".station_td_container").append("<div><table class='checked_station_table'><tr><td><span class='checked_station' data-station='"+station_selected[i]+"'>"+station_selected[i]+"</span></td><td><span class='close_station_btn'>X</span></td></tr></table></div>");
$('.close_station_btn:last').click(remove_station);
}
//$("#dialog-station").dialog("option", "position", { my: "center top", at: "center top+20px", of: window });
$('.add_station').unbind('click');
$('.add_station').click(add_station);
$('.share_close').click(function(){
station_selected = station_selected_old.slice(0);
$('.share_dialog').remove();
});
$('.share_ok').click(function(){
leave_warn = true;
$( ".share_dialog" ).remove();
});
}
});
});
}
station_event();
$('input[name="station_name_checkbox"]').click(function(){
if($(this).get(0).checked == true){
$('#station_btn').css("opacity", "0.3");
$("#station_btn").unbind('click');
}
else{
$("#station_btn").unbind('click');
$('#station_btn').css("opacity", "1");
station_event();
}
});
// Initialize station_selected variable
$.ajax({
url: "ajax/constraints/select_station.php",
type: 'POST',
cache: false,
data: {"action" : "edit", "user_id" : "<?php print(htmlspecialchars($_POST['user_id'], ENT_QUOTES)); ?>"},
success: function(data){
$(data).find(".checked_station").each(function(){
station_selected.push($(this).data('station').toString());
});
<?php if(!isset($_POST['new_user'])) { ?>
if(station_selected.length==0){
$('input[name="station_name_checkbox"]').click();
}
<?php } ?>
}
});
$("#station_btn").hover(
function(){
if($('input[name="station_name_checkbox"]').get(0).checked == false && station_selected.length > 0){
$('<div id="info_box"><div id="info_box_title">Έχετε επιλέξει να εξαιρέσετε '+station_selected.length+' μηχανήματα διαγνωστικών μονάδων</div></div>').appendTo('body');
for(var i=0; i<station_selected.length; i++){
$('#info_box').append('<div><i class="fa fa-check-square-o" style="color:#414959;"></i> '+station_selected[i]+'</div>');
}
}
if($('input[name="station_name_checkbox"]').get(0).checked == false && station_selected.length == 0){
$('<div id="info_box"><div id="info_box_title">Έχετε επιλέξει να μην εξαιρέσετε κανένα μηχάνημα διαγνωστικής μονάδας</div></div>').appendTo('body');
}
$('#info_box').position({my: "left top", at: "right top", of: "#station_btn"});
},
function(){
$('#info_box').remove();
}
);
// ******************** Select Stations END *******************************
// ******************** Select Body Part *******************************
// **** FUNCTIONS ******
function remove_body_part(this_remove_btn){
var body_part = $(this_remove_btn.target).closest('.checked_body_part_table').find('.checked_body_part').data('body_part');
var index = $.inArray(body_part.toString(), body_part_selected);
if(index != -1)
{
body_part_selected.splice(index, 1);
}
$(this_remove_btn.target).closest('.checked_body_part_table').closest('div').remove();
}
function add_body_part(){
var body_part = $('select[name="body_part"]').val();
if(body_part != null){
if($.inArray(body_part, body_part_selected) === -1){
body_part_selected.push(body_part);
$('.body_part_td_container').append("<div><table class='checked_body_part_table'><tr><td><span class='checked_body_part' data-body_part='"+body_part+"'>"+body_part+"</span></td><td><span class='close_body_part_btn'>X</span></td></tr></table></div>");
$('.close_body_part_btn:last').click(remove_body_part);
}
else{
alert("Η εγγραφή υπάρχει ήδη στη λίστα!");
}
}
else{
alert("Δεν υπάρχει κάποια εξέταση στο σύστημα με το συγκεκριμένο μέρος του σώματος");
}
}
function body_part_event(){
$("#body_part_btn").click(function(){
body_part_selected_old = body_part_selected.slice(0); // save old body_part list
$('<div class="share_dialog"></div>').appendTo('body');
$.ajax({
url: "ajax/constraints/select_body_part.php",
type: 'POST',
cache: false,
data: {"action" : "new"},
beforeSend: function(data){
$( ".share_dialog").html("<img src='img/loading.gif'>");
},
success: function(data){
$(".share_dialog").html(data);
for(var i = 0; i < body_part_selected.length; i++){
$(".body_part_td_container").append("<div><table class='checked_body_part_table'><tr><td><span class='checked_body_part' data-body_part='"+body_part_selected[i]+"'>"+body_part_selected[i]+"</span></td><td><span class='close_body_part_btn'>X</span></td></tr></table></div>");
$('.close_body_part_btn:last').click(remove_body_part);
}
$('.add_body_part').unbind('click');
$('.add_body_part').click(add_body_part);
$('.share_close').click(function(){
body_part_selected = body_part_selected_old.slice(0);
$('.share_dialog').remove();
});
$('.share_ok').click(function(){
leave_warn = true;
$( ".share_dialog" ).remove();
});
}
});
});
}
// **** FUNCTIONS END ******
body_part_event();
$('input[name="body_part_checkbox"]').click(function(){
if($(this).get(0).checked == true){
$('#body_part_btn').css("opacity", "0.3");
$("#body_part_btn").unbind('click');
}
else{
$("#body_part_btn").unbind('click');
$('#body_part_btn').css("opacity", "1");
body_part_event();
}
});
var body_part_selected = [];
var body_part_selected_old;
// Initialize body_part_selected variable
$.ajax({
url: "ajax/constraints/select_body_part.php",
type: 'POST',
cache: false,
data: {"action" : "edit", "user_id" : "<?php print(htmlspecialchars($_POST['user_id'], ENT_QUOTES)); ?>"},
success: function(data){
$(data).find(".checked_body_part").each(function(){
body_part_selected.push($(this).data('body_part').toString());
});
<?php if(!isset($_POST['new_user'])) { ?>
if(body_part_selected.length==0){
$('input[name="body_part_checkbox"]').click();
}
<?php } ?>
}
});
$("#body_part_btn").hover(
function(){
if($('input[name="body_part_checkbox"]').get(0).checked == false && body_part_selected.length > 0){
$('<div id="info_box"><div id="info_box_title">Έχετε επιλέξει '+body_part_selected.length+' μέρη του σώματος</div></div>').appendTo('body');
for(var i=0; i<body_part_selected.length; i++){
$('#info_box').append('<div><i class="fa fa-check-square-o" style="color:#414959;"></i> '+body_part_selected[i]+'</div>');
}
}
if($('input[name="body_part_checkbox"]').get(0).checked == false && body_part_selected.length == 0){
$('<div id="info_box"><div id="info_box_title">Δεν έχετε επιλέξει κανένα μέρος του σώματος</div></div>').appendTo('body');
}
$('#info_box').position({my: "left top", at: "right top", of: "#body_part_btn"});
},
function(){
$('#info_box').remove();
}
);
// ******************** Select body_part END *******************************
// ******************** Select Department *******************************
// **** FUNCTIONS ******
function remove_department(this_remove_btn){
var department = $(this_remove_btn.target).closest('.checked_department_table').find('.checked_department').data('department');
var index = $.inArray(department.toString(), department_selected);
if(index != -1)
{
department_selected.splice(index, 1);
}
$(this_remove_btn.target).closest('.checked_department_table').closest('div').remove();
}
function add_department(){
var department = $('select[name="department"]').val();
if(department != null){
if($.inArray(department, department_selected) === -1){
department_selected.push(department);
$('.department_td_container').append("<div><table class='checked_department_table'><tr><td><span class='checked_department' data-department='"+department+"'>"+department+"</span></td><td><span class='close_department_btn'>X</span></td></tr></table></div>");
$('.close_department_btn:last').click(remove_department);
}
else{
alert("Η εγγραφή υπάρχει ήδη στη λίστα!");
}
}
else{
alert("Δεν υπάρχει κάποια εξέταση στο σύστημα με το συγκεκριμένο τμήμα");
}
}
function department_event(){
$("#department_btn").click(function(){
department_selected_old = department_selected.slice(0); // save old department list
$('<div class="share_dialog"></div>').appendTo('body');
$.ajax({
url: "ajax/constraints/select_department.php",
type: 'POST',
cache: false,
data: {"action" : "new"},
beforeSend: function(data){
$( ".share_dialog").html("<img src='img/loading.gif'>");
},
success: function(data){
$(".share_dialog").html(data);
for(var i = 0; i < department_selected.length; i++){
$(".department_td_container").append("<div><table class='checked_department_table'><tr><td><span class='checked_department' data-department='"+department_selected[i]+"'>"+department_selected[i]+"</span></td><td><span class='close_department_btn'>X</span></td></tr></table></div>");
$('.close_department_btn:last').click(remove_department);
}
$('.add_department').unbind('click');
$('.add_department').click(add_department);
$('.share_close').click(function(){
department_selected = department_selected_old.slice(0);
$('.share_dialog').remove();
});
$('.share_ok').click(function(){
leave_warn = true;
$( ".share_dialog" ).remove();
});
}
});
});
}
// **** FUNCTIONS END ******
department_event();
$('input[name="department_checkbox"]').click(function(){
if($(this).get(0).checked == true){
$('#department_btn').css("opacity", "0.3");
$("#department_btn").unbind('click');
}
else{
$("#department_btn").unbind('click');
$('#department_btn').css("opacity", "1");
department_event();
}
});
var department_selected = [];
var department_selected_old;
// Initialize department_selected variable
$.ajax({
url: "ajax/constraints/select_department.php",
type: 'POST',
cache: false,
data: {"action" : "edit", "user_id" : "<?php print(htmlspecialchars($_POST['user_id'], ENT_QUOTES)); ?>"},
success: function(data){
$(data).find(".checked_department").each(function(){
department_selected.push($(this).data('department').toString());
});
<?php if(!isset($_POST['new_user'])) { ?>
if(department_selected.length==0){
$('input[name="department_checkbox"]').click();
}
<?php } ?>
}
});
$("#department_btn").hover(
function(){
if($('input[name="department_checkbox"]').get(0).checked == false && department_selected.length > 0){
$('<div id="info_box"><div id="info_box_title">Έχετε επιλέξει '+department_selected.length+' τμήματα</div></div>').appendTo('body');
for(var i=0; i<department_selected.length; i++){
$('#info_box').append('<div><i class="fa fa-check-square-o" style="color:#414959;"></i> '+department_selected[i]+'</div>');
}
}
if($('input[name="department_checkbox"]').get(0).checked == false && department_selected.length == 0){
$('<div id="info_box"><div id="info_box_title">Δεν έχετε επιλέξει κανένα τμήμα</div></div>').appendTo('body');
}
$('#info_box').position({my: "left top", at: "right top", of: "#department_btn"});
},
function(){
$('#info_box').remove();
}
);
// ******************** Select department END *******************************
// ******************** Submit event *******************************
$("button[type='submit']").click(function(){
var index = $.inArray(null, ref_doc_selected);
if(index != -1)
{
ref_doc_selected.splice(index, 1);
}
var index1 = $.inArray(null, station_selected);
if(index1 != -1)
{
station_selected.splice(index1, 1);
}
var index2 = $.inArray(null, body_part_selected);
if(index2 != -1)
{
body_part_selected.splice(index2, 1);
}
var index3 = $.inArray(null, department_selected);
if(index3 != -1)
{
department_selected.splice(index3, 1);
}
if( ($('input[name="ref_checkbox"]').get(0).checked == false && ref_doc_selected.length==0 ) || ($('input[name="body_part_checkbox"]').get(0).checked == false && body_part_selected.length==0 ) || ($('input[name="department_checkbox"]').get(0).checked == false && department_selected.length==0 ) || ($('input[name="station_name_checkbox"]').get(0).checked == false && station_selected.length==0 )){
alert("Παρακαλώ ελέξτε τα Στοιχεία Σύνδεσης και τους Περιορισμούς!");
// Refering physician Check option
if($('input[name="ref_checkbox"]').get(0).checked == false && ref_doc_selected.length==0){
$('input[name="ref_checkbox"] + span').css({"color":"firebrick", "border-color":"firebrick"});
$('input[name="ref_checkbox"] + span').next('.speech_bubble').css({"display":"inline-block"});
}else{
$('input[name="ref_checkbox"] + span').css({"color":"#333", "border-color":"#7f9db9"});
$('input[name="ref_checkbox"] + span').next('.speech_bubble').css({"display":"none"});
}
// Station Name Check option
if($('input[name="station_name_checkbox"]').get(0).checked == false && body_part_selected.length==0){
$('input[name="station_name_checkbox"] + span').css({"color":"firebrick", "border-color":"firebrick"});
$('input[name="station_name_checkbox"] + span').next('.speech_bubble').css({"display":"inline-block"});
}else{
$('input[name="station_name_checkbox"] + span').css({"color":"#333", "border-color":"#7f9db9"});
$('input[name="station_name_checkbox"] + span').next('.speech_bubble').css({"display":"none"});
}
// Body Part Check option
if($('input[name="body_part_checkbox"]').get(0).checked == false && body_part_selected.length==0){
$('input[name="body_part_checkbox"] + span').css({"color":"firebrick", "border-color":"firebrick"});
$('input[name="body_part_checkbox"] + span').next('.speech_bubble').css({"display":"inline-block"});
}else{
$('input[name="body_part_checkbox"] + span').css({"color":"#333", "border-color":"#7f9db9"});
$('input[name="body_part_checkbox"] + span').next('.speech_bubble').css({"display":"none"});
}
// Department Check option
if($('input[name="department_checkbox"]').get(0).checked == false && department_selected.length==0){
$('input[name="department_checkbox"] + span').css({"color":"firebrick", "border-color":"firebrick"});
$('input[name="department_checkbox"] + span').next('.speech_bubble').css({"display":"inline-block"});
}else{
$('input[name="department_checkbox"] + span').css({"color":"#333", "border-color":"#7f9db9"});
$('input[name="department_checkbox"] + span').next('.speech_bubble').css({"display":"none"});
}
return false;
}
$("form input[name='modality[]']").remove();
for(var i = 0; i < modalities.length; i++){
$("<input type='hidden' name='modality[]' value='"+modalities[i]+"'>").appendTo("form");
}
if($('input[name="ref_checkbox"]').get(0).checked == false ){
// Add referring physician constraints
$("form input[name='ref_names[]']").remove();
for(var i = 0; i < ref_doc_selected.length; i++){
$("<input type='hidden' name='ref_names[]' value='"+ref_doc_selected[i]+"'>").appendTo("form");
}
}
if($('input[name="station_name_checkbox"]').get(0).checked == false ){
// Add station name constraints
$("form input[name='station_names[]']").remove();
for(var i = 0; i < station_selected.length; i++){
$("<input type='hidden' name='station_names[]' value='"+station_selected[i]+"'>").appendTo("form");
}
}
if($('input[name="body_part_checkbox"]').get(0).checked == false ){
// Add body part constraints
$("form input[name='body_part[]']").remove();
for(var i = 0; i < body_part_selected.length; i++){
$("<input type='hidden' name='body_part[]' value='"+body_part_selected[i]+"'>").appendTo("form");
}
}
if($('input[name="department_checkbox"]').get(0).checked == false ){
// Add department constraints
$("form input[name='department[]']").remove();
for(var i = 0; i < department_selected.length; i++){
$("<input type='hidden' name='department[]' value='"+department_selected[i]+"'>").appendTo("form");
}
}
});
$('a').click(function(e){
if(leave_warn === true){
var r = confirm("Εάν φύγετε χωρίς να κάνετε αποθήκευση οι αλλαγές που κάνατε θα χαθούν!");
if (r == true) {
// leave
} else {
e.preventDefault();
return false;
}
}
});
});
</script>
<div class="expand_bar <?php print($additional_class); ?>">
Επεξεργασία Χρήστη
</div>
<?php if($user_results > 0) { ?>
<div class="user_profile user <?php print($additional_class); ?>" style="margin-top: 10px;">
<table class="user_infos">
<tr>
<td><i class="fa fa-user"></i></td>
<td> Ονοματεπώνυμο: </td>
<td><?php print(htmlspecialchars($row['surname'], ENT_QUOTES)." ".htmlspecialchars($row['name'], ENT_QUOTES)); ?></td>
</tr>
<tr>
<td><i class="fa fa-file-text"></i></td>
<td> ΑΜΚΑ: </td>
<td> <?php print(htmlspecialchars($row['AMKA'], ENT_QUOTES)); ?></td>
</tr>
<tr>
<td><i class="fa fa-group"></i></td>
<td> Ρόλος: </td>
<td><?php print(htmlspecialchars($row['usergroup'], ENT_QUOTES)); ?></td>
</tr>
<tr>
<td><i class="fa fa-hospital-o"></i></td>
<td> Ίδρυμα: </td>
<td><?php print(htmlspecialchars($institution_name, ENT_QUOTES)); ?></td>
</tr>
<tr>
<td><i class="<?php ($row['authorized'] == '0') ? print('fa fa-minus-circle') : print('fa fa-check') ?>"></i></td>
<td> Ενεργός Χρήστης: </td>
<td> <?php ($row['authorized'] == '0') ? print('Όχι') : print('Ναι') ?></td>
</tr>
</table>
</div>
<br>
<div id="search_examination_container" class="<?php print($additional_class); ?>">
<form action="main.php?cp=admin_user&action=save" method="post">
<input type="hidden" name="user_id" value='<?php print(htmlspecialchars($row['id'], ENT_QUOTES));?>'>
<input type="hidden" name="persistent_id" value='<?php print(htmlspecialchars($row['persistent_id'], ENT_QUOTES));?>'>
<table>
<thead>
<tr>
<?php if($usergroup == 'Hospital IT'){ ?>
<th class="constrains">Περιορισμοί</th>
<?php } ?>
</tr>
</thead>
<tbody>
<tr>
<?php if($usergroup == 'Hospital IT'){ ?>
<td class="constrains">
<input type="checkbox" name="ref_checkbox" title="Πρόκειται να δώσετε στο χρήστη πρόσβαση στις εξετάσεις όλων των παραπεμπόντων ιατρών"><span>Επιλογή Όλων</span><span class="speech_bubble" style="display: none;">!</span>
<br><br>
<!-- **** Multiple Ref_Doctors button -->
<button class="button_blue constrains_btn <?php print($additional_class); ?>" id="ref_doc_btn" type="button" style="white-space:nowrap;"><i class="big_icon fa fa-user-md fa-inverse"></i> Επιλογή παραπεμπόντων ιατρών</button>
<hr class="cnstr_hr">
<!-- **** Allowed Modalities List -->
<button class="button_blue constrains_btn <?php print($additional_class); ?>" id="modalities_filter_btn" type="button" style="white-space:nowrap;"><i class="big_icon fa fa-medkit fa-inverse"></i> Επιλογή διαγνωστικών μονάδων</button>
<!------------------- Station Names ----------------->
<hr class="cnstr_hr">
<input type="checkbox" name="station_name_checkbox" title="Πρόκειται να δώσετε στο χρήστη πρόσβαση στις εξετάσεις όλων των μηχανημάτων των διαγνωστικών μονάδων"><span>Επιλογή Όλων</span><span class="speech_bubble" style="display: none;">!</span>
<br></br>
<!-- Station Names button -->
<button class="button_blue constrains_btn <?php print($additional_class); ?>" id="station_btn" type="button" style="white-space:nowrap;"><i class="big_icon fa fa-stethoscope"></i> Εξαίρεση μηχανημάτων διαγνωστικών μονάδων</button>
<!------------------- Body Part ----------------->
<hr class="cnstr_hr">
<input type="checkbox" name="body_part_checkbox" title="Πρόκειται να δώσετε στο χρήστη πρόσβαση στις εξετάσεις όλων των μερών του σώματος"><span>Επιλογή Όλων</span><span class="speech_bubble" style="display: none;">!</span>
<br></br>
<!-- Body Part button -->
<button class="button_blue constrains_btn <?php print($additional_class); ?>" id="body_part_btn" type="button" style="white-space:nowrap;"><i class="big_icon fa fa-male"></i> Επιλογή μερών του σώματος</button>
<!------------------- Department ----------------->
<hr class="cnstr_hr">
<input type="checkbox" name="department_checkbox" title="Πρόκειται να δώσετε στο χρήστη πρόσβαση στις εξετάσεις όλων των τμημάτων"><span>Επιλογή Όλων</span><span class="speech_bubble" style="display: none;">!</span>
<br></br>
<!-- department button -->
<button class="button_blue constrains_btn <?php print($additional_class); ?>" id="department_btn" type="button" style="white-space:nowrap;"><i class="big_icon fa fa-hospital-o"></i> Επιλογή τμήματος</button>
</td>
<?php //}
} ?>
</tr>
<tr>
<td colspan="5" style="text-align: center;">
<button class="button_blue <?php print($additional_class); ?>" type="submit"><i class="big_icon fa fa-save"></i> Αποθήκευση</button>
</td>
</tr>
</tbody>
</table>
<?php
if($usergroup == 'Hospital IT'){
// --- Load user modalities filter
$sth4 = $dbh_portal->prepare("SELECT filter_user_modal FROM db_modalities WHERE user_id=?;");
$sth4->bindParam(1, $_POST['user_id'], PDO::PARAM_STR);
$sth4->execute();
$sth4->setFetchMode(PDO::FETCH_ASSOC);
$row4 =$sth4->fetch();
$row4 = explode(",", $row4['filter_user_modal']);
foreach($row4 as $keyx){
?>
<input type='hidden' name='modality[]' value='<?php print(htmlspecialchars($keyx, ENT_QUOTES)); ?>'>
<?php
}
} ?>
</form>
<!-------Dialog Form - select Modalities ---------->
<div id="dialog-modalities" style="display:none;" title="Επιλογή Διαγνωστικών Μονάδων"> </div>
</div>
<?php }else{ ?>
<div id='search_examination_container' class="<?php print($additional_class); ?>">
<div id='search_examination_title' class="<?php print($additional_class); ?>">Δεν έχετε δικαίωμα επεξεργασίας του συγκεκριμένου χρήστη.</div>
</div>
<?php } ?>
<?php
}
else{ // ****************** SHOW USERS *********************************************************************************************************
// ***********************************************************************************************************************************************
// ***********************************************************************************************************************************************
// ***********************************************************************************************************************************************
// ----------- Match table columns for sorting process -------
function table_columns($col_name){
// Array with proper column names
$col_array = array(
"name" => "name",
"surname" => "surname",
"usergroup" => "usergroup",
"amka" => "amka"
);
foreach ($col_array as $key => $col) {
if($key == $col_name){
return $col;
}
}
return 'surname';
}
?>
<!-- Search Form -->
<div class="expand_bar <?php print($additional_class); ?>">
Χρήστες
<div class="arrows"></div>
</div>
<?php if($usergroup == 'Hospital IT') { ?>
<div id="search_examination_container" class="<?php print($additional_class); ?>">
<form id="search" method="GET" action="main.php?cp=admin_user&action=search">
<input type="hidden" name="cp" value="admin_user">
<input type="hidden" name="action" value="search">
<table>
<thead>
<tr>
<th>Επώνυμο</th>
<th>Όνομα</th>
<th>ΑΜΚΑ</th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td><input type="text" name="surname" value="<?php print(htmlspecialchars($_GET['surname'], ENT_QUOTES)); ?>"></td>
<td><input type="text" name="name" value="<?php print(htmlspecialchars($_GET['name'], ENT_QUOTES)); ?>"></td>
<td><input type="text" name="amka" value="<?php print(htmlspecialchars($_GET['amka'], ENT_QUOTES)); ?>"></td>
<td style="text-align:center;"><button class="button_blue <?php print($additional_class); ?>" type="submit" style=" margin:0px 0px 0"><i class="big_icon fa fa-search fa-flip-horizontal"></i> Αναζήτηση</button></td>
</tr>
</tbody>
</table>
<br>
</form>
</div>
<?php
$sql = "SELECT db_user.id as id, persistent_id, surname, AMKA, name, usergroup, authorized
FROM db_user
WHERE institution = :institution AND usergroup = 'Doctor'";
$temp_surname='';
$temp_name='';
if (isset($_GET['action']) && $_GET['action'] == 'search'){
if (isset($_GET['surname']) && $_GET['surname'] != ''){
$temp_surname = str_replace('*','%', $_GET['surname']);
$sql .= " AND surname like :surname ";
}
if (isset($_GET['name']) && $_GET['name'] != ''){
$temp_name = str_replace('*','%', $_GET['name']);
$sql .= " AND db_user.name like :name ";
}
if (isset($_GET['amka']) && $_GET['amka'] != ''){
$sql .= " AND AMKA = :amka ";
}
}
// --- sort
$order_by="surname";
if (isset($_GET['reverce_order']) && $_GET['reverce_order'] != null && $_GET['sortby'] == null ){
$order_by="surname";
}
if (isset($_GET['sortby']) && $_GET['sortby'] != null) {
$order_by=$_GET['sortby'];
$order_by = table_columns($order_by);
}
if (isset($_GET['reverce_order']) && $_GET['reverce_order'] != null){
$order_by=$order_by." desc";
}
// --- limit
$limit=" LIMIT 0, 20 ";
if(isset($_GET['current_page']) || isset($_GET['pagesize'])){
$cur_page = 1;
$page_size = 20;
if(intval($_GET['current_page']))
$cur_page = intval($_GET['current_page']);
if(intval($_GET['pagesize']))
$page_size = intval($_GET['pagesize']);
$start=($cur_page-1)*$page_size;
$limit= "LIMIT ".$start.", ".$page_size;
}
$sth_size = $dbh_portal->prepare($sql);
$sql .= "order by ".$order_by." ".$limit.";";
$sth = $dbh_portal->prepare($sql);
$sth->bindParam(':institution', $institution, PDO::PARAM_STR);
$sth_size->bindParam(':institution', $institution, PDO::PARAM_STR);
if (isset($_GET['surname']) && $_GET['surname'] != ''){
$sth->bindParam(':surname', $temp_surname, PDO::PARAM_STR);
$sth_size->bindParam(':surname', $temp_surname, PDO::PARAM_STR);
}
if (isset($_GET['name']) && $_GET['name'] != ''){
$sth->bindParam(':name', $temp_name, PDO::PARAM_STR);
$sth_size->bindParam(':name', $temp_name, PDO::PARAM_STR);
}
if (isset($_GET['amka']) && $_GET['amka'] != ''){
$sth->bindParam(':amka', $_GET['amka'], PDO::PARAM_STR);
$sth_size->bindParam(':amka', $_GET['amka'], PDO::PARAM_STR);
}
$sth->execute();
$sth->setFetchMode(PDO::FETCH_ASSOC);
$sth_size->execute();
$sth_size->setFetchMode(PDO::FETCH_ASSOC);
$row_count = $sth_size->fetch(); //var_dump($row_count);
$row_count['row_count'] = $sth_size->rowCount();
?>
<div id="search_examination_container_results" class="exam_results <?php print($additional_class); ?>">
<div id="search_examination_title" class="<?php print($additional_class); ?>">
<?php print(htmlspecialchars($row_count['row_count'], ENT_QUOTES)); ?> αποτελέσματα,
<!-- Pages -->
<select name="pagesize" class="pagesize">
<option <?php ((isset($_POST['pagesize']) && $_POST['pagesize']=="10")?print("selected"):print(""))?>>10</option>
<option <?php (((isset($_POST['pagesize']) && $_POST['pagesize']=="20") || ($_POST['pagesize']==null))?print("selected"):print(""))?>>20</option>
<option <?php ((isset($_POST['pagesize']) && $_POST['pagesize']=="50")?print("selected"):print(""))?>>50</option>
<option <?php ((isset($_POST['pagesize']) && $_POST['pagesize']=="100")?print("selected"):print(""))?>>100</option>
</select>
ανα σελίδα
<div class="page_index" style="max-width:750px; display: inline-block">
<button class="prev_page">Προηγούμενο</button>
<span><!-- Pages (numbers) --></span>
<button class="next_page">Επόμενο</button>
&emsp;&emsp;Μετάβαση σε σελίδα:
<select class="select_page">
<?php
($_GET['current_page']!=null ? $current_page=$_GET['current_page'] : $current_page=1);
($_GET['pagesize']!=null ? $pagesize=$_GET['pagesize'] : $pagesize=20);
for($i=1; $i<=(ceil($row_count['row_count']/$pagesize)); $i++){
$selected="";
if($i == $current_page)
$selected="selected";
print("<option ".$selected.">".$i."</option>");
}
?>
</select>
</div>
</div>
<table class="admin_exams_results <?php print($additional_class); ?>">
<thead>
<tr>
<th>
<table>
<?php
$sort_icon="";
if(isset($_GET['sortby']) && $_GET['sortby']=="surname"){
if($_GET['reverce_order']=="1")
$sort_icon="ui-icon-triangle-1-s";
else
$sort_icon="ui-icon-triangle-1-n";
}
else
$sort_icon="ui-icon-triangle-2-n-s";
?>
<tr class="sort <?php print($additional_class); ?>" rel="surname">
<td>Επώνυμο</td>
<td><span class="ui-icon <?php print($sort_icon);?>"></span></td>
</tr>
</table>
</th>
<th>
<table>
<?php
$sort_icon="";
if(isset($_GET['sortby']) && $_GET['sortby']=="name"){
if($_GET['reverce_order']=="1")
$sort_icon="ui-icon-triangle-1-s";
else
$sort_icon="ui-icon-triangle-1-n";
}
else
$sort_icon="ui-icon-triangle-2-n-s";
?>
<tr class="sort <?php print($additional_class); ?>" rel="name">
<td>Όνομα</td>
<td><span class="ui-icon <?php print($sort_icon);?>"></span></td>
</tr>
</table>
</th>
<th>
<table>
<?php
$sort_icon="";
if((isset($_GET['sortby']) && $_GET['sortby']=="amka") ){
if($_GET['reverce_order']=="1")
$sort_icon="ui-icon-triangle-1-s";
else
$sort_icon="ui-icon-triangle-1-n";
}
else
$sort_icon="ui-icon-triangle-2-n-s";
?>
<tr class="sort <?php print($additional_class); ?>" rel="amka">
<td>AMKA</td>
<td><span class="ui-icon <?php print($sort_icon);?>"></span></td>
</tr>
</table>
</th>
<th>Ομάδα Χρήστη</th>
<th>Επεξεργασία Δικαιωμάτων</th>
<th>Ενεργός Χρήστης</th>
<th>Απενεργοποίηση Χρήστη</th>
</tr>
</thead>
<tbody>
<input type="hidden" name="action" value="authorize">
<?php
$modal="none";
$even_row=true;
while ($row = $sth->fetch()) { ?>
<tr class="exams_group <?php ($even_row?print("even_row"):print(""))?>">
<td title="<?php print(htmlspecialchars($row['surname'], ENT_QUOTES));?>"> <?php print(htmlspecialchars($row['surname'], ENT_QUOTES));?> </td>
<td title="<?php print(htmlspecialchars($row['name'], ENT_QUOTES));?>"> <?php print(htmlspecialchars($row['name'], ENT_QUOTES));?> </td>
<td title="<?php print(htmlspecialchars($row['AMKA'], ENT_QUOTES));?>"> <?php print(htmlspecialchars($row['AMKA'], ENT_QUOTES));?> </td>
<td title="<?php print(htmlspecialchars($row['usergroup'], ENT_QUOTES));?>"> <?php print(htmlspecialchars($row['usergroup'], ENT_QUOTES));?> </td>
<td style="text-align:center">
<form method="POST">
<input type="hidden" name="action" value="edit">
<input type="hidden" name="user_id" value="<?php print(htmlspecialchars($row['id'], ENT_QUOTES)); ?>">
<?php if ($row['authorized'] == 0 ) { ?>
<input type="hidden" name="new_user" value="new_user">
<?php } ?>
<input class="user_form_link edit_icon" type="image" src="img/editfr9.png" title='Επεξεργασία' alt='Επεξεργασία'>
</form>
</td>
<td style="text-align:center"><?php ($row['authorized'] == '0' ? print("<img src='img/red_circle.png' title='Χρήστης που δεν του έχουν αποδοθεί δικαιώματα πρόσβασης' alt='Μη Ενεργός Χρήστης'>"):print("<i style='font-size: 16px;color: green;' class='fa fa-check' title='Χρήστης που του έχουν αποδοθεί δικαιώματα πρόσβασης' alt='Ενεργός Χρήστης'></i>") ) ?></td>
<td style="text-align:center">
<?php ($row['authorized'] == '1' ? print("<img class='delete_auth_icon' data-id='".htmlspecialchars($row['id'], ENT_QUOTES)."' data-surname='".htmlspecialchars($row['surname'], ENT_QUOTES)."' title='Απενεργοποίηση Χρήστη' alt='Απενεργοποίηση Χρήστη' border='0' src='img/deletert9.png'>"):print("") ) ?>
</td>
</tr>
<?php
$even_row = !$even_row;
}
?>
</tbody>
</table>
<div id="search_examination_title">
<?php print(htmlspecialchars($row_count['row_count'], ENT_QUOTES)); ?> αποτελέσματα,
<!-- Pages -->
<select name="pagesize" class="pagesize">
<option <?php ((isset($_POST['pagesize']) && $_POST['pagesize']=="10")?print("selected"):print(""))?>>10</option>
<option <?php (((isset($_POST['pagesize']) && $_POST['pagesize']=="20") || ($_POST['pagesize']==null))?print("selected"):print(""))?>>20</option>
<option <?php ((isset($_POST['pagesize']) && $_POST['pagesize']=="50")?print("selected"):print(""))?>>50</option>
<option <?php ((isset($_POST['pagesize']) && $_POST['pagesize']=="100")?print("selected"):print(""))?>>100</option>
</select>
ανα σελίδα
<div class="page_index" style="max-width:750px; display: inline-block">
<button class="prev_page">Προηγούμενο</button>
<span><!-- Pages (numbers) --></span>
<button class="next_page">Επόμενο</button>
&emsp;&emsp;Μετάβαση σε σελίδα:
<select class="select_page">
<?php
($_GET['current_page']!=null ? $current_page=$_GET['current_page'] : $current_page=1);
($_GET['pagesize']!=null ? $pagesize=$_GET['pagesize'] : $pagesize=20);
for($i=1; $i<=(ceil($row_count['row_count']/$pagesize)); $i++){
$selected="";
if($i == $current_page)
$selected="selected";
print("<option ".$selected.">".$i."</option>");
}
?>
</select>
</div>
</div>
<form id="search_pageLimit_form" method="GET">
<input type="hidden" name="cp" value="admin_user">
<input type="hidden" name="action" value="search">
<input type="hidden" name="name" value="<?php (isset($_GET['name'])? print(htmlspecialchars($_GET['name'], ENT_QUOTES)):print(''))?>">
<input type="hidden" name="surname" value="<?php (isset($_GET['surname'])? print(htmlspecialchars($_GET['surname'], ENT_QUOTES)):print(''))?>">
<input type="hidden" name="login" value="<?php (isset($_GET['login'])? print(htmlspecialchars($_GET['login'], ENT_QUOTES)):print(''))?>">
<input type="hidden" name="usergroup" value="<?php (isset($_GET['usergroup'])? print(htmlspecialchars($_GET['usergroup'], ENT_QUOTES)):print(''))?>">
<input type="hidden" name="pagesize" value="<?php (isset($_GET['pagesize'])? print(htmlspecialchars($_GET['pagesize'], ENT_QUOTES)):print('20'))?>">
<input type="hidden" name="current_page" value="<?php (isset($_GET['current_page'])? print(htmlspecialchars($_GET['current_page'], ENT_QUOTES)):print('1'))?>">
<input type="hidden" name="sortby" value="<?php (isset($_GET['sortby'])? print(htmlspecialchars($_GET['sortby'], ENT_QUOTES)):print(''))?>">
<input type="hidden" name="reverce_order" value="<?php (isset($_GET['reverce_order'])? print(htmlspecialchars($_GET['reverce_order'], ENT_QUOTES)):print(''))?>">
</form>
</div>
<br>
<script type='text/javascript'>
$(function(){
var td_row = '<?php print(htmlspecialchars($td_row['columns'], ENT_QUOTES)); ?>';
td_row = td_row.split(",");
// Pages -----------------------------
var current_page = <?php ($_GET['current_page']!=null && intval($_GET['current_page']) ? print(htmlspecialchars($_GET['current_page'], ENT_QUOTES)) : print("1"));?>;
var max_page_num = 9;
var pages = Math.ceil(<?php print(htmlspecialchars($row_count['row_count'], ENT_QUOTES)); ?> / $('.pagesize').val());
if (pages == 0){
pages=1;
}
var pages_buttons="";
/////////////////// +/- 3 pages from current page
if(pages > max_page_num){
pages_buttons = "<a class='page_button'>"+1+"</a>";
if(parseInt(current_page - 4) > 1)
pages_buttons += " ... ";
for(var i = 3; i >= 1; i--){
if(parseInt(current_page - i) > 1){
pages_buttons += "<a class='page_button'>"+parseInt(current_page - i)+"</a>";
}
}
if(current_page > 1 && current_page < pages)
pages_buttons += "<a class='page_button'>"+current_page+"</a>";
for(var i = 1; i <= 3; i++){
if(parseInt(current_page + i) < pages){
pages_buttons += "<a class='page_button'>"+parseInt(current_page + i)+"</a>";
}
}
if(parseInt(current_page + 4) < pages)
pages_buttons += " ... ";
pages_buttons += "<a class='page_button'>"+pages+"</a>";
}
///////////////////
else{
for (var i = 1; i <= pages; i++) {
pages_buttons = pages_buttons+"<a class='page_button'>"+i+"</a>";
}
}
$('.page_index span').html(pages_buttons);
$('.page_button').each(function(){
if(parseInt($(this).text()) == current_page)
$(this).addClass('current_page');
});
// -- Events --
$('.prev_page').click(function(){
if( current_page >1){
$('#search_pageLimit_form input[name="current_page"]').val(current_page-1);
}
else{
$('#search_pageLimit_form input[name="current_page"]').val(1);
}
$('#search_pageLimit_form input[name="pagesize"]').val($('.pagesize').val());
$('input[type="checkbox"][name="modality[]"]').clone().appendTo('#search_pageLimit_form').hide();
$('#search_pageLimit_form').submit();
});
$('.next_page').click(function(){
if( current_page < pages){
$('#search_pageLimit_form input[name="current_page"]').val(current_page+1);
}
else{
$('#search_pageLimit_form input[name="current_page"]').val(pages);
}
$('#search_pageLimit_form input[name="pagesize"]').val($('.pagesize').val());
$('input[type="checkbox"][name="modality[]"]').clone().appendTo('#search_pageLimit_form').hide();
$('#search_pageLimit_form').submit();
});
$('.page_button').click(function(){
$('#search_pageLimit_form input[name="current_page"]').val($(this).text());
$('input[type="checkbox"][name="modality[]"]').clone().appendTo('#search_pageLimit_form').hide();
$('#search_pageLimit_form input[name="pagesize"]').val($('.pagesize').val());
$('#search_pageLimit_form').submit();
});
$('.pagesize').change(function(){
$('#search_pageLimit_form input[name="pagesize"]').val($(this).val());
$('#search_pageLimit_form input[name="current_page"]').val("1");
$('input[type="checkbox"][name="modality[]"]').clone().appendTo('#search_pageLimit_form').hide();
$('#search_pageLimit_form').submit();
});
$('.select_page').change(function(){
$('#search_pageLimit_form input[name="current_page"]').val($(this).val());
$('input[type="checkbox"][name="modality[]"]').clone().appendTo('#search_pageLimit_form').hide();
$('#search_pageLimit_form').submit();
});
// Sort table -----------------------------
$('.sort').click(function(){
if($(this).hasClass('sort_modality')){
$('#search_pageLimit_form input[name="sortby"]').val('');
$('input[type="checkbox"][name="modality[]"]').clone().appendTo('#search_pageLimit_form').hide();
if($('#search_pageLimit_form input[name="reverce_order"]').val()=='')
$('#search_pageLimit_form input[name="reverce_order"]').val('1');
else
$('#search_pageLimit_form input[name="reverce_order"]').val('');
$('#search_pageLimit_form').submit();
}
else{
$('#search_pageLimit_form input[name="sortby"]').val($(this).attr('rel'));
$('input[type="checkbox"][name="modality[]"]').clone().appendTo('#search_pageLimit_form').hide();
if($('#search_pageLimit_form input[name="reverce_order"]').val()=='')
$('#search_pageLimit_form input[name="reverce_order"]').val('1');
else
$('#search_pageLimit_form input[name="reverce_order"]').val('');
$('#search_pageLimit_form').submit();
}
});
$('.sort').find("span.ui-icon-triangle-1-n, span.ui-icon-triangle-1-s").closest('td').prev('td').css("color","#2a6496");
$('.sort.rm').find("span.ui-icon-triangle-1-n, span.ui-icon-triangle-1-s").closest('td').prev('td').css("color","rosybrown");
// Tooltips -----------------------------
$('#search_examination_container_results td').tooltip();
$('#search_examination_container_results td').tooltip("option", "show", {duration:0});
$('#search_examination_container_results td').tooltip("option", "hide", {duration:0});
// ---- Expand - Collapse button
$('.expand_bar').click(function(){
$.ajax({
url: "ajax/menu/search_user_form_state.php",
type: 'POST',
cache: false
}).done(function(){
$('.expand_bar .arrows').toggleClass('pressed');
$("#search_examination_container").slideToggle(300);
});
});
<?php
if(isset($_COOKIE["search_user_form_state"]) && $_COOKIE["search_user_form_state"]=="hidden"){
?>
$('.arrows').addClass('pressed');
$("#search_examination_container").hide();
<?php
}
else{
?>
$('.arrows').removeClass('pressed');
$("#search_examination_container").show();
<?php
}
?>
$('.delete_auth_icon').click(function(){
var user_auth_id = $(this).data('id');
var user_surname = $(this).data('surname');
var r = confirm('Είστε σίγουρος για την αφαίρεση της πρόσβασης στον χρήστη ' + user_surname+'? Θα διαγραφούν και οι τυχόν περιορισμοί που του είχαν επιβληθεί.');
if (r == true) {
$.ajax({
url: "ajax/constraints/delete_constraints_remove_auth.php",
data: {"user_auth_id" : user_auth_id},
type: 'POST',
cache: false
}).done(function(data){
if(data == true){
alert('Ο χρήστης ' +user_surname+ ' δεν έχει πλέον πρόσβαση στο σύστημα.');
var _path = location.pathname.split("/");
window.location = location.protocol+'//'+location.hostname+':'+location.port+'/'+_path[1]+'/main.php?cp=admin_user';
}else{
alert('Προέκυψε κάποιο σφάλμα. Παρακαλούμε προσπαθήστε ξανά.');
}
});
}
});
$('.user_form_link').click(function(){
$(this).closest('form').submit();
});
});
</script>
<?php
}
}
?>
</body>
</html>

Event Timeline