$json = "";$json .= "{\n";$json .= "page: $page,\n";$json .= "total: $total,\n";$json .= "rows: [";$rc = false;while ($row = mysql_fetch_array($result)) {if ($rc) $json .= ",";$json .= "\n{";$json .= "id:'".$row['request_id']."',";$json .= "cell:['".$row['request_id']."','".$row['request_date']."'";$json .= ",'".addslashes($row['requester'])."'";$json .= ",'".addslashes($row['foreas'])."'";$json .= ",'".addslashes($row['hall'])."'";$json .= ",'".addslashes($row['event'])."'";$json .= ",'".addslashes($row['date_from'])."'";$json .= ",'".addslashes($row['allDay'])."'";$json .= ",'".addslashes($row['repeat'])."']";$json .= "}"; $rc = true;}$json .= "]\n";$json .= "}";echo $json;
if ($row->allDay== 1) { $txt = '<img src="http://www.sitename.gr/includes/icons/nautilus/16x16/tick.png" alt="icon" border="0">;} else { $txt = '<img src="http://www.sitename.gr/includes/icons/nautilus/16x16/error.png" alt="icon" border="0">';}echo '<cell><![CDATA['.$txt."]]></cell>\n";
<?php session_start(); include('includes/header.php'); include('includes/menu.php'); ?> <link rel="stylesheet" type="text/css" href="css/flexigrid.css" /><script type="text/javascript" src="js/jquery-1.2.3.pack.js"></script><script type="text/javascript" src="js/flexigrid.js"></script><script type="text/javascript">$(document).ready(function(){ $("#flex1").flexigrid ( { url: 'request_search_data_xml.php', dataType: 'xml', colModel : [ {display: 'Κωδικός', name : 'request_id', width : 50, sortable : true, align: 'center'}, {display: 'Ημερομηνία', name : 'request_date', width : 60, sortable : false, align: 'left'}, {display: 'Αιτών', name : 'requester', width : 100, sortable : true, align: 'left'}, {display: 'Φορέας', name : 'foreas', width : 90, sortable : true, align: 'left'}, {display: 'Αίθουσα', name : 'hall', width : 115, sortable : true, align: 'left'}, {display: 'Εκδήλωση', name : 'event', width : 285, sortable : false, align: 'left'}, {display: 'Από', name : 'date_from', width : 60, sortable : true, align: 'left'}, {display: 'Ολοήμερη', name : 'allDay', width : 50, sortable : false, align: 'center'}, {display: 'Επανάληψη', name : 'repeat', width : 40, sortable : false, align: 'center'} ], buttons : [ {name: 'Προσθήκη', bclass: 'add', onpress : test}, {name: 'Διόρθωση', bclass: 'edit', onpress : test}, {name: 'Διαγραφή', bclass: 'delete', onpress : test}, {separator: true} ], searchitems : [ {display: 'Αιτών', name : 'requester', isdefault: true}, {display: 'Φορέας', name : 'foreas'}, {display: 'Αίθουσα', name : 'hall'}, {display: 'Εκδήλωση', name : 'event'} ], sortname: "request_id", sortorder: "desc", usepager: true, title: 'ΑΝΑΖΗΤΗΣΗ ΑΙΤΗΣΗΣ', useRp: true, rp: 20, height: 490, width: '100%', showTableToggleBtn: false, showToggleBtn: false, resizable: true, singleSelect: true, pagetext: 'Σελίδα', outof: 'από', pagestat: 'Εμφάνιση {from} ως {to} από {total} αντικείμενα', findtext: 'Αναζήτηση', procmsg: 'Παρακαλώ περιμένετε...', nomsg: 'Δεν βρέθηκαν αποτελέσματα!', errormsg: 'Σφάλμα σύνδεσης', submittext: 'Υποβολή', dir: 'ltr' } ); });function test(com,grid){ if (com=='Διαγραφή') { $('.trSelected', grid).each(function() { var id = $(this).attr('id'); id = id.substring(id.lastIndexOf('row')+3); alert("Δεν επιτρέπεται η διαγραφή"); }); } else if (com=='Προσθήκη') { alert("Εισαγωγή νέας αίτησης"); location.href = 'request_add.php'; } else if (com=='Διόρθωση') { var nsel = $('.trSelected', grid).length; if (nsel < 1) { alert('Δεν επιλέχθηκαν αντικείμενα!'); return false; } else { var items = $('.trSelected',grid); var id = parseInt(items[0].id.substr(3), 10); alert("Διόρθωση αίτησης με κωδικό " + id); location.href = 'request_edit.php?id='+id; } } } </script> <div> <table id="flex1" style="display:none"></table> </div><?php include('includes/footer.php');?>
<?php session_start(); error_reporting(1);function runSQL($rsql) {require ('includes/config.php'); $result = mysql_query($rsql) or die ('Αδυναμία εκτέλεσης Sql'); return $result; mysql_close($con);}$page = isset($_POST['page']) ? $_POST['page'] : 1;$rp = isset($_POST['rp']) ? $_POST['rp'] : 10;$sortname = isset($_POST['sortname']) ? $_POST['sortname'] : 'request_id';$sortorder = isset($_POST['sortorder']) ? $_POST['sortorder'] : 'desc';$query = isset($_POST['query']) ? $_POST['query'] : false;$qtype = isset($_POST['qtype']) ? $_POST['qtype'] : false;$where = "WHERE dat_request.ota_id=".$_SESSION["OTA_ID"]; if($_POST['query']!='') { $where .= " AND ".$_POST['qtype']." LIKE '%".$_POST['query']."%' "; } $sort = "ORDER BY $sortname $sortorder";if (!$page) $page = 1;if (!$rp) $rp = 10;$start = (($page-1) * $rp);$limit = "LIMIT $start, $rp";$sql = "SELECTdat_request.request_id, DATE_FORMAT(`dat_request`.`request_date`,'%d/%m/%Y') AS request_date,CONCAT_WS(' ',`ref_requester`.`l_name`,`ref_requester`.`f_name`) AS requester, ref_foreas.foreas ,ref_hall.hall, CONCAT_WS(' ',`ref_event_type`.`event_type`,`ref_event`.`title`,`ref_event`.`creator`) AS `event`,DATE_FORMAT(`ref_event`.`date_from`,'%d/%m/%Y') AS date_from, ref_event.allDay, ref_event.`repeat`,dat_request.ota_idFROM dat_requestINNER JOIN ref_requester ON ref_requester.requester_id = dat_request.requester_idINNER JOIN ref_foreas ON ref_foreas.foreas_id = dat_request.foreas_idINNER JOIN ref_hall ON ref_hall.hall_id = dat_request.hall_idINNER JOIN ref_event ON ref_event.event_id = dat_request.event_idINNER JOIN ref_event_type ON ref_event_type.event_type_id = ref_event.event_type_id $where $sort $limit"; $result = runSQL($sql);$total = mysql_num_rows($result);header("Expires: Mon, 26 Jul 1997 05:00:00 GMT" );header("Last-Modified: " . gmdate( "D, d M Y H:i:s" ) . "GMT" );header("Cache-Control: no-cache, must-revalidate" );header("Pragma: no-cache" );header("Content-type: text/xml");$xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";$xml .= "<rows>";$xml .= "<page>$page</page>";$xml .= "<total>$total</total>";while ($row = mysql_fetch_array($result)) { $xml .= "<row id='".$row['request_id']."'>"; $xml .= "<cell><![CDATA[".$row['request_id']."]]></cell>"; $xml .= "<cell><![CDATA[".$row['request_date']."]]></cell>"; $xml .= "<cell><![CDATA[".$row['requester']."]]></cell>"; $xml .= "<cell><![CDATA[".$row['foreas']."]]></cell>"; $xml .= "<cell><![CDATA[".$row['hall']."]]></cell>"; $xml .= "<cell><![CDATA[".$row['event']."]]></cell>"; $xml .= "<cell><![CDATA[".$row['date_from']."]]></cell>"; if ($row->allDay== 1) { $xml .= "<cell><![CDATA[<img src=\"images/tick.png\" alt=\"yes\" border=\"0\" />]]></cell>'"; } else { $xml .= "<cell><![CDATA[<img src=\"images/error.png\" alt=\"no\" border=\"0\" />]]></cell>'"; } if ($row->repeat== 1) { $xml .= "<cell><![CDATA[<img src=\"images/tick.png\" alt=\"yes\" border=\"0\" />]]></cell>'"; } else { $xml .= "<cell><![CDATA[<img src=\"images/error.png\" alt=\"no\" border=\"0\" />]]></cell>'"; } $xml .= "</row>";}$xml .= "</rows>";echo $xml;?>