Esempio n. 1
0
<?php

require_once '../../../jq-config.php';
require_once ABSPATH . "php/jqUtils.php";
require_once ABSPATH . "php/jqGridPdo.php";
require_once ABSPATH . "php/jqChart.php";
ini_set("display_errors", "1");
$conn = new PDO(DB_DSN, DB_USER, DB_PASSWORD);
// Tell the db that we use utf-8
jqGridDB::query($conn, "SET NAMES utf8");
$chart = new jqChart($conn);
$chart->setChartOptions(array("defaultSeriesType" => "line"))->setTitle(array('text' => 'Freight by Month 1997', "x" => -20))->setyAxis(array("title" => array("text" => "Freight")))->setTooltip(array("formatter" => "function(){return '<b>'+ this.series.name +'</b><br/>'+this.x +': '+ this.y;}"))->addSeries('Blauer See Delikatessen', "SELECT MONTH(OrderDate), SUM(Freight) FROM orders WHERE CustomerID =?  AND OrderDate BETWEEN '1997-01-01' AND '1997-12-31' GROUP BY MONTH(OrderDate)", array('BERGS'))->addSeries('White Clover Markets', "SELECT MONTH(OrderDate), SUM(Freight) FROM orders WHERE CustomerID =?  AND OrderDate BETWEEN '1997-01-01' AND '1997-12-31' GROUP BY MONTH(OrderDate)", array('WHITC'));
echo $chart->renderChart('', true, 700, 350);
Esempio n. 2
0
<?php

require_once '../../../jq-config.php';
require_once ABSPATH . "php/jqGridPdo.php";
$country = $_GET['q'];
if ($country) {
    try {
        $conn = new PDO(DB_DSN, DB_USER, DB_PASSWORD);
        $SQL = "SELECT DISTINCT(City) id, City value FROM customers WHERE Country='" . $country . "' ORDER BY City";
        $collation = jqGridDB::query($conn, "SET NAMES utf8");
        $city = jqGridDB::query($conn, $SQL);
        $result = jqGridDB::fetch_object($city, true, $conn);
        echo json_encode($result);
    } catch (Exception $e) {
        echo $e->getMessage();
    }
}
Esempio n. 3
0
 public function setSelect($colname, $data, $formatter = true, $editing = true, $seraching = true, $defvals = array())
 {
     $s1 = array();
     $prop = array();
     $oper = $this->GridParams["oper"];
     $goper = jqGridUtils::GetParam($oper, 'nooper');
     if ($goper == 'nooper' || $goper == $this->GridParams["excel"]) {
         $runme = true;
     } else {
         $runme = !in_array($goper, array_values($this->GridParams));
     }
     if (!$this->runSetCommands && !$runme) {
         return false;
     }
     if (count($this->colModel) > 0 && $runme) {
         if (is_string($data)) {
             $aset = jqGridDB::query($this->pdo, $data);
             if ($aset) {
                 while ($row = jqGridDB::fetch_num($aset)) {
                     $s1[$row[0]] = $row[1];
                 }
                 jqGridDB::closeCursor($aset);
             }
         } else {
             if (is_array($data)) {
                 $s1 = $data;
             }
         }
         if ($editing) {
             $prop = array_merge($prop, array('edittype' => 'select', 'editoptions' => array('value' => $s1)));
         }
         if ($formatter) {
             $prop = array_merge($prop, array('formatter' => 'select', 'editoptions' => array('value' => $s1)));
         }
         if ($seraching) {
             if (is_array($defvals) && count($defvals) > 0) {
                 $s1 = $defvals + $s1;
             }
             $prop = array_merge($prop, array("stype" => "select", "searchoptions" => array("value" => $s1)));
         }
         if (count($prop) > 0) {
             $this->setColProperty($colname, $prop);
         }
         return true;
     }
     return false;
 }
Esempio n. 4
0
 /**
  *
  * Construct the select used in the grid. The select element can be used in the
  * editing modules, in formatter or in search module
  * @param string $colname (requiered) valid colname in colmodel
  * @param mixed $data can be array (with pair key value) or string which is
  * the SQL command which is executed to obtain the values. The command should contain a
  * minimun two fields. The first is the key and the second is the value whch will
  * be displayed in the select
  * @param boolean $formatter deternines that the select should be used in the
  * formatter of type select. Default is true
  * @param boolean $editing determines if the select should be used in editing
  * modules. Deafult is true
  * @param boolean $seraching determines if the select should be present in
  * the search module. Deafult is true.
  * @param array $defvals Set the default value if none is selected. Typically this
  * is usefull in serch modules. Can be something like arrar(""=>"All");
  * @return boolean
  */
 public function setSelect($colname, $data, $formatter = true, $editing = true, $seraching = true, $defvals = array(), $sep = ":", $delim = ";")
 {
     $s1 = "";
     //array();
     //new stdClass();
     $prop = array();
     //$oper = $this->GridParams["oper"];
     $goper = $this->oper ? $this->oper : 'nooper';
     if ($goper == 'nooper' || $goper == $this->GridParams["excel"]) {
         $runme = true;
     } else {
         $runme = !in_array($goper, array_values($this->GridParams));
     }
     if (!$this->runSetCommands && !$runme) {
         return false;
     }
     if (count($this->colModel) > 0 && $runme) {
         if (is_string($data)) {
             $aset = jqGridDB::query($this->pdo, $data);
             if ($aset) {
                 $i = 0;
                 $s = '';
                 while ($row = jqGridDB::fetch_num($aset)) {
                     if ($i == 0) {
                         $s1 .= $row[0] . $sep . $row[1];
                     } else {
                         $s1 .= $delim . $row[0] . $sep . $row[1];
                     }
                     $i++;
                 }
             }
             jqGridDB::closeCursor($aset);
         } else {
             if (is_array($data)) {
                 $i = 0;
                 foreach ($data as $k => $v) {
                     if ($i == 0) {
                         $s1 .= $k . $sep . $v;
                     } else {
                         $s1 .= $delim . $k . $sep . $v;
                     }
                     $i++;
                 }
                 //$s1 = $data;
             }
         }
         if ($editing) {
             $prop = array_merge($prop, array('edittype' => 'select', 'editoptions' => array('value' => $s1, 'separator' => $sep, 'delimiter' => $delim)));
         }
         if ($formatter) {
             $prop = array_merge($prop, array('formatter' => 'select', 'editoptions' => array('value' => $s1, 'separator' => $sep, 'delimiter' => $delim)));
         }
         if ($seraching) {
             if (is_array($defvals) && count($defvals) > 0) {
                 //$s1 = $defvals+$s1;
                 foreach ($defvals as $k => $v) {
                     $s1 = $k . $sep . $v . $delim . $s1;
                 }
             }
             $prop = array_merge($prop, array("stype" => "select", "searchoptions" => array("value" => $s1, 'separator' => $sep, 'delimiter' => $delim)));
         }
         if (count($prop) > 0) {
             $this->setColProperty($colname, $prop);
         }
         return true;
     }
     return false;
 }
Esempio n. 5
0
include_once "../ip-config.php";
require_once '../jq-config.php';
// include the jqGrid Class
require_once ABSPATH . "php/jqGrid.php";
// include the driver class
require_once ABSPATH . "php/jqGridPdo.php";
// Connection to the server
$conn = new PDO(DB_DSN, DB_USER, DB_PASSWORD);
// Tell the db that we use utf-8
$conn->query("SET NAMES utf8");
$rowid = jqGridUtils::Strip($_REQUEST["rowid"]);
if (!$rowid) {
    die("Missed parameters");
}
// Get details
$SQL = "SELECT notes FROM project, priority, status WHERE id =" . (int) $rowid;
$qres = jqGridDB::query($conn, $SQL);
$result = jqGridDB::fetch_assoc($qres, $conn);
$s = "<table width='60%' align='left'><tbody>";
$s .= "<tr><td width='15%'><b>Notes</b></td><td width='85%'>" . $result["notes"] . "</td></tr>";
$s .= "<tr><td width='15%'><b>&nbsp;</b></td><td width='85%'>&nbsp;</td></tr>";
$s .= "<tr><td width='15%'><b>Priority</b></td><td width='85%'>" . $result["priority"] . "</td></tr>";
$s .= "<tr><td width='15%'><b>&nbsp;</b></td><td width='85%'>&nbsp;</td></tr>";
$s .= "<tr><td width='15%'><b>Status</b></td><td width='85%'>" . $result["status"] . "</td></tr>";
$s .= "<tr><td width='15%'><b>&nbsp;</b></td><td width='85%'>&nbsp;</td></tr>";
$s .= "</tbody></table>";
echo $s;
jqGridDB::closeCursor($qres);
?>