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()
|
|
|
|
{
|
2012-02-24 17:11:41 +00:00
|
|
|
$object = new Object_Dashboard();
|
2012-02-02 17:29:14 +00:00
|
|
|
$this->view->comptages = $object->index();
|
2012-02-24 16:26:20 +00:00
|
|
|
|
2012-02-24 17:11:41 +00:00
|
|
|
$auth = Zend_Auth::getInstance();
|
|
|
|
$user = $auth->getIdentity();
|
|
|
|
|
2012-02-24 16:26:20 +00:00
|
|
|
|
2012-02-24 17:11:41 +00:00
|
|
|
//Affichage des derniers enrichissements
|
|
|
|
$enrichissementsM = new Table_EnrichissementCommandes();
|
|
|
|
|
|
|
|
$sql = $enrichissementsM->select()
|
|
|
|
->setIntegrityCheck(false)
|
|
|
|
->from(
|
|
|
|
array('i' => 'enrichissement_identifiants'),
|
|
|
|
array('reference')
|
|
|
|
)
|
|
|
|
->join(
|
|
|
|
array('cmd' => 'enrichissement_commandes'), 'i.idCommande = cmd.id',
|
|
|
|
array('id', 'fichier', 'nbLigneTotales', 'nbLigneTraites', 'error', 'dateAdded', 'dateStart', 'dateStop')
|
|
|
|
)
|
|
|
|
->join(
|
|
|
|
array('c' => 'comptages'), 'i.idComptage = c.id',
|
|
|
|
array('')
|
|
|
|
)
|
|
|
|
->join(
|
|
|
|
array('criteres' => 'criteres'), 'c.idDefinition = criteres.id',
|
|
|
|
array('')
|
|
|
|
)
|
|
|
|
->where('criteres.idClient = ?', $user->idClient)
|
|
|
|
->where('criteres.login = ?', $user->username)
|
|
|
|
->order('dateAdded DESC');
|
|
|
|
|
|
|
|
$enrichissements = $enrichissementsM->fetchAll($sql);
|
|
|
|
$this->view->assign('enrichissements', $enrichissements);
|
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'];
|
|
|
|
}
|
|
|
|
|
2012-02-27 08:31:19 +00:00
|
|
|
public function ciblageAction()
|
2012-02-02 17:29:14 +00:00
|
|
|
{
|
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-27 08:31:19 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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,
|
2012-02-27 08:31:19 +00:00
|
|
|
'url' => $this->view->url(array('controller'=>'dashboard', 'action'=>'ciblage', 'id'=>$item->id)),
|
2012-02-15 10:35:07 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
echo json_encode($output);
|
2012-02-02 17:29:14 +00:00
|
|
|
}
|
|
|
|
|
2012-02-22 11:35:18 +00:00
|
|
|
/**
|
|
|
|
* 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 17:11:41 +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 17:11:41 +00:00
|
|
|
->join(
|
|
|
|
array('c' => 'comptages'), 'i.idComptage = c.id',
|
2012-02-24 16:26:20 +00:00
|
|
|
array('')
|
|
|
|
)
|
2012-02-24 17:11:41 +00:00
|
|
|
->join(
|
|
|
|
array('criteres' => 'criteres'), 'c.idDefinition = criteres.id',
|
2012-02-24 16:26:20 +00:00
|
|
|
array('')
|
2012-02-24 17:11:41 +00:00
|
|
|
);
|
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
|
|
|
$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
|
|
|
}
|
|
|
|
|
2012-02-22 11:35:18 +00:00
|
|
|
/**
|
|
|
|
* Détail d'un enrichissment
|
|
|
|
*/
|
|
|
|
public function enrichissementAction()
|
|
|
|
{
|
2012-02-24 15:32:15 +00:00
|
|
|
|
2012-02-22 11:35:18 +00:00
|
|
|
}
|
2012-02-02 17:29:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|