예제 #1
0
 public function renderCalendar($element, $script = true, $echo = true)
 {
     $s = "";
     if ($script) {
         $s .= "<script type='text/javascript'>";
         $s .= "jQuery(document).ready(function() {";
     }
     $s .= "if(jQuery.ui) { if(jQuery.ui.datepicker) { ";
     if ($this->buttonIcon || $this->buttonOnly) {
         $s .= "jQuery('" . $element . "').after('<button>Calendar</button>').next()";
         $s .= ".button({icons:{primary: 'ui-icon-calendar'}, text:false})";
         $s .= ".css({'font-size':'" . $this->fontsize . "'})";
         $s .= ".click(function(e){jQuery('" . $element . "').datepicker('show');return false;});";
     }
     if ($this->buttonOnly) {
         $this->setOption('showOn', 'button');
     }
     $s .= "jQuery('" . $element . "').datepicker(" . jqGridUtils::encode($this->coptions) . ");";
     if ($this->buttonOnly) {
         // delete the auto generated button.
         $s .= "jQuery('.ui-datepicker-trigger').remove();";
     }
     $s .= "jQuery('.ui-datepicker').css({'font-size':'" . $this->fontsize . "'});";
     $s .= "} }";
     if ($script) {
         $s .= " });</script>";
     }
     if ($echo) {
         echo $s;
     } else {
         return $s;
     }
 }
예제 #2
0
<?php

require_once '../../../jq-config.php';
require_once ABSPATH . "php/jqUtils.php";
require_once ABSPATH . "php/jqChart.php";
ini_set("display_errors", "1");
$data = array(array("y" => 55.11, "color" => "js:colors[0]", "drilldown" => array("name" => 'MSIE versions', "categories" => array('MSIE 6.0', 'MSIE 7.0', 'MSIE 8.0', 'MSIE 9.0'), "data" => array(10.85, 7.35, 33.06, 2.81), "color" => "js:colors[0]")), array("y" => 21.63, "color" => "js:colors[1]", "drilldown" => array("name" => 'Firefox versions', "categories" => array('Firefox 2.0', 'Firefox 3.0', 'Firefox 3.5', 'Firefox 3.6', 'Firefox 4.0'), "data" => array(0.2, 0.83, 1.58, 13.12, 5.43), "color" => "js:colors[1]")), array("y" => 11.94, "color" => "js:colors[2]", "drilldown" => array("name" => 'Chrome versions', "categories" => array('Chrome 5.0', 'Chrome 6.0', 'Chrome 7.0', 'Chrome 8.0', 'Chrome 9.0', 'Chrome 10.0', 'Chrome 11.0', 'Chrome 12.0'), "data" => array(0.12, 0.19, 0.12, 0.36, 0.32, 9.91, 0.5, 0.22), "color" => "js:colors[2]")), array("y" => 7.15, "color" => "js:colors[3]", "drilldown" => array("name" => 'Safari versions', "categories" => array('Safari 5.0', 'Safari 4.0', 'Safari Win 5.0', 'Safari 4.1', 'Safari/Maxthon', 'Safari 3.1', 'Safari 4.1'), "data" => array(4.55, 1.42, 0.23, 0.21, 0.2, 0.19, 0.14), "color" => "js:colors[3]")));
$sdata = jqGridUtils::encode($data);
$click = <<<CLICK
function(){
\tvar drilldown = this.drilldown; 
\tif (drilldown) { 
\t\tsetChart(drilldown.name, drilldown.categories, drilldown.data, drilldown.color);
\t} else {
\t\tsetChart(name, categories, {$sdata});
\t}
}
CLICK;
$chart = new jqChart();
$chart->setChartOptions(array("defaultSeriesType" => "column"))->setTitle(array('text' => 'Browser market share, April, 2011'))->setSubtitle(array("text" => "Click the columns to view versions. Click again to view brands."))->setxAxis(array("categories" => array('MSIE', 'Firefox', 'Chrome', 'Safari', 'Opera')))->setyAxis(array("title" => array("text" => "Total percent market share")))->setTooltip(array("formatter" => "function(){var point = this.point, s = this.x +':<b>'+ this.y +'% market share</b><br/>'; if (point.drilldown) {s += 'Click to view '+ point.category +' versions';} else {s += 'Click to return to browser brands';} return s;}"))->setPlotOptions(array("column" => array("cursor" => 'pointer', "point" => array("events" => array("click" => "js:" . $click), "dataLabels" => array("enabled" => true, "color" => "js:Highcharts.getOptions().colors[0]", "style" => array("fontWeight" => 'bold'), "formatter" => "js:function(){return this.y +'%';}")))))->addSeries('Browser brands', $data);
$setser = <<<SETSER
function setChart(name, categories, data, color) {
\tchart.xAxis[0].setCategories(categories);
\tchart.series[0].remove();
\tchart.addSeries({
\t\tname: name,
\t\tdata: data,
\t\tcolor: color || 'white'
     });
}
SETSER;
예제 #3
0
    /**
     * Main method which do allmost everthing for the grid.
     * Construct the grid, perform CRUD operations, perform Query and serch operations,
     * export to excel, set a jqGrid method, and javascript code
     * @param string $tblelement the id of the table element to costrict the grid
     * @param string $pager the id for the pager element
     * @param boolean $script if set to true add a script tag before constructin the grid.
     * @param array $summary - set which columns should be sumarized in order to be displayed to the grid
     * By default this parameter uses SQL SUM function: array("colmodelname"=>"sqlname");
     * It can be set to use other one this way :
     * array("colmodelname"=>array("sqlname"=>"AVG"));
     * By default the first field correspond to the name of colModel the second to
     * the database name
     * @param array $params parameters passed to the query
     * @param boolean $createtbl if set to true the table element is created automatically
     * from this method. Default is false
     * @param boolean $createpg if set to true the pager element is created automatically
     * from this script. Default false.
     * @param boolean $echo if set to false the function return the string representing
     * the grid
     * @return mixed.
     */
    public function renderGrid($tblelement = '', $pager = '', $script = true, array $summary = null, array $params = null, $createtbl = false, $createpg = false, $echo = true)
    {
        $oper = $this->GridParams["oper"];
        $goper = $this->oper ? $this->oper : 'nooper';
        if ($goper == $this->GridParams["autocomplete"]) {
            return false;
        } else {
            if ($goper == $this->GridParams["excel"]) {
                if (!$this->export) {
                    return false;
                }
                $this->exportToExcel($summary, $params, $this->colModel, true, $this->exportfile);
            } else {
                if ($goper == "pdf") {
                    if (!$this->export) {
                        return false;
                    }
                    $this->exportToPdf($summary, $params, $this->colModel, $this->pdffile);
                } else {
                    if ($goper == "csv") {
                        if (!$this->export) {
                            return false;
                        }
                        $this->exportToCsv($summary, $params, $this->colModel, true, $this->csvfile, $this->csvsep, $this->csvsepreplace);
                    } else {
                        if (in_array($goper, array_values($this->GridParams))) {
                            if ($this->inlineNav) {
                                $this->getLastInsert = true;
                            }
                            return $this->editGrid($summary, $params, $goper, $echo);
                        } else {
                            if (!isset($this->gridOptions["datatype"])) {
                                $this->gridOptions["datatype"] = $this->dataType;
                            }
                            // hack for editable=true as default
                            $ed = true;
                            if (isset($this->gridOptions['cmTemplate'])) {
                                $edt = $this->gridOptions['cmTemplate'];
                                $ed = isset($edt['editable']) ? $edt['editable'] : true;
                            }
                            foreach ($this->colModel as $k => $cm) {
                                if (!isset($this->colModel[$k]['editable'])) {
                                    $this->colModel[$k]['editable'] = $ed;
                                }
                            }
                            $this->gridOptions['colModel'] = $this->colModel;
                            if (isset($this->gridOptions['postData'])) {
                                $this->gridOptions['postData'] = jqGridUtils::array_extend($this->gridOptions['postData'], array($oper => $this->GridParams["query"]));
                            } else {
                                $this->setGridOptions(array("postData" => array($oper => $this->GridParams["query"])));
                            }
                            if (isset($this->primaryKey)) {
                                $this->GridParams["id"] = $this->primaryKey;
                            }
                            $this->setGridOptions(array("prmNames" => $this->GridParams));
                            $s = '';
                            if ($createtbl) {
                                $tmptbl = $tblelement;
                                if (strpos($tblelement, "#") === false) {
                                    $tblelement = "#" . $tblelement;
                                } else {
                                    $tmptbl = substr($tblelement, 1);
                                }
                                $s .= "<table id='" . $tmptbl . "'></table>";
                            }
                            if (strlen($pager) > 0) {
                                $tmppg = $pager;
                                if (strpos($pager, "#") === false) {
                                    $pager = "#" . $pager;
                                } else {
                                    $tmppg = substr($pager, 1);
                                }
                                if ($createpg) {
                                    $s .= "<div id='" . $tmppg . "'></div>";
                                }
                            }
                            // set the Error handler for data
                            if (!isset($this->gridOptions['loadError'])) {
                                $err = "function(xhr,status, err){ try {jQuery.jgrid.info_dialog(jQuery.jgrid.errors.errcap,'<div class=\"ui-state-error\">'+ xhr.responseText +'</div>', jQuery.jgrid.edit.bClose,{buttonalign:'right'});} catch(e) { alert(xhr.responseText);} }";
                                $this->setGridEvent('loadError', $err);
                            }
                            //if(!isset($this->editOptions['mtype']) && $this->showError) {
                            //$this->setNavEvent('edit', 'afterSubmit', "function(res,pdata){ var result = res.responseText.split('#'); if(result[0]=='$this->successmsg') return [true,result[1],result[2]]; else return [false,result[1],'']; }");
                            //}
                            //if(!isset($this->addOptions['mtype']) && $this->showError) {
                            //$this->setNavEvent('add', 'afterSubmit', "function(res,pdata){ var result = res.responseText.split('#'); if(result[0]=='$this->successmsg') return [true,result[1],result[2]]; else return [false,result[1],''];}");
                            //}
                            if (strlen($pager) > 0) {
                                $this->setGridOptions(array("pager" => $pager));
                            }
                            //$this->editOptions['mtype'] = $this->mtype;
                            //$this->addOptions['mtype'] = $this->mtype;
                            //$this->delOptions['mtype'] = $this->mtype;
                            if ($this->sharedEditOptions == true) {
                                $this->gridOptions['editOptions'] = $this->editOptions;
                            }
                            if ($this->sharedAddOptions == true) {
                                $this->gridOptions['addOptions'] = $this->addOptions;
                            }
                            if ($this->sharedDelOptions == true) {
                                $this->gridOptions['delOptions'] = $this->delOptions;
                            }
                            if ($script) {
                                $s .= "<script type='text/javascript'>";
                                $s .= "jQuery(document).ready(function(\$) {";
                            }
                            $s .= "jQuery('" . $tblelement . "').jqGrid(" . jqGridUtils::encode($this->gridOptions) . ");";
                            if ($this->navigator && strlen($pager) > 0) {
                                $s .= "jQuery('" . $tblelement . "').jqGrid('navGrid','" . $pager . "'," . jqGridUtils::encode($this->navOptions);
                                $s .= "," . jqGridUtils::encode($this->editOptions);
                                $s .= "," . jqGridUtils::encode($this->addOptions);
                                $s .= "," . jqGridUtils::encode($this->delOptions);
                                $s .= "," . jqGridUtils::encode($this->searchOptions);
                                $s .= "," . jqGridUtils::encode($this->viewOptions) . ");";
                                if ($this->navOptions["excel"] == true) {
                                    $eurl = $this->getGridOption('url');
                                    $exexcel = <<<EXCELE
onClickButton : function(e)
{
\ttry {
\t\tjQuery("{$tblelement}").jqGrid('excelExport',{tag:'excel', url:'{$eurl}'});
\t} catch (e) {
\t\twindow.location= '{$eurl}?oper=excel';
\t}
}
EXCELE;
                                    $s .= "jQuery('" . $tblelement . "').jqGrid('navButtonAdd','" . $pager . "',{id:'" . $tmppg . "_excel', caption:'" . $this->expoptions['excel']['caption'] . "',title:'" . $this->expoptions['excel']['title'] . "'," . $exexcel . ",buttonicon:'" . $this->expoptions['excel']['buttonicon'] . "'});";
                                }
                                if ($this->navOptions["pdf"] == true) {
                                    $eurl = $this->getGridOption('url');
                                    $expdf = <<<PDFE
onClickButton : function(e)
{
\ttry {
\t\tjQuery("{$tblelement}").jqGrid('excelExport',{tag:'pdf', url:'{$eurl}'});
\t} catch (e) {
\t\twindow.location= '{$eurl}?oper=pdf';
\t}
}
PDFE;
                                    $s .= "jQuery('" . $tblelement . "').jqGrid('navButtonAdd','" . $pager . "',{id:'" . $tmppg . "_pdf',caption:'" . $this->expoptions['pdf']['caption'] . "',title:'" . $this->expoptions['pdf']['title'] . "'," . $expdf . ", buttonicon:'" . $this->expoptions['pdf']['buttonicon'] . "'});";
                                }
                                if ($this->navOptions["csv"] == true) {
                                    $eurl = $this->getGridOption('url');
                                    $excsv = <<<CSVE
onClickButton : function(e)
{
\ttry {
\t\tjQuery("{$tblelement}").jqGrid('excelExport',{tag:'csv', url:'{$eurl}'});
\t} catch (e) {
\t\twindow.location= '{$eurl}?oper=csv';
\t}
}
CSVE;
                                    $s .= "jQuery('" . $tblelement . "').jqGrid('navButtonAdd','" . $pager . "',{id:'" . $tmppg . "_csv',caption:'" . $this->expoptions['csv']['caption'] . "',title:'" . $this->expoptions['csv']['title'] . "'," . $excsv . ",buttonicon:'" . $this->expoptions['csv']['buttonicon'] . "'});";
                                }
                                if ($this->navOptions["columns"] == true) {
                                    $clopt = jqGridUtils::encode($this->expoptions['columns']['options']);
                                    $excolumns = <<<COLUMNS
onClickButton : function(e)
{
\tjQuery("{$tblelement}").jqGrid('columnChooser',{$clopt});
}
COLUMNS;
                                    $s .= "jQuery('" . $tblelement . "').jqGrid('navButtonAdd','" . $pager . "',{id:'" . $tmppg . "_col',caption:'" . $this->expoptions['columns']['caption'] . "',title:'" . $this->expoptions['columns']['title'] . "'," . $excolumns . ",buttonicon:'" . $this->expoptions['columns']['buttonicon'] . "'});";
                                }
                            }
                            // inline navigator
                            if ($this->inlineNav && strlen($pager) > 0) {
                                $aftersave = <<<AFTERS
function (id, res)
{
\tres = res.responseText.split("#");
\ttry {
\t\t\$(this).jqGrid('setCell', id, res[0], res[1]);
\t\t\$("#"+id, "#"+this.p.id).removeClass("jqgrid-new-row").attr("id",res[1] );
\t\t\$(this)[0].p.selrow = res[1];
\t} catch (asr) {}
}
AFTERS;
                                $this->inlineNavOpt['addParams'] = jqGridUtils::array_extend($this->inlineNavOpt['addParams'], array("aftersavefunc" => "js:" . $aftersave));
                                $this->inlineNavOpt['editParams'] = jqGridUtils::array_extend($this->inlineNavOpt['editParams'], array("aftersavefunc" => "js:" . $aftersave));
                                $s .= "jQuery('" . $tblelement . "').jqGrid('inlineNav','" . $pager . "'," . jqGridUtils::encode($this->inlineNavOpt) . ");\n";
                            }
                            // toolbar filter
                            if ($this->toolbarfilter) {
                                $s .= "jQuery('" . $tblelement . "').jqGrid('filterToolbar'," . jqGridUtils::encode($this->filterOptions) . ");\n";
                            }
                            // grid methods
                            $gM = count($this->gridMethods);
                            if ($gM > 0) {
                                for ($i = 0; $i < $gM; $i++) {
                                    $s .= $this->gridMethods[$i] . "\n";
                                }
                            }
                            //at end the custom code
                            if (strlen($this->customCode) > 0) {
                                $s .= jqGridUtils::encode($this->customCode);
                            }
                            if ($script) {
                                $s .= " });</script>";
                            }
                            if ($echo) {
                                echo $s;
                            }
                            return $echo ? "" : $s;
                        }
                    }
                }
            }
        }
    }
예제 #4
0
    public function renderGrid($tblelement = '', $pager = '', $script = true, array $summary = null, array $params = null, $createtbl = false, $createpg = false, $echo = true)
    {
        $oper = $this->GridParams["oper"];
        $goper = jqGridUtils::GetParam($oper, 'nooper');
        if ($goper == $this->GridParams["excel"]) {
            if (!$this->export) {
                return false;
            }
            $this->exportToExcel($summary, $params, $this->colModel);
        } else {
            if (in_array($goper, array_values($this->GridParams))) {
                $this->editGrid($summary, $params, $goper);
            } else {
                if (!isset($this->gridOptions["datatype"])) {
                    $this->gridOptions["datatype"] = $this->dataType;
                }
                $this->gridOptions['colModel'] = $this->colModel;
                if (isset($this->gridOptions['postData'])) {
                    $this->gridOptions['postData'] = jqGridUtils::array_extend($this->gridOptions['postData'], array($oper => $this->GridParams["query"]));
                } else {
                    $this->setGridOptions(array("postData" => array($oper => $this->GridParams["query"])));
                }
                if (isset($this->primaryKey)) {
                    $this->GridParams["id"] = $this->primaryKey;
                }
                $this->setGridOptions(array("prmNames" => $this->GridParams));
                $s = '';
                if ($createtbl) {
                    $tmptbl = $tblelement;
                    if (strpos($tblelement, "#") === false) {
                        $tblelement = "#" . $tblelement;
                    } else {
                        $tmptbl = substr($tblelement, 1);
                    }
                    $s .= "<table id='" . $tmptbl . "'></table>";
                }
                if ($createpg) {
                    $tmppg = $pager;
                    if (strpos($pager, "#") === false) {
                        $pager = "#" . $pager;
                    } else {
                        $tmppg = substr($pager, 1);
                    }
                    $s .= "<div id='" . $tmppg . "'></div>";
                }
                if (strlen($pager) > 0) {
                    $this->setGridOptions(array("pager" => $pager));
                }
                $this->editOptions['mtype'] = $this->mtype;
                $this->addOptions['mtype'] = $this->mtype;
                $this->delOptions['mtype'] = $this->mtype;
                if ($script) {
                    $s .= "<script type='text/javascript'>";
                    $s .= "jQuery(document).ready(function() {";
                }
                $s .= "jQuery('" . $tblelement . "').jqGrid(" . jqGridUtils::encode($this->gridOptions) . ");";
                if ($this->navigator && strlen($pager) > 0) {
                    $s .= "jQuery('" . $tblelement . "').jqGrid('navGrid','" . $pager . "'," . jqGridUtils::encode($this->navOptions);
                    $s .= "," . jqGridUtils::encode($this->editOptions);
                    $s .= "," . jqGridUtils::encode($this->addOptions);
                    $s .= "," . jqGridUtils::encode($this->delOptions);
                    $s .= "," . jqGridUtils::encode($this->searchOptions);
                    $s .= "," . jqGridUtils::encode($this->viewOptions) . ");";
                    if ($this->navOptions["excel"] == true) {
                        $eurl = $this->getGridOption('url');
                        $exexcel = <<<EXCELE
onClickButton : function(e)
{
    try {
        jQuery("{$tblelement}").jqGrid('excelExport',{url:'{$eurl}'});
    } catch (e) {
        window.location= '{$eurl}?oper=excel';
    }
}
EXCELE;
                        $s .= "jQuery('" . $tblelement . "').jqGrid('navButtonAdd','" . $pager . "',{caption:'',title:'Export to Excel'," . $exexcel . "});";
                    }
                }
                if ($this->toolbarfilter) {
                    $s .= "jQuery('" . $tblelement . "').jqGrid('filterToolbar'," . jqGridUtils::encode($this->filterOptions) . ");\n";
                }
                $gM = count($this->gridMethods);
                if ($gM > 0) {
                    for ($i = 0; $i < $gM; $i++) {
                        $s .= $this->gridMethods[$i] . "\n";
                    }
                }
                if (strlen($this->customCode) > 0) {
                    $s .= jqGridUtils::encode($this->customCode);
                }
                if ($script) {
                    $s .= " });</script>";
                }
                if ($echo) {
                    echo $s;
                }
                return $echo ? "" : $s;
            }
        }
    }
예제 #5
0
 /**
  * Main method which construct the chart based on the options set
  * with the previous methods
  *
  * @param string $div_id the id of the chart element in the DOM. If empty
  * the default name 'jqchart' is used.
  * @param boolean $createlem if set to true a div element is created. If the
  * option is set to false the previous option should be set in order to render
  * the chart to a existing element.
  * @param mixed $width set the width of the chart. If  a number is used the
  * width is created in pixels. Have sense only if $createlem is true
  * @param <type> $height set the height of the chart. If  a number is used the
  * height is created in pixels. Have sense only if $createlem is true
  * @param string $chart the name which is used when a javascript chart object
  * is created. Can be used later to refer to the chart. The default
  * name is 'chart'
  *
  * @return string
  */
 public function renderChart($div_id = '', $createlem = true, $width = '800', $height = '400', $chart = 'chart')
 {
     if ($div_id == '') {
         $div_id = 'jqchart';
     }
     $this->coptions['chart']['renderTo'] = $div_id;
     $width = is_numeric($width) ? $width . 'px' : $width;
     $height = is_numeric($height) ? $height . 'px' : $height;
     $dim = "width:" . $width . ";height:" . $height . ";margin: 0 auto;";
     $s = "";
     if ($createlem) {
         $s .= '<div id="' . $div_id . '" style="' . $dim . '"></div>';
     }
     $s .= '<script type="text/javascript">';
     $s .= 'jQuery(document).ready(function(){';
     if ($this->theme && strlen($this->theme) > 0) {
         if (strpos($this->theme, '.js') === false) {
             $themeFile = $this->theme . ".js";
         } else {
             $themeFile = $this->theme;
         }
         try {
             $theme = file_get_contents($themeFile);
             if ($theme !== false) {
                 $s .= $theme;
             }
         } catch (Exception $e) {
         }
     }
     if (isset($this->coptions['lang'])) {
         $s .= 'Highcharts.setOptions({lang:' . jqGridUtils::encode($this->coptions["lang"]) . '});';
         unset($this->coptions['lang']);
     }
     $s .= 'var ' . $chart . ' = new Highcharts.Chart(' . jqGridUtils::encode($this->coptions) . ');';
     if ($this->jscode) {
         $s .= jqGridUtils::encode($this->jscode);
     }
     $s .= '});';
     $s .= '</script>';
     return $s;
 }
예제 #6
0
    /**
     * Main method which do everthing for the autocomplete. Should be called
     * after all settings are done. Note that in one file we can have more than
     * one autocomplete definitions.
     * Construct the autocomplete and perform Query operations.
     * @param string $element The DOM element on which audocomplete should be
     * applied
     * @param <type> $target - if set the value selection from autocomplete
     * will be set to this element
     * @param boolean $script - if set to false the script tag:
     * <script type='text/javascript'> will not be included.
     * @param boolean $echo if set to false the result is not echoed but returned
     * @param boolean $runme - internal variable used into the jqGrid class
     * @return string 
     */
    public function renderAutocomplete($element, $target = false, $script = true, $echo = true, $runme = true)
    {
        if ($this->runAll && $runme) {
            $this->_setSrc($element);
            $s = "";
            if ($script) {
                $s .= "<script type='text/javascript'>";
                $s .= "jQuery(document).ready(function() {";
            }
            if ($this->cache) {
                $s .= "var {$this->cachearray} = {};";
            }
            if ($target) {
                $trg = <<<TARGET
function (event, ui)
{
\t// change function to set target value
\tvar ival;
\tif(ui.item) {
\t\tival = ui.item.id || ui.item.value;
\t}
\tif(ival) {
\t\tjQuery("{$target}").val(ival);
\t} else {
\t\tjQuery("{$target}").val("");
\t\tif("{$this->strictcheck}" == "true"){
\t\tthis.value = "";
\t}
}
}
TARGET;
                $this->setOption('change', "js:" . $trg);
            }
            $s .= "if(jQuery.ui) { if(jQuery.ui.autocomplete){";
            $s .= "jQuery('" . $element . "').autocomplete(" . jqGridUtils::encode($this->aoptions) . ");";
            $s .= "jQuery('" . $element . "').autocomplete('widget').css('font-size','" . $this->fontsize . "');";
            if ($this->scroll) {
                $s .= "jQuery('" . $element . "').autocomplete('widget').css({'height':'{$this->height}','overflow-y':'auto'});";
            }
            $s .= "} }";
            if ($script) {
                $s .= " });</script>";
            }
            if ($echo) {
                echo $s;
            } else {
                return $s;
            }
        } else {
            if (trim($this->element) === trim($element)) {
                header("Content-type: text/x-json;charset=" . $this->encoding);
                if (function_exists('json_encode') && strtolower($this->encoding) == 'utf-8') {
                    echo json_encode($this->getACData());
                } else {
                    echo jqGridUtils::encode($this->getACData());
                }
            }
        }
    }