<?php $urlrq=$_SERVER['DOCUMENT_ROOT']; require_once ($urlrq."/configuration.php"); $tbname = 'project'; $cname=$mysql->get_table_field_names_array($tbname);//edit gettable_fieldname $accID= $CurrentAccount->ID; $acc = new account(); $acc->ID=$accID; $db_name = $acc->get_database_name_id(); ?> <script type="text/javascript"> $(document).ready(function () { var theme ="custom"; var data = {}; var url = "projectdata.php"; //var editedRows = new Array(); // prepare the data sdsdssdsdsdssddsdsddsd var generaterow = function () { var row = {}; return row; } var source = { datatype: "json", cache: false, datafields: [ { name: 'ID'}, { name: 'Name'}, { name: 'DisplayName'}, { name: 'ScheduleType'}, { name: 'Description'}, { name: 'Status'}, { name: 'NextRunTime'}, { name: 'LastRunTime'}, { name: 'LastRunResult'}, { name: 'Domain'} ], id: 'ID', url: url, root: 'Rows', pagesize: 10, beforeprocessing: function (data) { source.totalrecords = data[0].TotalRows; } }; var dataAdapter = new $.jqx.dataAdapter(source); $("#jqx-colection").jqxGrid( { width: '100%', height:600, source: dataAdapter, theme: theme, ready: function () { //HIDDEN COLUMN NAME $("#jqx-colection").jqxGrid('hidecolumn', 'Name'); }, columnsresize: true, // editable: true, //autoheight: true, sortable: true, pageable: true, filterable:true, showtoolbar:true, //editmode:'dblclick', selectionmode: 'singlerow',// show check box in first collumn altrows: true, // status bar--------------------------------------- rendertoolbar: function (toolbar) { var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>"); var inputFieldCol =$("<div style='float: left; margin-left: 5px;'>Find:<input id='inputFieldCol' type='text' class='jqx-input' style='width: 200px; height: 23px;' /> In:</div>"); var findButtonCol = $("<div style='float: left; margin-left: 5px;'><input type='button' name='search' value='search' id='findButtonCol'></div>"); var dropdownlist = $("<div id='dropdownlistCol' style='float: left; margin-left: 5px;'>dropvalue</div>"); var clearButtonCol = $("<input type='button' style='margin-left: 5px; float: left;' value='Clear' id='clearButtonCol' />"); container.append(inputFieldCol); container.append(dropdownlist); container.append(findButtonCol); container.append(clearButtonCol); toolbar.append(container); $("#clearButtonCol").hide();// hide clear button // findButtonCol.click(function (event) { // alert("had click search"); // }); }, rendergridrows: function (gridrows) { return dataadapter.records; }, columns: [ { text: 'ID',datafield: 'ID',width: '40px' }, // { text: 'Name',datafield: 'Name'}, { text: 'DisplayName',datafield: 'DisplayName',width: '300px'}, // { text: 'ScheduleType',datafield: 'ScheduleType',width:100}, { text: 'Description',datafield: 'Description',width: '400px'}, // { text: 'Status',datafield: 'Status'}, // { text: 'NextRunTime',datafield: 'NextRunTime'}, //{ text: 'LastRunTime',datafield: 'LastRunTime'}, // { text: 'LastRunResult',datafield: 'LastRunResult',width:100}, // { text: 'Domain',datafield: 'Domain'} ] }); $("#dropdownlistCol").jqxDropDownList({ autoDropDownHeight: true, selectedIndex: 0, width: 100, height: 23, theme: theme, source: [ <?php $list=''; foreach ($cname as $name) $list .= "'".$name."',"; $list = rtrim($list,','); echo $list; ?> // 'First Name', 'Last Name', 'Product', 'Quantity', 'Price' ] }); //theme ------------------------------------ $("#findButtonCol").jqxButton({ width: 70, theme: theme }); $("#clearButtonCol").jqxButton({theme: theme }); //event ----------------------------------- //header when click rows $("#jqx-colection").bind('rowselect', function (event) { var row = event.args.rowindex; var datarow = $("#jqx-colection").jqxGrid('getrowdata', row); tbname = datarow['Name']; datastring = JSON.stringify(datarow); $.ajax({ type: "GET", url: "gridview.php", //data: "tbname="+tbname+'&lastresult='+datarow['LastRunResult']+'&lastruntime='+datarow['LastRunTime']+'&scheduletype='+datarow['ScheduleType']+'&status='+datarow['Status'], data: "tbname="+tbname+'&datastring='+datastring, async:false, cache: false, success: function(kq) { $("#jqxWidget").html(kq); window.location.replace("#agent"); } }); }); // search button click $("#findButtonCol").click(function () { $("#jqx-colection").jqxGrid('clearfilters'); var searchColumnIndex = $("#dropdownlistCol").jqxDropDownList('selectedIndex'); var datafield = ""; switch (searchColumnIndex) { <?php $i=0; foreach($cname as $name){ echo "case $i: datafield= \"$name\";break;"; $i++; } ?> } var searchText = $("#inputFieldCol").val(); var filtergroup = new $.jqx.filter(); var filter_or_operator = 1; var filtervalue = searchText; var filtercondition = 'contains'; var filter = filtergroup.createfilter('stringfilter', filtervalue, filtercondition); filtergroup.addfilter(filter_or_operator, filter); $("#jqx-colection").jqxGrid('addfilter', datafield, filtergroup); // apply the filters. $("#jqx-colection").jqxGrid('applyfilters'); $("#clearButtonCol").show(); }); //clear filter $("#clearButtonCol").click(function () { $("#jqx-colection").jqxGrid('clearfilters'); $("#clearButtonCol").hide(); }); $('#refreshproject').click(function(){ $("#jqx-colection").jqxGrid({ source: dataAdapter }); }) }); </script> <style> html, body { height: 100%; width: 100%; margin: 0px; padding: 0px; overflow: hidden; } #jqxWidget{ font-size: 13px !important; font-family: Verdana; float: left; width: 100%; } #inputFieldCol{ background: #ffffff; } #submitadd{ background-color: #ff4c51; } #btdel{ float: right; margin: 10px 10px; } #columntablejqxgrid { z-index: 0 !important; } </style> <div class="widget"> <div class="widget-title"> <div class="icon"><i class="fa fa-magic font21 fa-nomargin"></i></div> <h4>Agents capture data into Collections.</h4> <a href="#" class="minimize"></a> </div> <div id='jqxWidgetCol'> <div id="jqx-colection"> </div> </div> <div style="clear:both"></div> </div> <div class="widget"> <div id="list_button" class="widget-content"> <?php require_once('colection.button.php'); require_once('collection.fromscratch.php'); ?> <input type =button id="create_from_file" value="create from a file" /> <div id="from-file-Dialog"> <div class="widget"> <div class="widget-title"> <div class="icon"><i class="i-database"></i></div> <h4>New collection </h4> <i id="close_new_collection2" class="i-close close_dialog"></i> </div> <div class="widget-content"> <form name="form" action="" method="POST" enctype="multipart/form-data"> <table cellpadding="0" cellspacing="0" class="tableForm"> <thead> <tr> <th>Please select a file and click Upload button</th> </tr> </thead> <tbody> <tr><td><input id="fileToUpload" type="file" size="45" name="fileToUpload" ></td></tr> </tbody> </table> </form> <div class="form-actions"> <i class="i-notebook"></i>Note: The file you import should be in CSV (comma separated value) or TSV (tab separated value) format. You can prepare and save such a file using Excel or another grid-editing program. </div> <div class="form-actions center"> <button id="btnCollSetting" class="btn btn-primary">Upload</button> <button id="close_new_collection" type="button" class="btn">Cancel</button> </div> </div> </div> </div> <!---dialog setting --> <div id="from-file-Setting"> <div class="widget"> <div class="widget-title"> <div class="icon"><i class="i-database"></i></div> <h4>New Collection Setting </h4> <i id="close_sett_collection2" class="i-close close_dialog"></i> </div> <div class="widget-content"> <table cellpadding="0" cellspacing="0" class="tableForm"> <thead> <tr> <td>Collection Name</td><td><input type="text" id="txtcollname"></td> </tr> <tr> <td>Description</td><td><input type="text" id="txtcollDescription" style="width: 400px"></td> </tr> </thead> <tbody> <div id="jqgrid-coll-setting"></div> </tbody> </table> <div class="form-actions center"> <button id="buttonUpload" class="btn btn-primary" onclick="return ajaxFileUpload();">Create Collection</button> <button id="close_sett_collection2" type="button" class="btn">Cancel</button> </div> </div> </div> </div> <!--- end dialog setting --> <script> $('#list_button').hide(); $( "#from-file-Dialog" ).dialog({ autoOpen: false, height: 600, width: 700, modal: true }); $( "#from-file-Setting" ).dialog({ autoOpen: false, height: 600, width: 700, modal: true }); $("#btnCollSetting").click(function(){ $("#txtcollname").val(filename); $("#from-file-Setting").dialog("open"); }); $('#close_new_collection, #close_new_collection2 ').click(function(event) { $( "#from-file-Dialog" ).dialog( "close" ); }); $('#close_sett_collection2, #close_sett_collection ').click(function(event) { $( "#from-file-Setting" ).dialog( "close" ); }); $('#create_from_file').click(function(){ $( "#from-file-Dialog" ).dialog( "open" ); }); $("#fileToUpload").change(function(e){ var myFile = e.target.files[0]; var reader = new FileReader(); reader.onload = function(e){ contents = e.target.result; filename = myFile.name; fieldstr = contents.substr(0, contents.indexOf("\n")); fieldstr = fieldstr.replace(/"/g,""); field_arr = fieldstr.split(","); //alert(JSON.stringify(field_arr)); }; reader.readAsText(myFile) }); function ajaxFileUpload() { $.ajaxFileUpload ( { url:'doajaxfileupload.php?dbname=<?php echo $db_name;?>&tbname='+$("#txtcollname").val()+'&field='+JSON.stringify(field_arr)+'&description='+$('#txtcollDescription').val(), secureuri:false, fileElementId:'fileToUpload', dataType: 'json', data:{name:'logan', id:'id'}, success: function (data, status) { if(typeof(data.error) != 'undefined') { if(data.error != '') { alert(data.error); }else { alert(data.msg); } } }, error: function (data, status, e) { alert(e); } } ) return false; } </script> </div> </div> <?php //setting require_once("account.setting.php"); require_once("transaction.php"); require_once ("../configuration.end.php"); ?>