<?php
// This script and data application were generated by AppGini 5.81
// Download AppGini for free from https://bigprof.com/appgini/download/

	$currDir=dirname(__FILE__);
	include("$currDir/defaultLang.php");
	include("$currDir/language.php");
	include("$currDir/lib.php");
	@include("$currDir/hooks/gestion_changes.php");
	include("$currDir/gestion_changes_dml.php");

	// mm: can the current member access this page?
	$perm=getTablePermissions('gestion_changes');
	if(!$perm[0]) {
		echo error_message($Translation['tableAccessDenied'], false);
		echo '<script>setTimeout("window.location=\'index.php?signOut=1\'", 2000);</script>';
		exit;
	}

	$x = new DataList;
	$x->TableName = "gestion_changes";

	// Fields that can be displayed in the table view
	$x->QueryFieldsTV = array(
		"`gestion_changes`.`idgchange`" => "idgchange",
		"`gestion_changes`.`link_in`" => "link_in",
		"`gestion_changes`.`agent_init`" => "agent_init",
		"`gestion_changes`.`agent`" => "agent",
		"IF(    CHAR_LENGTH(`clients1`.`matricule`), CONCAT_WS('',   `clients1`.`matricule`), '') /* Matricule */" => "matricule",
		"`gestion_changes`.`numero`" => "numero",
		"if(`gestion_changes`.`date`,date_format(`gestion_changes`.`date`,'%d/%m/%Y'),'')" => "date",
		"IF(    CHAR_LENGTH(`entete1`.`nom`), CONCAT_WS('',   `entete1`.`nom`), '') /* Ent&#234;te */" => "avec_entete",
		"IF(    CHAR_LENGTH(`entete1`.`raison_sociale`), CONCAT_WS('',   `entete1`.`raison_sociale`), '') /* Rs */" => "rs",
		"`gestion_changes`.`type`" => "type",
		"IF(    CHAR_LENGTH(`clients1`.`prenom`) || CHAR_LENGTH(`clients1`.`nom`), CONCAT_WS('',   `clients1`.`prenom`, '   ', `clients1`.`nom`), '') /* Nom & Pr&#233;nom du Demandeur */" => "nom_prenom",
		"IF(    CHAR_LENGTH(`pays1`.`pays`), CONCAT_WS('',   `pays1`.`pays`), '') /* Nationalit&#233; */" => "nationalite",
		"IF(    CHAR_LENGTH(`fonctions1`.`fonction`), CONCAT_WS('',   `fonctions1`.`fonction`), '') /* Profession */" => "profession",
		"IF(    CHAR_LENGTH(`clients1`.`adresse`), CONCAT_WS('',   `clients1`.`adresse`), '') /* Adresse client */" => "adclient",
		"IF(    CHAR_LENGTH(`clients1`.`telephone`), CONCAT_WS('',   `clients1`.`telephone`), '') /* T&#233;l&#233;phone client */" => "telclient",
		"IF(    CHAR_LENGTH(`clients1`.`email`), CONCAT_WS('',   `clients1`.`email`), '') /* Email client */" => "emclient",
		"IF(    CHAR_LENGTH(`clients1`.`raison_sociale`), CONCAT_WS('',   `clients1`.`raison_sociale`), '') /* Raison sociale */" => "raison_sociale",
		"`gestion_changes`.`termes`" => "termes",
		"`gestion_changes`.`fpdf`" => "fpdf",
		"`gestion_changes`.`fzip`" => "fzip",
		"IF(    CHAR_LENGTH(`entete1`.`devise`), CONCAT_WS('',   `entete1`.`devise`), '') /* Devise */" => "devise",
		"IF(    CHAR_LENGTH(`entete1`.`logo`), CONCAT_WS('',   `entete1`.`logo`), '') /* Logo */" => "logo",
		"IF(    CHAR_LENGTH(`entete1`.`description`), CONCAT_WS('',   `entete1`.`description`), '') /* Description */" => "description",
		"IF(    CHAR_LENGTH(`entete1`.`adresse`), CONCAT_WS('',   `entete1`.`adresse`), '') /* Adresse */" => "adresse",
		"IF(    CHAR_LENGTH(`entete1`.`telephone`), CONCAT_WS('',   `entete1`.`telephone`), '') /* T&#233;l&#233;phone */" => "telephone",
		"IF(    CHAR_LENGTH(`entete1`.`whatsapp`), CONCAT_WS('',   `entete1`.`whatsapp`), '') /* Whatsapp */" => "whatsapp",
		"IF(    CHAR_LENGTH(`entete1`.`email`), CONCAT_WS('',   `entete1`.`email`), '') /* Email */" => "email",
		"IF(    CHAR_LENGTH(`entete1`.`site_web`), CONCAT_WS('',   `entete1`.`site_web`), '') /* Site web */" => "site_web",
		"IF(    CHAR_LENGTH(`entete1`.`bp`), CONCAT_WS('',   `entete1`.`bp`), '') /* Bp */" => "bp",
		"IF(    CHAR_LENGTH(`entete1`.`footer_3`), CONCAT_WS('',   `entete1`.`footer_3`), '') /* Pied de page ligne 1 */" => "footer_3",
		"IF(    CHAR_LENGTH(`entete1`.`notice`), CONCAT_WS('',   `entete1`.`notice`), '') /* Notification de la date */" => "notice",
		"IF(    CHAR_LENGTH(`entete1`.`signataire`), CONCAT_WS('',   `entete1`.`signataire`), '') /* Signataire */" => "signataire",
		"`gestion_changes`.`groupe`" => "groupe",
	);
	// mapping incoming sort by requests to actual query fields
	$x->SortFields = array(
		1 => '`gestion_changes`.`idgchange`',
		2 => 2,
		3 => 3,
		4 => 4,
		5 => '`clients1`.`matricule`',
		6 => 6,
		7 => '`gestion_changes`.`date`',
		8 => '`entete1`.`nom`',
		9 => '`entete1`.`raison_sociale`',
		10 => 10,
		11 => 11,
		12 => 12,
		13 => 13,
		14 => '`clients1`.`adresse`',
		15 => '`clients1`.`telephone`',
		16 => '`clients1`.`email`',
		17 => '`clients1`.`raison_sociale`',
		18 => 18,
		19 => 19,
		20 => 20,
		21 => '`entete1`.`devise`',
		22 => '`entete1`.`logo`',
		23 => '`entete1`.`description`',
		24 => '`entete1`.`adresse`',
		25 => '`entete1`.`telephone`',
		26 => '`entete1`.`whatsapp`',
		27 => '`entete1`.`email`',
		28 => '`entete1`.`site_web`',
		29 => '`entete1`.`bp`',
		30 => '`entete1`.`footer_3`',
		31 => '`entete1`.`notice`',
		32 => '`entete1`.`signataire`',
		33 => 33,
	);

	// Fields that can be displayed in the csv file
	$x->QueryFieldsCSV = array(
		"`gestion_changes`.`idgchange`" => "idgchange",
		"`gestion_changes`.`link_in`" => "link_in",
		"`gestion_changes`.`agent_init`" => "agent_init",
		"`gestion_changes`.`agent`" => "agent",
		"IF(    CHAR_LENGTH(`clients1`.`matricule`), CONCAT_WS('',   `clients1`.`matricule`), '') /* Matricule */" => "matricule",
		"`gestion_changes`.`numero`" => "numero",
		"if(`gestion_changes`.`date`,date_format(`gestion_changes`.`date`,'%d/%m/%Y'),'')" => "date",
		"IF(    CHAR_LENGTH(`entete1`.`nom`), CONCAT_WS('',   `entete1`.`nom`), '') /* Ent&#234;te */" => "avec_entete",
		"IF(    CHAR_LENGTH(`entete1`.`raison_sociale`), CONCAT_WS('',   `entete1`.`raison_sociale`), '') /* Rs */" => "rs",
		"`gestion_changes`.`type`" => "type",
		"IF(    CHAR_LENGTH(`clients1`.`prenom`) || CHAR_LENGTH(`clients1`.`nom`), CONCAT_WS('',   `clients1`.`prenom`, '   ', `clients1`.`nom`), '') /* Nom & Pr&#233;nom du Demandeur */" => "nom_prenom",
		"IF(    CHAR_LENGTH(`pays1`.`pays`), CONCAT_WS('',   `pays1`.`pays`), '') /* Nationalit&#233; */" => "nationalite",
		"IF(    CHAR_LENGTH(`fonctions1`.`fonction`), CONCAT_WS('',   `fonctions1`.`fonction`), '') /* Profession */" => "profession",
		"IF(    CHAR_LENGTH(`clients1`.`adresse`), CONCAT_WS('',   `clients1`.`adresse`), '') /* Adresse client */" => "adclient",
		"IF(    CHAR_LENGTH(`clients1`.`telephone`), CONCAT_WS('',   `clients1`.`telephone`), '') /* T&#233;l&#233;phone client */" => "telclient",
		"IF(    CHAR_LENGTH(`clients1`.`email`), CONCAT_WS('',   `clients1`.`email`), '') /* Email client */" => "emclient",
		"IF(    CHAR_LENGTH(`clients1`.`raison_sociale`), CONCAT_WS('',   `clients1`.`raison_sociale`), '') /* Raison sociale */" => "raison_sociale",
		"`gestion_changes`.`termes`" => "termes",
		"`gestion_changes`.`fpdf`" => "fpdf",
		"`gestion_changes`.`fzip`" => "fzip",
		"IF(    CHAR_LENGTH(`entete1`.`devise`), CONCAT_WS('',   `entete1`.`devise`), '') /* Devise */" => "devise",
		"IF(    CHAR_LENGTH(`entete1`.`logo`), CONCAT_WS('',   `entete1`.`logo`), '') /* Logo */" => "logo",
		"IF(    CHAR_LENGTH(`entete1`.`description`), CONCAT_WS('',   `entete1`.`description`), '') /* Description */" => "description",
		"IF(    CHAR_LENGTH(`entete1`.`adresse`), CONCAT_WS('',   `entete1`.`adresse`), '') /* Adresse */" => "adresse",
		"IF(    CHAR_LENGTH(`entete1`.`telephone`), CONCAT_WS('',   `entete1`.`telephone`), '') /* T&#233;l&#233;phone */" => "telephone",
		"IF(    CHAR_LENGTH(`entete1`.`whatsapp`), CONCAT_WS('',   `entete1`.`whatsapp`), '') /* Whatsapp */" => "whatsapp",
		"IF(    CHAR_LENGTH(`entete1`.`email`), CONCAT_WS('',   `entete1`.`email`), '') /* Email */" => "email",
		"IF(    CHAR_LENGTH(`entete1`.`site_web`), CONCAT_WS('',   `entete1`.`site_web`), '') /* Site web */" => "site_web",
		"IF(    CHAR_LENGTH(`entete1`.`bp`), CONCAT_WS('',   `entete1`.`bp`), '') /* Bp */" => "bp",
		"IF(    CHAR_LENGTH(`entete1`.`footer_3`), CONCAT_WS('',   `entete1`.`footer_3`), '') /* Pied de page ligne 1 */" => "footer_3",
		"IF(    CHAR_LENGTH(`entete1`.`notice`), CONCAT_WS('',   `entete1`.`notice`), '') /* Notification de la date */" => "notice",
		"IF(    CHAR_LENGTH(`entete1`.`signataire`), CONCAT_WS('',   `entete1`.`signataire`), '') /* Signataire */" => "signataire",
		"`gestion_changes`.`groupe`" => "groupe",
	);
	// Fields that can be filtered
	$x->QueryFieldsFilters = array(
		"`gestion_changes`.`idgchange`" => "ID",
		"`gestion_changes`.`link_in`" => "Link in",
		"`gestion_changes`.`agent_init`" => "A.Initial",
		"`gestion_changes`.`agent`" => "Agent",
		"IF(    CHAR_LENGTH(`clients1`.`matricule`), CONCAT_WS('',   `clients1`.`matricule`), '') /* Matricule */" => "Matricule",
		"`gestion_changes`.`numero`" => "N&#176; Facture",
		"`gestion_changes`.`date`" => "Date",
		"IF(    CHAR_LENGTH(`entete1`.`nom`), CONCAT_WS('',   `entete1`.`nom`), '') /* Ent&#234;te */" => "Ent&#234;te",
		"IF(    CHAR_LENGTH(`entete1`.`raison_sociale`), CONCAT_WS('',   `entete1`.`raison_sociale`), '') /* Rs */" => "Rs",
		"`gestion_changes`.`type`" => "Type",
		"IF(    CHAR_LENGTH(`clients1`.`prenom`) || CHAR_LENGTH(`clients1`.`nom`), CONCAT_WS('',   `clients1`.`prenom`, '   ', `clients1`.`nom`), '') /* Nom & Pr&#233;nom du Demandeur */" => "Nom & Pr&#233;nom du Demandeur",
		"IF(    CHAR_LENGTH(`pays1`.`pays`), CONCAT_WS('',   `pays1`.`pays`), '') /* Nationalit&#233; */" => "Nationalit&#233;",
		"IF(    CHAR_LENGTH(`fonctions1`.`fonction`), CONCAT_WS('',   `fonctions1`.`fonction`), '') /* Profession */" => "Profession",
		"IF(    CHAR_LENGTH(`clients1`.`adresse`), CONCAT_WS('',   `clients1`.`adresse`), '') /* Adresse client */" => "Adresse client",
		"IF(    CHAR_LENGTH(`clients1`.`telephone`), CONCAT_WS('',   `clients1`.`telephone`), '') /* T&#233;l&#233;phone client */" => "T&#233;l&#233;phone client",
		"IF(    CHAR_LENGTH(`clients1`.`email`), CONCAT_WS('',   `clients1`.`email`), '') /* Email client */" => "Email client",
		"IF(    CHAR_LENGTH(`clients1`.`raison_sociale`), CONCAT_WS('',   `clients1`.`raison_sociale`), '') /* Raison sociale */" => "Raison sociale",
		"`gestion_changes`.`termes`" => "Termes",
		"`gestion_changes`.`fpdf`" => "PDF",
		"`gestion_changes`.`fzip`" => "ZIP",
		"IF(    CHAR_LENGTH(`entete1`.`devise`), CONCAT_WS('',   `entete1`.`devise`), '') /* Devise */" => "Devise",
		"IF(    CHAR_LENGTH(`entete1`.`logo`), CONCAT_WS('',   `entete1`.`logo`), '') /* Logo */" => "Logo",
		"IF(    CHAR_LENGTH(`entete1`.`description`), CONCAT_WS('',   `entete1`.`description`), '') /* Description */" => "Description",
		"IF(    CHAR_LENGTH(`entete1`.`adresse`), CONCAT_WS('',   `entete1`.`adresse`), '') /* Adresse */" => "Adresse",
		"IF(    CHAR_LENGTH(`entete1`.`telephone`), CONCAT_WS('',   `entete1`.`telephone`), '') /* T&#233;l&#233;phone */" => "T&#233;l&#233;phone",
		"IF(    CHAR_LENGTH(`entete1`.`whatsapp`), CONCAT_WS('',   `entete1`.`whatsapp`), '') /* Whatsapp */" => "Whatsapp",
		"IF(    CHAR_LENGTH(`entete1`.`email`), CONCAT_WS('',   `entete1`.`email`), '') /* Email */" => "Email",
		"IF(    CHAR_LENGTH(`entete1`.`site_web`), CONCAT_WS('',   `entete1`.`site_web`), '') /* Site web */" => "Site web",
		"IF(    CHAR_LENGTH(`entete1`.`bp`), CONCAT_WS('',   `entete1`.`bp`), '') /* Bp */" => "Bp",
		"IF(    CHAR_LENGTH(`entete1`.`footer_3`), CONCAT_WS('',   `entete1`.`footer_3`), '') /* Pied de page ligne 1 */" => "Pied de page ligne 1",
		"IF(    CHAR_LENGTH(`entete1`.`notice`), CONCAT_WS('',   `entete1`.`notice`), '') /* Notification de la date */" => "Notification de la date",
		"IF(    CHAR_LENGTH(`entete1`.`signataire`), CONCAT_WS('',   `entete1`.`signataire`), '') /* Signataire */" => "Signataire",
		"`gestion_changes`.`groupe`" => "Groupe",
	);

	// Fields that can be quick searched
	$x->QueryFieldsQS = array(
		"`gestion_changes`.`idgchange`" => "idgchange",
		"`gestion_changes`.`link_in`" => "link_in",
		"`gestion_changes`.`agent_init`" => "agent_init",
		"`gestion_changes`.`agent`" => "agent",
		"IF(    CHAR_LENGTH(`clients1`.`matricule`), CONCAT_WS('',   `clients1`.`matricule`), '') /* Matricule */" => "matricule",
		"`gestion_changes`.`numero`" => "numero",
		"if(`gestion_changes`.`date`,date_format(`gestion_changes`.`date`,'%d/%m/%Y'),'')" => "date",
		"IF(    CHAR_LENGTH(`entete1`.`nom`), CONCAT_WS('',   `entete1`.`nom`), '') /* Ent&#234;te */" => "avec_entete",
		"IF(    CHAR_LENGTH(`entete1`.`raison_sociale`), CONCAT_WS('',   `entete1`.`raison_sociale`), '') /* Rs */" => "rs",
		"`gestion_changes`.`type`" => "type",
		"IF(    CHAR_LENGTH(`clients1`.`prenom`) || CHAR_LENGTH(`clients1`.`nom`), CONCAT_WS('',   `clients1`.`prenom`, '   ', `clients1`.`nom`), '') /* Nom & Pr&#233;nom du Demandeur */" => "nom_prenom",
		"IF(    CHAR_LENGTH(`pays1`.`pays`), CONCAT_WS('',   `pays1`.`pays`), '') /* Nationalit&#233; */" => "nationalite",
		"IF(    CHAR_LENGTH(`fonctions1`.`fonction`), CONCAT_WS('',   `fonctions1`.`fonction`), '') /* Profession */" => "profession",
		"IF(    CHAR_LENGTH(`clients1`.`adresse`), CONCAT_WS('',   `clients1`.`adresse`), '') /* Adresse client */" => "adclient",
		"IF(    CHAR_LENGTH(`clients1`.`telephone`), CONCAT_WS('',   `clients1`.`telephone`), '') /* T&#233;l&#233;phone client */" => "telclient",
		"IF(    CHAR_LENGTH(`clients1`.`email`), CONCAT_WS('',   `clients1`.`email`), '') /* Email client */" => "emclient",
		"IF(    CHAR_LENGTH(`clients1`.`raison_sociale`), CONCAT_WS('',   `clients1`.`raison_sociale`), '') /* Raison sociale */" => "raison_sociale",
		"`gestion_changes`.`termes`" => "termes",
		"`gestion_changes`.`fpdf`" => "fpdf",
		"`gestion_changes`.`fzip`" => "fzip",
		"IF(    CHAR_LENGTH(`entete1`.`devise`), CONCAT_WS('',   `entete1`.`devise`), '') /* Devise */" => "devise",
		"IF(    CHAR_LENGTH(`entete1`.`logo`), CONCAT_WS('',   `entete1`.`logo`), '') /* Logo */" => "logo",
		"IF(    CHAR_LENGTH(`entete1`.`description`), CONCAT_WS('',   `entete1`.`description`), '') /* Description */" => "description",
		"IF(    CHAR_LENGTH(`entete1`.`adresse`), CONCAT_WS('',   `entete1`.`adresse`), '') /* Adresse */" => "adresse",
		"IF(    CHAR_LENGTH(`entete1`.`telephone`), CONCAT_WS('',   `entete1`.`telephone`), '') /* T&#233;l&#233;phone */" => "telephone",
		"IF(    CHAR_LENGTH(`entete1`.`whatsapp`), CONCAT_WS('',   `entete1`.`whatsapp`), '') /* Whatsapp */" => "whatsapp",
		"IF(    CHAR_LENGTH(`entete1`.`email`), CONCAT_WS('',   `entete1`.`email`), '') /* Email */" => "email",
		"IF(    CHAR_LENGTH(`entete1`.`site_web`), CONCAT_WS('',   `entete1`.`site_web`), '') /* Site web */" => "site_web",
		"IF(    CHAR_LENGTH(`entete1`.`bp`), CONCAT_WS('',   `entete1`.`bp`), '') /* Bp */" => "bp",
		"IF(    CHAR_LENGTH(`entete1`.`footer_3`), CONCAT_WS('',   `entete1`.`footer_3`), '') /* Pied de page ligne 1 */" => "footer_3",
		"IF(    CHAR_LENGTH(`entete1`.`notice`), CONCAT_WS('',   `entete1`.`notice`), '') /* Notification de la date */" => "notice",
		"IF(    CHAR_LENGTH(`entete1`.`signataire`), CONCAT_WS('',   `entete1`.`signataire`), '') /* Signataire */" => "signataire",
		"`gestion_changes`.`groupe`" => "groupe",
	);

	// Lookup fields that can be used as filterers
	$x->filterers = array('avec_entete' => 'Ent&#234;te', 'nom_prenom' => 'Nom & Pr&#233;nom du Demandeur', );

	$x->QueryFrom = "`gestion_changes` LEFT JOIN `entete` as entete1 ON `entete1`.`identete`=`gestion_changes`.`avec_entete` LEFT JOIN `clients` as clients1 ON `clients1`.`idclient`=`gestion_changes`.`nom_prenom` LEFT JOIN `pays` as pays1 ON `pays1`.`idpays`=`clients1`.`nationalite` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`clients1`.`fonction` ";
	$x->QueryWhere = '';
	$x->QueryOrder = '';

	$x->AllowSelection = 1;
	$x->HideTableView = ($perm[2]==0 ? 1 : 0);
	$x->AllowDelete = $perm[4];
	$x->AllowMassDelete = true;
	$x->AllowInsert = $perm[1];
	$x->AllowUpdate = $perm[3];
	$x->SeparateDV = 1;
	$x->AllowDeleteOfParents = 0;
	$x->AllowFilters = 1;
	$x->AllowSavingFilters = 1;
	$x->AllowSorting = 1;
	$x->AllowNavigation = 1;
	$x->AllowPrinting = 1;
	$x->AllowPrintingDV = 1;
	$x->AllowCSV = 1;
	$x->RecordsPerPage = 10;
	$x->QuickSearch = 1;
	$x->QuickSearchText = $Translation["quick search"];
	$x->ScriptFileName = "gestion_changes_view.php";
	$x->RedirectAfterInsert = "gestion_changes_view.php?SelectedID=#ID#";
	$x->TableTitle = "CHANGES";
	$x->TableIcon = "resources/table_icons/conversion_of_currency.png";
	$x->PrimaryKey = "`gestion_changes`.`idgchange`";
	$x->DefaultSortField = '4';
	$x->DefaultSortDirection = 'asc';

	$x->ColWidth   = array(  150, 150, 150, 150);
	$x->ColCaption = array("N&#176; Facture", "Date", "Nom & Pr&#233;nom du Demandeur", "Groupe");
	$x->ColFieldName = array('numero', 'date', 'nom_prenom', 'groupe');
	$x->ColNumber  = array(6, 7, 11, 33);

	// template paths below are based on the app main directory
	$x->Template = 'templates/gestion_changes_templateTV.html';
	$x->SelectedTemplate = 'templates/gestion_changes_templateTVS.html';
	$x->TemplateDV = 'templates/gestion_changes_templateDV.html';
	$x->TemplateDVP = 'templates/gestion_changes_templateDVP.html';

	$x->ShowTableHeader = 1;
	$x->TVClasses = "";
	$x->DVClasses = "";
	$x->HighlightColor = '#FFF0C2';
	$x->HasCalculatedFields = false;

	// mm: build the query based on current member's permissions
	$DisplayRecords = $_REQUEST['DisplayRecords'];
	if(!in_array($DisplayRecords, array('user', 'group'))) { $DisplayRecords = 'all'; }
	if($perm[2]==1 || ($perm[2]>1 && $DisplayRecords=='user' && !$_REQUEST['NoFilter_x'])) { // view owner only
		$x->QueryFrom.=', membership_userrecords';
		$x->QueryWhere="where `gestion_changes`.`idgchange`=membership_userrecords.pkValue and membership_userrecords.tableName='gestion_changes' and lcase(membership_userrecords.memberID)='".getLoggedMemberID()."'";
	}elseif($perm[2]==2 || ($perm[2]>2 && $DisplayRecords=='group' && !$_REQUEST['NoFilter_x'])) { // view group only
		$x->QueryFrom.=', membership_userrecords';
		$x->QueryWhere="where `gestion_changes`.`idgchange`=membership_userrecords.pkValue and membership_userrecords.tableName='gestion_changes' and membership_userrecords.groupID='".getLoggedGroupID()."'";
	}elseif($perm[2]==3) { // view all
		// no further action
	}elseif($perm[2]==0) { // view none
		$x->QueryFields = array("Not enough permissions" => "NEP");
		$x->QueryFrom = '`gestion_changes`';
		$x->QueryWhere = '';
		$x->DefaultSortField = '';
	}
	// hook: gestion_changes_init
	$render=TRUE;
	if(function_exists('gestion_changes_init')) {
		$args=array();
		$render=gestion_changes_init($x, getMemberInfo(), $args);
	}

	if($render) $x->Render();

	// hook: gestion_changes_header
	$headerCode='';
	if(function_exists('gestion_changes_header')) {
		$args=array();
		$headerCode=gestion_changes_header($x->ContentType, getMemberInfo(), $args);
	}  
	if(!$headerCode) {
		include_once("$currDir/header.php"); 
	}else{
		ob_start(); include_once("$currDir/header.php"); $dHeader=ob_get_contents(); ob_end_clean();
		echo str_replace('<%%HEADER%%>', $dHeader, $headerCode);
	}

	echo $x->HTML;
	// hook: gestion_changes_footer
	$footerCode='';
	if(function_exists('gestion_changes_footer')) {
		$args=array();
		$footerCode=gestion_changes_footer($x->ContentType, getMemberInfo(), $args);
	}  
	if(!$footerCode) {
		include_once("$currDir/footer.php"); 
	}else{
		ob_start(); include_once("$currDir/footer.php"); $dFooter=ob_get_contents(); ob_end_clean();
		echo str_replace('<%%FOOTER%%>', $dFooter, $footerCode);
	}
?>