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

Merge branch...

Merge branch 'hotline_#17774_remove_link_to_redirect_to_phone_version_if_no_profil_set' into 'hotline_6.56'

Hotline #17774 remove link to redirect to phone version if no profil set

See merge request !535
parents 56bbcea0 cc1c6238
Branches
Tags
5 merge requests!545Master,!544Master,!543Master,!542Master,!540Hotline 6.56
- ticket: accueil
- Suppression du message de redirection vers le site version mobile si aucun profil pour téléphone a été configuré.
\ No newline at end of file
......@@ -3,23 +3,23 @@ ob_start();
echo '<body '.$this->bodyParam.'>';
?>
<?php
if (isTelephone())
echo sprintf('<div class="back_to_phone">%s</div>',
$this->tagAnchor($this->url(array('module' => 'telephone'), null, true),
$this->_('Afficher le site en mode mobile')));
<?php
if (isTelephone() && Class_Profil::isAPhoneProfilEnabled())
echo sprintf('<div class="back_to_phone">%s</div>',
$this->tagAnchor($this->url(array('module' => 'telephone'), null, true),
$this->_('Afficher le site en mode mobile')));
echo $this->partial('accueil.phtml',
echo $this->partial('accueil.phtml',
['profil' => $this->profil]);
echo $this->partial('footer.phtml',
echo $this->partial('footer.phtml',
array('portail_cfg_site' => $this->profil->getCfgSiteAsArray()));
$html = ob_get_contents();
ob_end_clean();
echo $this->partial('head.phtml',
array_merge($this->profil->getCfgSiteAsArray(),
echo $this->partial('head.phtml',
array_merge($this->profil->getCfgSiteAsArray(),
array('titre' => $this->getTitre())));
echo $html;
?>
......@@ -55,6 +55,10 @@ class ProfilLoader extends Storm_Model_Loader {
public function getRoot() {
return Class_profil::newInstanceWithId(null,[]);
}
public function isAPhoneProfilEnabled() {
return Class_profil::countBy(['browser' => 'telephone']) >= 1;
}
}
......
......@@ -142,4 +142,41 @@ class IndexControllerWithLoggedUserTest extends AbstractControllerTestCase {
$this->assertXPath('//body[@data-logged="true"]');
}
}
class IndexControllerAsPhoneWithPhoneProfilTest extends AbstractControllerTestCase {
public function setUp() {
parent::setUp();
$_SERVER['HTTP_USER_AGENT'] = 'iphone';
$this->fixture('Class_Profil',
['id' => 9999,
'browser' => 'telephone']);
$this->dispatch('/opac', true);
}
/** @test */
public function messageToRedirectToPhoneModeShouldBePresent() {
$this->assertXPath('//div[@class="back_to_phone"]');
}
}
class IndexControllerAsPhoneWithNoPhoneProfilTest extends AbstractControllerTestCase {
public function setUp() {
parent::setUp();
$_SERVER['HTTP_USER_AGENT'] = 'iphone';
$this->dispatch('/opac', true);
}
/** @test */
public function messageToRedirectToPhoneModeShouldBePresent() {
$this->assertNotXPath('//div[@class="back_to_phone"]');
}
}
?>
\ No newline at end of file
......@@ -546,6 +546,11 @@ class IndexControllerTelephoneWithForceModuleOPACTest extends AbstractIndexContr
->setBrowser('opac')
->setLibelle('desktop'));
$this->fixture('Class_Profil',
['id' => 9999,
'browser' => 'telephone']);
$this->dispatch('/opac/index/index/id_profil/1', true);
}
......
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