2014-06-18 08:48:52 +00:00

36 lines
1.2 KiB
PHP

<?php
class Application_Controller_Plugin_DataDate extends Zend_Controller_Plugin_Abstract
{
/**
* Créer le menu en fonction des besoins et des paramètres en entrée
* @param Zend_Controller_Request_Abstract $request
*/
public function preDispatch(Zend_Controller_Request_Abstract $request)
{
$layout = Zend_Layout::getMVCInstance();
$controller = $request->getControllerName();
$action = $request->getActionName();
if ( $layout->isEnabled() && $controller!='user' )
{
$view = $layout->getView();
$model = new Application_Model_Sdv1SphinxIdx();
$sql = $model->select()
->where('nom=?', 'jo.etablissements_act')
->where('createEnd IS NOT NULL')
->where('indexingEnd IS NOT NULL')
->order('createEnd DESC')
->limit(1);
$view->DataDate = false;
try {
$result = $model->fetchRow($sql);
$view->DataDate = substr($result->createEnd,0,10);
} catch(Zend_Db_Exception $e) {}
}
}
}