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: 8 years ago
Size: 2,225 bytes


Class file image Download

include("conf/db.conf.php") ;
"logic/sqlExec.class.php") ;
"logic/DG.class.php") ;
"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=''>
                                        Powered by ghali Ahmed
//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 ?>
echo $grid->render() ; ?>