Advertisement
Guest User

Untitled

a guest
Jun 5th, 2016
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.56 KB | None | 0 0
  1. <?php
  2.  
  3.  
  4. // include db config
  5. include_once("config.php");
  6.  
  7. // include and create object
  8. include(PHPGRID_LIBPATH."inc/jqgrid_dist.php");
  9.  
  10. // Database config file to be passed in phpgrid constructor
  11. $db_conf = array(
  12. "type" => PHPGRID_DBTYPE,
  13. "server" => PHPGRID_DBHOST,
  14. "user" => PHPGRID_DBUSER,
  15. "password" => PHPGRID_DBPASS,
  16. "database" => PHPGRID_DBNAME
  17. );
  18.  
  19. $g = new jqgrid($db_conf);
  20.  
  21.  
  22. // export XLS file
  23. // export to excel parameters
  24. $opt = array();
  25. $opt["rowNum"] = 50; // by default 20
  26. $opt["sortname"] = 'Contribuente'; // by default sort grid by this field
  27. $opt["sortorder"] = "asc"; // ASC or DESC
  28. $opt["caption"] = "Utenti AER ma privi di abbinamento con Halley"; // caption of grid
  29. $opt["autowidth"] = true; // expand grid to screen width
  30. $opt["multiselect"] = false; // allow you to multi-select through checkboxes
  31. $opt["rowactions"] = true; // allow you to multi-select through checkboxes
  32.  
  33. // export XLS file
  34. // export to excel parameters
  35. $grid["export"] = array("format"=>"csv", "filename"=>"archivio_utenti_aer");
  36.  
  37. $g->set_options($opt);
  38.  
  39. $g->set_actions(array(
  40. "add"=>false, // allow/disallow add
  41. "edit"=>false, // allow/disallow edit
  42. "delete"=>false, // allow/disallow delete
  43. "rowactions"=>true, // show/hide row wise edit/del/save option
  44. "export"=>true, // show/hide export to excel option
  45. "autofilter" => true, // show/hide autofilter for search
  46. "search" => "false" // show single/multi field search condition (e.g. simple or advance)
  47. )
  48. );
  49.  
  50. // set few params
  51.  
  52. $grid["caption"] = "Utenti AER ma privi di abbinamento con Halley";
  53. $grid["multiselect"] = false;
  54. $grid["height"] = "1500";
  55. $grid["autowidth"] = true;
  56. $grid["rowNum"] = 50;
  57. $grid["view_options"] = array('width'=>'420');
  58.  
  59.  
  60.  
  61.  
  62. // Prima va messa la query personalizzata poi la tabella principale da cui far comparire la griglia e i comandi.
  63. $sql = "SELECT ht_ass_garbage.Dispositivo, ht_ass_garbage.CodUtenzaDispositivo,ht_ass_garbage.Cognome_ragione_soc_,ht_ass_garbage.Nome ,ht_ass_garbage.Cod_fiscale, ht_ass_garbage.Conferimento FROM ht_ass_garbage LEFT JOIN ht_ass_h_aer ON ht_ass_garbage.CodUtenzaDispositivo = ht_ass_h_aer.CodUtenzaDispositivo";
  64.  
  65. $g->select_command = $sql;
  66.  
  67. $g->table = "ht_ass_garbage";
  68.  
  69. $col = array();
  70. $col["title"] = "ID"; // caption of column, can use HTML tags too
  71. $col["name"] = "Seriale"; // grid column name, same as db field or alias from sql
  72. $col["width"] = "35"; // width on grid
  73. $col["show"] = array("list"=>false, "add"=>true, "edit"=>true, "view"=>true);
  74.  
  75. $cols[] = $col;
  76.  
  77. $col = array();
  78. $col["title"] = "Cod.Ut."; // caption of column, can use HTML tags too
  79. $col["name"] = "Codice_utenza"; // grid column name, same as db field or alias from sql
  80. $col["width"] = "35"; // width on grid
  81. $col["show"] = array("list"=>false, "add"=>true, "edit"=>true, "view"=>true);
  82.  
  83. $cols[] = $col;
  84.  
  85. $col = array();
  86. $col["title"] = "Contribuente"; // caption of column, can use HTML tags too
  87. $col["name"] = "Contribuente"; // grid column name, same as db field or alias from sql
  88. $col["width"] = "100"; // width on grid
  89.  
  90. $cols[] = $col;
  91.  
  92. $col = array();
  93. $col["title"] = "Cod.Fiscale"; // caption of column, can use HTML tags too
  94. $col["name"] = "Cod_fiscale"; // grid column name, same as db field or alias from sql
  95. $col["width"] = "80"; // width on grid
  96.  
  97. $cols[] = $col;
  98.  
  99. $col = array();
  100. $col["title"] = "T.Ut."; // caption of column, can use HTML tags too
  101. $col["name"] = "Tipo_utenza"; // grid column name, same as db field or alias from sql
  102. $col["search"] = false; // this column is not searchable
  103. $col["width"] = "25"; // width on grid
  104.  
  105. $cols[] = $col;
  106.  
  107. $col = array();
  108. $col["title"] = "ht_ass_aer"; // caption of column, can use HTML tags too
  109. $col["name"] = "ht_ass_h_aer.CodUtenzaDispositivo"; // grid column name, same as db field or alias from sql
  110. $col["search"] = false; // this column is not searchable
  111. $col["width"] = "25"; // width on grid
  112.  
  113. $cols[] = $col;
  114.  
  115.  
  116. $g->set_columns($cols);
  117.  
  118. $out = $g->render("list1");
  119.  
  120.  
  121. $lang_path = strstr(realpath("."),"demos",true)."lib/js/jqgrid/js/i18n";
  122.  
  123. $cdir = scandir($lang_path);
  124. foreach ($cdir as $key => $value)
  125. {
  126. if (!in_array($value,array(".","..")))
  127. {
  128. $langs[] = $value;
  129. }
  130. }
  131.  
  132. // if set from page
  133. if (!empty($_GET["lang"]))
  134. $i = $_GET["lang"];
  135. else
  136. $i = "grid.locale-en.js";
  137.  
  138. ?>
  139. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
  140. <html>
  141. <head>
  142. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  143. <link rel="stylesheet" type="text/css" media="screen" href="lib/js/themes/sunny/jquery-ui.custom.css"></link>
  144. <link rel="stylesheet" type="text/css" media="screen" href="lib/js/jqgrid/css/ui.jqgrid.css"></link>
  145.  
  146. <script src="lib/js/jquery.min.js" type="text/javascript"></script>
  147. <script src="lib/js/jqgrid/js/i18n/grid.locale-it.js" type="text/javascript"></script>
  148. <script src="lib/js/jqgrid/js/jquery.jqGrid.min.js" type="text/javascript"></script>
  149. <script src="lib/js/themes/jquery-ui.custom.min.js" type="text/javascript"></script>
  150. </head>
  151. <body>
  152.  
  153. <?php echo $out?>
  154. </div>
  155. </body>
  156. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement