extranet/application/controllers/AideController.php
2015-03-05 14:55:03 +00:00

102 lines
2.4 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
class AideController extends Zend_Controller_Action
{
/**
* 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);
//Zend_Registry::get('firebug')->info($sql->__toString());
$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 daccè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();
Zend_Registry::get('firebug')->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;
}
}