/** * JS code related to grid rendering */ function render_js($grid_id, $out) { ?> var lastSel; duplicate_row = function (table, Id) { newId = null; myData = jQuery(table).getRowData(Id) jQuery.ui.datepicker = null; jQuery(table).jqGrid('addRow', { rowID : "_empty", initdata : myData, position :"first", useDefValues : false, useFormatter : false, addRowParams : {extraparam:{}} }); jQuery(table).jqGrid('saveRow',"_empty"); jQuery(table).jqGrid().trigger('reloadGrid',[{jqgrid_page:1}]); } var grid_<?php echo $grid_id; ?> = jQuery("#<?php echo $grid_id; ?> ").jqGrid( jQuery.extend(<?php echo $out; ?> , (typeof(opts) == 'undefined') ? {} : opts ) ); jQuery("#<?php echo $grid_id; ?> ").jqGrid('navGrid','#<?php echo $grid_id . "_pager"; ?> ', { edit: <?php echo $this->actions["edit"] === false ? "false" : "true"; ?> , add: <?php echo $this->actions["add"] === false ? "false" : "true"; ?> , del: <?php echo $this->actions["delete"] === false ? "false" : "true"; ?> , view: <?php echo $this->actions["view"] === false ? "false" : "true"; ?> }, <?php echo json_encode_jsfunc($this->options["edit_options"]); ?> , <?php echo json_encode_jsfunc($this->options["add_options"]); ?> , <?php echo json_encode_jsfunc($this->options["delete_options"]); ?> , { multipleSearch:<?php echo $this->actions["search"] == "advance" ? "true" : "false"; ?> , sopt:['eq','ne','lt','le','gt','ge','bw','bn','in','ni','ew','en','cn','nc','nu','nn'] } ); <?php if ($this->actions["inlineadd"] !== false) { ?> jQuery('#<?php echo $grid_id; ?> ').jqGrid('inlineNav','#<?php echo $grid_id . "_pager"; ?> ',{"addtext":"Inline","edit":false,"save":true,"cancel":true, "addParams":{"aftersavefunc":function (id, res) { // set returned pk in new row of grid res = res.responseText.split("#"); try { $(this).jqGrid('setCell', id, res[0], res[1]); $("#"+id, "#"+this.p.id).removeClass("jqgrid-new-row").attr("id",res[1] ); } catch (asr) {} // but reload grid, to work properly jQuery('#<?php echo $grid_id; ?> ').trigger("reloadGrid",[{jqgrid_page:1}]); }},"editParams":{"aftersavefunc":function (id, res) { // set returned pk in new row of grid res = res.responseText.split("#"); try { $(this).jqGrid('setCell', id, res[0], res[1]); $("#"+id, "#"+this.p.id).removeClass("jqgrid-new-row").attr("id",res[1] ); } catch (asr) {} // but reload grid, to work properly jQuery('#<?php echo $grid_id; ?> ').trigger("reloadGrid",[{jqgrid_page:1}]); }}}); <?php } ?> <?php if ($this->actions["autofilter"] !== false) { ?> // auto filter with contains search jQuery("#<?php echo $grid_id; ?> ").jqGrid('filterToolbar',{stringResult: true,searchOnEnter : false, defaultSearch:'cn'}); // jQuery("#<?php echo $grid_id; ?> ").jqGrid('filterToolbar',{stringResult: true,searchOnEnter : false}); <?php } ?> <?php if ($this->actions["showhidecolumns"] !== false) { ?> // show/hide columns jQuery("#<?php echo $grid_id; ?> ").jqGrid('navButtonAdd',"#<?php echo $grid_id . "_pager"; ?> ",{caption:"Columns",title:"Hide/Show Columns", buttonicon :'ui-icon-note', onClickButton:function(){ jQuery("#<?php echo $grid_id; ?> ").jqGrid('setColumns'); } }); <?php } ?> <?php if ($this->actions["export"] === true) { $order_by = "&sidx=" . $this->options["sortname"] . "&sord=" . $this->options["sortorder"]; ?> // Export to what is defined in file jQuery("#<?php echo $grid_id; ?> ").jqGrid('navButtonAdd',"#<?php echo $grid_id . "_pager"; ?> ",{caption:"Export",title:"Export", buttonicon :'ui-icon-extlink', onClickButton:function(){ if ("<?php echo $this->options["url"]; ?> ".indexOf("?") != -1) location.href = "<?php echo $this->options["url"]; ?> " + "&export=1&jqgrid_page=1<?php echo $order_by; ?> "; else location.href = "<?php echo $this->options["url"]; ?> " + "?export=1&jqgrid_page=1<?php echo $order_by; ?> "; } }); <?php } ?> <?php if (isset($this->actions["export_excel"]) && $this->actions["export_excel"] === true) { ?> // Export to excel jQuery("#<?php echo $grid_id; ?> ").jqGrid('navButtonAdd',"#<?php echo $grid_id . "_pager"; ?> ",{caption:"Excel",title:"Excel", buttonicon :'ui-icon-extlink', onClickButton:function(){ if ("<?php echo $this->options["url"]; ?> ".indexOf("?") != -1) location.href = "<?php echo $this->options["url"]; ?> " + "&export=1&jqgrid_page=1&export_type=excel<?php echo $order_by; ?> "; else location.href = "<?php echo $this->options["url"]; ?> " + "?export=1&jqgrid_page=1&export_type=excel<?php echo $order_by; ?> "; } }); <?php } ?> <?php if (isset($this->actions["export_pdf"]) && $this->actions["export_pdf"] === true) { ?> // Export to pdf jQuery("#<?php echo $grid_id; ?> ").jqGrid('navButtonAdd',"#<?php echo $grid_id . "_pager"; ?> ",{caption:"PDF",title:"PDF", buttonicon :'ui-icon-extlink', onClickButton:function(){ if ("<?php echo $this->options["url"]; ?> ".indexOf("?") != -1) location.href = "<?php echo $this->options["url"]; ?> " + "&export=1&jqgrid_page=1&export_type=pdf<?php echo $order_by; ?> "; else location.href = "<?php echo $this->options["url"]; ?> " + "?export=1&jqgrid_page=1&export_type=pdf<?php echo $order_by; ?> "; } }); <?php } ?> <?php if (isset($this->actions["export_csv"]) && $this->actions["export_csv"] === true) { ?> // Export to csv jQuery("#<?php echo $grid_id; ?> ").jqGrid('navButtonAdd',"#<?php echo $grid_id . "_pager"; ?> ",{caption:"CSV",title:"CSV", buttonicon :'ui-icon-extlink', onClickButton:function(){ if ("<?php echo $this->options["url"]; ?> ".indexOf("?") != -1) location.href = "<?php echo $this->options["url"]; ?> " + "&export=1&jqgrid_page=1&export_type=csv<?php echo $order_by; ?> "; else location.href = "<?php echo $this->options["url"]; ?> " + "?export=1&jqgrid_page=1&export_type=csv<?php echo $order_by; ?> "; } }); <?php } ?> function link_date_picker(el,fmt,toolbar) { toolbar = toolbar || 0; setTimeout(function(){ if(jQuery.ui) { if(jQuery.ui.datepicker) { if (toolbar == 0) jQuery(el).after('<button>Calendar</button>').next().button({icons:{primary: 'ui-icon-calendar'}, text:false}).css({'font-size':'69%'}).click(function(e){jQuery(el).datepicker('show');return false;}); jQuery(el).datepicker({ "disabled":false, "dateFormat":fmt, "onSelect": function (dateText, inst) { if (toolbar) { setTimeout(function () { jQuery("#<?php echo $grid_id; ?> ")[0].triggerToolbar(); }, 50); } } }); jQuery('.ui-datepicker').css({'font-size':'69%'}); } } },300); } function link_datetime_picker(el,fmt) { setTimeout(function(){ if(jQuery.ui) { if(jQuery.ui.datepicker) { jQuery(el).after('<button>Calendar</button>').next().button({icons:{primary: 'ui-icon-calendar'}, text:false}).css({'font-size':'69%'}).click(function(e){jQuery(el).datetimepicker('show');return false;}); jQuery(el).datetimepicker({"disabled":false,"dateFormat":fmt}); jQuery('.ui-datepicker').css({'font-size':'69%'}); } } },100); } function link_editor(el) { setTimeout(function(){ var editor = CKEDITOR.replace( el, { on: { change: function(){ jQuery(el).val(editor.getData()); } }, height: '100px' }); },100); } function link_autocomplete(el,update_field) { setTimeout(function() { if(jQuery.ui) { if(jQuery.ui.autocomplete) { jQuery(el).autocomplete({ "appendTo":"body","disabled":false,"delay":300, "minLength":1, "source":function (request, response) { request.element = el.name; request.oper = 'autocomplete'; $.ajax({ url: "<?php echo $this->options["url"]; ?> ", dataType: "json", data: request, type: "POST", error: function(res, status) { alert(res.status+" : "+res.statusText+". Status: "+status); }, success: function( data ) { response( data ); } }); }, "select":function (event, ui) { // change function to set target value var ival; if(ui.item) { ival = ui.item.id || ui.item.value; } if(ival) { jQuery("input[name='"+update_field+"']").val(ival); } else { jQuery("input[name='"+update_field+"']").val(""); if("1" == "true"){ this.value = ""; } } } }); jQuery(el).autocomplete('widget').css('font-size','11px'); } // if jQuery.ui.autocomplete } // if jQuery.ui },200); // setTimeout } // link_autocomplete <?php if ($this->require_upload_ajax) { ?> function ajaxFileUpload(field,upload_url) { //starting setting some animation when the ajax starts and completes jQuery("#loading") .ajaxStart(function(){ jQuery(this).show(); }) .ajaxComplete(function(){ jQuery(this).hide(); }); /* prepareing ajax file upload url: the url of script file handling the uploaded files fileElementId: the file type of input element id and it will be the index of $_FILES Array() dataType: it support json, xml secureuri:use secure protocol success: call back function when the ajax complete error: callback function when the ajax failed */ jQuery.ajaxFileUpload ( { url:upload_url, secureuri:false, fileElementId:field, dataType: 'json', 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; } <?php } ?> jQuery("#<?php echo $grid_id; ?> ").jqGrid('gridResize',{}); jQuery("#<?php echo $grid_id; ?> ").jqGrid('setFrozenColumns'); <?php }
/** * JS code related to grid rendering */ function render_js($grid_id, $out) { ?> var lastSel; fx_clone_row = function (grid,id) { myData = {}; myData.id = id; myData.grid_id = grid; myData.oper = 'clone'; jQuery.ajax({ url: "<?php echo $this->options["url"]; ?> ", dataType: "html", data: myData, type: "POST", error: function(res, status) { alert(res.status+" : "+res.statusText+". Status: "+status); }, success: function( data ) { } }); jQuery("#"+grid).jqGrid().trigger('reloadGrid',[{jqgrid_page:1}]); }; var extra_opts = {}; <?php ### P ### ?> if (typeof(opts) != 'undefined') extra_opts = opts; if (typeof(opts_<?php echo $grid_id; ?> ) != 'undefined') extra_opts = opts_<?php echo $grid_id; ?> ; var grid_<?php echo $grid_id; ?> = jQuery("#<?php echo $grid_id; ?> ").jqGrid( jQuery.extend(<?php echo $out; ?> , extra_opts ) ); jQuery("#<?php echo $grid_id; ?> ").jqGrid('navGrid','#<?php echo $grid_id . "_pager"; ?> ', <?php echo json_encode_jsfunc($this->navgrid["param"]); ?> , <?php echo json_encode_jsfunc($this->options["edit_options"]); ?> , <?php echo json_encode_jsfunc($this->options["add_options"]); ?> , <?php echo json_encode_jsfunc($this->options["delete_options"]); ?> , <?php echo json_encode_jsfunc($this->options["search_options"]); ?> , <?php echo json_encode_jsfunc($this->options["view_options"]); ?> ); // Set grouping header using callGridMethod <?php if (!empty($this->group_header)) { ?> jQuery("#<?php echo $grid_id; ?> ").jqGrid("setGroupHeaders", <?php echo json_encode_jsfunc($this->group_header); ?> ); <?php } ?> <?php ### P ### ?> <?php if ($this->actions["inlineadd"] !== false || $this->actions["inline"] === true) { ?> jQuery('#<?php echo $grid_id; ?> ').jqGrid('inlineNav','#<?php echo $grid_id . "_pager"; ?> ',{"add":true,"edit":true,"save":true,"cancel":true, "addParams":{ "addRowParams": { "oneditfunc": function(id) { jQuery("#edit_row_<?php echo $grid_id; ?> _"+id+" a:first").click(); // jQuery("div.frozen-div, div.frozen-bdiv").hide(); }, "afterrestorefunc": function(id) { jQuery("#save_row_<?php echo $grid_id; ?> _"+id+" a:last").parent().hide().prev().show(); // jQuery(".frozen-div, .frozen-bdiv").show(); }, "aftersavefunc":function (id, res) { // but reload grid, to work properly jQuery('#<?php echo $grid_id; ?> ').trigger("reloadGrid",[{jqgrid_page:1}]); }, "errorfunc": function(id,res) { jQuery.jgrid.info_dialog(jQuery.jgrid.errors.errcap,'<div class=\"ui-state-error\">'+ res.responseText +'</div>', jQuery.jgrid.edit.bClose,{buttonalign:'right'}); jQuery('#<?php echo $grid_id; ?> ').trigger("reloadGrid",[{jqgrid_page:1}]); } } } ,"editParams":{ "aftersavefunc":function (id, res) { // jQuery(".frozen-div, .frozen-bdiv").show(); // but reload grid, to work properly jQuery('#<?php echo $grid_id; ?> ').trigger("reloadGrid",[{jqgrid_page:1}]); }, "errorfunc": function(id,res) { jQuery.jgrid.info_dialog(jQuery.jgrid.errors.errcap,'<div class=\"ui-state-error\">'+ res.responseText +'</div>', jQuery.jgrid.edit.bClose,{buttonalign:'right'}); jQuery('#<?php echo $grid_id; ?> ').trigger("reloadGrid",[{jqgrid_page:1}]); }, "oneditfunc": function(id) { jQuery('#<?php echo $grid_id; ?> ').jqGrid('setSelection',id); jQuery("#edit_row_<?php echo $grid_id; ?> _"+id+" a:first").click(); // jQuery("div.frozen-div, div.frozen-bdiv").hide(); }, "afterrestorefunc": function(id) { jQuery("#save_row_<?php echo $grid_id; ?> _"+id+" a:last").parent().hide().prev().show(); // jQuery(".frozen-div, .frozen-bdiv").show(); } }}); <?php } ?> <?php if ($this->actions["autofilter"] !== false) { ?> // auto filter with contains search jQuery("#<?php echo $grid_id; ?> ").jqGrid('filterToolbar',{stringResult: true,searchOnEnter : false, defaultSearch:'cn'}); // jQuery("#<?php echo $grid_id; ?> ").jqGrid('filterToolbar',{stringResult: true,searchOnEnter : false, searchOperators : true}); <?php } ?> <?php if ($this->actions["showhidecolumns"] !== false) { ?> // show/hide columns jQuery("#<?php echo $grid_id; ?> ").jqGrid('navButtonAdd',"#<?php echo $grid_id . "_pager"; ?> ",{caption:"Columns",title:"Hide/Show Columns", buttonicon :'ui-icon-note', onClickButton:function(){ jQuery("#<?php echo $grid_id; ?> ").jqGrid('columnChooser',{width : 250, height:150, modal:true, done:function(){ c = jQuery('#colchooser_<?php echo $grid_id; ?> select').val(); var colModel = jQuery("#<?php echo $grid_id; ?> ").jqGrid("getGridParam", "colModel"); str = ''; jQuery(c).each(function(i){ str += colModel[c[i]]['name'] + ","; }); document.cookie = 'jqgrid_colchooser=' + str; }, "dialog_opts" : {"minWidth": 270} }); jQuery("#colchooser_<?php echo $grid_id; ?> ").parent().position({ my: "center", at: "center", of: $("#gbox_<?php echo $grid_id; ?> ") }); } }); <?php } ?> <?php ### P ### ?> <?php if ($this->actions["bulkedit"] === true) { ?> jQuery("#<?php echo $grid_id; ?> ").jqGrid('navButtonAdd',"#<?php echo $grid_id . "_pager"; ?> ",{ 'caption' : 'Bulk Edit', 'buttonicon' : 'ui-icon-pencil', 'onClickButton': function() { var ids = jQuery('#<?php echo $grid_id; ?> ').jqGrid('getGridParam','selarrrow'); // don't process if nothing is selected if (ids.length == 0) { jQuery.jgrid.info_dialog(jQuery.jgrid.errors.errcap,'<div class=\"ui-state-error\">'+jQuery.jgrid.nav.alerttext+'</div>', jQuery.jgrid.edit.bClose,{buttonalign:'right'}); return; } jQuery('#<?php echo $grid_id; ?> ').jqGrid('editGridRow', ids, <?php echo json_encode_jsfunc($this->options["edit_options"]); ?> ); jQuery('#edithd<?php echo $grid_id; ?> .ui-jqdialog-title').html("Bulk Edit"); jQuery('#editmod<?php echo $grid_id; ?> .binfo').show(); jQuery('#editmod<?php echo $grid_id; ?> .bottominfo').html("NOTE: Blank fields will be skipped"); jQuery('#editmod<?php echo $grid_id; ?> select').prepend("<option value=''></option>").val(''); return true; }, 'position': 'last' }); <?php } ?> <?php ### P ### ?> <?php if (isset($this->actions["clone"]) && $this->actions["clone"] === true) { ?> // Clone button jQuery("#<?php echo $grid_id; ?> ").jqGrid('navButtonAdd',"#<?php echo $grid_id . "_pager"; ?> ",{caption:"",title:"Clone", buttonicon :'ui-icon-copy', onClickButton:function(){ var selr = jQuery("#<?php echo $grid_id; ?> ").jqGrid('getGridParam','selrow'); if (!selr) { var alertIDs = {themodal:'alertmod',modalhead:'alerthd',modalcontent:'alertcnt'}; if (jQuery("#"+alertIDs.themodal).html() === null) { jQuery.jgrid.createModal(alertIDs,"<div>"+jQuery.jgrid.nav.alerttext+ "</div><span tabindex='0'><span tabindex='-1' id='jqg_alrt'></span></span>", {gbox:"#gbox_"+jQuery.jgrid.jqID(this.p.id),jqModal:true,drag:true,resize:true, caption:jQuery.jgrid.nav.alertcap, top:100,left:100,width:200,height: 'auto',closeOnEscape:true, zIndex: null},"","",true); } jQuery.jgrid.viewModal("#"+alertIDs.themodal, {gbox:"#gbox_"+jQuery.jgrid.jqID(this.p.id),jqm:true}); jQuery("#jqg_alrt").focus(); return; } fx_clone_row("<?php echo $grid_id; ?> ",selr); } }); <?php } ?> <?php if ($this->actions["export"] === true || $this->actions["export_excel"] === true || $this->actions["export_pdf"] === true || $this->actions["export_csv"] === true) { $order_by = "&sidx=" . $this->options["sortname"] . "&sord=" . $this->options["sortorder"] . "&rows=" . $this->options["rowNum"]; ?> function jqgrid_process_export(type) { type = type || ""; var detail_grid_params = jQuery("#<?php echo $grid_id; ?> ").data('jqgrid_detail_grid_params'); detail_grid_params = detail_grid_params || ""; if ("<?php echo $this->options["url"]; ?> ".indexOf("?") != -1) window.open("<?php echo $this->options["url"]; ?> " + "&export=1&jqgrid_page=1&export_type="+type+"<?php echo $order_by; ?> "+detail_grid_params); else window.open("<?php echo $this->options["url"]; ?> " + "?export=1&jqgrid_page=1&export_type="+type+"<?php echo $order_by; ?> "+detail_grid_params); } <?php } ?> <?php ### P ### ?> <?php if ($this->actions["export"] === true) { ?> // Export to what is defined in file jQuery("#<?php echo $grid_id; ?> ").jqGrid('navButtonAdd',"#<?php echo $grid_id . "_pager"; ?> ",{caption:"Export",title:"Export", buttonicon :'ui-icon-extlink', onClickButton:function(){ jqgrid_process_export(); } }); <?php } ?> <?php ### P ### ?> <?php if (isset($this->actions["export_excel"]) && $this->actions["export_excel"] === true) { ?> // Export to excel jQuery("#<?php echo $grid_id; ?> ").jqGrid('navButtonAdd',"#<?php echo $grid_id . "_pager"; ?> ",{caption:"Excel",title:"Excel", buttonicon :'ui-icon-extlink', onClickButton:function(){ jqgrid_process_export('excel'); } }); <?php } ?> <?php ### P ### ?> <?php if (isset($this->actions["export_pdf"]) && $this->actions["export_pdf"] === true) { ?> // Export to pdf jQuery("#<?php echo $grid_id; ?> ").jqGrid('navButtonAdd',"#<?php echo $grid_id . "_pager"; ?> ",{caption:"PDF",title:"PDF", buttonicon :'ui-icon-extlink', onClickButton:function(){ jqgrid_process_export('pdf'); } }); <?php } ?> <?php ### P ### ?> <?php if (isset($this->actions["export_csv"]) && $this->actions["export_csv"] === true) { ?> // Export to csv jQuery("#<?php echo $grid_id; ?> ").jqGrid('navButtonAdd',"#<?php echo $grid_id . "_pager"; ?> ",{caption:"CSV",title:"CSV", buttonicon :'ui-icon-extlink', onClickButton:function(){ jqgrid_process_export('csv'); } }); <?php } ?> function link_multiselect(elem) { var $elem = $(elem), id = elem.id, inToolbar = typeof id === "string" && id.substr(0, 3) === "gs_", options = { selectedList: 4, height: "auto", checkAllText: "All", uncheckAllText: "None", noneSelectedText: "Any", open: function () { var $menu = $(".ui-multiselect-menu:visible"); $menu.width("auto"); return; } }, $options = $elem.find("option"); if ($options.length > 0 && $options[0].selected) { $options[0].selected = false; // unselect the first selected option } if (inToolbar) { options.minWidth = 'auto'; } $elem.multiselect(options).multiselectfilter({placeholder:''}); $elem.siblings('button.ui-multiselect').css({ width: inToolbar ? "98%" : "100%", height: "20px", fontWeight: "normal", backgroundColor: "white", color: "black", backgroundImage: "inherit", borderStyle: "inset" }); }; function link_date_picker(el,fmt,toolbar,opts) { toolbar = toolbar || 0; setTimeout(function(){ if(jQuery.ui) { if(jQuery.ui.datepicker) { opts = (typeof(opts) == 'undefined') ? {} : opts; if (toolbar == 0) { if (!jQuery.browser.msie && !jQuery("link[href$='ui.bootstrap.jqgrid.css']").length) jQuery(el).css('width',parseInt(jQuery(el).css('width'))-30); else jQuery(el).css('width','75%'); jQuery(el).after(' <button>Calendar</button>').next().button({icons:{primary: 'ui-icon-calendar'}, text:false}).css({'font-size':'69%', 'margin-left':'2px'}).click(function(e){jQuery(el).datepicker('show');return false;}); } jQuery(el).datepicker( jQuery.extend( { "disabled":false, "dateFormat":fmt, "changeMonth": false, "changeYear": false, "firstDay": 1, "onSelect": function (dateText, inst) { if (toolbar) { setTimeout(function () { jQuery("#<?php echo $grid_id; ?> ")[0].triggerToolbar(); }, 50); } jQuery(el).trigger('change'); } },opts) ); // if not bootstrap if (!jQuery("link[href$='ui.bootstrap.jqgrid.css']").length) jQuery('.ui-datepicker').css({'font-size':'69%'}); } } },300); } function link_datetime_picker(el,fmt,toolbar,opts) { setTimeout(function(){ if(jQuery.ui) { if(jQuery.ui.datepicker) { opts = (typeof(opts) == 'undefined') ? {} : opts; if (toolbar == 0) { if (!jQuery.browser.msie && !jQuery("link[href$='ui.bootstrap.jqgrid.css']").length) jQuery(el).css('width',parseInt(jQuery(el).css('width'))-30); else jQuery(el).css('width','75%'); jQuery(el).after(' <button>Calendar</button>').next().button({icons:{primary: 'ui-icon-calendar'}, text:false}).css({'font-size':'69%', 'margin-left':'2px'}).click(function(e){jQuery(el).datetimepicker('show');return false;}); } jQuery(el).datetimepicker( jQuery.extend( { "disabled":false, "dateFormat":fmt, "changeMonth": false, "changeYear": false, "onSelect": function (dateText, inst) { if (toolbar) { setTimeout(function () { jQuery("#<?php echo $grid_id; ?> ")[0].triggerToolbar(); }, 50); } jQuery(el).trigger('change'); } }, opts) ); // if not bootstrap if (!jQuery("link[href$='ui.bootstrap.jqgrid.css']").length) jQuery('.ui-datepicker').css({'font-size':'69%'}); } } },100); } <?php ### P ### ?> function link_editor(el) { setTimeout(function(){ var editor = CKEDITOR.replace( el, { on: { change: function(){ jQuery(el).val(editor.getData()); } }, height: '100px', enterMode : CKEDITOR.ENTER_BR }); },100); } <?php ### P ### ?> <?php if ($this->require_upload_ajax) { ?> fx_replace_upload = function(el,field) { // replace hidden input text with file upload jQuery(el).parent().append("<input id='"+field+"_file' size='10' name='" + field + "_file" + "' type='file' onchange='fx_ajax_file_upload(\""+field+"\",\"<?php echo $this->options["url"]; ?> \");' />"); // remove msg jQuery(el).parent().children("span").remove(); // remove delete button jQuery(el).parent().children("input[type=button]").remove(); } <?php } ?> function link_upload(el,field) { setTimeout(function(){ if(jQuery(el).val() != '') { // edit jQuery(el).parent().append("<span id='"+field+"_name'>"+jQuery(el).val().substring(jQuery(el).val().lastIndexOf('/')+1)+"</span> "); jQuery(el).parent().append("<input type='button' value='Delete' onclick='jQuery(\"#"+field+"\").val(\"\"); fx_replace_upload(\"#"+field+"\",\""+field+"\");' />"); jQuery(el).hide(); } else { // add jQuery(el).parent().append("<input id='"+field+"_file' size='10' name='" + field + "_file" + "' type='file' onchange='fx_ajax_file_upload(\""+field+"\",\"<?php echo $this->options["url"]; ?> \");' />"); jQuery(el).hide(); } },100); } <?php ### P ### ?> function link_autocomplete(el,update_field) { setTimeout(function() { if(jQuery.ui) { if(jQuery.ui.autocomplete) { jQuery(el).autocomplete({ "appendTo":"body","disabled":false,"delay":300, "minLength":1, "source":function (request, response) { request.element = el.name; request.oper = 'autocomplete'; jQuery.ajax({ url: "<?php echo $this->options["url"]; ?> ", dataType: "json", data: request, type: "POST", error: function(res, status) { alert(res.status+" : "+res.statusText+". Status: "+status); }, success: function( data ) { response( data ); } }); }, "select":function (event, ui) { // change function to set target value var ival; if(ui.item) { ival = ui.item.id || ui.item.value; } if(ival) { jQuery("input[name='"+update_field+"'].editable, input[id='"+update_field+"']").val(ival); } else { jQuery("input[name='"+update_field+"']").val(""); } } }); jQuery(el).autocomplete('widget').css('font-size','11px'); } // if jQuery.ui.autocomplete } // if jQuery.ui },200); // setTimeout } // link_autocomplete <?php ### P ### ?> fx_get_dropdown = function (o,field,for_search_bar) { var request = {}; request['value'] = o.value; if (o.event == 'onload') request['event'] = 'onload'; // for dialog, else inline if (jQuery(o).closest('.FormGrid').length) grid_id = jQuery(o).closest('.FormGrid').attr('id').replace('FrmGrid_',''); else grid_id = jQuery(o).closest('.ui-jqgrid-btable').attr('id'); grid = jQuery('#'+grid_id); // get editable and non-editable data, both var row = grid.getRowData(grid.getGridParam('selrow')); for (var a in row) request[a] = row[a]; // override html data (from above) with content of editable fields jQuery(".editable").each(function(){ request[jQuery(this).attr('name')] = jQuery(this).val(); }); // for dialogs, load param from visible form selection jQuery(".FormGrid:visible .FormElement").each(function(){ request[jQuery(this).attr('id')] = jQuery(this).val(); }); if (for_search_bar) jQuery(".ui-search-input input, .ui-search-input select").each(function(){ request[jQuery(this).attr('name')] = jQuery(this).val(); }); // dont send 'act' column data request['act'] = null; // to detect internal ajax call request['nd'] = '12345'; request['src'] = jQuery(o).attr('name'); // if callback is set for dropdown if (field instanceof Function) request['return'] = "json"; else { request['return'] = "option"; jQuery('select[name='+field+'].editable').html("<option value=''>Loading...</option>"); } jQuery.ajax({ url: grid.getGridParam('url'), dataType: 'html', data: request, type: 'POST', error: function(res, status) { alert(res.status+' : '+res.statusText+'. Status: '+status); }, success: function( data ) { if (for_search_bar == 1) { data = "<option value=''></option>" + data; jQuery('select[name='+field+']').html(data); } else { // if callback is defined for dropdown, call it if (field instanceof Function) { field(data); } else { jQuery('select[name='+field+'].editable').html(data); jQuery('select[name='+field+'].FormElement').html(data); val = request['value'] || request[request['src']]; // reselect last option if exist, in new dropdown data jQuery('select[name='+field+'].editable, select[name='+field+'].FormElement')[0].selectedIndex = -1; jQuery('select[name='+field+'].editable, select[name='+field+'].FormElement').val(val); } } } }); }; <?php ### P ### ?> fx_success_msg = function (msg,fade) { var t = Math.max(0, ((jQuery(window).height() - jQuery('#info_dialog').outerHeight()) / 2) + jQuery(window).scrollTop()); var l = Math.max(0, ((jQuery(window).width() - jQuery('#info_dialog').outerWidth()) / 2) + jQuery(window).scrollLeft()); jQuery.jgrid.info_dialog("Info","<div class='ui-state-highlight' style='padding:5px;'>"+msg+"</div>", jQuery.jgrid.edit.bClose,{buttonalign:"right", left:l, top:t }); jQuery("#info_dialog").abscenter(); if (fade == 1) { jQuery("#info_dialog").delay(1000).fadeOut(); setTimeout('jQuery.jgrid.hideModal("#info_dialog");',1200); } }; <?php ### P ### ?> fx_bulk_update = function (op,data,selection) { if (typeof(selection) == 'undefined') { // for non multi select var selr_one = jQuery('#<?php echo $grid_id; ?> ').jqGrid('getGridParam','selrow'); // array of id's of the selected rows when multiselect options is true. Empty array if not selection // for multi select var selr = []; selr = jQuery('#<?php echo $grid_id; ?> ').jqGrid('getGridParam','selarrrow'); // array of id's of the selected rows when multiselect options is true. Empty array if not selection if (selr.length < 2 && selr_one) selr[0] = selr_one; // don't process if nothing is selected if (selr.length == 0) { jQuery.jgrid.info_dialog(jQuery.jgrid.errors.errcap,'<div class=\"ui-state-error\">Please select rows to edit</div>', jQuery.jgrid.edit.bClose,{buttonalign:'right'}); return; } var str = selr[0]; for (var x=1;x < selr.length;x++) { str += ',' + selr[x]; } } else str = selection; // call ajax to update date in db var request = {}; request['oper'] = 'edit'; request['id'] = str; request['bulk'] = op; if (data) request['data'] = data; jQuery.ajax({ url: "<?php echo $this->options["url"]; ?> ", dataType: 'html', data: request, type: 'POST', error: function(res, status) { jQuery.jgrid.info_dialog(jQuery.jgrid.errors.errcap,'<div class=\"ui-state-error\">'+ res.responseText +'</div>', jQuery.jgrid.edit.bClose,{buttonalign:'right'}); }, success: function( data ) { if (data != "") { data = JSON.parse(data); if (typeof(data.msg) != "undefined") fx_success_msg(data.msg,data.fade); } else fx_success_msg("<?php echo $this->options["edit_options"]["success_msg_bulk"]; ?> ",1); // reload grid for data changes jQuery('#<?php echo $grid_id; ?> ').jqGrid().trigger('reloadGrid',[{jqgrid_page:1}]); } }); }; <?php ### P ### ?> <?php if ($this->require_upload_ajax) { ?> fx_ajax_file_upload = function (field,upload_url) { //starting setting some animation when the ajax starts and completes jQuery("input#"+field).parent().not(":has(span)").append('<span id="'+field+'_upload"></span>'); jQuery("span#"+field+"_upload").html(" Uploading..."); /* prepareing ajax file upload url: the url of script file handling the uploaded files fileElementId: the file type of input element id and it will be the index of $_FILES Array() dataType: it support json, xml secureuri:use secure protocol success: call back function when the ajax complete error: callback function when the ajax failed */ jQuery.extend({ handleError: function( s, xhr, status, e ) { if(xhr.responseText) console.log(xhr.responseText); } }); jQuery.ajaxFileUpload ( { url:upload_url, secureuri:false, fileElementId:field+"_file", dataType: 'json', data: {"field":field+"_file"}, success: function (data, status) { if(typeof(data.error) != 'undefined') { if(data.error != '') { //alert(data.error); jQuery("tr#FormError td.ui-state-error").html(data.error); jQuery("tr#FormError").show(); jQuery("#"+field+"_upload").html(""); // reset file upload jQuery("input#"+field+"_file").replaceWith(jQuery("input#"+field+"_file")[0].outerHTML); } else { //alert(data.msg); jQuery("#"+field+"_upload").html(data.msg.substring(data.msg.lastIndexOf('/')+1) + " (Uploaded)"); // hide error if displayed jQuery("tr#FormError td.ui-state-error").html(""); jQuery("tr#FormError").hide(); var o = jQuery("input#"+field); jQuery(o).val(data.msg); jQuery(o).parent().append(" <input type='button' value='Delete' onclick='fx_replace_upload(\"#"+field+"\",\""+field+"\");' />"); jQuery("#"+field+"_file").remove(); } } }, error: function (data, status, e) { alert(e); } } ) return false; }; <?php } ?> <?php ### P ### ?> <?php if (isset($this->options["toolbar"]) && $this->options["toolbar"] != "bottom") { ?> // Toolbar position button jQuery(document).ready(function(){ <?php if ($this->options["toolbar"] == "top") { ?> jQuery('#<?php echo $grid_id; ?> _pager').insertBefore('#<?php echo $grid_id; ?> _toppager'); <?php } else { if ($this->options["toolbar"] == "both") { ?> jQuery('#<?php echo $grid_id; ?> _pager').clone(true).insertBefore('#<?php echo $grid_id; ?> _toppager').attr('id','_toppager'); <?php } } ?> jQuery('#<?php echo $grid_id; ?> _pager').removeClass("ui-jqgrid-pager"); jQuery('#<?php echo $grid_id; ?> _pager').addClass("ui-jqgrid-toppager"); jQuery('#<?php echo $grid_id; ?> _toppager').remove(); jQuery('#_toppager').attr('id','<?php echo $grid_id; ?> _toppager'); // for bootstrap if (jQuery("link[href$='ui.bootstrap.jqgrid.css']").length) { jQuery('div.frozen-div').css('top','+=6px'); jQuery('div.frozen-bdiv').css('top','+=6px'); } }); <?php } ?> <?php if ($this->options["autoresize"] === true) { ?> jQuery(window).bind("resize", function () { var oldWidth = jQuery("#<?php echo $grid_id; ?> ").jqGrid("getGridParam", "width"), newWidth = jQuery(window).width() - 30; if (oldWidth !== newWidth) { jQuery("#<?php echo $grid_id; ?> ").jqGrid("setGridWidth", newWidth); } // adjust height on resize // jQuery('#<?php echo $grid_id; ?> ').jqGrid('setGridHeight',jQuery(window).innerHeight()-120); }).trigger("resize"); <?php } ?> <?php if ($this->options["resizable"] === true) { ?> jQuery("#<?php echo $grid_id; ?> ").jqGrid('gridResize',{}); <?php } ?> <?php ### P ### ?> jQuery("#<?php echo $grid_id; ?> ").jqGrid('setFrozenColumns'); jQuery("#<?php echo $grid_id; ?> ").triggerHandler("jqGridAfterGridComplete"); // center position div (abs) jQuery.fn.abscenter = function () { this.css("position","absolute"); this.css("top", Math.max(0, ((jQuery(window).height() - jQuery(this).outerHeight()) / 2) + jQuery(window).scrollTop()) + "px"); this.css("left", Math.max(0, ((jQuery(window).width() - jQuery(this).outerWidth()) / 2) + jQuery(window).scrollLeft()) + "px"); return this; }; // center position div (abs) jQuery.fn.fixedcenter = function () { this.css("position","fixed"); this.css("top", Math.max(0, ((jQuery(window).height() - jQuery(this).outerHeight()) / 2)) + "px"); this.css("left", Math.max(0, ((jQuery(window).width() - jQuery(this).outerWidth()) / 2)) + "px"); return this; }; // simulate ENTER on dialogs, and tabbing to submit,cancel jQuery.extend(jQuery.jgrid.edit, { onInitializeForm: function ($form) { jQuery("#sData, #cData").attr("tabIndex",0); jQuery("td.DataTD>.FormElement, #sData").keypress(function (e) { if (e.which === jQuery.ui.keyCode.ENTER && e.target.tagName != "TEXTAREA") { jQuery("#sData", $form.next()).trigger("click"); return false; } }); jQuery("#cData").keypress(function (e) { if (e.which === $.ui.keyCode.ENTER) { jQuery("#cData", $form.next()).trigger("click"); return false; } }); } }); <?php ### P ### ?> <?php echo $this->internal["js_dependent_dropdown"]; ?> <?php }
function F300015ed2190df99db5f1bad555700($grid_id, $Vc68271a63ddbc431c307beb7d29182) { ?> var lastSel; fx_clone_row = function (grid,id) { myData = {}; myData.id = id; myData.grid_id = grid; myData.oper = 'clone'; jQuery.ajax({ url: "<?php echo $this->options["url"]; ?> ", dataType: "json", data: myData, type: "POST", error: function(res, status) { alert(res.status+" : "+res.statusText+". Status: "+status); }, success: function( data ) { } }); jQuery("#"+grid).jqGrid().trigger('reloadGrid',[{jqgrid_page:1}]); }; var extra_opts = {}; <?php ?> if (typeof(opts) != 'undefined') extra_opts = opts; if (typeof(opts_<?php echo $grid_id; ?> ) != 'undefined') extra_opts = opts_<?php echo $grid_id; ?> ; var grid_<?php echo $grid_id; ?> = jQuery("#<?php echo $grid_id; ?> ").jqGrid( jQuery.extend(<?php echo $Vc68271a63ddbc431c307beb7d29182; ?> , extra_opts ) ); jQuery("#<?php echo $grid_id; ?> ").jqGrid('navGrid','#<?php echo $grid_id . "_pager"; ?> ', <?php echo json_encode_jsfunc($this->V86c223b5ea2c7e35154ae4410cd891["param"]); ?> , <?php echo json_encode_jsfunc($this->options["edit_options"]); ?> , <?php echo json_encode_jsfunc($this->options["add_options"]); ?> , <?php echo json_encode_jsfunc($this->options["delete_options"]); ?> , <?php echo json_encode_jsfunc($this->options["search_options"]); ?> , <?php echo json_encode_jsfunc($this->options["view_options"]); ?> ); <?php ?> <?php if ($this->actions["inlineadd"] !== false || $this->actions["inline"] === true) { ?> jQuery('#<?php echo $grid_id; ?> ').jqGrid('inlineNav','#<?php echo $grid_id . "_pager"; ?> ',{"add":true,"edit":true,"save":true,"cancel":true, "addParams":{ "addRowParams": { "oneditfunc": function(id) { jQuery("#edit_row_<?php echo $grid_id; ?> _"+id+" a:first").click(); }, "afterrestorefunc": function(id) { jQuery("#save_row_<?php echo $grid_id; ?> _"+id+" a:last").parent().hide().prev().show(); }, "aftersavefunc":function (id, res) { jQuery('#<?php echo $grid_id; ?> ').trigger("reloadGrid",[{jqgrid_page:1}]); }, "errorfunc": function(id,res) { jQuery.jgrid.info_dialog(jQuery.jgrid.errors.errcap,'<div class=\"ui-state-error\">'+ res.responseText +'</div>', jQuery.jgrid.edit.bClose,{buttonalign:'right'}); jQuery('#<?php echo $grid_id; ?> ').trigger("reloadGrid",[{jqgrid_page:1}]); } } } ,"editParams":{ "aftersavefunc":function (id, res) { jQuery('#<?php echo $grid_id; ?> ').trigger("reloadGrid",[{jqgrid_page:1}]); }, "errorfunc": function(id,res) { jQuery.jgrid.info_dialog(jQuery.jgrid.errors.errcap,'<div class=\"ui-state-error\">'+ res.responseText +'</div>', jQuery.jgrid.edit.bClose,{buttonalign:'right'}); jQuery('#<?php echo $grid_id; ?> ').trigger("reloadGrid",[{jqgrid_page:1}]); }, "oneditfunc": function(id) { jQuery('#<?php echo $grid_id; ?> ').jqGrid('setSelection',id); jQuery("#edit_row_<?php echo $grid_id; ?> _"+id+" a:first").click(); }, "afterrestorefunc": function(id) { jQuery("#save_row_<?php echo $grid_id; ?> _"+id+" a:last").parent().hide().prev().show(); } }}); <?php } ?> <?php if ($this->actions["autofilter"] !== false) { ?> jQuery("#<?php echo $grid_id; ?> ").jqGrid('filterToolbar',{stringResult: true,searchOnEnter : false, defaultSearch:'cn'}); <?php } ?> <?php if ($this->actions["showhidecolumns"] !== false) { ?> jQuery("#<?php echo $grid_id; ?> ").jqGrid('navButtonAdd',"#<?php echo $grid_id . "_pager"; ?> ",{caption:"Columns",title:"Hide/Show Columns", buttonicon :'ui-icon-note', onClickButton:function(){ jQuery("#<?php echo $grid_id; ?> ").jqGrid('columnChooser',{width : 250, height:150, modal:true, done:function(){ c = jQuery('#colchooser_<?php echo $grid_id; ?> select').val(); var colModel = jQuery("#<?php echo $grid_id; ?> ").jqGrid("getGridParam", "colModel"); str = ''; jQuery(c).each(function(i){ str += colModel[c[i]]['name'] + ","; }); document.cookie = 'jqgrid_colchooser=' + str; }, "dialog_opts" : {"minWidth": 270} }); jQuery("#colchooser_<?php echo $grid_id; ?> ").parent().position({ my: "center", at: "center", of: $("#gbox_<?php echo $grid_id; ?> ") }); } }); <?php } ?> <?php ?> <?php if ($this->actions["bulkedit"] === true) { ?> jQuery("#<?php echo $grid_id; ?> ").jqGrid('navButtonAdd',"#<?php echo $grid_id . "_pager"; ?> ",{ 'caption' : 'Bulk Edit', 'buttonicon' : 'ui-icon-pencil', 'onClickButton': function() { var ids = jQuery('#<?php echo $grid_id; ?> ').jqGrid('getGridParam','selarrrow'); if (ids.length == 0) { jQuery.jgrid.info_dialog(jQuery.jgrid.errors.errcap,'<div class=\"ui-state-error\">'+jQuery.jgrid.nav.alerttext+'</div>', jQuery.jgrid.edit.bClose,{buttonalign:'right'}); return; } jQuery('#<?php echo $grid_id; ?> ').jqGrid('editGridRow', ids, <?php echo json_encode_jsfunc($this->options["edit_options"]); ?> ); jQuery('#edithd<?php echo $grid_id; ?> .ui-jqdialog-title').html("Bulk Edit"); jQuery('#editmod<?php echo $grid_id; ?> .binfo').show(); jQuery('#editmod<?php echo $grid_id; ?> .bottominfo').html("NOTE: Blank fields will be skipped"); jQuery('#editmod<?php echo $grid_id; ?> select').prepend("<option value=''></option>").val(''); return true; }, 'position': 'last' }); <?php } ?> <?php ?> <?php if (isset($this->actions["clone"]) && $this->actions["clone"] === true) { ?> jQuery("#<?php echo $grid_id; ?> ").jqGrid('navButtonAdd',"#<?php echo $grid_id . "_pager"; ?> ",{caption:"",title:"Clone", buttonicon :'ui-icon-copy', onClickButton:function(){ var selr = jQuery("#<?php echo $grid_id; ?> ").jqGrid('getGridParam','selrow'); if (!selr) { var alertIDs = {themodal:'alertmod',modalhead:'alerthd',modalcontent:'alertcnt'}; if (jQuery("#"+alertIDs.themodal).html() === null) { jQuery.jgrid.createModal(alertIDs,"<div>"+jQuery.jgrid.nav.alerttext+ "</div><span tabindex='0'><span tabindex='-1' id='jqg_alrt'></span></span>", {gbox:"#gbox_"+jQuery.jgrid.jqID(this.p.id),jqModal:true,drag:true,resize:true, caption:jQuery.jgrid.nav.alertcap, top:100,left:100,width:200,height: 'auto',closeOnEscape:true, zIndex: null},"","",true); } jQuery.jgrid.viewModal("#"+alertIDs.themodal, {gbox:"#gbox_"+jQuery.jgrid.jqID(this.p.id),jqm:true}); jQuery("#jqg_alrt").focus(); return; } fx_clone_row("<?php echo $grid_id; ?> ",selr); } }); <?php } ?> <?php if ($this->actions["export"] === true || $this->actions["export_excel"] === true || $this->actions["export_pdf"] === true || $this->actions["export_csv"] === true) { $Vda3ad3b4322b19b609e4fa9d0a98a9 = "&sidx=" . $this->options["sortname"] . "&sord=" . $this->options["sortorder"] . "&rows=" . $this->options["rowNum"]; ?> function F3113f6c798c1640f3ce1f0ffc75e93(type) { type = type || ""; var detail_grid_params = jQuery("#<?php echo $grid_id; ?> ").data('jqgrid_detail_grid_params'); detail_grid_params = detail_grid_params || ""; if ("<?php echo $this->options["url"]; ?> ".indexOf("?") != -1) window.open("<?php echo $this->options["url"]; ?> " + "&export=1&jqgrid_page=1&export_type="+type+"<?php echo $Vda3ad3b4322b19b609e4fa9d0a98a9; ?> "+detail_grid_params); else window.open("<?php echo $this->options["url"]; ?> " + "?export=1&jqgrid_page=1&export_type="+type+"<?php echo $Vda3ad3b4322b19b609e4fa9d0a98a9; ?> "+detail_grid_params); } <?php } ?> <?php ?> fx_success_msg = function (msg,fade) { var t = Math.max(0, ((jQuery(window).height() - jQuery('#info_dialog').outerHeight()) / 2) + jQuery(window).scrollTop()); var l = Math.max(0, ((jQuery(window).width() - jQuery('#info_dialog').outerWidth()) / 2) + jQuery(window).scrollLeft()); jQuery.jgrid.info_dialog("Info","<div class='ui-state-highlight' style='padding:5px;'>"+msg+"</div>", jQuery.jgrid.edit.bClose,{buttonalign:"right", left:l, top:t }); jQuery("#info_dialog").abscenter(); if (fade == 1) jQuery("#info_dialog").delay(1000).fadeOut(); }; <?php ?> <?php if (isset($this->options["toolbar"]) && $this->options["toolbar"] != "bottom") { ?> jQuery(document).ready(function(){ <?php if ($this->options["toolbar"] == "top") { ?> jQuery('#<?php echo $grid_id; ?> _pager').insertBefore('#<?php echo $grid_id; ?> _toppager'); <?php } else { if ($this->options["toolbar"] == "both") { ?> jQuery('#<?php echo $grid_id; ?> _pager').clone(true).insertBefore('#<?php echo $grid_id; ?> _toppager').attr('id','_toppager'); <?php } } ?> jQuery('#<?php echo $grid_id; ?> _pager').removeClass("ui-jqgrid-pager"); jQuery('#<?php echo $grid_id; ?> _pager').addClass("ui-jqgrid-toppager"); jQuery('#<?php echo $grid_id; ?> _toppager').remove(); jQuery('#_toppager').attr('id','<?php echo $grid_id; ?> _toppager'); if (jQuery("link[href$='ui.bootstrap.jqgrid.css']").length) { jQuery('div.frozen-div').css('top','+=6px'); jQuery('div.frozen-bdiv').css('top','+=6px'); } }); <?php } ?> <?php if ($this->options["autoresize"] === true) { ?> jQuery(window).bind("resize", function () { var oldWidth = jQuery("#<?php echo $grid_id; ?> ").jqGrid("getGridParam", "width"), newWidth = jQuery(window).width() - 30; if (oldWidth !== newWidth) { jQuery("#<?php echo $grid_id; ?> ").jqGrid("setGridWidth", newWidth); } }).trigger("resize"); <?php } ?> <?php if ($this->options["resizable"] === true) { ?> jQuery("#<?php echo $grid_id; ?> ").jqGrid('gridResize',{}); <?php } ?> <?php ?> jQuery("#<?php echo $grid_id; ?> ").jqGrid('setFrozenColumns'); jQuery("#<?php echo $grid_id; ?> ").triggerHandler("jqGridAfterGridComplete"); jQuery.fn.abscenter = function () { this.css("position","absolute"); this.css("top", Math.max(0, ((jQuery(window).height() - jQuery(this).outerHeight()) / 2) + jQuery(window).scrollTop()) + "px"); this.css("left", Math.max(0, ((jQuery(window).width() - jQuery(this).outerWidth()) / 2) + jQuery(window).scrollLeft()) + "px"); return this; }; jQuery.fn.fixedcenter = function () { this.css("position","fixed"); this.css("top", Math.max(0, ((jQuery(window).height() - jQuery(this).outerHeight()) / 2)) + "px"); this.css("left", Math.max(0, ((jQuery(window).width() - jQuery(this).outerWidth()) / 2)) + "px"); return this; }; <?php }
protected function getScript($mode = 'normal') { $script = ''; switch ($mode) { case 'normal': $jwplayerConfigJSON = json_encode_jsfunc($this->getPlayerConfig($this->url, $mode)); $script = "loadJWPlayer = function() { jwplayer(\"{$this->playerId}\").setup({$jwplayerConfigJSON}); };\n"; break; case 'preroll': $file = self::getAssetUrl(F::app()->wg->ExtensionsPath . self::$JWPLAYER_DIR . self::$BLANK_MP4, self::JWPLAYER_VERSION); $prerollPlayerConfigJSON = json_encode_jsfunc($this->getPlayerConfig($file, $mode)); $script = "loadJWPlayer = function() { jwplayer(\"{$this->playerId}\").setup({$prerollPlayerConfigJSON}); };\n"; break; case 'agegate': $agegatePlayerConfigJSON = json_encode_jsfunc($this->getPlayerConfig($this->url, $mode)); $script = "loadAgegatePlayer = function() { jwplayer(\"{$this->playerId}\").setup({$agegatePlayerConfigJSON}); };\n"; break; case 'ad': $googimaDataVariable = self::GOOGIMA_DATA_VARIABLE; $jwplayerAdMessage = F::app()->wf->Msg('jwplayer-ad-message'); $script = <<<EOT if (!window.wgUserName || window.wgUserShowAds) { \t{$googimaDataVariable} = { 'ad.position': 'pre', 'ad.bandwidth': 'high', 'admessagedynamic': '{$jwplayerAdMessage}', 'admessagedynamickey': 'XX', 'scaled_ads': 'false', 'ad.tag': window.AdConfig.DART.getUrl('JWPLAYER', '320x240', 'jwplayer', 'DART') }; } else { {$googimaDataVariable} = null; } EOT; break; default: } return $script; }
function json_encode_jsfunc($input = array(), $funcs = array(), $level = 0) { foreach ($input as $key => $value) { if (is_array($value)) { $ret = json_encode_jsfunc($value, $funcs, 1); $input[$key] = $ret[0]; $funcs = $ret[1]; } else { if (substr($value, 0, 10) == 'function()') { $func_key = "#" . uniqid() . "#"; $funcs[$func_key] = $value; $input[$key] = $func_key; } } } if ($level == 1) { return array($input, $funcs); } else { $input_json = json_encode($input); foreach ($funcs as $key => $value) { $input_json = str_replace('"' . $key . '"', $value, $input_json); } return $input_json; } }
function F300015ed($Vab930cbb, $Vc68271a6) { ?> var lastSel;var grid_<?php echo $Vab930cbb; ?> = jQuery("#<?php echo $Vab930cbb; ?> ").jqGrid(<?php echo $Vc68271a6; ?> ); jQuery("#<?php echo $Vab930cbb; ?> ").jqGrid('navGrid','#<?php echo $Vab930cbb . "_pager"; ?> ', { edit: <?php echo $this->actions["edit"] === false ? "false" : "true"; ?> , add: <?php echo $this->actions["add"] === false ? "false" : "true"; ?> , del: <?php echo $this->actions["delete"] === false ? "false" : "true"; ?> }, <?php echo json_encode_jsfunc($this->options["edit_options"]); ?> , <?php echo json_encode_jsfunc($this->options["add_options"]); ?> , {}, {multipleSearch:<?php echo $this->actions["search"] == "advance" ? "true" : "false"; ?> }); <?php if ($this->actions["inlineadd"] !== false) { ?> jQuery('#<?php echo $Vab930cbb; ?> ').jqGrid('inlineNav','#<?php echo $Vab930cbb . "_pager"; ?> ',{"addtext":"Inline","edit":false,"save":true,"cancel":true, "addParams":{"aftersavefunc":function (id, res) { res = res.responseText.split("#");try { $(this).jqGrid('setCell', id, res[0], res[1]);$("#"+id, "#"+this.p.id).removeClass("jqgrid-new-row").attr("id",res[1] );} catch (asr) {} jQuery('#<?php echo $Vab930cbb; ?> ').trigger("reloadGrid",[{page:1}]);}},"editParams":{"aftersavefunc":function (id, res) { res = res.responseText.split("#");try { $(this).jqGrid('setCell', id, res[0], res[1]);$("#"+id, "#"+this.p.id).removeClass("jqgrid-new-row").attr("id",res[1] );} catch (asr) {} jQuery('#<?php echo $Vab930cbb; ?> ').trigger("reloadGrid",[{page:1}]);}}});<?php } ?> <?php if ($this->actions["autofilter"] !== false) { ?> jQuery("#<?php echo $Vab930cbb; ?> ").jqGrid('filterToolbar',{stringResult: true,searchOnEnter : false}); <?php } ?> <?php if ($this->actions["showhidecolumns"] !== false) { ?> jQuery("#<?php echo $Vab930cbb; ?> ").jqGrid('navButtonAdd',"#<?php echo $Vab930cbb . "_pager"; ?> ",{caption:"Columns",title:"Hide/Show Columns", buttonicon :'ui-icon-note', onClickButton:function(){ jQuery("#<?php echo $Vab930cbb; ?> ").jqGrid('setColumns'); } });<?php } ?> function link_dtpicker(el) { setTimeout(function(){ if(jQuery.ui) { if(jQuery.ui.datepicker) { jQuery(el).after('<button>Calendar</button>').next().button({icons:{primary: 'ui-icon-calendar'}, text:false}).css({'font-size':'69%'}).click(function(e){jQuery(el).datepicker('show');return false;});jQuery(el).datepicker({"disabled":false,"dateFormat":"yy-mm-dd"});jQuery('.ui-datepicker').css({'font-size':'69%'});} }},100);}jQuery("#<?php echo $Vab930cbb; ?> ").jqGrid('gridResize',{});<?php }
/** * JS code related to grid rendering */ function render_js($grid_id,$out) { ?> var lastSel; fx_clone_row = function (grid,id) { myData = {}; myData.id = id; myData.grid_id = grid; myData.oper = 'clone'; jQuery.ajax({ url: "<?php echo $this->options["url"]?>", dataType: "json", data: myData, type: "POST", error: function(res, status) { alert(res.status+" : "+res.statusText+". Status: "+status); }, success: function( data ) { } }); jQuery("#"+grid).jqGrid().trigger('reloadGrid',[{jqgrid_page:1}]); } var extra_opts = {}; <?php ### P ### ?> if (typeof(opts) != 'undefined') extra_opts = opts; if (typeof(opts_<?php echo $grid_id?>) != 'undefined') extra_opts = opts_<?php echo $grid_id?>; var grid_<?php echo $grid_id?> = jQuery("#<?php echo $grid_id?>").jqGrid( jQuery.extend(<?php echo $out?>, extra_opts ) ); jQuery("#<?php echo $grid_id?>").jqGrid('navGrid','#<?php echo $grid_id."_pager"?>', <?php echo json_encode_jsfunc($this->navgrid["param"])?>, <?php echo json_encode_jsfunc($this->options["edit_options"])?>, <?php echo json_encode_jsfunc($this->options["add_options"])?>, <?php echo json_encode_jsfunc($this->options["delete_options"])?>, <?php echo json_encode_jsfunc($this->options["search_options"])?>, <?php echo json_encode_jsfunc($this->options["view_options"])?> ); // Set grouping header using callGridMethod <?php if (!empty($this->group_header)) { ?> jQuery("#<?php echo $grid_id?>").jqGrid("setGroupHeaders", <?php echo json_encode_jsfunc($this->group_header)?>); <?php } ?> <?php ### P ### ?> <?php if ($this->actions["inlineadd"] !== false || $this->actions["inline"] === true) { ?> jQuery('#<?php echo $grid_id?>').jqGrid('inlineNav','#<?php echo $grid_id."_pager"?>',{"add":true,"edit":true,"save":true,"cancel":true, "addParams":{ "addRowParams": { "oneditfunc": function(id) { jQuery("#edit_row_<?php echo $grid_id?>_"+id+" a:first").click(); // jQuery("div.frozen-div, div.frozen-bdiv").hide(); }, "afterrestorefunc": function(id) { jQuery("#save_row_<?php echo $grid_id?>_"+id+" a:last").parent().hide().prev().show(); // jQuery(".frozen-div, .frozen-bdiv").show(); } } } ,"editParams":{ "aftersavefunc":function (id, res) { // set returned pk in new row of grid res = res.responseText.split("#"); try { jQuery(this).jqGrid('setCell', id, res[0], res[1]); jQuery("#"+id, "#"+this.p.id).removeClass("jqgrid-new-row").attr("id",res[1] ); } catch (asr) {} // jQuery(".frozen-div, .frozen-bdiv").show(); // but reload grid, to work properly jQuery('#<?php echo $grid_id?>').trigger("reloadGrid",[{jqgrid_page:1}]); }, "errorfunc": function(id,res) { jQuery.jgrid.info_dialog(jQuery.jgrid.errors.errcap,'<div class=\"ui-state-error\">'+ res.responseText +'</div>', jQuery.jgrid.edit.bClose,{buttonalign:'right'}); jQuery('#<?php echo $grid_id?>').trigger("reloadGrid",[{jqgrid_page:1}]); }, "oneditfunc": function(id) { jQuery('#<?php echo $grid_id?>').jqGrid('setSelection',id); jQuery("#edit_row_<?php echo $grid_id?>_"+id+" a:first").click(); // jQuery("div.frozen-div, div.frozen-bdiv").hide(); }, "afterrestorefunc": function(id) { jQuery("#save_row_<?php echo $grid_id?>_"+id+" a:last").parent().hide().prev().show(); // jQuery(".frozen-div, .frozen-bdiv").show(); } }}); <?php } ?> <?php if ($this->actions["autofilter"] !== false) { ?> // auto filter with contains search jQuery("#<?php echo $grid_id?>").jqGrid('filterToolbar',{stringResult: true,searchOnEnter : false, defaultSearch:'cn'}); // jQuery("#<?php echo $grid_id?>").jqGrid('filterToolbar',{stringResult: true,searchOnEnter : false}); <?php } ?> <?php if ($this->actions["showhidecolumns"] !== false) { ?> // show/hide columns jQuery("#<?php echo $grid_id?>").jqGrid('navButtonAdd',"#<?php echo $grid_id."_pager"?>",{caption:"Columns",title:"Hide/Show Columns", buttonicon :'ui-icon-note', onClickButton:function(){ jQuery("#<?php echo $grid_id?>").jqGrid('setColumns',{colnameview : false}); } }); <?php } ?> <?php ### P ### ?> <?php if ($this->actions["bulkedit"] === true) { ?> // Export to what is defined in file jQuery("#<?php echo $grid_id?>").jqGrid('navButtonAdd',"#<?php echo $grid_id."_pager"?>",{ 'caption' : 'Bulk Edit', 'buttonicon' : 'ui-icon-pencil', 'onClickButton': function() { var ids = jQuery('#<?php echo $grid_id?>').jqGrid('getGridParam','selarrrow'); // don't process if nothing is selected if (ids.length == 0) { jQuery.jgrid.info_dialog(jQuery.jgrid.errors.errcap,'<div class=\"ui-state-error\">'+jQuery.jgrid.nav.alerttext+'</div>', jQuery.jgrid.edit.bClose,{buttonalign:'right'}); return; } jQuery('#<?php echo $grid_id?>').jqGrid('editGridRow', ids, <?php echo json_encode_jsfunc($this->options["edit_options"])?>); jQuery('#edithd<?php echo $grid_id?> .ui-jqdialog-title').html("Bulk Edit"); jQuery('#editmod<?php echo $grid_id?> .binfo').show(); jQuery('#editmod<?php echo $grid_id?> .bottominfo').html("NOTE: Blank fields will be skipped"); return true; }, 'position': 'last' }); <?php } ?> <?php if ($this->actions["export"] === true || $this->actions["export_excel"] === true || $this->actions["export_pdf"] === true || $this->actions["export_csv"] === true) { $order_by = "&sidx=".$this->options["sortname"]."&sord=".$this->options["sortorder"]."&rows=".$this->options["rowNum"]; ?> function jqgrid_process_export(type) { type = type || ""; var detail_grid_params = jQuery("#<?php echo $grid_id?>").data('jqgrid_detail_grid_params'); detail_grid_params = detail_grid_params || ""; if ("<?php echo $this->options["url"]?>".indexOf("?") != -1) window.open("<?php echo $this->options["url"]?>" + "&export=1&jqgrid_page=1&export_type="+type+"<?php echo $order_by?>"+detail_grid_params); else window.open("<?php echo $this->options["url"]?>" + "?export=1&jqgrid_page=1&export_type="+type+"<?php echo $order_by?>"+detail_grid_params); } <?php } ?> <?php ### P ### ?> <?php if ($this->actions["export"] === true) { ?> // Export to what is defined in file jQuery("#<?php echo $grid_id?>").jqGrid('navButtonAdd',"#<?php echo $grid_id."_pager"?>",{caption:"Export",title:"Export", buttonicon :'ui-icon-extlink', onClickButton:function(){ jqgrid_process_export(); } }); <?php } ?> <?php ### P ### ?> <?php if (isset($this->actions["export_excel"]) && $this->actions["export_excel"] === true) { ?> // Export to excel jQuery("#<?php echo $grid_id?>").jqGrid('navButtonAdd',"#<?php echo $grid_id."_pager"?>",{caption:"Excel",title:"Excel", buttonicon :'ui-icon-extlink', onClickButton:function(){ jqgrid_process_export('excel'); } }); <?php } ?> <?php ### P ### ?> <?php if (isset($this->actions["export_pdf"]) && $this->actions["export_pdf"] === true) { ?> // Export to pdf jQuery("#<?php echo $grid_id?>").jqGrid('navButtonAdd',"#<?php echo $grid_id."_pager"?>",{caption:"PDF",title:"PDF", buttonicon :'ui-icon-extlink', onClickButton:function(){ jqgrid_process_export('pdf'); } }); <?php } ?> <?php ### P ### ?> <?php if (isset($this->actions["export_csv"]) && $this->actions["export_csv"] === true) { ?> // Export to csv jQuery("#<?php echo $grid_id?>").jqGrid('navButtonAdd',"#<?php echo $grid_id."_pager"?>",{caption:"CSV",title:"CSV", buttonicon :'ui-icon-extlink', onClickButton:function(){ jqgrid_process_export('csv'); } }); <?php } ?> <?php ### P ### ?> <?php if (isset($this->actions["clone"]) && $this->actions["clone"] === true) { ?> // Clone button jQuery("#<?php echo $grid_id?>").jqGrid('navButtonAdd',"#<?php echo $grid_id."_pager"?>",{caption:"",title:"Clone", buttonicon :'ui-icon-copy', onClickButton:function(){ var selr = jQuery("#<?php echo $grid_id?>").jqGrid('getGridParam','selrow'); if (!selr) { var alertIDs = {themodal:'alertmod',modalhead:'alerthd',modalcontent:'alertcnt'}; if (jQuery("#"+alertIDs.themodal).html() === null) { jQuery.jgrid.createModal(alertIDs,"<div>"+jQuery.jgrid.nav.alerttext+ "</div><span tabindex='0'><span tabindex='-1' id='jqg_alrt'></span></span>", {gbox:"#gbox_"+jQuery.jgrid.jqID(this.p.id),jqModal:true,drag:true,resize:true, caption:jQuery.jgrid.nav.alertcap, top:100,left:100,width:200,height: 'auto',closeOnEscape:true, zIndex: null},"","",true); } jQuery.jgrid.viewModal("#"+alertIDs.themodal, {gbox:"#gbox_"+jQuery.jgrid.jqID(this.p.id),jqm:true}); jQuery("#jqg_alrt").focus(); return; } fx_clone_row("<?php echo $grid_id?>",selr); } }); <?php } ?> function link_date_picker(el,fmt,toolbar,opts) { toolbar = toolbar || 0; setTimeout(function(){ if(jQuery.ui) { if(jQuery.ui.datepicker) { opts = (typeof(opts) == 'undefined') ? {} : opts; if (toolbar == 0) { if (!jQuery.browser.msie) jQuery(el).css('width',parseInt(jQuery(el).css('width'))-10); else jQuery(el).css('width','78%'); jQuery(el).after(' <button>Calendar</button>').next().button({icons:{primary: 'ui-icon-calendar'}, text:false}).css({'font-size':'69%', 'margin-left':'2px'}).click(function(e){jQuery(el).datepicker('show');return false;}); } jQuery(el).datepicker( jQuery.extend( { "disabled":false, "dateFormat":fmt, "changeMonth": false, "changeYear": false, "onSelect": function (dateText, inst) { if (toolbar) { setTimeout(function () { jQuery("#<?php echo $grid_id?>")[0].triggerToolbar(); }, 50); } jQuery(el).trigger('change'); } },opts) ); jQuery('.ui-datepicker').css({'font-size':'69%'}); } } },300); } function link_datetime_picker(el,fmt,toolbar,opts) { setTimeout(function(){ if(jQuery.ui) { if(jQuery.ui.datepicker) { opts = (typeof(opts) == 'undefined') ? {} : opts; if (toolbar == 0) { if (!jQuery.browser.msie) jQuery(el).css('width',parseInt(jQuery(el).css('width'))-10); else jQuery(el).css('width','78%'); jQuery(el).after(' <button>Calendar</button>').next().button({icons:{primary: 'ui-icon-calendar'}, text:false}).css({'font-size':'69%', 'margin-left':'2px'}).click(function(e){jQuery(el).datetimepicker('show');return false;}); } jQuery(el).datetimepicker( jQuery.extend( { "disabled":false, "dateFormat":fmt, "changeMonth": false, "changeYear": false, "onSelect": function (dateText, inst) { if (toolbar) { setTimeout(function () { jQuery("#<?php echo $grid_id?>")[0].triggerToolbar(); }, 50); } jQuery(el).trigger('change'); } }, opts) ); jQuery('.ui-datepicker').css({'font-size':'69%'}); } } },100); } <?php ### P ### ?> function link_editor(el) { setTimeout(function(){ var editor = CKEDITOR.replace( el, { on: { change: function(){ jQuery(el).val(editor.getData()); } }, height: '100px', enterMode : CKEDITOR.ENTER_BR }); },100); } <?php ### P ### ?> fx_replace_upload = function(el,field) { jQuery(el).parent().append("<input id='"+field+"_file' size='10' name='"+field+"' type='file' onchange='jQuery(\"#"+field+"\").remove(); jQuery(this).attr(\"id\",\""+field+"\"); fx_ajax_file_upload(\""+field+"\",\"<?php echo $this->options["url"]?>\");' />"); jQuery(el).parent().children("span").remove(); jQuery(el).parent().children("input[type=button]").remove(); } function link_upload(el,field) { setTimeout(function(){ if(jQuery(el).val() != '') { jQuery(el).parent().append("<span id='"+field+"_name'>"+jQuery(el).val().substring(jQuery(el).val().lastIndexOf('/')+1)+"</span> "); jQuery(el).parent().append("<input type='button' value='Delete' onclick='jQuery(\"#"+field+"\").val(\"\"); fx_replace_upload(\"#"+field+"\",\""+field+"\");' />"); jQuery(el).hide(); } else { jQuery(el).replaceWith("<input id='"+field+"' size='10' name='"+field+"' type='file' onchange='fx_ajax_file_upload(\""+field+"\",\"<?php echo $this->options["url"]?>\");' />"); } },100); } <?php ### P ### ?> function link_autocomplete(el,update_field) { setTimeout(function() { if(jQuery.ui) { if(jQuery.ui.autocomplete) { jQuery(el).autocomplete({ "appendTo":"body","disabled":false,"delay":300, "minLength":1, "source":function (request, response) { request.element = el.name; request.oper = 'autocomplete'; jQuery.ajax({ url: "<?php echo $this->options["url"]?>", dataType: "json", data: request, type: "POST", error: function(res, status) { alert(res.status+" : "+res.statusText+". Status: "+status); }, success: function( data ) { response( data ); } }); }, "select":function (event, ui) { // change function to set target value var ival; if(ui.item) { ival = ui.item.id || ui.item.value; } if(ival) { jQuery("input[name='"+update_field+"'].editable, input[id='"+update_field+"']").val(ival); } else { jQuery("input[name='"+update_field+"']").val(""); } } }); jQuery(el).autocomplete('widget').css('font-size','11px'); } // if jQuery.ui.autocomplete } // if jQuery.ui },200); // setTimeout } // link_autocomplete <?php ### P ### ?> fx_get_dropdown = function (o,field,for_search_bar) { var request = {}; request['value'] = o.value; jQuery(".editable").each(function(){ request[jQuery(this).attr('name')] = jQuery(this).val(); }); // if callback is set for dropdown if (field instanceof Function) request['return'] = "json"; else request['return'] = "select"; request['src'] = jQuery(o).attr('name'); jQuery.ajax({ url: "<?php echo $this->options["url"]?>", dataType: 'html', data: request, type: 'POST', error: function(res, status) { alert(res.status+' : '+res.statusText+'. Status: '+status); }, success: function( data ) { if (for_search_bar == 1) { data = "<option value=''></option>" + data; jQuery('select[name='+field+']').html(data); } else { // if callback is defined for dropdown, call it if (field instanceof Function) { field(data); } else { jQuery('select[name='+field+'].editable').html(data); jQuery('select[name='+field+'].FormElement').html(data); } } } }); } <?php ### P ### ?> fx_success_msg = function (msg,fade) { jQuery.jgrid.info_dialog("Info","<div class='ui-state-highlight' style='padding:5px;'>"+msg+"</div>", jQuery.jgrid.edit.bClose,{buttonalign:"right"}); $("#info_dialog").position({ my: "center", at: "center", of: $("#info_dialog").parent() }); if (fade == 1) jQuery("#info_dialog").delay(1000).fadeOut(); } <?php ### P ### ?> fx_bulk_update = function (op,data) { // for non multi select var selr_one = jQuery('#<?php echo $grid_id?>').jqGrid('getGridParam','selrow'); // array of id's of the selected rows when multiselect options is true. Empty array if not selection // for multi select var selr = []; selr = jQuery('#<?php echo $grid_id?>').jqGrid('getGridParam','selarrrow'); // array of id's of the selected rows when multiselect options is true. Empty array if not selection if (selr.length < 2 && selr_one) selr[0] = selr_one; // don't process if nothing is selected if (selr.length == 0) { jQuery.jgrid.info_dialog(jQuery.jgrid.errors.errcap,'<div class=\"ui-state-error\">Please select rows to edit</div>', jQuery.jgrid.edit.bClose,{buttonalign:'right'}); return; } var str = selr[0]; for (var x=1;x < selr.length;x++) { str += ',' + selr[x]; } // call ajax to update date in db var request = {}; request['oper'] = 'edit'; request['id'] = str; request['bulk'] = op; if (data) request['data'] = data; jQuery.ajax({ url: "<?php echo $this->options["url"]?>", dataType: 'json', data: request, type: 'POST', error: function(res, status) { alert(res.status+' : '+res.statusText+'. Status: '+status); }, success: function( data ) { // reload grid for data changes jQuery('#<?php echo $grid_id?>').jqGrid().trigger('reloadGrid',[{jqgrid_page:1}]); } }); } <?php ### P ### ?> <?php if ($this->require_upload_ajax) { ?> fx_ajax_file_upload = function (field,upload_url) { //starting setting some animation when the ajax starts and completes if (typeof(document.getElementById(field+'_upload')) != "undefined") jQuery("input#"+field).parent().append('<span id="'+field+'_upload"> Uploading...</span>'); else jQuery("#"+field+"_upload").html("Uploading..."); /* prepareing ajax file upload url: the url of script file handling the uploaded files fileElementId: the file type of input element id and it will be the index of $_FILES Array() dataType: it support json, xml secureuri:use secure protocol success: call back function when the ajax complete error: callback function when the ajax failed */ jQuery.extend({ handleError: function( s, xhr, status, e ) { if(xhr.responseText) console.log(xhr.responseText); } }); jQuery.ajaxFileUpload ( { url:upload_url, secureuri:false, fileElementId:field, dataType: 'json', data: {"field":field}, success: function (data, status) { if(typeof(data.error) != 'undefined') { if(data.error != '') { //alert(data.error); jQuery("#"+field+"_upload").html(data.error); }else { //alert(data.msg); jQuery("#"+field+"_upload").html(data.msg.substring(data.msg.lastIndexOf('/')+1) + " (Uploaded)"); var o = jQuery("input#"+field); jQuery("<input type='text' />").attr({ name: o.attr("name"), value: data.msg, "class": "FormElement ui-widget-content ui-corner-all", role: "textbox", id: o.attr("id") }).insertBefore(o).hide(); o.remove(); } } }, error: function (data, status, e) { alert(e); } } ) return false; } <?php } ?> <?php ### P ### ?> <?php if (isset($this->options["toolbar"]) && $this->options["toolbar"] != "bottom") { ?> // Toolbar position button jQuery(document).ready(function(){ <?php if ($this->options["toolbar"] == "top") { ?> jQuery('#<?php echo $grid_id?>_pager').insertBefore('#<?php echo $grid_id?>_toppager'); <?php } else if ($this->options["toolbar"] == "both") { ?> jQuery('#<?php echo $grid_id?>_pager').clone(true).insertBefore('#<?php echo $grid_id?>_toppager').attr('id','_toppager'); <?php } ?> jQuery('#<?php echo $grid_id?>_pager').removeClass("ui-jqgrid-pager"); jQuery('#<?php echo $grid_id?>_pager').addClass("ui-jqgrid-toppager"); jQuery('#<?php echo $grid_id?>_toppager').remove(); jQuery('#_toppager').attr('id','<?php echo $grid_id?>_toppager'); // for bootstrap if (jQuery("link[href$='ui.bootstrap.jqgrid.css']").length) { jQuery('div.frozen-div').css('top','+=6px'); jQuery('div.frozen-bdiv').css('top','+=6px'); } }); <?php } ?> <?php if ($this->options["resizable"] === true) { ?> jQuery(window).bind("resize", function () { var oldWidth = jQuery("#<?php echo $grid_id?>").jqGrid("getGridParam", "width"), newWidth = jQuery(window).width() - 30; if (oldWidth !== newWidth) { jQuery("#<?php echo $grid_id?>").jqGrid("setGridWidth", newWidth); } }).trigger("resize"); jQuery("#<?php echo $grid_id?>").jqGrid('gridResize',{}); <?php } ?> <?php ### P ### ?> jQuery("#<?php echo $grid_id?>").jqGrid('setFrozenColumns'); jQuery("#<?php echo $grid_id?>").triggerHandler("jqGridAfterGridComplete"); <?php ### P ### ?> <?php echo $this->internal["js_dependent_dropdown"]; ?> <?php }
function render($R4BC8E01FD735B288AE2C70A47401309E) { if ($_REQUEST["subgrid"]) { $R4BC8E01FD735B288AE2C70A47401309E .= "_" . $_REQUEST["subgrid"]; } if (!$this->options["colNames"]) { $this->set_columns(); } if ($R07C0DD69A9C2B0D1C815296F57795AE8 = $_POST['oper']) { $R7318A606A3118D468DAE7078098FBA7B = $_POST; $R3584859062EA9ECFB39B93BFCEF8E869 = $R7318A606A3118D468DAE7078098FBA7B['id']; $R2753F3199DFA4EABAA38569B441BB9BB = $this->options["colModel"][0]["index"]; switch ($R07C0DD69A9C2B0D1C815296F57795AE8) { case "add": unset($R7318A606A3118D468DAE7078098FBA7B['id']); unset($R7318A606A3118D468DAE7078098FBA7B['oper']); $R44249C36FC2615B032F3832EF30CB9C2 = array(); $RA94EF3EDEBBECC120DD9EC4D9CB90BD1 = array(); foreach ($R7318A606A3118D468DAE7078098FBA7B as $RA09FE38AF36F6839F4A75051DC7CEA25 => $RA3D52E52A48936CDE0F5356BB08652F2) { if (strstr($RA09FE38AF36F6839F4A75051DC7CEA25, "::") !== false) { list($RCC5C6E696C11A4FDF170ECE8BA9FDC6F, $RA09FE38AF36F6839F4A75051DC7CEA25) = explode("::", $RA09FE38AF36F6839F4A75051DC7CEA25); } $RA09FE38AF36F6839F4A75051DC7CEA25 = addslashes($RA09FE38AF36F6839F4A75051DC7CEA25); $RA3D52E52A48936CDE0F5356BB08652F2 = addslashes($RA3D52E52A48936CDE0F5356BB08652F2); $R44249C36FC2615B032F3832EF30CB9C2[] = "{$RA09FE38AF36F6839F4A75051DC7CEA25}='{$RA3D52E52A48936CDE0F5356BB08652F2}'"; $RA94EF3EDEBBECC120DD9EC4D9CB90BD1[$RA09FE38AF36F6839F4A75051DC7CEA25] = $RA3D52E52A48936CDE0F5356BB08652F2; } $R44249C36FC2615B032F3832EF30CB9C2 = "SET " . implode(",", $R44249C36FC2615B032F3832EF30CB9C2); if (!empty($this->events["on_insert"])) { $R94F2A42E16297B91A9F03B5E4B01132B = $this->events["on_insert"][0]; $R602BAA072843820A45861C75C510C77E = $this->events["on_insert"][1]; $R8676B010EDB4835BFD8EAE388F5D769F = $this->events["on_insert"][2]; if ($R602BAA072843820A45861C75C510C77E) { call_user_method($R94F2A42E16297B91A9F03B5E4B01132B, $R602BAA072843820A45861C75C510C77E, array($R2753F3199DFA4EABAA38569B441BB9BB => $R3584859062EA9ECFB39B93BFCEF8E869, "params" => $RA94EF3EDEBBECC120DD9EC4D9CB90BD1)); } else { call_user_func($R94F2A42E16297B91A9F03B5E4B01132B, array($R2753F3199DFA4EABAA38569B441BB9BB => $R3584859062EA9ECFB39B93BFCEF8E869, "params" => $RA94EF3EDEBBECC120DD9EC4D9CB90BD1)); } if (!$R8676B010EDB4835BFD8EAE388F5D769F) { break; } } $R130D64A4AD653C91E0FD80DE8FEADC3A = "INSERT INTO {$this->table} {$R44249C36FC2615B032F3832EF30CB9C2}"; mysql_query($R130D64A4AD653C91E0FD80DE8FEADC3A) or die("Couldn't execute query. " . mysql_error()); break; case "edit": unset($R7318A606A3118D468DAE7078098FBA7B['id']); unset($R7318A606A3118D468DAE7078098FBA7B['oper']); $R44249C36FC2615B032F3832EF30CB9C2 = array(); $RA94EF3EDEBBECC120DD9EC4D9CB90BD1 = array(); foreach ($R7318A606A3118D468DAE7078098FBA7B as $RA09FE38AF36F6839F4A75051DC7CEA25 => $RA3D52E52A48936CDE0F5356BB08652F2) { if (strstr($RA09FE38AF36F6839F4A75051DC7CEA25, "::") !== false) { list($RCC5C6E696C11A4FDF170ECE8BA9FDC6F, $RA09FE38AF36F6839F4A75051DC7CEA25) = explode("::", $RA09FE38AF36F6839F4A75051DC7CEA25); } $RA09FE38AF36F6839F4A75051DC7CEA25 = addslashes($RA09FE38AF36F6839F4A75051DC7CEA25); $RA3D52E52A48936CDE0F5356BB08652F2 = addslashes($RA3D52E52A48936CDE0F5356BB08652F2); $R44249C36FC2615B032F3832EF30CB9C2[] = "{$RA09FE38AF36F6839F4A75051DC7CEA25}='{$RA3D52E52A48936CDE0F5356BB08652F2}'"; $RA94EF3EDEBBECC120DD9EC4D9CB90BD1[$RA09FE38AF36F6839F4A75051DC7CEA25] = $RA3D52E52A48936CDE0F5356BB08652F2; } $R44249C36FC2615B032F3832EF30CB9C2 = "SET " . implode(",", $R44249C36FC2615B032F3832EF30CB9C2); if (strstr($R2753F3199DFA4EABAA38569B441BB9BB, "::") !== false) { $R2753F3199DFA4EABAA38569B441BB9BB = explode("::", $R2753F3199DFA4EABAA38569B441BB9BB); $R2753F3199DFA4EABAA38569B441BB9BB = $R2753F3199DFA4EABAA38569B441BB9BB[1]; } if (!empty($this->events["on_update"])) { $R94F2A42E16297B91A9F03B5E4B01132B = $this->events["on_update"][0]; $R602BAA072843820A45861C75C510C77E = $this->events["on_update"][1]; $R8676B010EDB4835BFD8EAE388F5D769F = $this->events["on_update"][2]; if ($R602BAA072843820A45861C75C510C77E) { call_user_method($R94F2A42E16297B91A9F03B5E4B01132B, $R602BAA072843820A45861C75C510C77E, array($R2753F3199DFA4EABAA38569B441BB9BB => $R3584859062EA9ECFB39B93BFCEF8E869, "params" => $RA94EF3EDEBBECC120DD9EC4D9CB90BD1)); } else { call_user_func($R94F2A42E16297B91A9F03B5E4B01132B, array($R2753F3199DFA4EABAA38569B441BB9BB => $R3584859062EA9ECFB39B93BFCEF8E869, "params" => $RA94EF3EDEBBECC120DD9EC4D9CB90BD1)); } if (!$R8676B010EDB4835BFD8EAE388F5D769F) { break; } } $R130D64A4AD653C91E0FD80DE8FEADC3A = "UPDATE {$this->table} {$R44249C36FC2615B032F3832EF30CB9C2} WHERE {$R2753F3199DFA4EABAA38569B441BB9BB} = {$R3584859062EA9ECFB39B93BFCEF8E869}"; mysql_query($R130D64A4AD653C91E0FD80DE8FEADC3A) or die("Couldn't execute query. " . mysql_error()); break; case "del": if (strstr($R2753F3199DFA4EABAA38569B441BB9BB, "::") !== false) { $R2753F3199DFA4EABAA38569B441BB9BB = explode("::", $R2753F3199DFA4EABAA38569B441BB9BB); $R2753F3199DFA4EABAA38569B441BB9BB = $R2753F3199DFA4EABAA38569B441BB9BB[1]; } if (!empty($this->events["on_delete"])) { $R94F2A42E16297B91A9F03B5E4B01132B = $this->events["on_delete"][0]; $R602BAA072843820A45861C75C510C77E = $this->events["on_delete"][1]; $R8676B010EDB4835BFD8EAE388F5D769F = $this->events["on_delete"][2]; if ($R602BAA072843820A45861C75C510C77E) { call_user_method($R94F2A42E16297B91A9F03B5E4B01132B, $R602BAA072843820A45861C75C510C77E, array($R2753F3199DFA4EABAA38569B441BB9BB => $R3584859062EA9ECFB39B93BFCEF8E869)); } else { call_user_func($R94F2A42E16297B91A9F03B5E4B01132B, array($R2753F3199DFA4EABAA38569B441BB9BB => $R3584859062EA9ECFB39B93BFCEF8E869)); } if (!$R8676B010EDB4835BFD8EAE388F5D769F) { break; } } $R130D64A4AD653C91E0FD80DE8FEADC3A = "DELETE FROM {$this->table} WHERE {$R2753F3199DFA4EABAA38569B441BB9BB} IN ({$R3584859062EA9ECFB39B93BFCEF8E869})"; mysql_query($R130D64A4AD653C91E0FD80DE8FEADC3A) or die("Couldn't execute query. " . mysql_error()); break; } die; } $R1DE5EB826FD16191A583C874762A090C = ""; $RB2591AD347B389A9C8CBAE0812E33504 = $this->strip($_REQUEST['_search']); if ($RB2591AD347B389A9C8CBAE0812E33504 == 'true') { $R4AED8984E5B2FD9141093D19A7D35A9E = $this->strip($_REQUEST['searchField']); $R246159316604D58DB8DE9F848709E772 = array(); foreach ($this->options["colModel"] as $RDC72801A64A9084B77642D2A5707C5BD) { $R246159316604D58DB8DE9F848709E772[] = $RDC72801A64A9084B77642D2A5707C5BD["index"]; } if (!$R4AED8984E5B2FD9141093D19A7D35A9E) { $RABB3D330BA391544BA91CB840322048A = $this->strip($_REQUEST['filters']); $R1DE5EB826FD16191A583C874762A090C = $this->construct_where($RABB3D330BA391544BA91CB840322048A); } else { if (in_array($R4AED8984E5B2FD9141093D19A7D35A9E, $R246159316604D58DB8DE9F848709E772)) { $RDF70A84BA2309C68417BE460189BE4AB = $this->strip($_REQUEST['searchString']); $REAA219F0FBD8E8A3DA05387318316513 = $this->strip($_REQUEST['searchOper']); $R1DE5EB826FD16191A583C874762A090C .= " AND " . $R4AED8984E5B2FD9141093D19A7D35A9E; switch ($REAA219F0FBD8E8A3DA05387318316513) { case "eq": if (is_numeric($RDF70A84BA2309C68417BE460189BE4AB)) { $R1DE5EB826FD16191A583C874762A090C .= " = " . $RDF70A84BA2309C68417BE460189BE4AB; } else { $R1DE5EB826FD16191A583C874762A090C .= " = '" . $RDF70A84BA2309C68417BE460189BE4AB . "'"; } break; case "ne": if (is_numeric($RDF70A84BA2309C68417BE460189BE4AB)) { $R1DE5EB826FD16191A583C874762A090C .= " <> " . $RDF70A84BA2309C68417BE460189BE4AB; } else { $R1DE5EB826FD16191A583C874762A090C .= " <> '" . $RDF70A84BA2309C68417BE460189BE4AB . "'"; } break; case "lt": if (is_numeric($RDF70A84BA2309C68417BE460189BE4AB)) { $R1DE5EB826FD16191A583C874762A090C .= " < " . $RDF70A84BA2309C68417BE460189BE4AB; } else { $R1DE5EB826FD16191A583C874762A090C .= " < '" . $RDF70A84BA2309C68417BE460189BE4AB . "'"; } break; case "le": if (is_numeric($RDF70A84BA2309C68417BE460189BE4AB)) { $R1DE5EB826FD16191A583C874762A090C .= " <= " . $RDF70A84BA2309C68417BE460189BE4AB; } else { $R1DE5EB826FD16191A583C874762A090C .= " <= '" . $RDF70A84BA2309C68417BE460189BE4AB . "'"; } break; case "gt": if (is_numeric($RDF70A84BA2309C68417BE460189BE4AB)) { $R1DE5EB826FD16191A583C874762A090C .= " > " . $RDF70A84BA2309C68417BE460189BE4AB; } else { $R1DE5EB826FD16191A583C874762A090C .= " > '" . $RDF70A84BA2309C68417BE460189BE4AB . "'"; } break; case "ge": if (is_numeric($RDF70A84BA2309C68417BE460189BE4AB)) { $R1DE5EB826FD16191A583C874762A090C .= " >= " . $RDF70A84BA2309C68417BE460189BE4AB; } else { $R1DE5EB826FD16191A583C874762A090C .= " >= '" . $RDF70A84BA2309C68417BE460189BE4AB . "'"; } break; case "ew": $R1DE5EB826FD16191A583C874762A090C .= " LIKE '%" . $RDF70A84BA2309C68417BE460189BE4AB . "'"; break; case "en": $R1DE5EB826FD16191A583C874762A090C .= " NOT LIKE '%" . $RDF70A84BA2309C68417BE460189BE4AB . "'"; break; case "cn": $R1DE5EB826FD16191A583C874762A090C .= " LIKE '%" . $RDF70A84BA2309C68417BE460189BE4AB . "%'"; break; case "nc": $R1DE5EB826FD16191A583C874762A090C .= " NOT LIKE '%" . $RDF70A84BA2309C68417BE460189BE4AB . "%'"; break; case "in": $R1DE5EB826FD16191A583C874762A090C .= " IN (" . $RDF70A84BA2309C68417BE460189BE4AB . ")"; break; case "ni": $R1DE5EB826FD16191A583C874762A090C .= " NOT IN (" . $RDF70A84BA2309C68417BE460189BE4AB . ")"; break; case "bw": default: $RDF70A84BA2309C68417BE460189BE4AB .= "%"; $R1DE5EB826FD16191A583C874762A090C .= " LIKE '" . $RDF70A84BA2309C68417BE460189BE4AB . "'"; break; } } } $_SESSION["jqgrid_filter"] = $R1DE5EB826FD16191A583C874762A090C; } elseif ($RB2591AD347B389A9C8CBAE0812E33504 == 'false') { $_SESSION["jqgrid_filter"] = ''; } if ($_GET['page']) { $R71A6FD054F6EBC38E69167AB39449848 = $_GET['page']; $RFED47D15719EF82BD3F83B580230DA5B = $_GET['rows']; $R23D3D9B8DFA4E4368DA39400B9C86AE0 = $_GET['sidx']; $RD8DCC7F148C8D95B199B9E279DACA58B = $_GET['sord']; if (!$R23D3D9B8DFA4E4368DA39400B9C86AE0) { $R23D3D9B8DFA4E4368DA39400B9C86AE0 = 1; } if (!$RFED47D15719EF82BD3F83B580230DA5B) { $RFED47D15719EF82BD3F83B580230DA5B = 20; } $R23D3D9B8DFA4E4368DA39400B9C86AE0 = str_replace("::", ".", $R23D3D9B8DFA4E4368DA39400B9C86AE0); if ($this->actions["export"] !== false && $_GET["export"]) { $R2322221D09E72D62CE8923BF936F088E = array(); $R8215FC713714746F7372553678F08C50 = ""; if ($this->options["export"]["range"] == "filtered") { $R8215FC713714746F7372553678F08C50 = $_SESSION["jqgrid_filter"]; } if (($R2A039ED8FDBF4CEAA9E79CDC3AECD1A2 = stripos($this->select_command, "GROUP BY")) !== false) { $RBE4C4D037E939226F65812885A53DAD9 = substr($this->select_command, 0, $R2A039ED8FDBF4CEAA9E79CDC3AECD1A2); $R19B21277FE0A89473E38CE571FDAFE89 = substr($this->select_command, $R2A039ED8FDBF4CEAA9E79CDC3AECD1A2); $R3DBA9CA9C983EE1579A11D1F9DCCB80B = $RBE4C4D037E939226F65812885A53DAD9 . $R8215FC713714746F7372553678F08C50 . $R19B21277FE0A89473E38CE571FDAFE89 . " ORDER BY {$R23D3D9B8DFA4E4368DA39400B9C86AE0} {$RD8DCC7F148C8D95B199B9E279DACA58B}"; } else { $R3DBA9CA9C983EE1579A11D1F9DCCB80B = $this->select_command . $R8215FC713714746F7372553678F08C50 . " ORDER BY {$R23D3D9B8DFA4E4368DA39400B9C86AE0} {$RD8DCC7F148C8D95B199B9E279DACA58B}"; } $R679E9B9234E2062F809DBD3325D37FB6 = mysql_query($R3DBA9CA9C983EE1579A11D1F9DCCB80B) or die("Couldn't execute query. " . mysql_error()); $R8C133456E7D7948044667AE76D7692B3 = array(); if ($this->options["colModel"]) { foreach ($this->options["colModel"] as $R3E33E017CD76B9B7E6C7364FB91E2E90) { if ($R3E33E017CD76B9B7E6C7364FB91E2E90["export"] === false) { $R8C133456E7D7948044667AE76D7692B3[] = $R3E33E017CD76B9B7E6C7364FB91E2E90["name"]; } } } foreach ($this->options["colModel"] as $R3E33E017CD76B9B7E6C7364FB91E2E90) { $R972A1D6D7FBAA83B27C6006E2C7CBC3F[$R3E33E017CD76B9B7E6C7364FB91E2E90["name"]] = $R3E33E017CD76B9B7E6C7364FB91E2E90["title"]; } $R2322221D09E72D62CE8923BF936F088E[] = $R972A1D6D7FBAA83B27C6006E2C7CBC3F; while ($R4EEB713E57BBAAF1217CF39632604473 = mysql_fetch_array($R679E9B9234E2062F809DBD3325D37FB6, MYSQL_ASSOC)) { $R2322221D09E72D62CE8923BF936F088E[] = $R4EEB713E57BBAAF1217CF39632604473; } if (!empty($R8C133456E7D7948044667AE76D7692B3)) { $R4E614DB68169D1467244C51FD0753885 = array(); foreach ($R2322221D09E72D62CE8923BF936F088E as $RDB051EBB8314CF943CDF8C76FFABA176) { foreach ($RDB051EBB8314CF943CDF8C76FFABA176 as $RA09FE38AF36F6839F4A75051DC7CEA25 => $RA16D2280393CE6A2A5428A4A8D09E354) { if (in_array($RA09FE38AF36F6839F4A75051DC7CEA25, $R8C133456E7D7948044667AE76D7692B3)) { unset($RDB051EBB8314CF943CDF8C76FFABA176[$RA09FE38AF36F6839F4A75051DC7CEA25]); } } $R4E614DB68169D1467244C51FD0753885[] = $RDB051EBB8314CF943CDF8C76FFABA176; } $R2322221D09E72D62CE8923BF936F088E = $R4E614DB68169D1467244C51FD0753885; } if (!$this->options["export"]["filename"]) { $this->options["export"]["filename"] = $R4BC8E01FD735B288AE2C70A47401309E; } if (!$this->options["export"]["sheetname"]) { $this->options["export"]["sheetname"] = ucwords($R4BC8E01FD735B288AE2C70A47401309E) . " Sheet"; } if ($this->options["export"]["format"] == "pdf") { require_once "dompdf/dompdf_config.inc.php"; $R9906335164C88242D6E7C68FD92565AF = ""; $R9906335164C88242D6E7C68FD92565AF .= "<style>td{font-size:11px; font-family:Courier}</style>"; $R9906335164C88242D6E7C68FD92565AF .= "<h1 style='border-bottom:1px solid black'>" . $this->options["export"]["heading"] . "</h1>"; $R9906335164C88242D6E7C68FD92565AF .= "<table border='0' cellpadding='2' cellspacing='2'>"; $RA16D2280393CE6A2A5428A4A8D09E354 = 0; foreach ($R2322221D09E72D62CE8923BF936F088E as $RA3D52E52A48936CDE0F5356BB08652F2) { $R89A35F576DFC447C286E56295D970E74 = $RA16D2280393CE6A2A5428A4A8D09E354++ % 2 ? "bgcolor='#efefef'" : ""; $R9906335164C88242D6E7C68FD92565AF .= "<tr>"; foreach ($RA3D52E52A48936CDE0F5356BB08652F2 as $R20FD65E9C7406034FADC682F06732868) { $R9906335164C88242D6E7C68FD92565AF .= "<td {$R89A35F576DFC447C286E56295D970E74}>{$R20FD65E9C7406034FADC682F06732868}</td>"; } $R9906335164C88242D6E7C68FD92565AF .= "</tr>"; } $R9906335164C88242D6E7C68FD92565AF .= "<table>"; $R0A0EAFAD473E2E19876D6FAEAAF556F7 = ini_set("memory_limit", "16M"); $R28EF232B792BA24222CE81FCE3864BE2 = new DOMPDF(); $R28EF232B792BA24222CE81FCE3864BE2->load_html($R9906335164C88242D6E7C68FD92565AF); $R28EF232B792BA24222CE81FCE3864BE2->set_paper($this->options["export"]["paper"], $this->options["export"]["orientation"]); $R28EF232B792BA24222CE81FCE3864BE2->render(); $R28EF232B792BA24222CE81FCE3864BE2->stream($this->options["export"]["filename"] . ".pdf"); } else { include "php-excel.class.php"; $RAB137FAC01BDA319F8CA51B777DD3B53 = new Excel_XML('UTF-8', true, $this->options["export"]["sheetname"]); $RAB137FAC01BDA319F8CA51B777DD3B53->addArray($R2322221D09E72D62CE8923BF936F088E); $RAB137FAC01BDA319F8CA51B777DD3B53->generateXML($this->options["export"]["filename"]); } die; } if (($R2A039ED8FDBF4CEAA9E79CDC3AECD1A2 = stripos($this->select_command, "GROUP BY")) !== false) { $RAB5ED0112EFC44137E2EF7E93D62EE50 = preg_replace("/SELECT (.*) FROM/i", "SELECT 1 as c FROM", $this->select_command); $R2A039ED8FDBF4CEAA9E79CDC3AECD1A2 = stripos($RAB5ED0112EFC44137E2EF7E93D62EE50, "GROUP BY"); $R0C9B969C7F0E60CDF57B781D8DF77BE2 = substr($RAB5ED0112EFC44137E2EF7E93D62EE50, 0, $R2A039ED8FDBF4CEAA9E79CDC3AECD1A2); $RA2D6A66E917FA575C744BDE7F91D9FBD = substr($RAB5ED0112EFC44137E2EF7E93D62EE50, $R2A039ED8FDBF4CEAA9E79CDC3AECD1A2); $RAB5ED0112EFC44137E2EF7E93D62EE50 = "SELECT count(*) as c FROM ({$R0C9B969C7F0E60CDF57B781D8DF77BE2} {$R1DE5EB826FD16191A583C874762A090C} {$R39B03A32FEFD285ED4E488938C8E4A8A}) as o"; } else { $RAB5ED0112EFC44137E2EF7E93D62EE50 = $this->select_command . $R1DE5EB826FD16191A583C874762A090C; $RAB5ED0112EFC44137E2EF7E93D62EE50 = "SELECT count(*) as c FROM (" . $RAB5ED0112EFC44137E2EF7E93D62EE50 . ") as table_count"; } $R679E9B9234E2062F809DBD3325D37FB6 = mysql_query($RAB5ED0112EFC44137E2EF7E93D62EE50) or die("Couldn't execute query. " . mysql_error()); $R4EEB713E57BBAAF1217CF39632604473 = mysql_fetch_array($R679E9B9234E2062F809DBD3325D37FB6, MYSQL_ASSOC); $RA1D44C0654A40984A103C270FFB9BF33 = $R4EEB713E57BBAAF1217CF39632604473['c']; if ($RA1D44C0654A40984A103C270FFB9BF33 > 0) { $R742E28A3470962E8B08929B92FED9841 = ceil($RA1D44C0654A40984A103C270FFB9BF33 / $RFED47D15719EF82BD3F83B580230DA5B); } else { $R742E28A3470962E8B08929B92FED9841 = 0; } if ($R71A6FD054F6EBC38E69167AB39449848 > $R742E28A3470962E8B08929B92FED9841) { $R71A6FD054F6EBC38E69167AB39449848 = $R742E28A3470962E8B08929B92FED9841; } $RBE4C4D037E939226F65812885A53DAD9 = $RFED47D15719EF82BD3F83B580230DA5B * $R71A6FD054F6EBC38E69167AB39449848 - $RFED47D15719EF82BD3F83B580230DA5B; if ($RBE4C4D037E939226F65812885A53DAD9 < 0) { $RBE4C4D037E939226F65812885A53DAD9 = 0; } $R674635BCB9D7D69791FDBB3B5D56DF5D->page = $R71A6FD054F6EBC38E69167AB39449848; $R674635BCB9D7D69791FDBB3B5D56DF5D->total = $R742E28A3470962E8B08929B92FED9841; $R674635BCB9D7D69791FDBB3B5D56DF5D->records = $RA1D44C0654A40984A103C270FFB9BF33; if (($R2A039ED8FDBF4CEAA9E79CDC3AECD1A2 = stripos($this->select_command, "GROUP BY")) !== false) { $R0C9B969C7F0E60CDF57B781D8DF77BE2 = substr($this->select_command, 0, $R2A039ED8FDBF4CEAA9E79CDC3AECD1A2); $R39B03A32FEFD285ED4E488938C8E4A8A = substr($this->select_command, $R2A039ED8FDBF4CEAA9E79CDC3AECD1A2); $R3DBA9CA9C983EE1579A11D1F9DCCB80B = "{$R0C9B969C7F0E60CDF57B781D8DF77BE2} {$R1DE5EB826FD16191A583C874762A090C} {$R39B03A32FEFD285ED4E488938C8E4A8A} ORDER BY {$R23D3D9B8DFA4E4368DA39400B9C86AE0} {$RD8DCC7F148C8D95B199B9E279DACA58B} LIMIT {$RBE4C4D037E939226F65812885A53DAD9}, {$RFED47D15719EF82BD3F83B580230DA5B}"; } else { $R3DBA9CA9C983EE1579A11D1F9DCCB80B = $this->select_command . $R1DE5EB826FD16191A583C874762A090C . " ORDER BY {$R23D3D9B8DFA4E4368DA39400B9C86AE0} {$RD8DCC7F148C8D95B199B9E279DACA58B} LIMIT {$RBE4C4D037E939226F65812885A53DAD9}, {$RFED47D15719EF82BD3F83B580230DA5B}"; } $R679E9B9234E2062F809DBD3325D37FB6 = mysql_query($R3DBA9CA9C983EE1579A11D1F9DCCB80B) or die("Couldn't execute query. " . mysql_error()); while ($R4EEB713E57BBAAF1217CF39632604473 = mysql_fetch_array($R679E9B9234E2062F809DBD3325D37FB6, MYSQL_ASSOC)) { foreach ($this->options["colModel"] as $R3E33E017CD76B9B7E6C7364FB91E2E90) { $R565CE24E665D0C6F383AEA8C9DC17B27 = str_replace(".", "::", $R3E33E017CD76B9B7E6C7364FB91E2E90["name"]); if ($R3E33E017CD76B9B7E6C7364FB91E2E90["formatter"] == "image") { $R60BDA7385E13A62AA6FD1F1FEC071BC7 = array(); foreach ($R3E33E017CD76B9B7E6C7364FB91E2E90["formatoptions"] as $RA09FE38AF36F6839F4A75051DC7CEA25 => $RA3D52E52A48936CDE0F5356BB08652F2) { $R60BDA7385E13A62AA6FD1F1FEC071BC7[] = "{$RA09FE38AF36F6839F4A75051DC7CEA25}='{$RA3D52E52A48936CDE0F5356BB08652F2}'"; } $R60BDA7385E13A62AA6FD1F1FEC071BC7 = implode(" ", $R60BDA7385E13A62AA6FD1F1FEC071BC7); $R4EEB713E57BBAAF1217CF39632604473[$R565CE24E665D0C6F383AEA8C9DC17B27] = "<img {$R60BDA7385E13A62AA6FD1F1FEC071BC7} src='" . $R4EEB713E57BBAAF1217CF39632604473[$R565CE24E665D0C6F383AEA8C9DC17B27] . "'>"; } if (!empty($R3E33E017CD76B9B7E6C7364FB91E2E90["link"])) { foreach ($this->options["colModel"] as $R7BFD22312AFC202571C98E50BD3A3E5B) { $RA0C95E76B5BEFAD1716FD2144FAF4BDA = str_replace(".", "::", $R7BFD22312AFC202571C98E50BD3A3E5B["name"]); $RA4139DE6AC782C986E25FADCEB6B17D2 = urlencode($R4EEB713E57BBAAF1217CF39632604473[$RA0C95E76B5BEFAD1716FD2144FAF4BDA]); $R3E33E017CD76B9B7E6C7364FB91E2E90["link"] = str_replace("{" . $R7BFD22312AFC202571C98E50BD3A3E5B["name"] . "}", $RA4139DE6AC782C986E25FADCEB6B17D2, $R3E33E017CD76B9B7E6C7364FB91E2E90["link"]); } if (!empty($R3E33E017CD76B9B7E6C7364FB91E2E90["linkoptions"])) { $R60BDA7385E13A62AA6FD1F1FEC071BC7 = $R3E33E017CD76B9B7E6C7364FB91E2E90["linkoptions"]; } $R4EEB713E57BBAAF1217CF39632604473[$R565CE24E665D0C6F383AEA8C9DC17B27] = "<a {$R60BDA7385E13A62AA6FD1F1FEC071BC7} href='{$R3E33E017CD76B9B7E6C7364FB91E2E90["link"]}'>{$R4EEB713E57BBAAF1217CF39632604473[$R565CE24E665D0C6F383AEA8C9DC17B27]}</a>"; } if ($R3E33E017CD76B9B7E6C7364FB91E2E90["formatter"] == "password") { $R4EEB713E57BBAAF1217CF39632604473[$R565CE24E665D0C6F383AEA8C9DC17B27] = "*****"; } } foreach ($R4EEB713E57BBAAF1217CF39632604473 as $RA09FE38AF36F6839F4A75051DC7CEA25 => $RAA7BB4B05FBD27DB7CA594893F166B47) { $R4EEB713E57BBAAF1217CF39632604473[$RA09FE38AF36F6839F4A75051DC7CEA25] = stripslashes($R4EEB713E57BBAAF1217CF39632604473[$RA09FE38AF36F6839F4A75051DC7CEA25]); } $R674635BCB9D7D69791FDBB3B5D56DF5D->rows[] = $R4EEB713E57BBAAF1217CF39632604473; } echo json_encode($R674635BCB9D7D69791FDBB3B5D56DF5D); die; } $this->options["pager"] = '#' . $R4BC8E01FD735B288AE2C70A47401309E . "_pager"; $this->options["jsonReader"] = array("repeatitems" => false, "id" => "0"); if ($this->actions["edit"] === false || $this->actions["delete"] === false || $this->options["cellEdit"] === true) { $this->actions["rowactions"] = false; } if ($this->actions["rowactions"] !== false) { $this->options["colNames"][] = "Actions"; $R6B6E98CDE8B33087A33E4D3A497BD86B = false; foreach ($this->options["colModel"] as $R3E33E017CD76B9B7E6C7364FB91E2E90) { if (!empty($R3E33E017CD76B9B7E6C7364FB91E2E90["width"])) { $R6B6E98CDE8B33087A33E4D3A497BD86B = true; break; } } if ($R6B6E98CDE8B33087A33E4D3A497BD86B) { $this->options["colModel"][] = array("name" => "act", "align" => "center", "index" => "act", "width" => "30", "sortable" => false, "search" => false); } else { $this->options["colModel"][] = array("name" => "act", "align" => "center", "index" => "act", "sortable" => false, "search" => false); } } $R4A18FB3F34307C291A1914D7471481C9 = json_encode_jsfunc($this->options); $R4A18FB3F34307C291A1914D7471481C9 = substr($R4A18FB3F34307C291A1914D7471481C9, 0, strlen($R4A18FB3F34307C291A1914D7471481C9) - 1); if ($this->actions["rowactions"] !== false) { $R4A18FB3F34307C291A1914D7471481C9 .= ",'gridComplete': function(){ var ids = jQuery('#{$R4BC8E01FD735B288AE2C70A47401309E}').jqGrid('getDataIDs'); for(var i=0;i < ids.length;i++){ var cl = ids[i]; be = ' <a title=\"Edit this row\" href=\"javascript:void(0);\" onclick=\"jQuery(\\'#{$R4BC8E01FD735B288AE2C70A47401309E}\\').editRow('+cl+',true); jQuery(this).parent().hide(); jQuery(this).parent().next().show(); \">Edit</a>'; de = ' | <a title=\"Delete this row\" href=\"javascript:void(0);\" onclick=\"jQuery(\\'#{$R4BC8E01FD735B288AE2C70A47401309E}\\').delGridRow('+cl+'); \">Delete</a>'; se = ' <a title=\"Save this row\" href=\"javascript:void(0);\" onclick=\"jQuery(\\'#{$R4BC8E01FD735B288AE2C70A47401309E}\\').saveRow('+cl+'); jQuery(this).parent().hide(); jQuery(this).parent().prev().show();\">Save</a>'; ce = ' | <a title=\"Restore this row\" href=\"javascript:void(0);\" onclick=\"jQuery(\\'#{$R4BC8E01FD735B288AE2C70A47401309E}\\').restoreRow('+cl+'); jQuery(this).parent().hide(); jQuery(this).parent().prev().show();\">Cancel</a>'; jQuery('#{$R4BC8E01FD735B288AE2C70A47401309E}').jqGrid('setRowData',ids[i],{act:'<span id=\"edit_row_'+cl+'\">'+be+de+'</span>'+'<span style=display:none id=\"save_row_'+cl+'\">'+se+ce+'</span>'}); } }"; } if ($this->actions["edit"] !== false && $this->options["cellEdit"] !== true) { $R4A18FB3F34307C291A1914D7471481C9 .= ",'ondblClickRow':function(id) { if(id && id!==lastSel){ jQuery('#{$R4BC8E01FD735B288AE2C70A47401309E}').restoreRow(lastSel); jQuery('#edit_row_'+lastSel).show(); jQuery('#save_row_'+lastSel).hide(); lastSel=id; } jQuery('#{$R4BC8E01FD735B288AE2C70A47401309E}').editRow(id, true, function(){}, function(){ jQuery('#edit_row_'+id).show(); jQuery('#save_row_'+id).hide(); return true; },null,null,null,null, function(){ jQuery('#edit_row_'+id).show(); jQuery('#save_row_'+id).hide(); return true; } ); jQuery('#edit_row_'+id).hide(); jQuery('#save_row_'+id).show(); }"; } if ($this->options["subgridurl"] != '') { $RD82DF3779EBBBE173C5A990F17DBA23D = "false"; if (!empty($this->options["subgridparams"])) { $RD82DF3779EBBBE173C5A990F17DBA23D = "true"; } $R4A18FB3F34307C291A1914D7471481C9 .= ",'subGridRowExpanded': function(subgridid, id) { var data = {subgrid:subgridid, rowid:id}; if('{$RD82DF3779EBBBE173C5A990F17DBA23D}' == 'true') { var anm= '" . $this->options["subgridparams"] . "'; anm = anm.split(','); var rd = jQuery('#" . $R4BC8E01FD735B288AE2C70A47401309E . "').jqGrid('getRowData', id); if(rd) { for(var i=0; i<anm.length; i++) { if(rd[anm[i]]) { data[anm[i]] = rd[anm[i]]; } } } } jQuery('#'+jQuery.jgrid.jqID(subgridid)).load('" . $this->options["subgridurl"] . "',data); }"; } $R4A18FB3F34307C291A1914D7471481C9 .= "}"; ob_start(); ?> <table id="<?php echo $R4BC8E01FD735B288AE2C70A47401309E; ?> "></table> <div id="<?php echo $R4BC8E01FD735B288AE2C70A47401309E . "_pager"; ?> "></div> <script> jQuery(document).ready(function(){ <?php echo $this->render_js($R4BC8E01FD735B288AE2C70A47401309E, $R4A18FB3F34307C291A1914D7471481C9); ?> }); </script> <?php return ob_get_clean(); }