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

139 lines
3.6 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 11:29:00 +00:00
$this->view->headLink()->appendStylesheet('/themes/default/styles/dashboard.css', 'all');
$this->view->headScript()->appendFile('/themes/default/scripts/dashboard.js', 'text/javascript');
2012-02-02 17:29:14 +00:00
}
public function indexAction()
{
$object = new Object_Dashboard();
$this->view->comptages = $object->index();
2012-02-24 16:26:20 +00:00
2012-02-02 17:29:14 +00:00
}
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
}
/**
* Liste des enrichissements
*/
public function enrichissementsAction()
2012-02-02 17:29:14 +00:00
{
2012-02-24 16:26:20 +00:00
$auth = Zend_Auth::getInstance();
$user = $auth->getIdentity();
//Criteres => Comptages (last) => enrichissement_identifiants => enrichissement_commandes
$enrichissementsM = new Table_EnrichissementCommandes();
2012-02-24 15:32:15 +00:00
$sql = $enrichissementsM->select()
->setIntegrityCheck(false)
->from(
2012-02-24 16:26:20 +00:00
array('i' => 'enrichissement_identifiants'),
array('reference')
2012-02-24 15:32:15 +00:00
)
2012-02-24 16:26:20 +00:00
->join( array('cmd' => 'enrichissement_commandes'), 'i.idCommande = cmd.id',
2012-02-24 15:32:15 +00:00
array('id', 'fichier', 'nbLigneTotales', 'nbLigneTraites', 'error', 'dateAdded', 'dateStart', 'dateStop')
)
2012-02-24 16:26:20 +00:00
->join( array('c' => 'comptages'), 'i.idComptage = c.id',
array('')
)
->join( array('criteres' => 'criteres'), 'c.idDefinition = criteres.id',
array('')
);
$sql->where('cmd.dateStop = ?', 0)
->where('criteres.idClient = ?', $user->idClient)
->where('criteres.login = ?', $user->username);
2012-02-24 15:32:15 +00:00
$encours = $enrichissementsM->fetchAll($sql);
$this->view->assign('encours', $encours);
2012-02-24 16:26:20 +00:00
$sql->where('cmd.dateStop != ?', 0)
->where('criteres.idClient = ?', $user->idClient)
->where('criteres.login = ?', $user->username);
2012-02-24 15:32:15 +00:00
$fini = $enrichissementsM->fetchAll($sql);
$this->view->assign('fini', $fini);
2012-02-02 17:29:14 +00:00
}
/**
* Détail d'un enrichissment
*/
public function enrichissementAction()
{
2012-02-24 15:32:15 +00:00
}
2012-02-02 17:29:14 +00:00
}