SHARE
TWEET

Untitled

a guest Oct 11th, 2014 50 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. /**
  3.  * PHP Grid Component
  4.  *
  5.  * @author Abu Ghufran <gridphp@gmail.com> - http://www.phpgrid.org
  6.  * @version 1.4.6
  7.  * @license: see license.txt included in package
  8.  */
  9.  
  10.  
  11.        
  12.  
  13. include('/homepages/29/d369536025/htdocs/zonaprivadatdg/config/config.php');
  14. $conn = mysql_connect(DB_HOST,DB_USER,DB_PASS);
  15. mysql_select_db(DB_NAME);  
  16.  
  17.  include('/homepages/29/d369536025/htdocs/zonaprivadatdg/phpgrid/lib/inc/jqgrid_dist.php');
  18.  
  19. // set your db encoding -- for ascent chars (if required)
  20. mysql_query("SET NAMES 'utf8'");
  21.  
  22.  
  23. $g = new jqgrid();
  24.  
  25.  
  26. $e["on_insert"] = array("insert_soci", null, false);
  27. $e["on_update"] = array("update_soci", null, false);
  28. $e["on_delete"] = array("delete_soci", null, false);
  29.  
  30.  
  31.  
  32. function insert_soci($data)
  33. {
  34.    $sql="INSERT into anotacions(anotacions) VALUES ('insert record')";
  35.    mysql_query($sql);
  36.    
  37. }
  38.  
  39.  
  40. function update_soci($data)
  41. {
  42.    $sql="INSERT into anotacions(anotacions) VALUES ('update record')";
  43.    mysql_query($sql);
  44. }
  45.  
  46. function delete_soci($data)
  47. {
  48.    $sql="DELETE from anotacions WHERE anotacions like '%insert%'";
  49.    //mysql_query($sql);
  50. }
  51.  
  52. $g->set_events($e);
  53.  
  54.  
  55.  
  56.  
  57. // set few params
  58.  
  59. $grid["autowidth"] = true;
  60. $grid["resizable"] = true;
  61. $grid["height"] = "600";
  62. $grid["rowNum"] = 25;
  63. $grid["caption"] = "Socis";
  64. $grid["multiselect"] = true;
  65. $grid["auto_width"] = true;
  66. $grid["sortname"] = 'cognom1,cognom2,nom';
  67. $grid["sortorder"] = "desc";
  68.  
  69.  
  70.  
  71.  
  72.  
  73. $grid["export"]["range"] = "filtered"; // or "all"
  74.  
  75. // # set add/edit dialog width ... to apply css (see below)
  76.  
  77.  
  78. // export PDF file params
  79. $grid["export"] = array("format"=>"excel","filename"=>"socis_alldata_list", "heading"=>"Socis All Data List", "orientation"=>"landscape", "paper"=>"a4");
  80. // for excel, sheet header
  81. $grid["export"]["sheetname"] = "schedule_draws";
  82.  
  83.  
  84. // export filtered data or all data
  85. $grid["export"]["range"] = "filtered"; // or "all"
  86.  
  87. $grid["add_options"] = array("recreateForm" => true, "closeAfterEdit"=>true, 'width'=>'600', 'top'=>'0', 'left'=>'0');
  88. $grid["edit_options"] = array("recreateForm" => true, "closeAfterEdit"=>true, 'width'=>'600', 'top'=>'0', 'left'=>'0');
  89.  
  90.  
  91.  
  92. $g->set_options($grid);
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100. // set database table for CRUD operations
  101. $g->table = "socis";  
  102.  
  103. $col = array();
  104. $col["title"] = "Id";  
  105. $col["name"] = "id";
  106. $cols[] = $col;
  107.  
  108. $col = array();
  109. $col["title"] = "Cognom 1";  
  110. $col["name"] = "cognom1";
  111. $col["editable"] = true;
  112. $cols[] = $col;
  113.  
  114. $col = array();
  115. $col["title"] = "Cognom 2";  
  116. $col["name"] =  "cognom2";
  117. $col["editable"] = true;
  118. $cols[] = $col;
  119.  
  120. $col = array();
  121. $col["title"] = "Nom";  
  122. $col["name"] = "nom";
  123. $col["editable"] = true;
  124. $cols[] = $col;
  125.  
  126. $col = array();
  127. $col["title"] = "Sexe";  
  128. $col["name"] = "sexe";
  129. $col["editable"] = true;
  130. $col["stype"] = "select";
  131. $col["searchoptions"] = array("value" => ":;H:Home;D:Dona");
  132. $cols[] = $col;
  133.  
  134. $col = array();
  135. $col["title"] = "Mòbil";  
  136. $col["name"] = "mobil";
  137. $col["editable"] = true;
  138. $cols[] = $col;
  139.  
  140. $col = array();
  141. $col["title"] = "Fijo";  
  142. $col["name"] = "fijo";
  143. $col["editable"] = true;
  144. $cols[] = $col;
  145.  
  146. $col = array();
  147. $col["title"] = "CC";  
  148. $col["name"] = "cc_iban";
  149. $col["editable"] = true;
  150. $cols[] = $col;
  151.  
  152. $col = array();
  153. $col["title"] = "Dni";  
  154. $col["name"] = "dni";
  155. $col["editable"] = true;
  156. $cols[] = $col;
  157.  
  158. $col = array();
  159. $col["title"] = "Adreça";  
  160. $col["name"] = "adreça";
  161. $col["editable"] = true;
  162. $cols[] = $col;
  163.  
  164. $col = array();
  165. $col["title"] = "Numero";  
  166. $col["name"] = "numero";
  167. $col["editable"] = true;
  168. $cols[] = $col;
  169.  
  170. $col = array();
  171. $col["title"] = "Ciutat";  
  172. $col["name"] = "ciutat";
  173. $col["editable"] = true;
  174. $cols[] = $col;
  175.  
  176. $col = array();
  177. $col["title"] = "Email";  
  178. $col["name"] = "email";
  179. $col["editable"] = true;
  180. $cols[] = $col;
  181.  
  182. $col = array();
  183. $col["title"] = "Any inscripcio";  
  184. $col["name"] = "any_inscripcio";
  185. $col["editable"] = true;
  186. $cols[] = $col;
  187.  
  188. $col = array();
  189. $col["title"] = "Data N.";  
  190. $col["name"] = "data_naixement";
  191. $col["editable"] = true;
  192. $cols[] = $col;
  193.  
  194. $col = array();
  195. $col["title"] = "Xiquet";  
  196. $col["name"] = "xiquet";
  197. $col["stype"] = "select";
  198. $col["searchoptions"] = array("value" => ":;1:Si;0:No");
  199. $col["edittype"] = "checkbox";
  200. $col["editoptions"] = array("value"=>"1:0");
  201. $col["editable"] = true;
  202.  
  203. $cols[] = $col;
  204.  
  205. $col = array();
  206. $col["title"] = "Nom R.";  
  207. $col["name"] = "nom_responsable";
  208. $col["editable"] = true;
  209. $cols[] = $col;
  210.  
  211. $col = array();
  212. $col["title"] = "Dni R.";  
  213. $col["name"] = "dni_responsable";
  214. $col["editable"] = true;
  215. $cols[] = $col;
  216.  
  217. $col = array();
  218. $col["title"] = "Resp Socia";  
  219. $col["name"] = "responsable_socia";
  220. $col["edittype"] = "checkbox";
  221. $col["editoptions"] = array("value"=>"1:0");
  222. $col["editable"] = true;
  223. $cols[] = $col;
  224.  
  225. $col = array();
  226. $col["title"] = "Q. Mant";  
  227. $col["name"] = "quota_manteniment";
  228. $col["editable"] = true;
  229. $col["stype"] = "select";
  230. $col["searchoptions"] = array("value" => ":;1:Si;0:No");
  231. $col["edittype"] = "checkbox";
  232. $col["editoptions"] = array("value"=>"1:0");
  233. $cols[] = $col;
  234.  
  235. $col = array();
  236. $col["title"] = "Any.Mant";  
  237. $col["name"] = "any_manteniment";
  238. $col["editable"] = true;
  239. $cols[] = $col;
  240.  
  241. $col = array();
  242. $col["title"] = "Action";
  243. $col["name"] = "act";
  244. $col["width"] = "150";
  245. $col["export"] = false;
  246. $cols[] = $col;
  247.  
  248.  
  249.  
  250. $g->set_columns($cols);
  251.  
  252.  
  253. $f["column"] = "xiquet"; // exact column name, as defined above in set_columns or sql field name
  254. $f["op"] = "eq"; // cn - contains, eq - equals
  255. $f["value"] = "1";
  256. $f["css"] = "'background-color':'#80bedf', 'border':'1px solid #DDDDDD'"; // must use (single quote ') with css attr and value
  257. $f_conditions[] = $f;
  258.  
  259. $f["column"] = "quota_manteniment"; // exact column name, as defined above in set_columns or sql field name
  260. $f["op"] = "eq"; // cn - contains, eq - equals
  261. $f["value"] = "1";
  262. $f["css"] = "'background-color':'#ffcc94', 'border':'1px solid #DDDDDD'"; // must use (single quote ') with css attr and value
  263. $f_conditions[] = $f;
  264.  
  265.  
  266.  
  267.  
  268.  
  269. $g->set_conditional_css($f_conditions);
  270.  
  271.  
  272.  
  273.  
  274.  
  275. $g->set_actions(array( 
  276.                                                 "add"=>true, // allow/disallow add
  277.                                                 "edit"=>true, // allow/disallow edit
  278.                                                 "delete"=>true, // allow/disallow delete
  279.                                                 "rowactions"=>true, // show/hide row wise edit/del/save option
  280.                                                 "export_excel"=>true, // show/hide export to excel option - must set export xlsx params
  281.                                                 "export_pdf"=>false, // show/hide export to pdf option - must set pdf params
  282.                                                 "autofilter" => true, // show/hide autofilter for search
  283.                                                 "search" => "advance" // show single/multi field search condition (e.g. simple or advance)
  284.                                         )
  285.                                 );
  286.                        
  287. // render grid
  288. $out = $g->render("list1");
  289.  
  290.  
  291.  
  292.      
  293.  
  294.  
  295. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top