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

Merge branch 'hotline#49679_remove_records_stats' into 'stable'

hotline #49679 remove stat

See merge request !1884
parents 04c61f72 86d68a83
Branches
Tags
2 merge requests!1902Master,!1896Master
- ticket #49679 : Administration : suppression des fonctions obsolètes des statistiquess des consultation de notices
\ No newline at end of file
......@@ -39,19 +39,6 @@ class Admin_StatController extends ZendAfi_Controller_Action {
}
public function visunoticeAction() {
$this->view->titre = $this->_('Statistiques de visualisation des notices');
$this->view->table_stat = $this->cls_stat->getRecapVisu();
}
public function palmaresvisunoticeAction() {
$this->view->titre = 'Palmarès des visualisations de notices';
$this->view->table_stat = $this->cls_stat->getPalmaresVisu($this->_getParam('type_doc'));
$this->view->type_doc = $this->_getParam('type_doc');
}
public function rechercheinfructueuseAction() {
$this->view->titre = $this->_('Recherches infructueuses');
$page = $this->_getParam('page', 1);
......
<table>
<tr>
<td style="text-align:right">Type de document : </td>
<td style="text-align:left" width="70%">
<?php
echo $this->ComboCodification('type_doc',
$this->type_doc,
'onchange="window.location.replace(\''.BASE_URL.'/admin/stat/palmaresvisunotice?type_doc=\' + this.value);"'); ?>
</td>
</tr>
</table>
<br/>
<table class="stat">
<tr>
<th class="stat" width="1%">Rang</th>
<th class="stat" width="1%">&nbsp;</th>
<th class="stat" width="50%">Titre</th>
<th class="stat" width="40%">Auteur</th>
<th class="stat" width="9%">Vue</th>
</tr>
<?php
$rang = 0;
$last_nombre = 0;
if($this->table_stat) {
foreach($this->table_stat as $notice) {
// Calcul n° de rang
if($notice["nombre"] != $last_nombre) {
$last_nombre=$notice["nombre"];
$rang++;
}
// Html
print('<tr>');
print('<td class="stat_nombre" style="text-align:center"><B>'.$rang.'</b></td>');
print('<td class="stat_libelle"><img src="'.URL_ADMIN_IMG.'supports/support_'.$notice["type_doc"].'.gif" border="0"></td>');
print('<td class="stat_libelle">'.$notice["titre"].'</td>');
print('<td class="stat_libelle">'.$notice["auteur"].'</td>');
print('<td class="stat_nombre">'.$notice["nombre"].'&nbsp;fois</td>');
print('</tr>');
}
}
print('</table>');
?>
<br>
<h2 class="stat">
<?php echo $this->periode;?>,
<?php echo number_format($this->table_stat["total"], 0, ',', ' ');?> notices ont été visualisées
</h2>
<script>
$(function(){$('#accordion').accordion({autoHeight:false, collapsible:true});});
</script>
<?php if (isset($this->table_stat)) { ?>
<h3 class="stat">Détail par années</h3>
<?php
$years = [];
foreach ($this->table_stat as $label => $datas)
if (isset($datas['total']))
$years[$label] = $datas['total'];
echo $this->blocStats('Année', $years);?>
<h3 class="stat">Détail par mois</h3>
<div id="accordion">
<?php foreach ($this->table_stat as $label => $datas) {
if (!isset($datas['mois'])) continue;?>
<h4><?php echo $label;?></h4>
<?php echo $this->blocStats('Mois', $datas['mois']);?>
<?php } ?>
</div>
<?php } ?>
<br>
......@@ -110,9 +110,7 @@ class ZendAfi_View_Helper_Admin_MenuGaucheAdmin extends ZendAfi_View_Helper_Base
return $this
->renderBloc($this->_('Statistiques'),
[['piwik_stats', $this->_('Piwik'), '/admin/stat/piwik'],
['failed_searches', $this->_('Recherches infructueuses'), '/admin/stat/rechercheinfructueuse'],
['record_views', $this->_('Visualisations de notices'), '/admin/stat/visunotice'],
['top_record_views', $this->_('Palmarès des visualisations'), '/admin/stat/palmaresvisunotice']
['failed_searches', $this->_('Recherches infructueuses'), '/admin/stat/rechercheinfructueuse']
]);
}
......
......@@ -16,7 +16,7 @@
*
* 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
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
require_once 'AdminAbstractControllerTestCase.php';
......@@ -31,131 +31,4 @@ class Admin_StatControllerRecherchesInfructueusesTest extends Admin_AbstractCont
$this->assertXPathContentContains('//h1', 'Recherches infructueuses');
}
}
class Admin_StatControllerVisunoticeTest extends Admin_AbstractControllerTestCase{
public function setUp() {
parent::setUp();
$this->sql = $this->mock()
->whenCalled('fetchAll')
->with('Select annee, sum(nb_visu) from stats_notices group by 1 order by annee desc', false)
->answers([['annee' => '2000', 'sum(nb_visu)' => 6000],])
->whenCalled('fetchAll')
->with('Select annee, mois, nb_visu as cnt from stats_notices order by annee desc, mois desc',
false)
->answers([['annee' => '2000', 'mois' => 1, 'cnt' => 42],])
->whenCalled('fetchOne')
->with('select min(annee) from stats_notices')
->answers('2000')
->whenCalled('fetchOne')
->with("select min(mois) from stats_notices where annee=2000")
->answers('1')
->whenCalled('fetchOne')
->answers('1');
Zend_Registry::set('sql', $this->sql);
$this->dispatch('/admin/stat/visunotice', true);
}
/** @test */
public function titreShouldBeVisualisationNotice() {
$this->assertXPathContentContains('//h1', 'visualisation des notices');
}
/** @test */
public function shouldHaveYearDetails() {
$this->assertXPathContentContains('//h3', 'Détail par années');
}
/** @test */
public function shouldHaveYear2000Label() {
$this->assertXPathContentContains('//td', '2000');
}
/** @test */
public function shouldHaveYear2000Detail() {
$this->assertXPathContentContains('//td', '6000');
}
/** @test */
public function shouldHaveYearsGraph() {
$this->assertXPath('//img[contains(@src, "chl=2000")]');
}
/** @test */
public function shouldHaveMonthDetails() {
$this->assertXPathContentContains('//h3', 'Détail par mois');
}
/** @test */
public function shouldHaveMonth1DetailLabel() {
$this->assertXPathContentContains('//td', 'janvier');
}
/** @test */
public function shouldHaveMonth1DetailCount() {
$this->assertXPathContentContains('//td', '42');
}
/** @test */
public function shouldHaveMonthsGraph() {
$this->assertXPath('//img[contains(@src, "janvier")]',
$this->_response->getBody());
}
}
class Admin_StatControllerPalmaresVisunoticeTest extends Admin_AbstractControllerTestCase{
public function setUp() {
parent::setUp();
Storm_Test_ObjectWrapper::onLoaderOfModel('Class_TypeDoc')
->whenCalled('findUsedTypeDocIds')
->answers([]);
$this->fixture('Class_Notice', ['id' => 1,
'nb_visu' => 600,
'titre_principal' => 'Captain Harlock']);
$this->dispatch('/admin/stat/palmaresvisunotice', true);
}
/** @test */
public function titleShouldBePalmares() {
$this->assertXPathContentContains('//h1', 'Palmarès des visualisations de notices');
}
/** @test */
public function docTypeSelectorShouldBePresent() {
$this->assertXPath('//select[@id="select_type_doc"]');
}
/** @test */
public function harlockShouldBeInPalmares() {
$this->assertXPathContentContains('//td', 'Captain Harlock');
}
/** @test */
public function harlockShouldHaveBeenViewed600Times() {
$this->assertXPathContentContains('//td', '600', $this->_response->getBody());
}
}
?>
\ No newline at end of file
......@@ -228,8 +228,6 @@ Trait MenuGaucheAdminRolesDefinition {
'profil/genres',
'index/update-skin',
'stat/rechercheinfructueuse',
'stat/visunotice',
'stat/palmaresvisunotice',
'zone',
'bib',
'users',
......@@ -282,8 +280,6 @@ Trait MenuGaucheAdminRolesDefinition {
'profil/genres',
'index/update-skin',
'stat/rechercheinfructueuse',
'stat/visunotice',
'stat/palmaresvisunotice',
'zone',
'bib',
'users',
......@@ -309,8 +305,6 @@ Trait MenuGaucheAdminRolesDefinition {
'modo/membreview',
'newsletter',
'stat/rechercheinfructueuse',
'stat/visunotice',
'stat/palmaresvisunotice',
] ],
[ZendAfi_Acl_AdminControllerRoles::ADMIN_BIB,
......@@ -335,8 +329,6 @@ Trait MenuGaucheAdminRolesDefinition {
'print/index',
'profil/genres',
'stat/rechercheinfructueuse',
'stat/visunotice',
'stat/palmaresvisunotice',
'bib',
'users',
'usergroup'
......@@ -350,8 +342,6 @@ Trait MenuGaucheAdminRolesDefinition {
'modo/membreview',
'newsletter',
'stat/rechercheinfructueuse',
'stat/visunotice',
'stat/palmaresvisunotice',
] ]
];
}
......
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