odea/application/modules/frontend/controllers/DashboardController.php

100 lines
2.3 KiB
PHP
Raw Normal View History

2012-02-02 17:29:14 +00:00
<?php
class DashboardController extends Libs_Controller
{
public function init()
{
2012-02-15 10:35:07 +00:00
$this->view->headLink()->appendStylesheet('/themes/default/styles/'.$this->getRequest()->getControllerName().'.css', 'all');
$this->view->headScript()->appendFile('/themes/default/scripts/'.$this->getRequest()->getControllerName().'.js', 'text/javascript');
2012-02-02 17:29:14 +00:00
}
public function indexAction()
{
$object = new Object_Dashboard();
$this->view->comptages = $object->index();
}
public function menuAction()
{
// action body
}
public function ciblagesAction()
{
$object = new Object_Dashboard();
$request = $this->getRequest();
$assigns = $object->ciblage($request->getParam('page', 1));
$this->view->ciblages = $assigns['ciblages'];
$this->view->nbCiblage = $assigns['nbCiblage'];
}
public function ciblagedetailAction()
{
2012-02-15 09:25:21 +00:00
2012-02-02 17:29:14 +00:00
$object = new Object_Dashboard();
$request = $this->getRequest();
2012-02-15 09:25:21 +00:00
$comptage = $object->ciblagedetail($request->getParam('id'));
$this->view->criteres = $comptage['criteres'];
$this->view->comptages = $comptage['comptages'];
2012-02-02 17:29:14 +00:00
}
public function rcomptageAction()
{
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
$request = $this->getRequest();
2012-02-15 10:35:07 +00:00
$q = $request->getParam('q');
$auth = Zend_Auth::getInstance();
$user = $auth->getIdentity();
2012-02-02 17:29:14 +00:00
2012-02-15 10:35:07 +00:00
$criteresM = new Table_Criteres();
$sql = $criteresM->select()
->from($criteresM, array('id', 'reference', "DATE_FORMAT(dateAjout, '%d/%m/%Y') as date"))
->where("idClient = ?", $user->idClient)
->where("login = ?", $user->username)
->where("reference LIKE ?", $q.'%');
$rows = $criteresM->fetchAll($sql);
if (count($rows)>0){
$separator = " , ";
foreach ($rows as $item) {
$output[] = array(
'label' => $item->reference . $separator . $item->date,
'value' => $item->reference,
'url' => $this->view->url(array('controller'=>'dashboard', 'action'=>'ciblagedetail', 'id'=>$item->id)),
);
}
}
echo json_encode($output);
2012-02-02 17:29:14 +00:00
}
public function configurationAction()
{
// action body
}
public function exportsAction()
{
// action body
}
}