PHP Pg Frontend
Version 0.2
by Raphaël Pautasso and Alexandre Lollini


The PHP Pg frontend project is yet an another frontend for the PostgresSQL database but it fully works !

It have several cool features :

The bad news are at this point that the source code is dirty and comment are in french.
But if someone find this software usefull, it will be improve.
If you want use some part of the source code, tell us and we will help you.

Works on :
- Linux Red Hat 7.5 with Apache 3.18.4, PHP 4.0.3 and PostgreSQL 7.2.1

- Mac OS X.3 with Apache 1.3.29, PHP 4.3.4, PostgreSQL 7.4 and Safari (browser based on Konqueror)
(You MUST change your php.in like this : register_globals = On)

Authors assume that you are familiar with PHP and PotsgreSQL.


How to install the demo :
- Go in the "demo" folder 
- Go in the "sql" folder
- Read the file database.sql
- Create an new PG user "admin" with password "admin" if it did not exist
- Use the file database.sql to create the database "cataweb"
- Check if you can connect to the "cataweb" as user "admin"
- Populate the database with the file "data.sql"
- Return in the "demo" folder
- Copy the "php" folder in a place where your http server could handle it
- In this folder, go in the "log" folder
- Change owner and rights. Your http server must read/write on this file
- Go in the "config" folder
- Verify if the file "bd.php" is OK for you
- Go to the demo URL with your browser
- Enjoy !


With the following documentation, you will understand the demo.


Demo database diagram  (table PROD for product) :


Describe output :

TIMBRE (stamp) table :
cataweb=# \d timbre
Table "timbre"
Column | Type | Modifiers
----------------+--------------------------+-----------
id_prod | bigint | not null
nom_prod | text |
pha_prod | double precision |
pv_prod | double precision |
stock_a | integer |
stock_v | integer |
stock_p | integer |
stock_r | integer |
dat_com_prod | date |
dat_modif_prod | timestamp with time zone |
id_pays | bigint | not null
id_chapitre | bigint |
type_t | integer |
nd_t | integer |
dent_t | integer |
surch_t | integer |
val_t | integer | not null
tir_t | integer |
h_t | integer |
l_t | integer |
dat_emis_t | date |
design_t | text |
impr_t | integer |
off_t | integer |
ref_y_t | text |
cote_y_t | double precision |
ref_m_t | text |
cote_m_t | double precision |
ref_s_t | text |
cote_s_t | double precision |
classe_t | integer |
recu_t | date |
fourn_t | text |
commentaire_t | text |

Unique keys: timbre_nom_prod_key
...

PAYS (country) table :

cataweb=# \d pays  
Table "pays"
Column | Type | Modifiers
----------------+---------+-----------
id_pays | bigint | not null
nom_pays | text |
ref_pays | text |
monnaie_pays | text |
capitale_pays | text |
continent_pays | integer |
nom_pays_2 | text |
nom_pays_3 | text |
nom_pays_4 | text |
nom_pays_5 | text |
Primary key: pays_pkey
Unique keys: pays_nom_pays_key,
pays_ref_pays_key
...

CHAPITRE (chapter) table :

cataweb=# \d chapitre
Table "chapitre"
Column | Type | Modifiers
----------------+---------+-----------
id_chapitre | bigint | not null
nom_chapitre | text |
ref_chapitre | integer | not null
nom_chapitre_2 | text |
nom_chapitre_3 | text |
nom_chapitre_4 | text |
nom_chapitre_5 | text |
Primary key: chapitre_pkey
Unique keys: chapitre_nom_chapitre_key,
chapitre_ref_chapitre_key
...

DESCRIPTION table :

cataweb=# \d description
Table "description"
Column | Type | Modifiers
----------------------------+---------+-----------
id_description | bigint | not null
chemin_fichier_description | text |
texte_description | text |
langue_description | integer |
type_description | integer |
Primary key: description_pkey
Triggers: RI_ConstraintTrigger_1001239,
RI_ConstraintTrigger_1001237,
RI_ConstraintTrigger_1001235,
RI_ConstraintTrigger_1001233,
RI_ConstraintTrigger_1001231,
RI_ConstraintTrigger_1001229,
RI_ConstraintTrigger_1001227,
RI_ConstraintTrigger_1001225,
RI_ConstraintTrigger_1001223,
RI_ConstraintTrigger_1001221

timbre_c_descr table (for n-n link between stamp and description) :

cataweb=# \d timbre_c_descr 
Table "timbre_c_descr"
Column | Type | Modifiers
-------------------+--------+-----------
id_timbre_c_descr | bigint | not null
id_prod | bigint | not null
id_description | bigint | not null
Primary key: timbre_c_descr_pkey
...


Behavior Diagram (reduced) :

 


T3, T11, T14 example :

On the top, from left to right, you can see the basic treatment bar :

Information bar :

Sort bar :

For each line of data you can confirmation form, check for delete, display, modify and see a selection of fields (fully customizable).

Picture liste.jpg :



<>
Example of custom config file :

The ref_chapitre field is int4 data type (file id) but the configuration enable the display of the linked picture.

cfg-liste.jpg :


Customization files arborescence example :

Look at the flag of each country. By default, you have the id of the country but by the config file, you have the flag picture.

Picture liste-tri.jpg :


The files for customization are stored in a file arborescence matching the database structure.

Table list -> Field list -> one file for each basic treatment (check input, forms generation, list and item display).

Picture interface-controle.jpg :


T5, modify with custom form example :

Picture modif.jpg :



< style="font-weight: bold;">
Example of custom item display :

Look at the links established (dark red column), an N-N type link between TIMBRE and DESCRIPTION tables via TIMBRE_C_DESCR link table.

Picture liaisons-etablies.jpg :



That's all folks !