PHP Classes

File: Exemple.php

Recommend this page to a friend!
  Classes of Ghali Ahmed   DG   Exemple.php   Download  
File: Exemple.php
Role: Example script
Content type: text/plain
Description: Exemple file
Class: DG
Display database query results in HTML tables
Author: By
Last change: change the css src
Date: 16 years ago
Size: 2,225 bytes
 

Contents

Class file image Download
<?php

include("conf/db.conf.php") ;
include(
"logic/sqlExec.class.php") ;
include(
"logic/DG.class.php") ;
include(
"logic/function.php") ;

//******************************************First step:***********************************************
//Retrive results from the data base

$db = new sqlExec() ;
$db->setTable("utilisateurs") ;
//*****************************************The second step:*******************************************
//prepare the different parameters of the grid
$grid = new DG() ;
$grid->setConf('lblDbId','identifiant') ;

//This is a test you allow to see some error in the debug pannel
//whene the first argument is not a key in the conf array of the DG class

$grid->setConf('gdfgdfg','id_book') ;

$grid->setDbRessource($db) ;

$grid->addToQueryString('DG_version','1.0') ;
//The columns of the table to post the value in the rows of the grid

//The columns of the table to post the value in the rows of the grid
$grid->setFields("identifiant,nom,prenom,login,actif,niveau_user") ;

//Some columns need to be changed to be display the correct label
//exemple identifiant becomes user Id
$grid->setlblFields(array("identifiant"=>"user Id","niveau_user"=>"Catgorie de l'utilisateur")) ;

//Definir the columns of the actions such as delete and update
//you can also oblige the systeme to use the values of some columns
//As we selectionne give them with the name of the column enter hook
$grid->setActions(array('Action'=>'<a href="#?id={identifiant}&nom={nom}"><img src="images/update.gif" /></a>
                                    <a href="#?id={identifiant}"><img src="images/delete.gif" /></a>'
)) ;
                                  

//seting up the value of the footer

$grid->setFooter("<div align='center'>
                            Show book from table book<br>
                                    <a href='mailto:ghaliano2005@yahoo.fr'>
                                        Powered by ghali Ahmed
                                    </a>
                                </div>"
);
//design
//I like to display all cel of the
//columns 'nom' with the special css style 'test'
$grid->setSpecialTdStyle(array("fonction"=>"test")) ;

?>
<script src="js/js.js"></script>
<link href="styles/default.css" rel="stylesheet" type="text/css" />
<?php //Render the grid ?>
<?php
echo $grid->render() ; ?>