issue #0001990 : Date de dernières mise à jour

This commit is contained in:
Michael RICOIS 2014-06-18 08:48:52 +00:00
parent c627a137f2
commit 9cc95bcd91
6 changed files with 61 additions and 0 deletions

View File

@ -14,6 +14,7 @@ return array(
'IndexController' => dirname(__FILE__) . '/controllers/IndexController.php',
'UploadController' => dirname(__FILE__) . '/controllers/UploadController.php',
'UserController' => dirname(__FILE__) . '/controllers/UserController.php',
'Zend_View_Helper_DataDate' => dirname(__FILE__) . '/views/default/helpers/DataDate.php',
'Zend_View_Helper_Field' => dirname(__FILE__) . '/views/default/helpers/Field.php',
'Zend_View_Helper_ProfileLink' => dirname(__FILE__) . '/views/default/helpers/ProfileLink.php',
);

View File

@ -0,0 +1,14 @@
<?php
class Zend_View_Helper_DataDate extends Zend_View_Helper_Abstract
{
public function dataDate()
{
if ( $this->view->DataDate ) {
$date = new Zend_Date($this->view->DataDate, 'yyyy-MM-dd');
return $date->toString('dd/MM/yyyy');
}
return '...';
}
}

View File

@ -36,6 +36,9 @@
</li>
<?php }?>
</ul>
<p class="navbar-text">
<span class="label label-info" title="Date de mise à jour des données">Données à jour au <?=$this->DataDate()?></span>
</p>
<p class="navbar-text pull-right"><?=$this->profileLink()?></p>
</div><!--/.nav-collapse -->
</div>

View File

@ -0,0 +1,36 @@
<?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) {}
}
}
}

View File

@ -0,0 +1,6 @@
<?php
class Application_Model_Sdv1SphinxIdx extends Zend_Db_Table_Abstract
{
protected $_name = 'sphinx_idx';
protected $_schema = 'sdv1';
}

View File

@ -21,6 +21,7 @@ return array(
'Application_Model_CiblageRegions' => dirname(__FILE__) . '/Model/CiblageRegions.php',
'Application_Model_JoSpinxIdx' => dirname(__FILE__) . '/Model/JoSphinxIdx.php',
'Application_Model_Sdv1Clients' => dirname(__FILE__) . '/Model/Sdv1Clients.php',
'Application_Model_Sdv1SphinxIdx' => dirname(__FILE__) . '/Model/Sdv1SphinxIdx.php',
'Application_Model_Sdv1Utilisateurs' => dirname(__FILE__) . '/Model/Sdv1Utilisateurs.php',
'Application_Model_Sdv1UtilisateursService' => dirname(__FILE__) . '/Model/Sdv1UtilisateursService.php',
);