Skip to content
Snippets Groups Projects
Commit a6a1bbd8 authored by Patrick Barroca's avatar Patrick Barroca :grin:
Browse files

cosmo status block appears

parent a7b20a95
Branches
Tags
6 merge requests!2080Sandbox detach zf from storm,!1922Master,!1921Hotline master,!1920Master,!1910Dev bloc info integration,!1905Dev bloc info integration
<h2><?php echo $this->traduire('Paramètres du site');?>&nbsp;:</h2>
<h2><?php echo $this->_('Paramètres du site');?>&nbsp;:</h2>
<?php
$profil = Class_Profil::getCurrentProfil();
$lien_edit_site = $lien = $edit_domain_name = '';
......@@ -6,34 +6,34 @@ if ($this->user->isAdmin()) {
$lien = sprintf('<a href="admin?setsiteok=%s" style="margin-left:30px">&raquo;&nbsp;%s&nbsp;&laquo;</a>',
$this->href_site, $this->lien_site);
$lien_edit_site = sprintf('<a href="%s" style="margin-left:30px" >&raquo;&nbsp;Paramétrer&nbsp;&laquo;</a>',
$this->url(array('controller' => 'profil',
'action' => 'accueil',
'id_profil' => $profil->getId())));
$this->url(['controller' => 'profil',
'action' => 'accueil',
'id_profil' => $profil->getId()]));
$edit_domain_name = $this->tagAnchor($this->url(['module' => 'admin',
'controller' => 'index',
'action' => 'adminvaredit',
'cle'=> 'NOM_DOMAINE']),
'» Modifier «',
$this->_('» Modifier «'),
['style' => 'margin-left: 30px;',
'data-popup' => 'true']);
}
echo $this->ligneInfos("Etat du site", $this->etat_site . $lien)
. $this->ligneInfos("Profil", $profil->getLibelle() . $lien_edit_site)
. $this->ligneInfos("Thème", $profil->getSkin())
. $this->ligneInfos('Nom du domaine', Class_AdminVar::get('NOM_DOMAINE') . $edit_domain_name);
echo $this->ligneInfos($this->_('Etat du site'), $this->etat_site . $lien)
. $this->ligneInfos($this->_('Profil'), $profil->getLibelle() . $lien_edit_site)
. $this->ligneInfos($this->_('Thème'), $profil->getSkin())
. $this->ligneInfos($this->_('Nom du domaine'), Class_AdminVar::get('NOM_DOMAINE') . $edit_domain_name);
?>
<h2><?php echo $this->traduire('Données en attente de modération');?>&nbsp;:
<a class="rss" href="<?php
echo $this->url(array('module' => 'opac',
'controller' => 'rss',
'action' => 'moderations'));
?>"><img src="<?php echo URL_ADMIN_IMG;?>/rss.gif" alt="RSS"/></a>
</h2>
<h2><?php echo $this->_('Données en attente de modération');?>&nbsp;:
<a class="rss" href="<?php
echo $this->url(array('module' => 'opac',
'controller' => 'rss',
'action' => 'moderations'));
?>"><img src="<?php echo URL_ADMIN_IMG;?>/rss.gif" alt="RSS"/></a>
</h2>
<?php
$moderer = new Class_Moderer();
$moderer = new Class_Moderer();
$modstats = $moderer->getModerationStats();
foreach ($modstats as $stat) {
$nombre = ($stat['count']) ? $stat['count'] : 'aucun';
......@@ -43,27 +43,30 @@ foreach ($modstats as $stat) {
}
?>
<?php echo $this->cosmoStatus(); ?>
<h2><?php echo $this->_('Participez à la communauté'); ?> !</h2>
<div class='ligne_info'>
<a onclick="window.open(this.href); return false" href="http://bokeh-library-portal.org">Site communautaire</a> -
<a onclick="window.open(this.href); return false" href="https://groups.google.com/group/utilisateurs-bokeh">Google group Bokeh</a> -
<a onclick="window.open(this.href); return false" href="http://wiki.bokeh-library-portal.org">Wiki Bokeh</a> -
<a onclick="window.open(this.href); return false" href="http://git.afi-sa.fr/afi/opacce/tree/master">Code source</a>
<a onclick="window.open(this.href); return false" href="http://bokeh-library-portal.org"><?php echo $this->_('Site communautaire');?></a> -
<a onclick="window.open(this.href); return false" href="https://groups.google.com/group/utilisateurs-bokeh"><?php echo $this->_('Google group Bokeh');?></a> -
<a onclick="window.open(this.href); return false" href="http://wiki.bokeh-library-portal.org"><?php echo $this->_('Wiki Bokeh');?></a> -
<a onclick="window.open(this.href); return false" href="http://git.afi-sa.fr/afi/opacce/tree/master"><?php echo $this->_('Code source');?></a>
</div>
<h2><?php echo $this->_('Salle de discussion #Bokeh'); ?> :</h2>
<?php echo $this->ligneInfos($this->_('Discutez avec les contributeurs de Bokeh en direct'), '<a href="http://wiki.bokeh-library-portal.org/index.php/Salle_de_discussion_bokeh" target="_blank"><img src="'.BASE_URL.'/public/admin/images/ico/help.png"></img></a>') ?>
<h2><?php echo $this->_('Salle de discussion #Bokeh'); ?> :</h2>
<?php echo $this->ligneInfos($this->_('Discutez avec les contributeurs de Bokeh en direct'),
'<a href="http://wiki.bokeh-library-portal.org/index.php/Salle_de_discussion_bokeh" target="_blank"><img src="'.BASE_URL.'/public/admin/images/ico/help.png"></img></a>') ?>
<br>
<iframe src="https://kiwiirc.com/client/irc.freenode.net/?nick=votrenom-?#bokeh" style="border:0; width:100%; height:450px;"></iframe>
<iframe src="https://kiwiirc.com/client/irc.freenode.net/?nick=votrenom-?#bokeh" style="border:0; width:100%; height:450px;"></iframe>
<script>
(function() {
function supportsCanvas() {
return !!document.createElement('canvas').getContext;
}
(function() {
function supportsCanvas() {
return !!document.createElement('canvas').getContext;
}
if (!supportsCanvas())
showNotification({message: 'Votre navigateur ne permet pas d\'utiliser pleinement l\'interface d\'administration. Pour un fonctionnement optimal, nous recommandons d\'utiliser une version récente de Firefox, Chrome, Safari ou Internet Explorer',
type: 'error'});
})();
if (!supportsCanvas())
showNotification({message: 'Votre navigateur ne permet pas d\'utiliser pleinement l\'interface d\'administration. Pour un fonctionnement optimal, nous recommandons d\'utiliser une version récente de Firefox, Chrome, Safari ou Internet Explorer',
type: 'error'});
})();
</script>
......@@ -83,5 +83,9 @@ class Class_TimeSource {
$time = $this->time();
return date('Y', $time) - 1 . date('-m-d', $time);
}
}
?>
\ No newline at end of file
public function daysFrom($time) {
return (int)(($this->time() - $time) / 3660 / 24);
}
}
\ No newline at end of file
<?php
/**
* Copyright (c) 2012-2014, Agence Française Informatique (AFI). All rights reserved.
*
* BOKEH is free software; you can redistribute it and/or modify
* it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by
* the Free Software Foundation.
*
* There are special exceptions to the terms and conditions of the AGPL as it
* is applied to this software (see README file).
*
* BOKEH is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
* along with BOKEH; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
class ZendAfi_View_Helper_Admin_CosmoStatus extends ZendAfi_View_Helper_BaseHelper {
use Trait_TimeSource;
public function cosmoStatus() {
$date_integration = Class_CosmoVar::getValueOf('integration_date');
$html = $this->_tag('h2', $this->_('Intégration des données : '))
. $this->view->ligneInfos($this->_('Dernier traitement d\'intégration effectué le'),
Class_Date::getHumanDate($date_integration, 'd MMMM yyyy'));
if ('1' == Class_CosmoVar::getValueOf('clef_traitements')) {
$html .= $this->view->ligneInfos($this->_('La base est bloquée - phase de traitement'),
Class_CosmoVar::getValueOf('traitement_phase'));
}
$ecart = $this->getTimeSource()->daysFrom(strtotime($date_integration));
$frequence = (int)Class_CosmoVar::getValueOf('integration_frequence');
if (0 < $frequence && $frequence < $ecart) {
$html .= $this->view->ligneInfos($this->_('Les traitements d\'intégration n\'ont pas été effectués depuis'),
$this->_('%s jours', $ecart));
}
return $html;
/*
//---------------------------------------------------------------------------------
// Nombre de fichiers en attente
//---------------------------------------------------------------------------------
$nombre=$sql->fetchOne("select count(*) from integrations where traite = 'non'");
if($nombre == 0) afficherLigne(false,"Tous les fichiers en attente ont été intégrés.");
else afficherLigne(false,"Il reste " . $nombre . " fichier(s) en attente d'intégration.");
*/
}
}
\ No newline at end of file
......@@ -39,10 +39,38 @@ class Admin_IndexControllerTest extends Admin_IndexControllerTestCase {
'clef' => 'NOM_DOMAINE',
'valeur' => 'http://bokeh-library-portal.org']);
$this->fixture('Class_CosmoVar',
['id' => 'integration_date',
'clef' => 'integration_date',
'valeur' => '2016-10-25']);
$this->fixture('Class_CosmoVar',
['id' => 'clef_traitements',
'clef' => 'clef_traitements',
'valeur' => '1']);
$this->fixture('Class_CosmoVar',
['id' => 'traitement_phase',
'clef' => 'traitement_phase',
'valeur' => 'Execution des batchs programmés']);
$this->fixture('Class_CosmoVar',
['id' => 'integration_frequence',
'clef' => 'integration_frequence',
'valeur' => '1']);
ZendAfi_View_Helper_Admin_CosmoStatus::setTimeSource(new TimeSourceForTest('2016-11-07 12:27:45'));
$this->dispatch('/admin/index/index', true);
}
public function tearDown() {
ZendAfi_View_Helper_Admin_CosmoStatus::setTimeSource(null);
parent::tearDown();
}
/** @test */
public function fileBokeh74ShouldBeLoaded() {
$this->assertXPath('//link[contains(@href, "bokeh74/global.css")]');
......@@ -69,8 +97,7 @@ class Admin_IndexControllerTest extends Admin_IndexControllerTestCase {
/** @test */
public function linkToGoogleGroupShouldBePresent() {
$this->assertXPathContentContains(
'//a[contains(@href, "utilisateurs-bokeh")]', 'Google group Bokeh');
$this->assertXPathContentContains('//a[contains(@href, "utilisateurs-bokeh")]', 'Google group Bokeh');
}
......@@ -92,6 +119,30 @@ class Admin_IndexControllerTest extends Admin_IndexControllerTestCase {
}
/** @test */
public function dataIntegrationShouldPresent() {
$this->assertXPathContentContains('//div[@class="modules"]/h2', 'Intégration des données :');
}
/** @test */
public function lastIntegrationDateShouldBe2016_10_25() {
$this->assertXPathContentContains('//b', '25 octobre 2016');
}
/** @test */
public function integrationShouldBeInProgress() {
$this->assertXPathContentContains('//b', 'Execution des batchs programmés');
}
/** @test */
public function lastIntegrationShouldBeLateFrom14Days() {
$this->assertXPathContentContains('//b', '13 jours', $this->_response->getBody());
}
/** @test */
public function editDomaineNameLinkShouldBePresent() {
$this->assertXPathContentContains('//a[contains(@href, "/admin/index/adminvaredit/cle/NOM_DOMAINE")]','Modifier', $this->_response->getBody());
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment