本文整理汇总了PHP中jqgrid::set_actions方法的典型用法代码示例。如果您正苦于以下问题:PHP jqgrid::set_actions方法的具体用法?PHP jqgrid::set_actions怎么用?PHP jqgrid::set_actions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jqgrid
的用法示例。
在下文中一共展示了jqgrid::set_actions方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionIndex
//.........这里部分代码省略.........
$col["dbname"] = "addresses.Phone"; // grid column name, same as db field or alias from sql
$col["resizable"] = true;
$col["editable"] = true; // this column is editable
$col["viewable"] = true;
$cols[] = $col;
$col = array();
$col["title"] = "Fax"; // caption of column
$col["name"] = "Fax";
$col["dbname"] = "addresses.Fax"; // grid column name, same as db field or alias from sql
$col["resizable"] = true;
$col["editable"] = true; // this column is editable
$col["viewable"] = true;
$col["search"] = false;
$cols[] = $col;
$g = new jqgrid();
$grid["caption"] = "Documents";
// $grid["multiselect"] = true;
$grid["autowidth"] = true;
$grid["resizable"] = true;
//$grid["toppager"] = true;
$grid["sortname"] = 'documents.Document_ID';
$grid["sortorder"] = "ASC";
$grid["add_options"] = array(
'width'=>'420',
"closeAfterEdit"=>true, // close dialog after add/edit
"top"=>"200", // absolute top position of dialog
"left"=>"200" // absolute left position of dialog
);
$g->set_options($grid);
$g->set_actions(array(
"add"=>false, // allow/disallow add
"edit"=>true, // allow/disallow edit
"delete"=>true, // allow/disallow delete
"rowactions"=>true, // show/hide row wise edit/del/save option
"export"=>true, // show/hide export to excel option
"autofilter" => true, // show/hide autofilter for search
"search" => "advance" // show single/multi field search condition (e.g. simple or advance)
)
);
$g->select_command = "SELECT addresses.*, persons.*, users.Default_Project,
users.User_Login, users.User_Type, users.Last_Login, users.Active,
users.Last_IP, documents.*, images.File_Name, images.Mime_Type
FROM documents
LEFT JOIN images ON images.Document_ID = documents.Document_ID
LEFT JOIN users ON users.User_ID = documents.User_ID
LEFT JOIN persons ON users.Person_ID = persons.Person_ID
LEFT JOIN person_addresses ON person_addresses.Person_ID = persons.Person_ID
LEFT JOIN addresses ON addresses.Address_ID = person_addresses.Address_ID";
// set database table for CRUD operations
$g->table = "documents";
$g->set_columns($cols);
// group columns header
$g->set_group_header( array(
"useColSpanStyle"=>true,
"groupHeaders"=>array(
array(
"startColumnName"=>'Document_ID', // group starts from this column
"numberOfColumns"=>3, // group span to next 2 columns
"titleText"=>'Document Information' // caption of group header
),
array(
"startColumnName"=>'File_Name', // group starts from this column
"numberOfColumns"=>2, // group span to next 2 columns
"titleText"=>'Image Information' // caption of group header
),
array(
"startColumnName"=>'User_ID', // group starts from this column
"numberOfColumns"=>7, // group span to next 2 columns
"titleText"=>'User Information' // caption of group header
),
array(
"startColumnName"=>'First_Name', // group starts from this column
"numberOfColumns"=>6, // group span to next 2 columns
"titleText"=>'Person Information' // caption of group header
),
array(
"startColumnName"=>'Address1', // group starts from this column
"numberOfColumns"=>8, // group span to next 2 columns
"titleText"=>"User's Address" // caption of group header
)
)
)
);
// render grid and get html/js output
$out = $g->render("documents");
$this->render('index',array(
'out'=>$out,
));
}
示例2: index
//.........这里部分代码省略.........
$col['formater'] = "number";
$col['editable'] = true;
$cols[] = $col;
#Remark
$col = array();
$col['title'] = $this->lang->line('remark');
$col['name'] = "remark";
$col['dbname'] = "orders.remark";
$col["fixed"] = true;
$col['width'] = "120";
$col["edittype"] = "textarea";
$col["editoptions"] = array("rows" => 2, "cols" => 20);
$col['editable'] = true;
$cols[] = $col;
/*Grid Option*/
$opt["sortname"] = 'id';
$opt["sortorder"] = "desc";
$opt["caption"] = $this->lang->line('Order_Transportation');
$opt['rowNum'] = 10;
$opt['rowList'] = array(10, 20, 30);
$opt['height'] = "360";
$opt["autowidth"] = true;
$opt["multiselect"] = true;
$opt["scroll"] = true;
$opt["add_options"] = array("recreateForm" => true, "closeAfterEdit" => true, 'width' => '420');
$opt["edit_options"] = array("recreateForm" => true, "closeAfterEdit" => true, 'width' => '420');
$opt["add_options"]["afterShowForm"] = 'function(formid) { jQuery("#dp_number").focus();}';
$opt["edit_options"]["afterShowForm"] = 'function(formid) { jQuery("#dp_number").focus();}';
$opt["altRows"] = true;
$opt["altclass"] = "myAltRowClass";
$opt["form"]["position"] = "center";
// or "all"
$g->set_options($opt);
$g->set_actions(array("add" => $this->cizacl->check_isAllowed($i_rule, 'truckorder', 'add'), "edit" => $this->cizacl->check_isAllowed($i_rule, 'truckorder', 'edit'), "delete" => $this->cizacl->check_isAllowed($i_rule, 'truckorder', 'delete'), "rowactions" => false, "export" => true, "autofilter" => true, "search" => "advance"));
$g->select_command = "SELECT\n\tid,\n\tdp_number,\n\torders.customer_id,\n cus.customers_name AS cid,\n orders.factory_id,\n\tfac.factory_code,\n\treal_distance,\n\torders.distance_id,\n\tdis.distance_code,\t\n cubic.cubic_value as cubic_id,\n orders.price AS price,\n\torders.use_oil,\n orders.car_id,\n\tcar.car_number,\n\torders.driver_id,\n\tdri.driver_name,\n order_date,\n orders.delivery_datetime,\n orders.remark\n\nFROM\n\t`orders` AS orders\nLEFT JOIN transport_factory AS fac ON (\n\torders.factory_id = fac.factory_id\n)\nLEFT JOIN transport_customers AS cus ON (\n\torders.customer_id = cus.customer_id\n)\nLEFT JOIN transport_cubiccode AS cubic ON (\n\torders.cubic_id = cubic.cubic_id\n)\nLEFT JOIN distancecode AS dis ON (\n\torders.distance_id = dis.distance_id\n)\nLEFT JOIN transport_cars AS car ON (\norders.car_id = car.car_id\n)\nLEFT JOIN driver AS dri ON (\n\torders.driver_id = dri.driver_id\n)";
// this db table will be used for add,edit,delete
$g->table = "orders";
$e["on_insert"] = array("add_order", null, true);
$e["on_after_insert"] = array("after_insert", null, true);
$e["on_update"] = array("do_update", null, true);
$e["on_data_display"] = array("filter_display", null, true);
$g->set_events($e);
function add_order(&$data)
{
//print_r($data);
$obj =& get_instance();
$obj->load->model("price_model", "pricelist");
//$id = intval($_REQUEST["id"]);
$factory_id = $data["params"]["factory_id"];
$distance_id = $data["params"]["distance_id"];
$cubid_id = $data["params"]["cubic_id"];
$order_date = $data["params"]["order_date"];
#get price
$order_price = $obj->pricelist->get_order_Price($factory_id, $cubid_id, $distance_id, $order_date);
if ($order_price == null) {
$str = ob_get_clean();
$str = "ยังไม่มีการกำหนดราคาค่าขนส่ง";
phpgrid_error($str);
}
/*check DP NUmber*/
$check_sql = "SELECT count(*) as c from orders where LOWER(`dp_number`) = '" . strtolower($data["params"]["dp_number"]) . "'";
$rs = mysql_fetch_assoc(mysql_query($check_sql));
if ($rs["c"] > 0) {
phpgrid_error("หมายเลข DP Number ซ้ำ");
}
/*End Check DP Number*/
示例3: array
$col["formatoptions"] = array("srcformat" => 'Y-m-d', "newformat" => 'd/m/Y');
// @todo: format as date, not working with editing
$col["search"] = false;
$cols[] = $col;
$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"] = false;
// allow you to multi-select through checkboxes
$g->set_options($grid);
$g->set_actions(array("add" => false, "edit" => false, "delete" => true, "rowactions" => true, "autofilter" => true));
// you can provide custom SQL query to display data
$g->select_command = "SELECT * FROM (SELECT i.id, invdate , c.name FROM invheader i\r\n\t\t\t\t\t\tINNER JOIN clients c ON c.client_id = i.client_id) o";
// this db table will be used for add,edit,delete
$g->table = "invheader";
// pass the cooked columns to grid
$g->set_columns($cols);
// generate grid output, with unique grid name as 'list1'
$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="js/themes/smoothness/jquery-ui.custom.css"></link>
<link rel="stylesheet" type="text/css" media="screen" href="js/jqgrid/css/ui.jqgrid.css"></link>
示例4: actionIndex
//.........这里部分代码省略.........
$col = array();
$col["title"] = "Phone"; // caption of column
$col["name"] = "Phone";
$col["dbname"] = "addresses.Phone"; // grid column name, same as db field or alias from sql
$col["resizable"] = true;
$col["editable"] = true; // this column is editable
$col["viewable"] = true;
$cols[] = $col;
$col = array();
$col["title"] = "Fax"; // caption of column
$col["name"] = "Fax";
$col["dbname"] = "addresses.Fax"; // grid column name, same as db field or alias from sql
$col["resizable"] = true;
$col["editable"] = true; // this column is editable
$col["viewable"] = true;
$col["search"] = false;
$cols[] = $col;
$g = new jqgrid();
$grid["caption"] = "PO";
// $grid["multiselect"] = true;
$grid["autowidth"] = true;
$grid["resizable"] = false;
//$grid["toppager"] = true;
$grid["sortname"] = 'companies.Company_Name';
$grid["sortorder"] = "ASC";
$grid["add_options"] = array(
'width'=>'420',
"closeAfterEdit"=>true, // close dialog after add/edit
"top"=>"200", // absolute top position of dialog
"left"=>"200" // absolute left position of dialog
);
$g->set_options($grid);
$g->set_actions(array(
"add"=>false, // allow/disallow add
"edit"=>true, // allow/disallow edit
"delete"=>true, // allow/disallow delete
"rowactions"=>true, // show/hide row wise edit/del/save option
"export"=>true, // show/hide export to excel option
"autofilter" => true, // show/hide autofilter for search
"search" => "advance" // show single/multi field search condition (e.g. simple or advance)
)
);
$g->select_command = "SELECT companies.*, addresses.*,
pos.*, images.File_Name, images.Mime_Type
FROM pos
LEFT JOIN documents ON documents.Document_ID = pos.Document_ID
LEFT JOIN images ON images.Document_ID = documents.Document_ID
LEFT JOIN vendors ON pos.Vendor_ID = vendors.Vendor_ID
LEFT JOIN clients ON clients.Client_ID = vendors.Vendor_Client_ID
LEFT JOIN companies ON clients.Company_ID = companies.Company_ID
LEFT JOIN company_addresses ON company_addresses.Company_ID = companies.Company_ID
LEFT JOIN addresses ON addresses.Address_ID = company_addresses.Address_ID";
// set database table for CRUD operations
$g->table = "pos";
$g->set_columns($cols);
// group columns header
$g->set_group_header( array(
"useColSpanStyle"=>true,
"groupHeaders"=>array(
array(
"startColumnName"=>'PO_ID', // group starts from this column
"numberOfColumns"=>13, // group span to next 13 columns
"titleText"=>'PO Information' // caption of group header
),
array(
"startColumnName"=>'File_Name', // group starts from this column
"numberOfColumns"=>2, // group span to next 2 columns
"titleText"=>'Image Information' // caption of group header
),
array(
"startColumnName"=>'Company_ID', // group starts from this column
"numberOfColumns"=>6, // group span to next 2 columns
"titleText"=>'Company Information' // caption of group header
),
array(
"startColumnName"=>'Address1', // group starts from this column
"numberOfColumns"=>8, // group span to next 2 columns
"titleText"=>"Company's Address" // caption of group header
)
)
)
);
// render grid and get html/js output
$out = $g->render("po");
$this->render('index',array(
'out'=>$out,
));
}
示例5: jqgrid
// include and create object
include PHPGRID_LIBPATH . "inc/jqgrid_dist.php";
$g = new jqgrid();
// custom data (if passed) need to be filled in URL as query string ($_REQUEST);
//$grid["url"] = "subgrid_detail.php?rowid=".$_REQUEST["rowid"]."&subgrid=".$_REQUEST["subgrid"]."&closed=".$_REQUEST["closed"];
// if no custom param, it is auto set inside lib -- dont need to set
//$grid["url"] = "subgrid_detail.php?rowid=".$_REQUEST["rowid"]."&subgrid=".$_REQUEST["subgrid"];
$grid["sortname"] = 'id';
// by default sort grid by this field
$grid["sortorder"] = "desc";
// ASC or DESC
$grid["height"] = "";
// autofit height of subgrid
$grid["caption"] = "Item Data";
// caption of grid
$grid["autowidth"] = true;
// expand grid to screen width
$grid["multiselect"] = true;
// allow you to multi-select through checkboxes
$grid["export"] = array("filename" => "my-file", "sheetname" => "test");
// export to excel parameters
$g->set_options($grid);
$g->set_actions(array("add" => false, "edit" => false, "delete" => false, "rowactions" => true, "export" => true, "autofilter" => true, "search" => "advance"));
$c_id = $_REQUEST["rowid"];
# composite key implementation
$g->select_command = "select concat(id,'-',num) as `key`, i.* FROM invlines i\n\t\t\t\t\t\tWHERE id = {$c_id}";
// this db table will be used for add,edit,delete
$g->table = "invlines";
// generate grid output, with unique grid name as 'list1'
$out = $g->render("sub2");
echo $out;
示例6: array
$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();
$col["title"] = "Type";
$col["name"] = "TABLE_TYPE";
$col["search"] = true;
$col["editable"] = true;
$col["edittype"] = "select";
示例7: array
$col["name"] = "invdate";
$col["width"] = "50";
$col["editable"] = true;
// this column is editable
$col["editoptions"] = array("size" => 20);
// with default display of textbox with size 20
$col["editrules"] = array("required" => true);
// and is required
$col["formatter"] = "date";
// format as date
$cols[] = $col;
// set few params
$grid["caption"] = "Sample Grid";
$grid["multiselect"] = true;
$g->set_options($grid);
$g->set_actions(array("add" => true, "inlineadd" => true, "edit" => true, "delete" => true, "rowactions" => true));
// set database table for CRUD operations
$g->table = "invheader";
$g->set_columns($cols);
// 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>
<script src="../../lib/js/jqgrid/js/i18n/grid.locale-en.js" type="text/javascript"></script>
<script src="../../lib/js/jqgrid/js/jquery.jqGrid.min.js" type="text/javascript"></script>
示例8: pregledRezervacije
public function pregledRezervacije($id, $ime)
{
$col = array();
$col["title"] = "Datum";
$col["name"] = "reservation_week";
$col["width"] = "20";
$cols[] = $col;
$col = array();
$col["title"] = "Dvorana";
$col["name"] = "reservation_day";
$col["width"] = "10";
$cols[] = $col;
$col = array();
$col["title"] = "Termin";
$col["name"] = "reservation_time";
$col["width"] = "20";
$cols[] = $col;
$col = array();
$col["title"] = "Poveznica";
$col["name"] = "event_name";
$col["width"] = "20";
$col["editable"] = true;
$col["summaryType"] = "count";
$col["edittype"] = "checkbox";
$col["editoptions"] = array("value" => $ime . ": ");
$cols[] = $col;
$g = new jqgrid();
// $grid["url"] = ""; // your paramterized URL -- defaults to REQUEST_URI
$grid["rowNum"] = 20;
// by default 20
$grid["sortname"] = 'reservation_day';
// by default sort grid by this field
$grid["sortorder"] = "desc";
// ASC or DESC
$grid["caption"] = "Vase rezervacije dvorana; Poveznice za kolegij -" . $ime;
//$grid["autowidth"] = true; // expand grid to screen width
$grid["width"] = "850";
$grid["height"] = "550";
$grid["multiselect"] = true;
// allow you to multi-select through checkboxes
$grid["hiddengrid"] = true;
$grid["grouping"] = true;
//
$grid["groupingView"] = array();
$grid["groupingView"]["groupField"] = array("reservation_week");
// specify column name to group listing
$grid["groupingView"]["groupColumnShow"] = array(true);
// either show grouped column in list or not (default: true)
//$grid["groupingView"]["groupText"] = array("<b>{0} - {1} Item(s)</b>"); // {0} is grouped value, {1} is count in group
$grid["groupingView"]["groupOrder"] = array("asc");
// show group in asc or desc order
$grid["groupingView"]["groupDataSorted"] = array(true);
// show sorted data within group
$grid["groupingView"]["groupSummary"] = array(true);
// work with summaryType, summaryTpl, see column: $col["name"] = "total";
$grid["groupingView"]["groupCollapse"] = false;
// Turn true to show group collapse (default: false)
$grid["groupingView"]["showSummaryOnHide"] = true;
// show summary row even if group collapsed (hide)
// export XLS file
// export to excel parameters
$grid["export"] = array("format" => "xlsx", "filename" => "my-file", "sheetname" => "test");
// RTL support
// $grid["direction"] = "rtl";
$grid["cellEdit"] = true;
// inline cell editing, like spreadsheet
$g->set_options($grid);
$g->set_actions(array("add" => true, "edit" => true, "delete" => true, "rowactions" => true, "export" => true, "autofilter" => true, "search" => "advance"));
// set database table for CRUD operations
$g->table = 'phpmyreservation_reservations';
$g->set_columns($cols);
// subqueries are also supported now (v1.2)
$g->select_command = "select * from (SELECT `reservation_week` , `reservation_day` , `reservation_time` , `event_name` \nFROM `phpmyreservation_reservations` \nWHERE `reservation_user_id`=" . $id . ") as o";
$grid_id = "dvorane1";
// render grid
$out = $g->render($grid_id);
$sql = "SELECT `reservation_week` , `reservation_day` , `reservation_time` , `event_name` FROM `phpmyreservation_reservations` WHERE `reservation_user_id`=" . $id;
return array('out' => $out, 'grid_id' => $grid_id, 'sql' => $sql, 'naziv' => $grid["caption"], 'cols' => $cols);
}
示例9: array
*
*/
$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 "../../lib/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, "export_pdf" => true, "autofilter" => true, "search" => "advance"));
$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();
$col["title"] = "Type";
$col["name"] = "TABLE_TYPE";
$col["search"] = true;
$col["editable"] = true;
$cols[] = $col;
$g->set_columns($cols);
示例10: actionIndex
//.........这里部分代码省略.........
$col["search"] = true;
$col["sortable"] = true;
$cols[] = $col;
$col = array();
$col["title"] = "Additional Storage Fee"; // caption of column
$col["name"] = "Additional_Storage_Fee";
$col["dbname"] = "Additional_Storage_Fee"; // grid column name, same as db field or alias from sql
$col["resizable"] = false;
$col["editable"] = true; // this column is editable
$col["hidden"] = false;
$col["viewable"] = true;
$col["search"] = true;
$col["sortable"] = true;
$cols[] = $col;
$col = array();
$col["title"] = "Trial_Period"; // caption of column
$col["name"] = "Trial_Period";
$col["dbname"] = "Trial_Period"; // grid column name, same as db field or alias from sql
$col["resizable"] = false;
$col["editable"] = true; // this column is editable
$col["hidden"] = false;
$col["viewable"] = true;
$col["search"] = true;
$col["sortable"] = true;
$cols[] = $col;
$col = array();
$col["title"] = "Description"; // caption of column
$col["name"] = "Description";
$col["dbname"] = "Description"; // grid column name, same as db field or alias from sql
$col["resizable"] = true;
$col["editable"] = true; // this column is editable
$col["hidden"] = false;
$col["viewable"] = true;
$col["search"] = true;
$col["sortable"] = false;
$col["edittype"] = "textarea";
$col["editoptions"] = array("rows"=>15, "cols"=>80);
$cols[] = $col;
$g = new jqgrid();
$grid["caption"] = "Service Level Settings";
// $grid["multiselect"] = true;
$grid["autowidth"] = true;
$grid["resizable"] = true;
//$grid["toppager"] = true;
$grid["sortname"] = 'Service_Level_ID';
$grid["sortorder"] = "ASC";
$grid["add_options"] = array(
'width'=>'600',
"closeAfterEdit"=>true, // close dialog after add/edit
"top"=>"200", // absolute top position of dialog
"left"=>"200" // absolute left position of dialog
);
$g->set_options($grid);
$g->set_actions(array(
"add"=>true, // allow/disallow add
"edit"=>true, // allow/disallow edit
"delete"=>false, // allow/disallow delete
"rowactions"=>true, // show/hide row wise edit/del/save option
"export"=>true, // show/hide export to excel option
"autofilter" => true, // show/hide autofilter for search
"search" => "advance" // show single/multi field search condition (e.g. simple or advance)
)
);
$g->select_command = "SELECT service_level_settings.*
FROM service_level_settings";
// set database table for CRUD operations
$g->table = "service_level_settings";
$g->set_columns($cols);
// group columns header
$g->set_group_header( array(
"useColSpanStyle"=>true,
"groupHeaders"=>array(
array(
"startColumnName"=>'Service_Level_ID', // group starts from this column
"numberOfColumns"=>11, // group span to next 2 columns
"titleText"=>'Service Level Settings Information' // caption of group header
),
)
)
);
// render grid and get html/js output
$out = $g->render("service_level_settings");
$this->render('index',array(
'out'=>$out,
));
}
示例11: actionIndex
//.........这里部分代码省略.........
$col = array();
$col["title"] = "Country"; // caption of column
$col["name"] = "Country";
$col["dbname"] = "addresses.Country"; // grid column name, same as db field or alias from sql
$col["resizable"] = true;
$col["editable"] = true; // this column is editable
$col["viewable"] = true;
$cols[] = $col;
$col = array();
$col["title"] = "Phone"; // caption of column
$col["name"] = "Phone";
$col["dbname"] = "addresses.Phone"; // grid column name, same as db field or alias from sql
$col["resizable"] = true;
$col["editable"] = true; // this column is editable
$col["viewable"] = true;
$cols[] = $col;
$col = array();
$col["title"] = "Fax"; // caption of column
$col["name"] = "Fax";
$col["dbname"] = "addresses.Fax"; // grid column name, same as db field or alias from sql
$col["resizable"] = true;
$col["editable"] = true; // this column is editable
$col["viewable"] = true;
$col["search"] = false;
$cols[] = $col;
$g = new jqgrid();
$grid["caption"] = "Vendor List";
// $grid["multiselect"] = true;
$grid["autowidth"] = true;
$grid["resizable"] = true;
//$grid["toppager"] = true;
$grid["sortname"] = 'companies.Company_Name';
$grid["sortorder"] = "ASC";
$grid["add_options"] = array(
'width'=>'420',
"closeAfterEdit"=>true, // close dialog after add/edit
"top"=>"200", // absolute top position of dialog
"left"=>"200" // absolute left position of dialog
);
$g->set_options($grid);
$g->set_actions(array(
"add"=>false, // allow/disallow add
"edit"=>true, // allow/disallow edit
"delete"=>true, // allow/disallow delete
"rowactions"=>true, // show/hide row wise edit/del/save option
"export"=>true, // show/hide export to excel option
"autofilter" => true, // show/hide autofilter for search
"search" => "advance" // show single/multi field search condition (e.g. simple or advance)
)
);
$g->select_command = "SELECT vendors.*, companies.*, addresses.*
FROM vendors
LEFT JOIN clients ON clients.Client_ID = vendors.Vendor_Client_ID
LEFT JOIN companies ON clients.Company_ID = companies.Company_ID
LEFT JOIN company_addresses ON company_addresses.Company_ID = companies.Company_ID
LEFT JOIN addresses ON addresses.Address_ID = company_addresses.Address_ID";
// set database table for CRUD operations
$g->table = "vendors";
$g->set_columns($cols);
// group columns header
$g->set_group_header( array(
"useColSpanStyle"=>true,
"groupHeaders"=>array(
array(
"startColumnName"=>'Vendor_ID', // group starts from this column
"numberOfColumns"=>9, // group span to next 2 columns
"titleText"=>'Vendor Information' // caption of group header
),
array(
"startColumnName"=>'Company_ID', // group starts from this column
"numberOfColumns"=>6, // group span to next 2 columns
"titleText"=>'Vendor Company' // caption of group header
),
array(
"startColumnName"=>'Address1', // group starts from this column
"numberOfColumns"=>8, // group span to next 2 columns
"titleText"=>"Vendor's Address" // caption of group header
)
)
)
);
// render grid and get html/js output
$out = $g->render("Vendors");
$this->render('index',array(
'out'=>$out,
));
}
示例12: jqgrid
<?php
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"] = "User";
$g->set_options($grid);
$g->set_actions(array("add" => false, "delete" => false, "edit" => false, "search" => "simple"));
include 'database.php';
$e = $_SESSION["myusername"];
$sql = "SHOW TABLES";
$res = mysql_query($sql);
$num = mysql_num_rows($res);
$count = 1;
$query = "SELECT * FROM task1";
while ($count < $num) {
$count++;
$string = "task{$count}";
$query = "{$query} UNION (SELECT * FROM {$string}) ";
}
$query2 = " SELECT Taskname , Name , Points, Status FROM ({$query}) AS U WHERE U.Name='{$e}' ";
$g->select_command = $query2;
// set database table for CRUD operations
//$g->table = "task1";
// render grid
$out = $g->render("list1");
示例13: getDataGrid
function getDataGrid($id)
{
$g = new jqgrid();
$pageL = $this->database->getTableLink($id);
$type = 'gridoptions';
$result = $this->database->getGrid1($type, $id);
while ($row = $result->FetchRow()) {
$value = $row[2];
if ($row[0] != 'table' and $row[0] != 'where') {
if ($row[1] == 'number') {
$value = (int) $value;
}
if ($row[1] == 'boolean') {
if ($value == 'true') {
$value = true;
} else {
$value = false;
}
}
$grid[$row[0]] = $value;
}
if ($row[0] == 'sql') {
$value = str_replace('operatorId', $_SESSION['opridLogin'], $value);
$g->select_command = $value;
}
if ($row[0] == 'table') {
$g->table = $value;
}
if ($id == 'nb_factura_de_pg') {
if (isset($_GET["factura"])) {
$factura = $_GET["factura"];
if (!is_numeric($factura)) {
$factura = 0;
}
} else {
$factura = 0;
}
$g->select_command = "Select * from nb_detallef_tbl where factura like '" . $factura . "-%'";
}
}
$campos = $this->database->getGrid2($id);
$type = 'gridcoloptions';
$cols = array();
while ($camposDescribe = $campos->FetchRow()) {
$result = $this->database->getGrid3($type, $id, $camposDescribe[0]);
$col = array();
while ($row = $result->FetchRow()) {
$value = $row[2];
if ($row[0] == 'link') {
$value = "nabu.php?p=" . $pageL[0] . "&accion=b&" . $value;
}
if ($row[0] == 'linkE') {
$row[0] = 'link';
}
if ($row[1] == 'number') {
$value = (int) $value;
}
if ($row[1] == 'boolean') {
if ($value == 'true') {
$value = true;
} else {
$value = false;
}
}
$col[$row[0]] = $value;
}
$cols[] = $col;
}
$this->database->conectar();
$g->set_columns($cols);
$g->set_options($grid);
if ($id == 'nb_factura_de_pg') {
$configGrid = true;
} else {
$configGrid = false;
}
$g->set_actions(array("add" => $configGrid, "edit" => $configGrid, "delete" => $configGrid, "rowactions" => true, "search" => "advance"));
return $g->render("list1");
}
示例14: intval
$date = $_GET["Date"];
$num = intval($_GET["NoVente"]);
$vache = $GET["NoVache"];
/*$genre = $GET["Genre"];
$prix_decoupe = $GET["PrixDecoupe"];
$prix_abattage = $GET["PrixAbattage"];
$poids_carcasse = $GET["PoidsCarcasse"];
$piece_compta = $GET["PieceCompta"];*/
$d_grid->select_command = "SELECT DISTINCT t_detail.ID,NoVente,IDClient,PoidsAchat,PrixKgTTC, ModePaiement FROM t_detail\n INNER JOIN t_clients on t_clients.ID = IDClient WHERE NoVente = {$id} ";
// disable all dialogs except edit
$d_grid->navgrid["param"]["edit"] = false;
$d_grid->navgrid["param"]["add"] = false;
$d_grid->navgrid["param"]["del"] = false;
$d_grid->navgrid["param"]["search"] = false;
$d_grid->navgrid["param"]["refresh"] = true;
$d_grid->set_actions(array("add" => true, "edit" => true, "delete" => true, "inlineadd" => true, "rowactions" => true, "autofilter" => false, "export" => true));
//for export {{
$sql = "SELECT SUM(PoidsAchat) AS PA,SUM( PoidsAchat * PrixKgTTC ) AS value_sum FROM t_detail WHERE NoVente = {$id}";
$result = mysql_query($sql) or die('Erreur SQL !' . $sql . '' . mysql_error());
$row = mysql_fetch_assoc($result);
$sssumTTC = round($row['value_sum'], 2);
$sssumHT = $sssumTTC / 1.055;
// HT 5.5%
$sssumHT = round($sssumHT, 2);
$sssumTVA = $sssumTTC - $sssumHT;
$sssPA = $row[PA];
$opt = array();
$opt["sortname"] = 'NoVente';
// by default sort grid by this field
$opt["sortorder"] = "desc";
// ASC or DESC
示例15: actionIndex
//.........这里部分代码省略.........
$col = array();
$col["title"] = "Phone"; // caption of column
$col["name"] = "Phone";
$col["dbname"] = "addresses.Phone"; // grid column name, same as db field or alias from sql
$col["resizable"] = true;
$col["editable"] = true; // this column is editable
$col["viewable"] = true;
$cols[] = $col;
$col = array();
$col["title"] = "Fax"; // caption of column
$col["name"] = "Fax";
$col["dbname"] = "addresses.Fax"; // grid column name, same as db field or alias from sql
$col["resizable"] = true;
$col["editable"] = true; // this column is editable
$col["viewable"] = true;
$col["search"] = false;
$cols[] = $col;
$g = new jqgrid();
$grid["caption"] = "W9";
// $grid["multiselect"] = true;
$grid["autowidth"] = true;
$grid["resizable"] = true;
//$grid["toppager"] = true;
$grid["sortname"] = 'companies.Company_Name';
$grid["sortorder"] = "ASC";
$grid["add_options"] = array(
'width'=>'420',
"closeAfterEdit"=>true, // close dialog after add/edit
"top"=>"200", // absolute top position of dialog
"left"=>"200" // absolute left position of dialog
);
$g->set_options($grid);
$g->set_actions(array(
"add"=>false, // allow/disallow add
"edit"=>true, // allow/disallow edit
"delete"=>true, // allow/disallow delete
"rowactions"=>true, // show/hide row wise edit/del/save option
"export"=>true, // show/hide export to excel option
"autofilter" => true, // show/hide autofilter for search
"search" => "advance" // show single/multi field search condition (e.g. simple or advance)
)
);
$g->select_command = "SELECT companies.*, addresses.*,
w9.*, images.File_Name, images.Mime_Type
FROM w9
LEFT JOIN documents ON documents.Document_ID = w9.Document_ID
LEFT JOIN images ON images.Document_ID = documents.Document_ID
LEFT JOIN clients ON clients.Client_ID = w9.Client_ID
LEFT JOIN companies ON clients.Company_ID = companies.Company_ID
LEFT JOIN company_addresses ON company_addresses.Company_ID = companies.Company_ID
LEFT JOIN addresses ON addresses.Address_ID = company_addresses.Address_ID";
// set database table for CRUD operations
$g->table = "w9";
$g->set_columns($cols);
// group columns header
$g->set_group_header( array(
"useColSpanStyle"=>true,
"groupHeaders"=>array(
array(
"startColumnName"=>'W9_ID', // group starts from this column
"numberOfColumns"=>11, // group span to next 2 columns
"titleText"=>'W9 Information' // caption of group header
),
array(
"startColumnName"=>'File_Name', // group starts from this column
"numberOfColumns"=>2, // group span to next 2 columns
"titleText"=>'Image Information' // caption of group header
),
array(
"startColumnName"=>'Company_ID', // group starts from this column
"numberOfColumns"=>6, // group span to next 2 columns
"titleText"=>'Company Information' // caption of group header
),
array(
"startColumnName"=>'Address1', // group starts from this column
"numberOfColumns"=>8, // group span to next 2 columns
"titleText"=>"Company's Address" // caption of group header
)
)
)
);
// render grid and get html/js output
$out = $g->render("w9");
$this->render('index',array(
'out'=>$out,
));
}