.net server control is almost feature complete and functional. All .net examples...
[infodrom/rico3] / examples / php / ShipperEdit.php
1 <?php
2 if (!isset ($_SESSION)) session_start();
3 header("Cache-Control: no-cache");
4 header("Pragma: no-cache");
5 header("Expires: ".gmdate("D, d M Y H:i:s",time()+(-1*60))." GMT");
6 header('Content-type: text/html; charset=utf-8');
7 ?>
8
9 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
10 <html>
11 <head>
12 <title>Rico LiveGrid-Shippers (editable)</title>
13
14 <?php
15 require "dbConnect.php";
16 require "LoadRicoClient.php";
17 require "../../plugins/php/ricoLiveGridForms.php";
18 ?>
19
20 <link href="../demo.css" type="text/css" rel="stylesheet" />
21 <style type="text/css">
22 div.ricoLG_cell {
23   white-space:nowrap;
24 }
25 #explanation * { font-size: 8pt; }
26 </style>
27 </head>
28 <body>
29
30 <?php
31 //************************************************************************************************************
32 //  LiveGrid-Edit Example
33 //************************************************************************************************************
34 //  Matt Brown
35 //************************************************************************************************************
36 if (OpenGridForm("", "shippers")) {
37   if ($oForm->action == "table") {
38     DisplayTable();
39   }
40   else {
41     DefineFields();
42   }
43 } else {
44   echo 'open failed';
45 }
46 CloseApp();
47
48 function DisplayTable() {
49   global $oForm,$oDB;
50   
51   echo "<table id='explanation' border='0' cellpadding='0' cellspacing='5' style='clear:both'><tr valign='top'><td>";
52   echo "Base Library: <script type='text/javascript'>document.write(Rico.Lib+' '+Rico.LibVersion);</script>";
53   echo "<hr>The data on this grid can be edited using pop-up forms. ";
54   echo "Just click on a grid cell and then select Edit, Delete, or Add from the pop-up menu. ";
55   echo "The Add and Edit forms are automatically generated by LiveGrid. ";
56   echo "Updates are disabled on the database, so you will get an error message if you try to save.";
57   echo "</td><td>";
58   require "info.php";
59   echo "</td></tr></table>";
60
61   echo "<p><strong>Shippers Table</strong></p>";
62   $oForm->options["frozenColumns"]=1;
63   $oForm->options["menuEvent"]='click';
64   $oForm->options["highlightElem"]='cursorRow';
65   DefineFields();
66   //echo "<p><textarea id='shippers_debugmsgs' rows='5' cols='80' style='font-size:smaller;'></textarea>";
67 }
68
69 function DefineFields() {
70   global $oForm,$oDB;
71
72   $oForm->AddEntryFieldW("ShipperID", "ID", "B", "<auto>",50);
73   $oForm->AddEntryFieldW("CompanyName", "Company Name", "B", "", 150);
74   $oForm->ConfirmDeleteColumn();
75   $oForm->SortAsc();
76   $oForm->AddEntryFieldW("Phone", "Phone Number", "B", "", 150);
77
78   $oForm->DisplayPage();
79 }
80 ?>
81
82 </body>
83 </html>