You must then define the views you want to be shown to your users. The "view" word must be specified. There is no SQL view (create view ...), this is just a definition of table sequence.
The first table of each views is the base table. The base tables are the only tables where the user can add entries (apart from first level "newlink"). In our sample, we have 3 different views:
There is 4 type of link in ViewMaker:
For each link, the OID field is used as tuple key.
The third view of our sample involve only the vacance table. So the only things you have to define are each fields of this table.
The definition of a table is implemented as an array of dictionary. The first dictionary contain some attribute of the table and the each others define a field (name, type, label, options, ...).
Be aware! The dictionary keys are case sensitive.
Here is the entries of the first dictionary:
Here is the entries of the fields dictionaries:
array("nom"=>"fichier", "label"=>$offre_fichier,
"type"=>"file", "defaut"=>"" ,"contenu"=>$OBL)
The table must contain fichier:varchar (the name of the file),
fichiero:oid (the id of the LO), fichiers:int (the size of the file).
Possible field options are:
$table_vacance=array(
array("nomTable"=>"vacance", "options"=>0),
array("nom"=>"resume", "label"=>$rdv_resume,
"type"=>"varchar", "defaut"=>"" ,"contenu"=>$OBL+$TAB),
array("nom"=>"debut", "label"=>$rdv_debut,
"type"=>"date", "defaut"=>"" ,"contenu"=>$OBL+$TAB+$ORD),
array("nom"=>"fin", "label"=>$rdv_fin,
"type"=>"date", "defaut"=>"" ,"contenu"=>$OBL+$TAB),
array("nom"=>"detail", "label"=>$rdv_detail,
"type"=>"varchar", "defaut"=>"" ,"contenu"=>$MUL)
);
For the second view of our sample, we have a linked table lieux. Each person in your address book can have N addresses. The newlink link type fit exactly our needs.
Here is how we do it:
$table_adresse=array(
array("nomTable"=>"gens", "options"=>$EXTLINK+$CANLIST,
"tableHead"=>"|l|l|l|l|l|l|", "fontSize"=>9, "nbList"=>6,
"geometry"=>"a4paper,dvips,noheadfoot,left=1cm,top=1cm,textheight=30cm"
),
array("nom"=>"nom", "label"=>$adresse_nom,
"type"=>"varchar", "defaut"=>"" ,"contenu"=>$ORD+$OBL+$TAB+$LIS),
array("nom"=>"prenom", "label"=>$adresse_prenom,
"type"=>"varchar", "defaut"=>"" ,"contenu"=>$ORD+$OBL+$TAB+$LIS),
array("nom"=>"date", "label"=>$adresse_date, "taille"=>12,
"type"=>"date", "defaut"=>"" ,"contenu"=>$LIS),
array("nom"=>"lieux", "label"=>$adresse_lieux,
"type"=>"newlink", "defaut"=>"", "contenu"=>$LIS,
"table"=>"table_adresse_lieux"),
array("nom"=>"com1", "label"=>$adresse_com,
"type"=>"varchar", "defaut"=>"" ,"contenu"=>$MUL),
array("nom"=>"etml", "label"=>$adresse_etml, "taille"=>3,
"type"=>"float", "defaut"=>"0","contenu"=>0),
array("nom"=>"einev", "label"=>$adresse_einev, "taille"=>3,
"type"=>"float", "defaut"=>"0","contenu"=>0),
array("nom"=>"primsup", "label"=>$adresse_primsup,
"type"=>"bool", "defaut"=>"f", "contenu"=>0),
array("nom"=>"perdu", "label"=>$adresse_perdu,
"type"=>"bool", "defaut"=>"f", "contenu"=>0)
);
$table_adresse_lieux=array(
array("nomTable"=>"lieux","label"=>$lieux_label,"backLink"=>1,
"nbList"=>3),
array("nom"=>"gens",
"type"=>"prevlink", "defaut"=>"", "contenu"=>$OBL),
array("nom"=>"descr", "label"=>$lieux_descr,
"type"=>"varchar", "defaut"=>"" ,"contenu"=>$LIS+$ORD),
array("nom"=>"phone", "label"=>$lieux_phone,
"type"=>"varchar", "defaut"=>"", "contenu"=>$LIS),
array("nom"=>"adresse", "label"=>$lieux_adresse,
"type"=>"varchar", "defaut"=>"" ,"contenu"=>$MUL+$LIS),
array("nom"=>"email", "label"=>$lieux_email, "URL"=>"mailto:",
"type"=>"varchar", "defaut"=>"" ,"contenu"=>0),
array("nom"=>"homepage", "label"=>$lieux_homepage, "URL"=>"http://",
"type"=>"varchar", "defaut"=>"" ,"contenu"=>0)
);
You can see in $table_adresse a special field lieux of type newlink. This field have a reference on $table_adresse_lieux who define the linked table fields.
This second definition is same as a normal definition apart from the backLink entry. It have the index number of the field which link with the base table. This field is of prevlink type.
We give the user the possibility to print his address book as a Latex file. So we must add tableHead, fontSize, nbList, geometry in the main table definition and nbList in the sub-tables definitions. The option $SUB is added to each fields and links that must be included in the report.
The first view of our sample is defined like this:
$table_rdv=array(
array("nomTable"=>"rdv", "options"=>$EXTLINK+$CANLIST,
"tableHead"=>"|l|l|l|l|l|l|l|", "fontSize"=>9, "nbList"=>7,
"geometry"=>
"a4paper,dvips,noheadfoot,left=2cm,top=2cm,landscape,textheight=20cm"
),
array("nom"=>"resume", "label"=>$rdv_resume,
"type"=>"varchar", "defaut"=>"" ,"contenu"=>$OBL+$TAB+$LIS),
array("nom"=>"debut", "label"=>$rdv_debut,
"type"=>"datetime", "defaut"=>"" ,"contenu"=>$OBL+$TAB+$ORD+$LIS),
array("nom"=>"fin", "label"=>$rdv_fin,
"type"=>"datetime", "defaut"=>"" ,"contenu"=>$OBL+$TAB),
array("nom"=>"alarme", "label"=>$rdv_alarme, "taille"=>5,
"type"=>"int", "defaut"=>"" ,"contenu"=>0),
array("nom"=>"detail", "label"=>$rdv_detail,
"type"=>"varchar", "defaut"=>"" ,"contenu"=>$MUL),
array("nom"=>"contact", "label"=>$rdv_contact,
"type"=>"extlink", "defaut"=>"" ,"contenu"=>$LIS,
"table"=>"table_rdv_contact"),
array("nom"=>"prive", "label"=>$rdv_prive,
"type"=>"bool", "defaut"=>"f","contenu"=>0),
array("nom"=>"confirme", "label"=>$rdv_confirme,
"type"=>"bool", "defaut"=>"f","contenu"=>0)
);
$table_rdv_contact=array(
array("nomTable"=>"contact", "label"=>$contact_descr, "nbList"=>5,
"backLink"=>1, "foreLink"=>2),
array("nom"=>"rdv", "type"=>"prevlink", "defaut"=>"" ,"contenu"=>$OBL),
array("nom"=>"adresse", "type"=>"link", "defaut"=>"" ,"contenu"=>$OBL+$LIS,
"table"=>"table_rdv_adresse")
);
$table_rdv_adresse=array(
array("nomTable"=>"gens", "nbList"=>5, "filtre"=>"perdu='f'"),
array("nom"=>"nom", "label"=>$adresse_nom,
"type"=>"varchar", "defaut"=>"" ,"contenu"=>$ORD+$OBL+$TAB+$LIS),
array("nom"=>"prenom", "label"=>$adresse_prenom,
"type"=>"varchar", "defaut"=>"" ,"contenu"=>$ORD+$OBL+$TAB+$LIS),
array("nom"=>"lieux", "label"=>$adresse_lieux,
"type"=>"newlink", "defaut"=>"", "contenu"=>$LIS,
"table"=>"table_adresse_lieux")
);
$table_adresse_lieux=array(
...
);
I have introduced a table for linking rdv with adresse. This definition must have a backLink entry and a foreLink entry.
Yes, but it's becoming hard to explain how to do it. You must try... or ask me.
Now you must create some php3 files.