Loading rico1 and rico3 files
[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 <script type='text/javascript'>
20 Rico.loadModule('LiveGridForms');
21 </script>
22
23 <link href="../demo.css" type="text/css" rel="stylesheet" />
24 <style type="text/css">
25 div.ricoLG_cell {
26   white-space:nowrap;
27 }
28 #explanation * { font-size: 8pt; }
29 </style>
30 </head>
31 <body>
32
33 <?php
34 //************************************************************************************************************
35 //  LiveGrid-Edit Example
36 //************************************************************************************************************
37 //  Matt Brown
38 //************************************************************************************************************
39 if (OpenGridForm("", "shippers")) {
40   if ($oForm->action == "table") {
41     DisplayTable();
42   }
43   else {
44     DefineFields();
45   }
46 } else {
47   echo 'open failed';
48 }
49 CloseApp();
50
51 function DisplayTable() {
52   global $oForm,$oDB;
53   
54   echo "<table id='explanation' border='0' cellpadding='0' cellspacing='5' style='clear:both'><tr valign='top'><td>";
55   echo "Base Library: <script type='text/javascript'>document.write(Rico.Lib+' '+Rico.LibVersion);</script>";
56   echo "<hr>The data on this grid can be edited using pop-up forms. ";
57   echo "Just click on a grid cell and then select Edit, Delete, or Add from the pop-up menu. ";
58   echo "The Add and Edit forms are automatically generated by LiveGrid. ";
59   echo "Updates are disabled on the database, so you will get an error message if you try to save.";
60   echo "</td><td>";
61   echo "<script type='text/javascript'><!--\n";
62   echo "google_ad_client = 'pub-7218597156507462';\n";
63   echo "/* 125x125, created 5/11/09 */\n";
64   echo "google_ad_slot = '9298106441';\n";
65   echo "google_ad_width = 125;\n";
66   echo "google_ad_height = 125;\n";
67   echo "//-->\n";
68   echo "</script>\n";
69   echo "<script type='text/javascript' src='http://pagead2.googlesyndication.com/pagead/show_ads.js'></script>\n";
70   echo "</td></tr></table>";
71
72   echo "<p><strong>Shippers Table</strong></p>";
73   $oForm->options["frozenColumns"]=1;
74   $oForm->options["menuEvent"]='click';
75   $oForm->options["highlightElem"]='cursorRow';
76   DefineFields();
77   //echo "<p><textarea id='shippers_debugmsgs' rows='5' cols='80' style='font-size:smaller;'></textarea>";
78 }
79
80 function DefineFields() {
81   global $oForm,$oDB;
82
83   $oForm->AddEntryFieldW("ShipperID", "ID", "B", "<auto>",50);
84   $oForm->AddEntryFieldW("CompanyName", "Company Name", "B", "", 150);
85   $oForm->ConfirmDeleteColumn();
86   $oForm->SortAsc();
87   $oForm->AddEntryFieldW("Phone", "Phone Number", "B", "", 150);
88
89   $oForm->DisplayPage();
90 }
91 ?>
92
93 </body>
94 </html>