73 lines
1.8 KiB
PHP
73 lines
1.8 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()
|
|
{
|
|
$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('/');
|
|
}
|
|
}
|
|
}
|
|
} |