Main Page   Compound List   File List   Compound Members   File Members  

tables.php

Go to the documentation of this file.
00001 <?php
00002 //include libs and read postgresql connection parameter from config.ini file 
00003 include('../include/init/init.php');
00004 
00005 //connect to database
00006 $PgDbConn=pg_connect(
00007                      "dbname=".$CONFIG["DB"]['DBNAME'].
00008                      " user=".$CONFIG["DB"]['USER'].
00009                      " password=".$CONFIG["DB"]['PASSWORD'].
00010                      " host=".$CONFIG["DB"]['HOST']
00011                      ) 
00012      or die("Can't connect!");
00013 
00014 
00015 //initialize Pgtable object
00016 $table = new Pgtable($PgDbConn, "../conf/pgtbconf.ini");
00017 
00018 
00019 //because this file is used to manage more tables, get current selected table from submitted data
00020 list($tbSchema, $tbName, $tbPkey)=$table->get_table();
00021 
00022 //add current table at Pgtable object
00023 $table->add_table($tbSchema, $tbName, $tbPkey);
00024 
00025 
00026 //configure tables settings here: perms, column type etc.
00027 switch($tbName){
00028   /*
00029 
00030  //this configure "lobjecttable" as a table with a column named file_file to store large lobject
00031  case "lobjecttable":
00032   $table->alter_type($tbSchema, $tbName,'file_file', "lobject", array( "type"=>'', 'mime_type_col'=>'file_type', 'name_col'=>'file_name', 'size_col'=>'file_size', 'thumbnail_col'=>'file_thumbnail', 'exif_col'=>'file_exif', "thumbnail_size"=>120));
00033  breaK;
00034 
00035  //this configure "filetable" as a table with a column named file_file to store file 
00036  case "filetable":
00037   $table->alter_type($tbSchema, $tbName,'file_file', "file", array( "type"=>'', 'mime_type_col'=>'file_type', 'name_col'=>'file_name', 'size_col'=>'file_size', 'thumbnail_col'=>'file_thumbnail', 'exif_col'=>'file_exif', "thumbnail_size"=>120));
00038  breaK;
00039 
00040   */
00041 }
00042 
00043 
00044 
00045 $pg_table=$table->switch_actions($tbSchema,  $tbName, $tbPkey);
00046 
00047 
00048 //manage errors and messages
00049 $errors=$table->errors->get();
00050 if($errors)
00051 $errors=array_to_html($errors,0,0);
00052 
00053 $messages=$table->messages->get();
00054 if($messages)
00055 $messages=array_to_html($messages,0,0);
00056 
00057 $title='Table '.$tbName;
00058 
00059 ?>
00060 <html>
00061 
00062 <head>
00063 <link rel="stylesheet" type="text/css" href="/css/main.css" />
00064 <title>phpPgWeb: <?=$title?></title>
00065 </head>
00066 
00067 <body>
00068    <div id="navigation">
00069      <p class="centrato"><a href="/" title="Home"><h1>phpPgWeb</h1></a></p>
00070    </div>
00071 
00072    <p class="titolo"><?=$title?></p>
00073 
00074    <form  name="pgform" method="POST" enctype="multipart/form-data" action="<?=$_SERVER["PHP_SELF"]?>">
00075 
00076    <div id="tbform">
00077    <?=$errors?("       <div id=\"error\">\n".$errors."       </div><hr>\n"):'';?>
00078    <?=$messages?("       <div id=\"alert\">\n".$messages."      </div><hr>\n"):'';?>
00079    <?=$pg_table["search_bar"]?($pg_table["search_bar"].'<br>'):'';?></p>
00080    <p><table>
00081       <?=$pg_table["table"]?>
00082       </table>
00083    </p>
00084    <br>
00085    <p><?=$pg_table["text"]?><hr><?=$pg_table["submit"]?></p>
00086    </div>
00087 
00088    </form>
00089 
00090 </body>
00091 </html>

Generated on Mon Nov 29 01:21:58 2004 for phpPgWeb by doxygen1.2.18