<?php
include_once( '../../../includes/prepend.php' );
$sTagProjet = $_REQUEST[ 'tag' ];
//recupere les infos du projet
$oData = $oFramework->oProjets->getData( $sTagProjet );
//tentative de connexion à la base de données
$bConnexion = false;
$oBD = NULL;
try{
if( $oBD = new PDO( "mysql:host=".$oData->bddServer.";port=3306;dbname=".$oData->bddBdd, $oData->bddUser, $oData->bddPass ) )
$bConnexion = true;
}catch (PDOException $e) {
$bConnexion = false;
}
//recuperation des infos des tables
$oAllTables = NULL;
if( $bConnexion ){
$oAllTables = array();
foreach ($oBD->query( 'SHOW TABLES' ) as $oRow )
$oAllTables[] = $oRow[ 'Tables_in_'.$oData->bddBdd ];
}
//recuperation des objects du projet si il y en a
$oObjectsPrj = $oFramework->oObjects->getObjects( $sTagProjet );
$oTpl_projet_detail = new smarty_site();
$oTpl_projet_detail->assign( 'urlSubmit', 'index.php?act=save&tag='.$sTagProjet );
$oTpl_projet_detail->assign( 'data', $oData );
$oTpl_projet_detail->assign( 'bConnexion', $bConnexion );
$oTpl_projet_detail->assign( 'oAllTables', $oAllTables );
$oTpl_projet_detail->assign( 'oAllObjects', $oObjectsPrj );
$oTpl_projet_detail->clear_cache( 'app/projet/projet-objet.html' );
$sFromProjet = $oTpl_projet_detail->fetch( 'app/projet/projet-objet.html' );
//ajout du fichier javascript
$oTemplate->assign( 'header', '<script src="objets.js"></script>'.
'<script>'.
'window.objetsPrj = new objetsPrj( "'.$sTagProjet.'" );'."\n".
'window.olang = new Array();'."\n".
'window.olang[ \'selection_table\' ] = \''.$oLang[ 'selection_table' ].'\';'."\n".
'window.olang[ \'attention_del_obj\' ] = \''.$oLang[ 'attention_del_obj' ].'\';'."\n".
'window.olang[ \'attention_del_obj1\' ] = \''.$oLang[ 'attention_del_obj1' ].'\';'."\n".
'window.olang[ \'attention_del_all_obj\' ] = \''.$oLang[ 'attention_del_all_obj' ].'\';'."\n".
'</script>' );
$oTemplate->assign( 'body', $sFromProjet.'<span id="debug"></span>' );
$oTemplate->clear_cache('index.html');
$oTemplate->display('index.html');
?>