3 // This is where the database connection settings go.
4 // This is required to get the LiveGrid examples running.
5 // As your application develops, this would also be a logical place to put security checks.
6 // The Northwind database is required to run the examples.
7 // Samples of this database in various formats are located in the examples/data directory.
11 require "../../plugins/php/dbClass2.php";
15 function CreateDbClass() {
17 $oDB = new dbClass(); // from dbClass2
19 // What dialect of SQL will we be speaking?
21 //$oDB->Dialect="MySQL" // this is the default, so you can leave it commented
22 //$oDB->Dialect="Oracle";
23 //$oDB->Dialect="TSQL";
24 //$oDB->Dialect="Access";
31 // This is where the database connection is made
32 // Uncomment the appropriate line for your database
35 // $oDB->Provider="MySQLremoveserver" // required if MySQL is remote
36 return $oDB->MySqlLogon($GLOBALS['appDB'], "userid", "password");
38 // Connect via ODBC to a DSN
39 //return $oDB->OdbcLogon("northwindDSN","Northwind","userid","password");
41 // Connect to Oracle XE
42 // Make sure the Oracle database is loaded with the sample database
43 // $oDB->Provider="MySQLremoveserver" // required if Oracle is remote
44 //return $oDB->OracleLogon("XE","northwind","password");
47 function OpenApp($title) {
53 AppHeader($GLOBALS['appName']."-".$title);
55 $GLOBALS['accessRights']="rw";
56 // CHECK APPLICATION SECURITY HERE (in this example, "r" gives read-only access and "rw" gives read/write access)
57 if (empty($GLOBALS['accessRights']) || !isset($GLOBALS['accessRights']) || substr($GLOBALS['accessRights'],0,1) != "r") {
58 echo "<p class='error'>You do not have permission to access this application";
66 function OpenTableEdit($tabname) {
67 $obj= new TableEditClass();
68 $obj->SetTableName($tabname);
69 $obj->options["XMLprovider"]="ricoXMLquery.php";
70 $obj->convertCharSet=true; // because sample database is ISO-8859-1 encoded
74 function OpenGridForm($title, $tabname) {
76 if (!OpenApp($title)) {
79 $GLOBALS['oForm']= OpenTableEdit($tabname);
80 $CanModify=($GLOBALS['accessRights'] == "rw");
81 $GLOBALS['oForm']->options["canAdd"]=$CanModify;
82 $GLOBALS['oForm']->options["canEdit"]=$CanModify;
83 $GLOBALS['oForm']->options["canDelete"]=$CanModify;
84 session_set_cookie_params(60*60);
85 $GLOBALS['sqltext']='.';
91 if (is_object($oDB)) $oDB->dbClose();
93 $GLOBALS['oForm']=NULL;
96 function AppHeader($hdg) {
97 echo "<h2 class='appHeader'>".str_replace("<dialect>",$GLOBALS['oDB']->Dialect,$hdg)."</h2>";