extranet/application/controllers/AideController.php
2013-12-26 14:42:44 +00:00

94 lines
2.3 KiB
PHP

<?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);
}
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('/');
}
}
}
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;
}
}