118 lines
2.7 KiB
PHP
118 lines
2.7 KiB
PHP
<?php
|
||
class AideController extends Zend_Controller_Action
|
||
{
|
||
protected $theme;
|
||
|
||
/**
|
||
* Logger
|
||
* @var \Monolog\Logger
|
||
*/
|
||
protected $logger;
|
||
|
||
public function init()
|
||
{
|
||
if (Zend_Registry::isRegistered('logger')) {
|
||
$this->logger = Zend_Registry::get('logger');
|
||
}
|
||
|
||
// --- Theme
|
||
$this->theme = Zend_Registry::get('theme');
|
||
}
|
||
|
||
/**
|
||
* Afficher bulle pour les nouveautés
|
||
*/
|
||
public function newAction()
|
||
{
|
||
$nbNewsMax = 5;
|
||
$nbJourGlisssant = 5;
|
||
|
||
$user = new Scores_Utilisateur();
|
||
$date = $user->getDateDerniereConnexion();
|
||
$nouveautes = array();
|
||
if ( $date!=null || $date!='0000-00-00 00:00:00' )
|
||
{
|
||
$time = mktime(0, 0, 0, date('m'), date('d')-$nbJourGlisssant, date('Y'));
|
||
$dateglissant = date('Y-m-d', $time);
|
||
$now = date('Y-m-d');
|
||
|
||
$nouveautesM = new Application_Model_Nouveautes();
|
||
$sql = $nouveautesM->select()
|
||
->where("date>='".$dateglissant."' AND date<='".$now."'")
|
||
->order('date DESC')
|
||
->limit($nbNewsMax);
|
||
$nouveautes = $nouveautesM->fetchAll($sql);
|
||
}
|
||
$this->view->assign('nouveautes', $nouveautes);
|
||
}
|
||
|
||
/**
|
||
* Afficher la liste des nouveautés
|
||
*/
|
||
public function newlisteAction()
|
||
{
|
||
$this->view->headTitle()->prepend('Nouveautés');
|
||
|
||
$request = $this->getRequest();
|
||
|
||
//Selection
|
||
$nouveautesM = new Application_Model_Nouveautes();
|
||
$sql = $nouveautesM->select()
|
||
->from('nouveautes', array('categorie', 'intitule', "date", 'fichier'))
|
||
->order('date DESC');
|
||
$nouveautes = $nouveautesM->fetchAll($sql);
|
||
$this->view->assign('nouveautes', $nouveautes);
|
||
|
||
}
|
||
|
||
/**
|
||
* Affichage et validation de "cgu"
|
||
* Conditions d’accès à l'extranet
|
||
*/
|
||
public function cguAction()
|
||
{
|
||
$this->_helper->layout()->disableLayout();
|
||
$request = $this->getRequest();
|
||
|
||
$accept = $request->getParam('accept', 0);
|
||
|
||
if ( $accept == 1 ) {
|
||
require_once 'Scores/WsScores.php';
|
||
$ws = new WsScores();
|
||
$accept = $ws->setCGU();
|
||
$this->logger->info($accept);
|
||
if ($accept) {
|
||
//Put in session
|
||
$auth = Zend_Auth::getInstance();
|
||
$identity = $auth->getIdentity();
|
||
$identity->acceptationCGU = date('Y-m-d H:i:s');
|
||
$auth->getStorage()->write($identity);
|
||
//Redirect
|
||
$this->redirect('/');
|
||
}
|
||
}
|
||
}
|
||
|
||
|
||
/**
|
||
* Afficher des propriétés du navigateur
|
||
* Compatibilités et version
|
||
*/
|
||
public function navinfoAction()
|
||
{
|
||
$bootstrap = $this->getInvokeArg('bootstrap');
|
||
$userAgent = $bootstrap->getResource('useragent');
|
||
|
||
$device = $userAgent->getDevice();
|
||
|
||
echo $device->getFeature('browser_compatibility').'<br/>';
|
||
echo $device->getFeature('browser_version').'<br/>';
|
||
|
||
echo "<pre>";
|
||
print_r($device);
|
||
echo "</pre>";
|
||
exit;
|
||
}
|
||
|
||
|
||
} |