| Line 79... |
Line 79... |
| 79 |
{
|
79 |
{
|
| 80 |
$fichier_cache = EF_CHEMIN_STOCKAGE_CACHE.$this->getCacheId();
|
80 |
$fichier_cache = EF_CHEMIN_STOCKAGE_CACHE.$this->getCacheId();
|
| 81 |
if (!is_null($this->getCacheDuree())) {
|
81 |
if (!is_null($this->getCacheDuree())) {
|
| 82 |
$fichier_cache .= '_['.$this->getCacheDuree().']';
|
82 |
$fichier_cache .= '_['.$this->getCacheDuree().']';
|
| 83 |
}
|
83 |
}
|
| 84 |
$fichier_cache .= '.cache.'.$this->registre->get('format');
|
84 |
$fichier_cache .= '.cache.'.$this->getRegistre()->get('format');
|
| Line 85... |
Line 85... |
| 85 |
|
85 |
|
| 86 |
return $fichier_cache;
|
86 |
return $fichier_cache;
|
| Line 87... |
Line 87... |
| 87 |
}
|
87 |
}
|
| 88 |
|
88 |
|
| 89 |
public function getCacheDuree()
|
89 |
public function getCacheDuree()
|
| 90 |
{
|
90 |
{
|
| 91 |
$dlc = null;
|
91 |
$dlc = null;
|
| 92 |
$methode_cache_dlc = 'getCacheDlc'.ucfirst($this->registre->get('action'));
|
92 |
$methode_cache_dlc = 'getCacheDlc'.$this->getActionNom();
|
| 93 |
if (method_exists($this, $methode_cache_dlc) && !is_null($this->$methode_cache_dlc())) {
|
93 |
if (method_exists($this, $methode_cache_dlc) && !is_null($this->$methode_cache_dlc())) {
|
| 94 |
$dlc = call_user_func(array($this, $methode_cache_dlc)); // dlc en seconde
|
94 |
$dlc = call_user_func(array($this, $methode_cache_dlc)); // dlc en seconde
|
| 95 |
}
|
95 |
}
|
| Line 96... |
Line 96... |
| 96 |
return $dlc;
|
96 |
return $dlc;
|
| 97 |
}
|
97 |
}
|
| 98 |
|
98 |
|
| 99 |
public function getActionNom()
|
99 |
public function getActionNom()
|
| 100 |
{
|
100 |
{
|
| 101 |
if ($this->getRegistre()->get('action') != null) {
|
101 |
if ($this->getRegistre()->get('action') != null) {
|
| 102 |
return $action = str_replace(' ', '', ucwords(str_replace('_', ' ', $this->registre->get('action'))));
|
102 |
return $action = str_replace(' ', '', ucwords(str_replace('_', ' ', $this->getRegistre()->get('action'))));
|
| Line 103... |
Line 103... |
| 103 |
}
|
103 |
}
|
| Line 193... |
Line 193... |
| 193 |
$this->getRegistre()->set('format', aModule::SORTIE_HTML);
|
193 |
$this->getRegistre()->set('format', aModule::SORTIE_HTML);
|
| 194 |
$this->getRegistre()->set('squelette_fichier', null);
|
194 |
$this->getRegistre()->set('squelette_fichier', null);
|
| 195 |
$this->getRegistre()->set('squelette_moteur', aModule::TPL_PHP);
|
195 |
$this->getRegistre()->set('squelette_moteur', aModule::TPL_PHP);
|
| Line 196... |
Line 196... |
| 196 |
|
196 |
|
| - |
|
197 |
// Gestion du multilinguisme
|
| - |
|
198 |
/*
|
| - |
|
199 |
if (isset($GLOBALS['_EF_']['i18n'][$module_nom][$action]) || isset($GLOBALS['_EF_']['i18n']['_defaut_'][$action])) {
|
| - |
|
200 |
$this->getRegistre()->set('module_i18n', $GLOBALS['_EF_']['i18n']['_defaut_']['general']);
|
| - |
|
201 |
if (isset($GLOBALS['_EF_']['i18n']['_defaut_'][$action])) {
|
| - |
|
202 |
$this->getRegistre()->set('module_i18n', $GLOBALS['_EF_']['i18n']['_defaut_'][$action]);
|
| 197 |
// Gestion du multilinguisme
|
203 |
}
|
| 198 |
//if (isset($GLOBALS['_EF_']['i18n'][$module_nom][$action])) {
|
204 |
if (isset($GLOBALS['_EF_']['i18n'][$module_nom][$action])) {
|
| 199 |
//$this->getRegistre()->set('module_i18n', $GLOBALS['_EF_']['i18n'][$module_nom][$action]);
|
205 |
$this->getRegistre()->set('module_i18n', $GLOBALS['_EF_']['i18n'][$module_nom][$action]);
|
| - |
|
206 |
}
|
| - |
|
207 |
|
| - |
|
208 |
$aso_donnees = $this->getRegistre()->get('squelette_donnees');
|
| - |
|
209 |
$aso_donnees['i18n'] = $this->getRegistre()->get('module_i18n');
|
| 200 |
//}
|
210 |
$this->getRegistre()->set('squelette_donnees', $aso_donnees);
|
| - |
|
211 |
|
| - |
|
212 |
}
|
| 201 |
|
213 |
*/
|
| 202 |
// Exécution du rendu de l'action
|
214 |
// Exécution du rendu de l'action
|
| 203 |
$sortie .= $this->traiterRendu($action);
|
215 |
$sortie .= $this->traiterRendu($action);
|
| Line 204... |
Line 216... |
| 204 |
}
|
216 |
}
|
| Line 234... |
Line 246... |
| 234 |
if ($this->getActionNom() != null) {
|
246 |
if ($this->getActionNom() != null) {
|
| 235 |
$methode_action .= $this->getActionNom();
|
247 |
$methode_action .= $this->getActionNom();
|
| 236 |
}
|
248 |
}
|
| 237 |
if (method_exists($this, $methode_action)) {
|
249 |
if (method_exists($this, $methode_action)) {
|
| 238 |
call_user_func(array($this, $methode_action));
|
250 |
call_user_func(array($this, $methode_action));
|
| - |
|
251 |
} else if (!$this->getSqueletteFichier()) {
|
| - |
|
252 |
// Tentative de recherche de l'action dans le module des Communs
|
| - |
|
253 |
$fichier_communs = SC_CHEMIN_MODULE.'communs'.DIRECTORY_SEPARATOR.'Communs.class.php';
|
| - |
|
254 |
if (file_exists($fichier_communs)) {
|
| - |
|
255 |
include_once $fichier_communs;
|
| - |
|
256 |
$Commun = new Communs();
|
| - |
|
257 |
$sortie_commun = $Commun->traiterAction();
|
| - |
|
258 |
}
|
| - |
|
259 |
if (isset($sortie_commun)) {
|
| - |
|
260 |
return $sortie_commun;
|
| 239 |
} else {
|
261 |
} else {
|
| 240 |
$e = 'La méthode '.$methode_action.' pour l\'action '.$this->registre->get('action').' n\'existe pas!';
|
262 |
$e = 'Aucun squelette ou méthode "'.$methode_action.'" n\'existe pour l\'action '.$this->registre->get('action');
|
| 241 |
trigger_error($e, E_USER_WARNING);
|
263 |
trigger_error($e, E_USER_WARNING);
|
| 242 |
return null;
|
264 |
return null;
|
| - |
|
265 |
}
|
| 243 |
}
|
266 |
}
|
| Line 244... |
Line 267... |
| 244 |
|
267 |
|
| 245 |
// Gestion du rendu en fonction du type de template
|
268 |
// Gestion du rendu en fonction du type de template
|
| 246 |
switch($this->registre->get('squelette_moteur')) {
|
269 |
switch($this->registre->get('squelette_moteur')) {
|
| 247 |
case aModule::TPL_PHP_MAIL :
|
270 |
case aModule::TPL_PHP_MAIL :
|
| 248 |
case aModule::TPL_PHP :
|
- |
|
| 249 |
$aso_donnees = $this->registre->get('squelette_donnees');
|
- |
|
| 250 |
//$aso_donnees['i18n'] = $this->registre->get('module_i18n');
|
271 |
case aModule::TPL_PHP :
|
| 251 |
$Squelette = new SquelettePhp();
|
272 |
$Squelette = new SquelettePhp();
|
| 252 |
$Squelette->set($aso_donnees);
|
273 |
$Squelette->set($this->getRegistre()->get('squelette_donnees'));
|
| 253 |
if ($this->getSqueletteFichier()) {
|
274 |
if ($this->getSqueletteFichier()) {
|
| 254 |
$sortie = $Squelette->analyser($this->getSqueletteFichier());
|
275 |
$sortie = $Squelette->analyser($this->getSqueletteFichier());
|
| 255 |
if ($this->registre->get('squelette_moteur') == aModule::TPL_PHP_MAIL) {
|
276 |
if ($this->registre->get('squelette_moteur') == aModule::TPL_PHP_MAIL) {
|
| 256 |
// Traitement spécial pour les mails
|
277 |
// Traitement spécial pour les mails
|
| Line 275... |
Line 296... |
| 275 |
}
|
296 |
}
|
| Line 276... |
Line 297... |
| 276 |
|
297 |
|
| 277 |
// Gestion du cache : écriture du fichier
|
298 |
// Gestion du cache : écriture du fichier
|
| 278 |
if ($this->cache_bool) {
|
299 |
if ($this->cache_bool) {
|
| 279 |
if (!is_null($this->getCacheId())) {
|
300 |
if (!is_null($this->getCacheId())) {
|
| - |
|
301 |
if (!file_put_contents($this->getCacheFichier(), $this->getRegistre()->get('sortie'))) {
|
| 280 |
$fp = fopen($this->getCacheFichier(), 'w');
|
302 |
$e = 'Écriture du fichier de cache impossible : '.$this->getCacheFichier();
|
| 281 |
fwrite($fp, $this->registre->get('sortie'));
|
303 |
trigger_error($e, E_USER_WARNING);
|
| 282 |
fclose($fp);
|
304 |
}
|
| 283 |
}
|
305 |
}
|
| Line 284... |
Line 306... |
| 284 |
}
|
306 |
}
|
| 285 |
|
307 |
|
| Line 305... |
Line 327... |
| 305 |
}
|
327 |
}
|
| 306 |
}
|
328 |
}
|
| 307 |
return $this->getRegistre()->get('sortie');
|
329 |
return $this->getRegistre()->get('sortie');
|
| 308 |
break;
|
330 |
break;
|
| 309 |
case aModule::SORTIE_EXIT_HTML :
|
331 |
case aModule::SORTIE_EXIT_HTML :
|
| 310 |
echo $this->registre->get('sortie');
|
332 |
echo $this->getRegistre()->get('sortie');
|
| 311 |
exit();
|
333 |
exit();
|
| 312 |
break;
|
334 |
break;
|
| 313 |
case aModule::SORTIE_XML :
|
335 |
case aModule::SORTIE_XML :
|
| 314 |
header('Content-Type: application/xhtml+xml; charset='.$this->registre->get('charset'));
|
336 |
header('Content-Type: application/xhtml+xml; charset='.$this->registre->get('charset'));
|
| 315 |
echo $this->registre->get('sortie');
|
337 |
echo $this->registre->get('sortie');
|