当前位置: 首页>>代码示例>>PHP>>正文


PHP jqgrid类代码示例

本文整理汇总了PHP中jqgrid的典型用法代码示例。如果您正苦于以下问题:PHP jqgrid类的具体用法?PHP jqgrid怎么用?PHP jqgrid使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了jqgrid类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: actionIndex

	/**
	 * Lists all models.
	 */
	public function actionIndex()
	{
        if (isset($_POST['oper']) && $_POST['oper'] == 'edit') {
            $documentId = intval($_POST["id"]);
            $document = Documents::model()->with('images', 'user')->findByPk($documentId);

            if ($document) {
                $user = $document->user;
                $image = $document->image;

                if ($user) {
                    $person = $user->person;
                    $addresses = $person->adresses;

                    if (isset($addresses[0])) {
                        $address = $addresses[0];
                        $address->Address1 =  $_POST["Address1"];
                        $address->Address2 =  $_POST["Address2"];
                        $address->City =  $_POST["City"];
                        $address->State =  $_POST["State"];
                        $address->ZIP =  $_POST["ZIP"];
                        $address->Country =  $_POST["Country"];
                        $address->Phone =  $_POST["Phone"];
                        $address->Fax =  $_POST["Fax"];
                        if ($address->validate()) {
                            $address->save();
                            echo "adresses\n";
                        }
                    }

                    $user->User_Login = $_POST["User_Login"];
                    $user->User_Type = $_POST["User_Type"];
                    $user->Last_Login = $_POST["Last_Login"] ? $_POST["Last_Login"] : null;
                    $user->Active = intval($_POST["Active"]);
                    if ($user->validate()) {
                        $user->save();
                        echo "user\n";
                    }

                    $person->First_Name = $_POST["First_Name"];
                    $person->Last_Name = $_POST["Last_Name"];
                    $person->Email = $_POST["Email"];
                    $person->Mobile_Phone = $_POST["Mobile_Phone"];
                    $person->Direct_Phone = $_POST["Direct_Phone"];
                    $person->Direct_Fax = $_POST["Direct_Fax"];
                    if ($person->validate()) {
                        $person->save();
                        echo "person\n";
                    }
                }

                $document->Created = $_POST["Created"];
                if ($document->validate()) {
                    $document->save();
                    echo "document\n";
                }
/*
                $image->File_Name = $_POST["File_Name"];
                if ($image->validate()) {
                    $image->save();
                    echo "image\n";
                }
*/
            }

            die;
        }

        if (isset($_POST['oper']) && $_POST['oper'] == 'add') {
            die;
        }

        if (isset($_POST['oper']) && $_POST['oper'] == 'del') {
            $documentId = intval($_POST["id"]);
            $document = Documents::model()->findByPk($documentId);
            if ($document) {
                Documents::deleteDocument($documentId);
            }
            die;
        }

        $conn = mysql_connect(Yii::app()->params->dbhost, Yii::app()->params->dbuser, Yii::app()->params->dbpassword);
        mysql_select_db(Yii::app()->params->dbname);
        mysql_query("SET NAMES 'utf8'");

        Yii::import('ext.phpgrid.inc.jqgrid');

        // set columns
        $col = array();
        $col["title"] = "Document ID"; // caption of column
        $col["name"] = "Document_ID";
        $col["dbname"] = "documents.Document_ID"; // grid column name, same as db field or alias from sql
        $col["resizable"] = false;
        $col["editable"] = false; // this column is editable
        $col["hidden"] = false;
        $col["viewable"] = true;
        $col["search"] = false;
//.........这里部分代码省略.........
开发者ID:ranvijayj,项目名称:htmlasa,代码行数:101,代码来源:DocumentsController.php

示例2: actionIndex

	/**
	 * Lists all models.
	 */
	public function actionIndex()
	{
        if (isset($_POST['oper']) && $_POST['oper'] == 'edit') {
            $poId = intval($_POST["id"]);
            $po = Pos::model()->with('vendor')->findByPk($poId);

            if ($po) {
                $vendor = $po->vendor;
                if ($vendor) {
                    $client = $vendor->client;
                    $company = $client->company;
                    $addresses = $company->adreses;

                    if (isset($addresses[0])) {
                        $address = $addresses[0];
                        $address->Address1 =  $_POST["Address1"];
                        $address->Address2 =  $_POST["Address2"];
                        $address->City =  $_POST["City"];
                        $address->State =  $_POST["State"];
                        $address->ZIP =  $_POST["ZIP"];
                        $address->Country =  $_POST["Country"];
                        $address->Phone =  $_POST["Phone"];
                        $address->Fax =  $_POST["Fax"];
                        if ($address->validate()) {
                            $address->save();
                            echo "adresses\n";
                        }
                    }

                    if ($company) {
                        $company->Company_Name = $_POST["Company_Name"];
                        $company->Company_Fed_ID = $_POST["Company_Fed_ID"];
                        $company->Email = $_POST["Email"];
                        $company->SSN = $_POST["SSN"];
                        $company->Business_NameW9 = $_POST["Business_NameW9"];
                        if ($company->validate()) {
                            $company->save();
                            echo "company\n";
                        }
                    }
                }

                $po->PO_Account_Number = $_POST["PO_Account_Number"] ? $_POST["PO_Account_Number"] : null;
                $po->PO_Approval_Value = $_POST["PO_Approval_Value"];
                //$po->PO_Delivery_Chg = $_POST["PO_Delivery_Chg"] ? $_POST["PO_Delivery_Chg"] : null;
                //$po->PO_Other_Chg = $_POST["PO_Other_Chg"] ? $_POST["PO_Other_Chg"] : null;
                $po->Export_Batch_ID = $_POST["Export_Batch_ID"] ? $_POST["Export_Batch_ID"] : null;
                $po->PO_Subtotal = $_POST["PO_Subtotal"] ? $_POST["PO_Subtotal"] : null;
                $po->PO_Tax = $_POST["PO_Tax"] ? $_POST["PO_Tax"] : null;
                $po->PO_Total = $_POST["PO_Total"] ? $_POST["PO_Total"] : null;
                $po->PO_Date = $_POST["PO_Date"] ? $_POST["PO_Date"] : null;
                $po->PO_Previous_PO_Val = $_POST["PO_Previous_PO_Val"];
                $po->Payment_Type = $_POST["Payment_Type"];
                $po->PO_Card_Last_4_Digits = $_POST["PO_Card_Last_4_Digits"] ? $_POST["PO_Card_Last_4_Digits"] : null;
                $po->PO_Approved = $_POST["PO_Approved"];
                if ($po->validate()) {
                    $po->save();
                    echo "po\n";
                }

            }
            die;
        }

        if (isset($_POST['oper']) && $_POST['oper'] == 'add') {
            die;
        }

        if (isset($_POST['oper']) && $_POST['oper'] == 'del') {
            $apId = intval($_POST["id"]);
            $ap = Aps::model()->findByPk($apId);
            if ($ap) {
                Aps::deleteAP($apId);
            }
            die;
        }

        $conn = mysql_connect(Yii::app()->params->dbhost, Yii::app()->params->dbuser, Yii::app()->params->dbpassword);
        mysql_select_db(Yii::app()->params->dbname);
        mysql_query("SET NAMES 'utf8'");

        Yii::import('ext.phpgrid.inc.jqgrid');

        // set columns
        $col = array();
        $col["title"] = "PO ID"; // caption of column
        $col["name"] = "PO_ID";
        $col["dbname"] = "pos.PO_ID"; // grid column name, same as db field or alias from sql
        $col["resizable"] = false;
        $col["editable"] = false; // this column is editable
        $col["hidden"] = false;
        $col["viewable"] = true;
        $col["search"] = false;
        $col["sortable"] = false;
        $cols[] = $col;

        // set columns
//.........这里部分代码省略.........
开发者ID:ranvijayj,项目名称:htmlasa,代码行数:101,代码来源:PosController.php

示例3: ini_set

<?php

/**
 * JqGrid PHP Component
 *
 * @author Afnan Zari <azghanvi@gmail.com> - http://azgtech.wordpress.com
 * @version 1.0
 * @todo: footer summary, grouping
 * @license: see license.txt included in package
 */
#error_reporting(E_ALL & ~E_NOTICE);
ini_set("display_errors", "on");
$conn = mysql_connect("localhost", "root", "");
mysql_select_db("griddemo");
include "inc/jqgrid_dist.php";
$g = new jqgrid();
$col = array();
$col["title"] = "Id";
// caption of column
$col["name"] = "id";
$col["width"] = "10";
$col["link"] = "http://localhost/?id={id}";
// e.g. http://domain.com?id={id} given that, there is a column with $col["name"] = "id" exist
$col["linkoptions"] = "target='_blank'";
// extra params with <a> tag
$cols[] = $col;
$col = array();
$col["title"] = "Client";
$col["name"] = "name";
$col["width"] = "100";
$col["editable"] = false;
开发者ID:cdnsolution,项目名称:LeERP,代码行数:31,代码来源:external-link.php

示例4: mysql_connect

/**
 * PHP Grid Component
 *
 * @author Abu Ghufran <gridphp@gmail.com> - http://www.phpgrid.org
 * @version 1.5.2
 * @license: see license.txt included in package
 */
// include db config
include_once "/config.php";
// set up DB
mysql_connect(PHPGRID_DBHOST, PHPGRID_DBUSER, PHPGRID_DBPASS);
mysql_select_db(PHPGRID_DBNAME);
// include and create object
include PHPGRID_LIBPATH . "inc/jqgrid_dist.php";
$g = new jqgrid();
// set few params
$grid["caption"] = "Sample Grid";
$g->set_options($grid);
// set database table for CRUD operations
$g->table = "clients";
// render grid
$out = $g->render("list1");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
<head>
	<link rel="stylesheet" type="text/css" media="screen" href="/lib/js/themes/redmond/jquery-ui.custom.css"></link>	
	<link rel="stylesheet" type="text/css" media="screen" href="/lib/js/jqgrid/css/ui.jqgrid.css"></link>	
 
	<script src="/lib/js/jquery.min.js" type="text/javascript"></script>
开发者ID:kpbaek,项目名称:sbm.dealer,代码行数:30,代码来源:phpGrid.php

示例5: actionIndex

    /**
     * Lists all models.
     */
    public function actionIndex()
    {
        if (isset($_POST['oper']) && $_POST['oper'] == 'edit') {
            $noteId = intval($_POST["id"]);
            $note = Notes::model()->findByPk($noteId);

            if ($note) {
                $note->Comment = $_POST["Comment"] ? $_POST["Comment"] : null;
                $note->Created = $_POST["Created"] ? $_POST["Created"] : null;
                if ($note->validate()) {
                    $note->save();
                    echo "note\n";
                }
            }

            die;
        }

        if (isset($_POST['oper']) && $_POST['oper'] == 'add') {
            die;
        }

        if (isset($_POST['oper']) && $_POST['oper'] == 'del') {
            $noteId = intval($_POST["id"]);
            $note = Notes::model()->findByPk($noteId);
            if ($note) {
                $note->delete();
            }
            die;
        }

        $conn = mysql_connect(Yii::app()->params->dbhost, Yii::app()->params->dbuser, Yii::app()->params->dbpassword);
        mysql_select_db(Yii::app()->params->dbname);
        mysql_query("SET NAMES 'utf8'");

        Yii::import('ext.phpgrid.inc.jqgrid');

        // set columns
        $col = array();
        $col["title"] = "Note ID"; // caption of column
        $col["name"] = "Note_ID";
        $col["dbname"] = "notes.Note_ID"; // grid column name, same as db field or alias from sql
        $col["resizable"] = false;
        $col["editable"] = false; // this column is editable
        $col["hidden"] = false;
        $col["viewable"] = true;
        $col["search"] = false;
        $col["sortable"] = true;
        $cols[] = $col;

        // set columns
        $col = array();
        $col["title"] = "Document ID"; // caption of column
        $col["name"] = "Document_ID";
        $col["dbname"] = "notes.Document_ID"; // grid column name, same as db field or alias from sql
        $col["resizable"] = false;
        $col["editable"] = false; // this column is editable
        $col["hidden"] = false;
        $col["viewable"] = true;
        $col["search"] = true;
        $col["sortable"] = true;
        $cols[] = $col;

        // set columns
        $col = array();
        $col["title"] = "User ID"; // caption of column
        $col["name"] = "User_ID";
        $col["dbname"] = "notes.User_ID"; // grid column name, same as db field or alias from sql
        $col["resizable"] = false;
        $col["editable"] = false; // this column is editable
        $col["hidden"] = false;
        $col["viewable"] = true;
        $col["search"] = true;
        $col["sortable"] = true;
        $cols[] = $col;

        // set columns
        $col = array();
        $col["title"] = "Company ID"; // caption of column
        $col["name"] = "Company_ID";
        $col["dbname"] = "notes.Company_ID"; // grid column name, same as db field or alias from sql
        $col["resizable"] = false;
        $col["editable"] = false; // this column is editable
        $col["hidden"] = false;
        $col["viewable"] = true;
        $col["search"] = true;
        $col["sortable"] = true;
        $cols[] = $col;

        $col = array();
        $col["title"] = "Client ID"; // caption of column
        $col["name"] = "Client_ID";
        $col["dbname"] = "notes.Client_ID"; // grid column name, same as db field or alias from sql
        $col["resizable"] = false;
        $col["editable"] = false; // this column is editable
        $col["hidden"] = false;
        $col["viewable"] = true;
//.........这里部分代码省略.........
开发者ID:ranvijayj,项目名称:htmlasa,代码行数:101,代码来源:NotesController.php

示例6: schedulegrid

 public function schedulegrid()
 {
     $page = $this->get->page;
     // get the requested page
     $limit = $this->get->rows;
     // get how many rows we want to have into the grid
     $sidx = $this->get->sidx;
     // get index row - i.e. user click to sort
     $sord = $this->get->sord;
     // get the direction
     if (!$sidx) {
         $sidx = 1;
     }
     # http://dev.phpvms.net/admin/action.php/operations/
     # ?_search=true&nd=1270940867171&rows=20&page=1&sidx=flightnum&sord=asc&searchField=code&searchString=TAY&searchOper=eq
     /* Do the search using jqGrid */
     $where = array();
     if ($this->get->_search == 'true') {
         $searchstr = jqgrid::strip($this->get->filters);
         $where_string = jqgrid::constructWhere($searchstr);
         # Append to our search, add 1=1 since it comes with AND
         #	from above
         $where[] = "1=1 {$where_string}";
     }
     Config::Set('SCHEDULES_ORDER_BY', "{$sidx} {$sord}");
     # Do a search without the limits so we can find how many records
     $count = SchedulesData::countSchedules($where);
     if ($count > 0) {
         $total_pages = ceil($count / $limit);
     } else {
         $total_pages = 0;
     }
     if ($page > $total_pages) {
         $page = $total_pages;
     }
     $start = $limit * $page - $limit;
     // do not put $limit*($page - 1)
     if ($start < 0) {
         $start = 0;
     }
     # And finally do a search with the limits
     $schedules = SchedulesData::findSchedules($where, $limit, $start);
     if (!$schedules) {
         $schedules = array();
     }
     # Form the json header
     $json = array('page' => $page, 'total' => $total_pages, 'records' => $count, 'rows' => array());
     # Add each row to the above array
     foreach ($schedules as $row) {
         if ($row->route != '') {
             $route = '<a href="#" onclick="showroute(\'' . $row->id . '\'); return false;">View</a>';
         } else {
             $route = '-';
         }
         $edit = '<a href="' . adminurl('/operations/editschedule?id=' . $row->id) . '">Edit</a>';
         $delete = '<a href="#" onclick="deleteschedule(' . $row->id . '); return false;">Delete</a>';
         $tmp = array('id' => $row->id, 'cell' => array($row->code, $row->flightnum, $row->depicao, $row->arricao, $row->aircraft, $row->registration, $route, Util::GetDaysCompact($row->daysofweek), $row->distance, $row->timesflown, $edit, $delete));
         $json['rows'][] = $tmp;
     }
     header("Content-type: text/x-json");
     echo json_encode($json);
 }
开发者ID:ryanunderwood,项目名称:phpVMS,代码行数:62,代码来源:Operations.php

示例7: array

 * http://phplens.com/lens/adodb/docs-adodb.htm#drivers
 * 
 * For oracle, extension of oci8 should be enabled in php.ini
 * 
 */
$db_conf = array();
$db_conf["type"] = "oci8";
// mysql,oci8(for oracle),mssql,postgres,sybase
$db_conf["server"] = "127.0.0.1:1521";
$db_conf["user"] = "system";
$db_conf["password"] = "asd";
$db_conf["database"] = "xe";
// include and create object
$base_path = strstr(realpath("."), "demos", true) . "lib/";
include $base_path . "inc/jqgrid_dist.php";
$g = new jqgrid($db_conf);
// set few params
$grid["caption"] = "Sample Grid";
$grid["rowNum"] = 15;
$g->set_options($grid);
$g->set_actions(array("inlineadd" => true));
// set database table for CRUD operations
$g->table = "cat";
$col = array();
$col["title"] = "Table";
// caption of column
$col["name"] = "TABLE_NAME";
$col["search"] = true;
$col["editable"] = true;
$cols[] = $col;
$col = array();
开发者ID:ra-ckhar,项目名称:www,代码行数:31,代码来源:db-layer-oracle.php

示例8: array

$col["search"] = false;
$col["sortable"] = false;
$col["link"] = "http://localhost/?id={id}";
// e.g. http://domain.com?id={id} given that, there is a column with $col["name"] = "id" exist
$col["linkoptions"] = "target='_blank'";
// extra params with <a> tag
$col["default"] = "View More";
// default link text
$cols[] = $col;
# Customization of Action column width and other properties
$col = array();
$col["title"] = "Action";
$col["name"] = "act";
$col["width"] = "50";
$cols[] = $col;
$g = new jqgrid();
// $grid["url"] = ""; // your paramterized URL -- defaults to REQUEST_URI
$grid["rowNum"] = 10;
// by default 20
$grid["sortname"] = 'id';
// by default sort grid by this field
$grid["sortorder"] = "desc";
// ASC or DESC
$grid["caption"] = "Invoice Data";
// caption of grid
$grid["autowidth"] = true;
// expand grid to screen width
$grid["multiselect"] = true;
// allow you to multi-select through checkboxes
$grid["scroll"] = true;
// allow you to multi-select through checkboxes
开发者ID:ra-ckhar,项目名称:www,代码行数:31,代码来源:example-full.php

示例9: mysql_connect

/**
 * PHP Grid Component
 *
 * @author Abu Ghufran <gridphp@gmail.com> - http://www.phpgrid.org
 * @version 1.5.2
 * @license: see license.txt included in package
 */
// include db config
include_once "../../config.php";
// set up DB
mysql_connect(PHPGRID_DBHOST, PHPGRID_DBUSER, PHPGRID_DBPASS);
mysql_select_db(PHPGRID_DBNAME);
// include and create object
include PHPGRID_LIBPATH . "inc/jqgrid_dist.php";
$g = new jqgrid();
// passed from parent grid
$c_id = $_REQUEST["rowid"];
if (empty($c_id)) {
    $c_id = 0;
}
// you can customize your own columns ...
$col = array();
$col["title"] = "Id";
// caption of column
$col["name"] = "id";
// field name, must be exactly same as with SQL prefix or db field
$col["width"] = "10";
$cols[] = $col;
$col = array();
$col["title"] = "Client Id";
开发者ID:cagc4,项目名称:Nabu,代码行数:30,代码来源:subgrid_detail.php

示例10: index

 public function index()
 {
     if ($this->session->userdata('user_name')) {
         $g = new jqgrid();
         $g->select_command = "SELECT id,fac.factory_code as factory_id ,dis.distance_code as distance_id,cubic.cubic_value as cubic_id,pr.price, start_date,end_date FROM pricelist as pr \nLEFT JOIN transport_factory as fac ON(pr.factory_id=fac.factory_id)\nLEFT JOIN transport_cubiccode as cubic ON(pr.cubic_id = cubic.cubic_id)\nLEFT JOIN distancecode as dis ON(pr.distance_id=dis.distance_id)";
         $g->table = "pricelist";
         $col = array();
         $col["title"] = "id";
         $col["name"] = "id";
         //$col["dbname"] = "pr.pricelist_id";
         $col["width"] = "10";
         $col["hidden"] = true;
         $col["editable"] = false;
         $cols[] = $col;
         $col = array();
         $col["title"] = $this->lang->line('factory_code');
         // caption of column
         $col["name"] = "factory_id";
         $col["dbname"] = "pr.factory_id";
         $col["width"] = "10";
         $col["align"] = "left";
         $col["search"] = true;
         $col["editable"] = true;
         $col["editrules"] = array("required" => true);
         $col["edittype"] = "select";
         // render as select
         # fetch data from database, with alias k for key, v for value
         $str = $g->get_dropdown_values("SELECT DISTINCT factory_id AS k,factory_code AS v FROM transport_factory");
         $col["editoptions"] = array("value" => ":;" . $str);
         // multi-select in search filter
         $col["stype"] = "select-multiple";
         $col["searchoptions"]["value"] = $str;
         $cols[] = $col;
         $col = array();
         $col["title"] = $this->lang->line('distance_code');
         // caption of column
         $col["name"] = "distance_id";
         $col["dbname"] = "pr.distance_id";
         $col["width"] = "10";
         $col["align"] = "left";
         $col["search"] = true;
         $col["editable"] = true;
         $col["editrules"] = array("required" => true);
         $col["edittype"] = "select";
         // render as select
         # fetch data from database, with alias k for key, v for value
         $str = $g->get_dropdown_values("SELECT DISTINCT distance_id AS k,distance_code AS v FROM distancecode WHERE distance_status=1");
         $col["editoptions"] = array("value" => ":;" . $str);
         // multi-select in search filter
         $col["stype"] = "select-multiple";
         $col["searchoptions"]["value"] = $str;
         $cols[] = $col;
         $col = array();
         $col["title"] = $this->lang->line('cubic_value');
         // caption of column
         $col["name"] = "cubic_id";
         $col["dbname"] = "pr.cubic_id";
         $col["width"] = "10";
         $col["align"] = "left";
         $col["search"] = true;
         $col["editable"] = true;
         $col["editrules"] = array("required" => true);
         $col["edittype"] = "select";
         // render as select
         # fetch data from database, with alias k for key, v for value
         $str = $g->get_dropdown_values("SELECT DISTINCT cubic_id AS k,cubic_value AS v FROM transport_cubiccode WHERE cubic_status=1");
         $col["editoptions"] = array("value" => ":;" . $str);
         // multi-select in search filter
         $col["stype"] = "select-multiple";
         $col["searchoptions"]["value"] = $str;
         $cols[] = $col;
         $col = array();
         $col["title"] = $this->lang->line('price');
         // caption of column
         $col["name"] = "price";
         $col["editable"] = true;
         $col["width"] = "10";
         $col["editrules"] = array("required" => true);
         $cols[] = $col;
         $col = array();
         $col["title"] = $this->lang->line('start_date');
         // caption of column
         $col["name"] = "start_date";
         $col["formatter"] = "date";
         // format as date
         $col["formatoptions"] = array("srcformat" => 'Y-m-d', "newformat" => 'd/m/Y');
         // http://docs.jquery.com/UI/Datepicker/formatDate
         $col["width"] = "10";
         $col["editrules"] = array("required" => true);
         $col["editable"] = true;
         $cols[] = $col;
         $col = array();
         $col["title"] = $this->lang->line('end_date');
         // caption of column
         $col["name"] = "end_date";
         $col["formatter"] = "date";
         // format as date
         $col["formatoptions"] = array("srcformat" => 'Y-m-d', "newformat" => 'd/m/Y');
         // http://docs.jquery.com/UI/Datepicker/formatDate
         $col["width"] = "10";
//.........这里部分代码省略.........
开发者ID:arnon22,项目名称:transportcm,代码行数:101,代码来源:pricelist2.php

示例11: actionIndex

	/**
	 * Lists all models.
	 */
	public function actionIndex()
	{
        if (isset($_POST['oper']) && $_POST['oper'] == 'edit') {
            $paymentId = intval($_POST["id"]);
            $payment = Payments::model()->with('vendor')->findByPk($paymentId);

            if ($payment) {
                $vendor = $payment->vendor;
                $bank_account = $payment->bank_account;
                if ($vendor) {
                    $client = $vendor->client;
                    $company = $client->company;
                    $addresses = $company->adreses;

                    if (isset($addresses[0])) {
                        $address = $addresses[0];
                        $address->Address1 =  $_POST["Address1"];
                        $address->Address2 =  $_POST["Address2"];
                        $address->City =  $_POST["City"];
                        $address->State =  $_POST["State"];
                        $address->ZIP =  $_POST["ZIP"];
                        $address->Country =  $_POST["Country"];
                        $address->Phone =  $_POST["Phone"];
                        $address->Fax =  $_POST["Fax"];
                        if ($address->validate()) {
                            $address->save();
                            echo "adresses\n";
                        }
                    }

                    if ($company) {
                        $company->Company_Name = $_POST["Company_Name"];
                        $company->Company_Fed_ID = $_POST["Company_Fed_ID"];
                        $company->Email = $_POST["Email"];
                        $company->SSN = $_POST["SSN"];
                        $company->Business_NameW9 = $_POST["Business_NameW9"];
                        if ($company->validate()) {
                            $company->save();
                            echo "company\n";
                        }
                    }
                }

                if ($bank_account) {
                    $bank_account->Account_Number = $_POST["Account_Number"];
                    $bank_account->Account_Name = $_POST["Account_Name"];
                    $bank_account->Bank_Name = $_POST["Bank_Name"];
                    $bank_account->Bank_Routing = $_POST["Bank_Routing"];
                    $bank_account->Bank_SWIFT = $_POST["Bank_SWIFT"];
                    if ($bank_account->validate()) {
                        $bank_account->save();
                        echo "bank account\n";
                    }
                }

                $payment->Payment_Check_Date = $_POST["Payment_Check_Date"] ? $_POST["Payment_Check_Date"] : null;
                $payment->Payment_Check_Number = $_POST["Payment_Check_Number"] ? $_POST["Payment_Check_Number"] : null;
                $payment->Payment_Amount = $_POST["Payment_Amount"] ? $_POST["Payment_Amount"] : null;
                if ($payment->validate()) {
                    $payment->save();
                    echo "payment\n";
                }
            }

            die;
        }

        if (isset($_POST['oper']) && $_POST['oper'] == 'add') {
            die;
        }

        if (isset($_POST['oper']) && $_POST['oper'] == 'del') {
            $paymentId = intval($_POST["id"]);
            $payment = Payments::model()->findByPk($paymentId);
            if ($payment) {
                Payments::deletePayment($paymentId);
            }
            die;
        }

        $conn = mysql_connect(Yii::app()->params->dbhost, Yii::app()->params->dbuser, Yii::app()->params->dbpassword);
        mysql_select_db(Yii::app()->params->dbname);
        mysql_query("SET NAMES 'utf8'");

        Yii::import('ext.phpgrid.inc.jqgrid');

        // set columns
        $col = array();
        $col["title"] = "Payment ID"; // caption of column
        $col["name"] = "Payment_ID";
        $col["dbname"] = "payments.Payment_ID"; // grid column name, same as db field or alias from sql
        $col["resizable"] = false;
        $col["editable"] = false; // this column is editable
        $col["hidden"] = false;
        $col["viewable"] = true;
        $col["search"] = false;
        $col["sortable"] = false;
//.........这里部分代码省略.........
开发者ID:ranvijayj,项目名称:htmlasa,代码行数:101,代码来源:PaymentsController.php

示例12: array

// with default display of textbox with size 20
$col["editrules"] = array("required" => true);
// and is required
$cols[] = $col;
$grid->set_columns($cols);
$e["on_insert"] = array("add_client", null, true);
$grid->set_events($e);
function add_client(&$data)
{
    $id = intval($_GET["rowid"]);
    $data["params"]["client_id"] = $id;
}
// generate grid output, with unique grid name as 'list1'
$out_detail = $grid->render("list2");
// detail detail grid
$grid = new jqgrid();
$opt = array();
$opt["sortname"] = 'id';
// by default sort grid by this field
$opt["sortorder"] = "desc";
// ASC or DESC
$opt["height"] = "";
// autofit height of subgrid
$opt["caption"] = "Invoice Data Detail";
// caption of grid
$grid->set_options($opt);
$grid->set_actions(array("add" => false, "edit" => false, "delete" => false, "rowactions" => false, "autofilter" => true, "search" => "advance"));
// receive id, selected row of parent grid
$id = intval($_GET["rowid"]);
$grid->select_command = "SELECT id,client_id,invdate,amount,tax,total FROM invheader WHERE id = {$id}";
$grid->table = "invheader";
开发者ID:ra-ckhar,项目名称:www,代码行数:31,代码来源:nested-master-detail.php

示例13: mysql_connect

<?php

/**
 * PHP Grid Component
 *
 * @author Abu Ghufran <gridphp@gmail.com> - http://www.phpgrid.org
 * @version 1.4.8
 * @license: see license.txt included in package
 */
$conn = mysql_connect("localhost", "root", "");
mysql_select_db("griddemo");
mysql_query("SET NAMES 'utf8'");
$base_path = strstr(realpath("."), "demos", true) . "lib/";
include $base_path . "inc/jqgrid_dist.php";
$g = new jqgrid();
$col = array();
$col["title"] = "Id";
// caption of column
$col["name"] = "id";
$col["width"] = "10";
$cols[] = $col;
$col = array();
$col["title"] = "Client";
$col["name"] = "client_id";
$col["dbname"] = "clients.name";
// this is required as we need to search in name field, not id
$col["width"] = "100";
$col["align"] = "left";
$col["search"] = true;
$col["editable"] = true;
$col["edittype"] = "select";
开发者ID:ra-ckhar,项目名称:www,代码行数:31,代码来源:dropdown.php

示例14: index

 public function index()
 {
     //check login
     if ($this->session->userdata('user_name')) {
         $g = new jqgrid();
         $opt["caption"] = "รายการรับ - จ่าย น้ำมัน";
         // following params will enable subgrid -- by default first column (PK) of parent is passed as param 'id'
         $opt["detail_grid_id"] = "list2,list3";
         $opt["subgridparams"] = "factory_id";
         $opt["height"] = "90";
         $opt['autowidth'] = true;
         $g->set_options($opt);
         $col = array();
         $col['title'] = "id";
         $col['name'] = "factory_id";
         $col['hidden'] = true;
         // $col['dbname'] = "fac.factory_id";
         $cols[] = $col;
         #factory Name
         $col = array();
         $col['title'] = $this->lang->line('factory_name');
         $col['name'] = "factory_name";
         //$col['dbnaem'] = "fac.factory_name";
         $col["search"] = false;
         $cols[] = $col;
         #factory Code
         $col = array();
         $col['title'] = $this->lang->line('factory_code');
         $col['name'] = "factory_code";
         $col['dbnaem'] = "fac.factory_code";
         $col["search"] = false;
         $cols[] = $col;
         #Recived Oil
         $col = array();
         $col['title'] = $this->lang->line('sum_recived_oil');
         $col['name'] = "receive_oil";
         $col["search"] = false;
         $col["formatter"] = "number";
         $col["formatoptions"] = array("thousandsSeparator" => ",", "decimalSeparator" => ".", "decimalPlaces" => 2);
         $cols[] = $col;
         #Sell Oil
         $col = array();
         $col['title'] = $this->lang->line('sum_sell_oil');
         $col['name'] = "sell_oil";
         $col["search"] = false;
         $col["formatter"] = "number";
         $col["formatoptions"] = array("thousandsSeparator" => ",", "decimalSeparator" => ".", "decimalPlaces" => 2);
         $cols[] = $col;
         #Total Amount
         $col = array();
         $col['title'] = $this->lang->line("oil_total_amount");
         $col['name'] = "total_amount";
         $col["search"] = false;
         $col["formatter"] = "number";
         $col["formatoptions"] = array("thousandsSeparator" => ",", "decimalSeparator" => ".", "decimalPlaces" => 2);
         $cols[] = $col;
         // Command 1
         $g->select_command = "SELECT\n     factory_id,\n     factory_code,\n     factory_name,\n     SUM(receive_oil) AS receive_oil,\n     SUM(sell_oil) AS sell_oil,\n     oil_type,\n     SUM(receive_oil - sell_oil) AS total_amount,\n\t\t factory_status\nFROM\n     (\n          SELECT\n               t1.factory_id,\n               t1.factory_code,\n               t1.factory_name,\n\t\t\t\t\t\t\t t1.factory_status,\n               t2.receive_oil,\n               t2.sell_oil,\n               t2.oil_type\n          FROM\n               transport_factory AS t1\n          LEFT JOIN oilstock AS t2 ON t1.factory_id = t2.factory_id\n          UNION\n               SELECT\n                    t1.factory_id,\n                    t1.factory_code,\n                    t1.factory_name,\n\t\t\t\t\t\t\t\t\t\tt1.factory_status,\n                    t2.receive_oil,\n                    t2.sell_oil,\n                    t2.oil_type\n               FROM\n                    transport_factory AS t1\n               RIGHT JOIN oilstock AS t2 ON t1.factory_id = t2.factory_id\n     ) oilstock\nGROUP BY\n     factory_id\nHAVING factory_status =1";
         $g->table = "transport_factory";
         $g->set_columns($cols);
         $g->set_actions(array("add" => false, "edit" => false, "delete" => false, "rowactions" => false, "autofilter" => false));
         // render grid and get html/js output
         $out_master = $g->render("list1");
         /*
         if (!empty($_REQUEST["factory_id"]))
         {
         $_SESSION["factory_id"] = intval($_REQUEST["factory_id"]);
         }
         
         if (isset($_SESSION['factory_id']))
         {
         $fac_id = $_SESSION["factory_id"];
         } else
         {
         $fac_id = "0";
         }
         */
         $fac_id = intval($_GET["factory_id"]);
         #Detail Oil Recive **รับน้ำมัน
         $g2 = new jqgrid();
         /*Option*/
         $opt2["caption"] = $this->lang->line("recived_oil_list");
         $opt2["sortname"] = 'stock_id';
         $opt2["sortorder"] = "desc";
         $opt2["height"] = "250";
         $opt2['rowNum'] = 10;
         $opt2['rowList'] = array(10, 20, 30);
         $opt2["width"] = "979";
         //$opt2["autowidth"] = true;
         //$opt3['hidegrid'] = true;
         $opt2["form"]["position"] = "center";
         $opt2["add_options"] = array("recreateForm" => true, "closeAfterEdit" => true, 'width' => '420');
         $opt2["edit_options"] = array("recreateForm" => true, "closeAfterEdit" => true, 'width' => '420');
         /*
         $opt2["add_options"]["beforeInitData"] = "function(formid){ var selr = jQuery('#list1').jqGrid('getGridParam','selrow'); if (!selr) { alert('จำเป็นต้องเลือกโรงงาน'); return false; } }";
         $opt2["add_options"]["afterSubmit"] = "function(){jQuery('#list1').trigger('reloadGrid',[{jqgrid_page:1}]); return true;}";
         $opt2["edit_options"]["afterSubmit"] = "function(){jQuery('#list1').trigger('reloadGrid',[{jqgrid_page:1}]); return true;}";
         $opt2["delete_options"]["afterSubmit"] = "function(){jQuery('#list1').trigger('reloadGrid',[{jqgrid_page:1}]); return true;}";
         $opt2["add_options"]["afterShowForm"] =
         'function(formid) { jQuery("#ref_number").focus(); }';
//.........这里部分代码省略.........
开发者ID:arnon22,项目名称:transportcm,代码行数:101,代码来源:oil.php

示例15: array

$db_conf = array();
$db_conf["type"] = "odbc_mssql"; 
$db_conf["server"] = "Driver={SQL Server};Server=localhost;Database=northwind;";
$db_conf["user"] = "user";
$db_conf["password"] = "pass";
$db_conf["database"] = null;

$db_conf = array();
$db_conf["type"] = "ado_mssql"; 
$db_conf["server"] = "PROVIDER=MSDASQL;DRIVER={SQL Server};SERVER=flipper;DATABASE=ai;UID=sa;PWD=;";
$db_conf["user"] = null;
$db_conf["password"] = null;
$db_conf["database"] = null;
*/
include "../../lib/inc/jqgrid_dist.php";
$g = new jqgrid($db_conf);
// set few params
$grid["caption"] = "Sample Grid";
$grid["rowNum"] = 5;
$g->set_options($grid);
$g->set_actions(array("inlineadd" => true));
// set database table for CRUD operations
$g->table = "[msdb].[dbo].[syscategories]";
// subqueries are also supported now (v1.2)
// $g->select_command = "select * from (select * from invheader) as o";
// render grid
$out = $g->render("list1");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
<head>
开发者ID:Jaylsc,项目名称:Simple-GAE,代码行数:31,代码来源:db-layer-sqlsvr.php


注:本文中的jqgrid类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。