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

dev #76156 : day filter with ajax only

parent 9721d1eb
Branches
Tags
3 merge requests!2806Master,!2794Dev#76156 1240 st cloud maj fonctionnement agenda,!2793Dev#76156 1240 st cloud maj fonctionnement agenda
Pipeline #4633 passed with stage
in 46 minutes and 6 seconds
......@@ -245,6 +245,9 @@ class CmsController extends ZendAfi_Controller_Action {
$param['DATE'] = date('Y') . '-' . sprintf("%02d", $month);
}
if ($day = $this->_getParam('day'))
$param['DATE'] = $day;
$param['URL']='';
$param['ID_BIB']=Class_Profil::getCurrentProfil()->getIdSite();
$param['AFFICH_MOIS']=1;
......
<?php
/**
* Copyright (c) 2012, 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_Calendar_TableFilter extends ZendAfi_View_Helper_Calendar_Table {
public function calendar_TableFilter($articles, $month, $year, $param) {
return parent::calendar_Table($articles, $month, $year, $param);
}
protected function _lastMonthUrl() {
return ['controller' => 'cms',
'action' => 'calendar',
'day' => $this->getLastMonth($this->month, $this->year)];
}
protected function _currentMonthUrl() {
$month = str_pad($this->month, 2, '0', STR_PAD_LEFT);
return ['controller' => 'cms',
'action' => 'calendar',
'day' => $this->year . '-' . $month];
}
protected function _nextMonthUrl() {
return ['controller' => 'cms',
'action' => 'calendar',
'day' => $this->getNextMonth($this->month, $this->year)];
}
protected function _dayUrl($day, $month) {
$month = str_pad(($month ? $month : $this->month), 2, '0', STR_PAD_LEFT);
$day = '' == $day ? '' : str_pad($day, 2, '0', STR_PAD_LEFT);
return ['controller' => 'cms',
'action' => 'calendar',
'day' => $this->year . '-' . $month . '-' . $day];
}
}
\ No newline at end of file
......@@ -24,11 +24,12 @@ class ZendAfi_View_Helper_Filters_Strategy_Calendar
extends ZendAfi_View_Helper_Filters_Strategy_Abstract {
protected function _renderContent() {
return ($calendar = $this->_settings->getCalendar())
? $this->view->calendar_Table($calendar->getSelectedMonthArticles(),
$calendar->getMonth(),
$calendar->getYear(),
$calendar->getParams())
: '';
if (!$calendar = $this->_settings->getCalendar())
return '';
return $this->view->calendar_TableFilter($calendar->getSelectedMonthArticles(),
$calendar->getMonth(),
$calendar->getYear(),
$calendar->getParams());
}
}
......@@ -148,8 +148,8 @@ class CmsControllerCalendarActionLanguageEnTest extends CmsControllerCalendarAct
/** @test **/
function calendarShouldContains3AwithClassCalendarTitleMonthClickable() {
$this->assertXPathCount('//a[@class="calendar_title_month_clickable"]',3);
function calendarShouldContains6AwithClassCalendarTitleMonthClickable() {
$this->assertXPathCount('//a[@class="calendar_title_month_clickable"]', 6);
}
}
......@@ -291,8 +291,8 @@ class CmsControllerCalendarActionWithFiltersTest
['id' => 5,
'titre' => 'OPAC 4 en prod !',
'contenu' => 'youpi !',
'events_debut' => '2011-02-17',
'events_fin' => '2011-02-22']);
'events_debut' => '2014-07-17',
'events_fin' => '2014-07-18']);
$this->setupCustomFields();
$common_preferences = ['display_order' => 'EventDebut',
......@@ -404,6 +404,28 @@ class CmsControllerCalendarActionWithFiltersTest
$this->assertXPathContentContains('//ul[contains(@class, "filters")]/li[@class="date"]/h2[text()="Mois"]/span',
' : Juillet');
}
/** @test */
public function linkNextMonthContainsDayParameter() {
$this->assertXPath('//a[@class="calendar_title_month_clickable"][contains(@href,"/day/2014-08")]');
}
/** @test */
public function linkPreviousMonthContainsDayParameter() {
$this->assertXPath('//a[@class="calendar_title_month_clickable"][contains(@href,"/day/2014-06")]');
}
/** @test */
public function linkCurrentMonthContainsDayParameter() {
$this->assertXPath('//a[@class="calendar_title_month_clickable"][contains(@href,"/day/2014-07")]');
}
/** @test */
public function linkInsideCalendarShouldContainsDayParameter() {
$this->assertXPath('//a[contains(@class,"day_clickable")][contains(@href,"/day/2014-07-17")]',$this->_response->getBody());
}
}
......@@ -1046,4 +1068,18 @@ class CmsControllerCalendarActionWithOutDateTest extends AbstractControllerTestC
public function gatArticleByPreferencesShouldBeCallWithEventDAteAfter() {
$this->assertXPathContentContains('//div', 'Kitchen', $this->_response->getBody());
}
}
class CmsControllerCalendarActionWithDateFilterTest extends AbstractControllerTestCase {
public function setUp() {
parent::setUp();
$this->dispatch('/cms/calendar', true);
}
/** @test */
public function ShouldExpectation() {
}
}
\ No newline at end of file
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