Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * PHP Grid Component
- *
- * @author Abu Ghufran <gridphp@gmail.com> - http://www.phpgrid.org
- * @version 1.4.6
- * @license: see license.txt included in package
- */
- include('/homepages/29/d369536025/htdocs/zonaprivadatdg/config/config.php');
- $conn = mysql_connect(DB_HOST,DB_USER,DB_PASS);
- mysql_select_db(DB_NAME);
- include('/homepages/29/d369536025/htdocs/zonaprivadatdg/phpgrid/lib/inc/jqgrid_dist.php');
- // set your db encoding -- for ascent chars (if required)
- mysql_query("SET NAMES 'utf8'");
- $g = new jqgrid();
- $e["on_insert"] = array("insert_soci", null, false);
- $e["on_update"] = array("update_soci", null, false);
- $e["on_delete"] = array("delete_soci", null, false);
- function insert_soci($data)
- {
- $sql="INSERT into anotacions(anotacions) VALUES ('insert record')";
- mysql_query($sql);
- }
- function update_soci($data)
- {
- $sql="INSERT into anotacions(anotacions) VALUES ('update record')";
- mysql_query($sql);
- }
- function delete_soci($data)
- {
- $sql="DELETE from anotacions WHERE anotacions like '%insert%'";
- //mysql_query($sql);
- }
- $g->set_events($e);
- // set few params
- $grid["autowidth"] = true;
- $grid["resizable"] = true;
- $grid["height"] = "600";
- $grid["rowNum"] = 25;
- $grid["caption"] = "Socis";
- $grid["multiselect"] = true;
- $grid["auto_width"] = true;
- $grid["sortname"] = 'cognom1,cognom2,nom';
- $grid["sortorder"] = "desc";
- $grid["export"]["range"] = "filtered"; // or "all"
- // # set add/edit dialog width ... to apply css (see below)
- // export PDF file params
- $grid["export"] = array("format"=>"excel","filename"=>"socis_alldata_list", "heading"=>"Socis All Data List", "orientation"=>"landscape", "paper"=>"a4");
- // for excel, sheet header
- $grid["export"]["sheetname"] = "schedule_draws";
- // export filtered data or all data
- $grid["export"]["range"] = "filtered"; // or "all"
- $grid["add_options"] = array("recreateForm" => true, "closeAfterEdit"=>true, 'width'=>'600', 'top'=>'0', 'left'=>'0');
- $grid["edit_options"] = array("recreateForm" => true, "closeAfterEdit"=>true, 'width'=>'600', 'top'=>'0', 'left'=>'0');
- $g->set_options($grid);
- // set database table for CRUD operations
- $g->table = "socis";
- $col = array();
- $col["title"] = "Id";
- $col["name"] = "id";
- $cols[] = $col;
- $col = array();
- $col["title"] = "Cognom 1";
- $col["name"] = "cognom1";
- $col["editable"] = true;
- $cols[] = $col;
- $col = array();
- $col["title"] = "Cognom 2";
- $col["name"] = "cognom2";
- $col["editable"] = true;
- $cols[] = $col;
- $col = array();
- $col["title"] = "Nom";
- $col["name"] = "nom";
- $col["editable"] = true;
- $cols[] = $col;
- $col = array();
- $col["title"] = "Sexe";
- $col["name"] = "sexe";
- $col["editable"] = true;
- $col["stype"] = "select";
- $col["searchoptions"] = array("value" => ":;H:Home;D:Dona");
- $cols[] = $col;
- $col = array();
- $col["title"] = "Mòbil";
- $col["name"] = "mobil";
- $col["editable"] = true;
- $cols[] = $col;
- $col = array();
- $col["title"] = "Fijo";
- $col["name"] = "fijo";
- $col["editable"] = true;
- $cols[] = $col;
- $col = array();
- $col["title"] = "CC";
- $col["name"] = "cc_iban";
- $col["editable"] = true;
- $cols[] = $col;
- $col = array();
- $col["title"] = "Dni";
- $col["name"] = "dni";
- $col["editable"] = true;
- $cols[] = $col;
- $col = array();
- $col["title"] = "Adreça";
- $col["name"] = "adreça";
- $col["editable"] = true;
- $cols[] = $col;
- $col = array();
- $col["title"] = "Numero";
- $col["name"] = "numero";
- $col["editable"] = true;
- $cols[] = $col;
- $col = array();
- $col["title"] = "Ciutat";
- $col["name"] = "ciutat";
- $col["editable"] = true;
- $cols[] = $col;
- $col = array();
- $col["title"] = "Email";
- $col["name"] = "email";
- $col["editable"] = true;
- $cols[] = $col;
- $col = array();
- $col["title"] = "Any inscripcio";
- $col["name"] = "any_inscripcio";
- $col["editable"] = true;
- $cols[] = $col;
- $col = array();
- $col["title"] = "Data N.";
- $col["name"] = "data_naixement";
- $col["editable"] = true;
- $cols[] = $col;
- $col = array();
- $col["title"] = "Xiquet";
- $col["name"] = "xiquet";
- $col["stype"] = "select";
- $col["searchoptions"] = array("value" => ":;1:Si;0:No");
- $col["edittype"] = "checkbox";
- $col["editoptions"] = array("value"=>"1:0");
- $col["editable"] = true;
- $cols[] = $col;
- $col = array();
- $col["title"] = "Nom R.";
- $col["name"] = "nom_responsable";
- $col["editable"] = true;
- $cols[] = $col;
- $col = array();
- $col["title"] = "Dni R.";
- $col["name"] = "dni_responsable";
- $col["editable"] = true;
- $cols[] = $col;
- $col = array();
- $col["title"] = "Resp Socia";
- $col["name"] = "responsable_socia";
- $col["edittype"] = "checkbox";
- $col["editoptions"] = array("value"=>"1:0");
- $col["editable"] = true;
- $cols[] = $col;
- $col = array();
- $col["title"] = "Q. Mant";
- $col["name"] = "quota_manteniment";
- $col["editable"] = true;
- $col["stype"] = "select";
- $col["searchoptions"] = array("value" => ":;1:Si;0:No");
- $col["edittype"] = "checkbox";
- $col["editoptions"] = array("value"=>"1:0");
- $cols[] = $col;
- $col = array();
- $col["title"] = "Any.Mant";
- $col["name"] = "any_manteniment";
- $col["editable"] = true;
- $cols[] = $col;
- $col = array();
- $col["title"] = "Action";
- $col["name"] = "act";
- $col["width"] = "150";
- $col["export"] = false;
- $cols[] = $col;
- $g->set_columns($cols);
- $f["column"] = "xiquet"; // exact column name, as defined above in set_columns or sql field name
- $f["op"] = "eq"; // cn - contains, eq - equals
- $f["value"] = "1";
- $f["css"] = "'background-color':'#80bedf', 'border':'1px solid #DDDDDD'"; // must use (single quote ') with css attr and value
- $f_conditions[] = $f;
- $f["column"] = "quota_manteniment"; // exact column name, as defined above in set_columns or sql field name
- $f["op"] = "eq"; // cn - contains, eq - equals
- $f["value"] = "1";
- $f["css"] = "'background-color':'#ffcc94', 'border':'1px solid #DDDDDD'"; // must use (single quote ') with css attr and value
- $f_conditions[] = $f;
- $g->set_conditional_css($f_conditions);
- $g->set_actions(array(
- "add"=>true, // allow/disallow add
- "edit"=>true, // allow/disallow edit
- "delete"=>true, // allow/disallow delete
- "rowactions"=>true, // show/hide row wise edit/del/save option
- "export_excel"=>true, // show/hide export to excel option - must set export xlsx params
- "export_pdf"=>false, // show/hide export to pdf option - must set pdf params
- "autofilter" => true, // show/hide autofilter for search
- "search" => "advance" // show single/multi field search condition (e.g. simple or advance)
- )
- );
- // render grid
- $out = $g->render("list1");
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement