2012-02-02 17:29:14 +00:00
|
|
|
<?php
|
2012-05-02 18:19:07 +00:00
|
|
|
class DashboardController extends Zend_Controller_Action
|
2012-02-02 17:29:14 +00:00
|
|
|
{
|
|
|
|
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-05-02 18:19:07 +00:00
|
|
|
$object = new Object_Dashboard();
|
|
|
|
|
2012-03-20 08:24:41 +00:00
|
|
|
$this->view->comptages = $object->index();
|
|
|
|
$this->view->enrichissements = $object->enrichissements();
|
2012-05-02 18:19:07 +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-03-07 11:14:14 +00:00
|
|
|
require_once('Scores/Field.php');
|
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'));
|
2012-04-04 08:33:37 +00:00
|
|
|
$enrichissement = $object->enrichissement($request->getParam('id'));
|
2012-05-02 18:19:07 +00:00
|
|
|
|
2012-04-06 09:49:41 +00:00
|
|
|
$this->view->comptageId = $request->getParam('id');
|
2012-03-07 11:14:14 +00:00
|
|
|
$this->view->label = new Fields();
|
2012-02-15 09:25:21 +00:00
|
|
|
$this->view->criteres = $comptage['criteres'];
|
|
|
|
$this->view->comptages = $comptage['comptages'];
|
2012-04-04 08:33:37 +00:00
|
|
|
$this->view->enrichissements = $enrichissement;
|
2012-04-12 09:25:37 +00:00
|
|
|
$this->view->pathfile = $config->path->data;
|
2012-02-02 17:29:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public function rcomptageAction()
|
|
|
|
{
|
|
|
|
$this->_helper->layout()->disableLayout();
|
|
|
|
$this->_helper->viewRenderer->setNoRender(true);
|
2012-05-02 18:19:07 +00:00
|
|
|
|
2012-02-02 17:29:14 +00:00
|
|
|
$request = $this->getRequest();
|
2012-02-15 10:35:07 +00:00
|
|
|
$q = $request->getParam('q');
|
|
|
|
$auth = Zend_Auth::getInstance();
|
|
|
|
$user = $auth->getIdentity();
|
2012-05-02 18:19:07 +00:00
|
|
|
|
2012-05-02 19:06:36 +00:00
|
|
|
$criteresM = new Application_Model_Criteres();
|
2012-02-15 10:35:07 +00:00
|
|
|
$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
|
2012-05-02 19:06:36 +00:00
|
|
|
$enrichissementsM = new Application_Model_EnrichissementIdentifiants();
|
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'),
|
2012-02-27 09:36:49 +00:00
|
|
|
array('id', 'reference', 'fichier', 'nbLigneTotales', 'nbLigneTraites', 'error', 'dateAdded', 'dateStart', 'dateStop')
|
2012-02-24 15:32:15 +00:00
|
|
|
)
|
2012-04-05 08:19:57 +00:00
|
|
|
->join(
|
2012-05-02 18:19:07 +00:00
|
|
|
array('c' => 'comptages'), 'i.idComptage = c.id',
|
2012-02-24 16:26:20 +00:00
|
|
|
array('')
|
|
|
|
)
|
2012-04-05 08:19:57 +00:00
|
|
|
->join(
|
2012-02-27 09:36:49 +00:00
|
|
|
array('criteres' => 'criteres'), 'i.idCriteres = criteres.id',
|
2012-02-24 16:26:20 +00:00
|
|
|
array('')
|
2012-02-24 17:11:41 +00:00
|
|
|
);
|
2012-02-27 09:36:49 +00:00
|
|
|
$sql->where('i.dateStop = ?', 0)
|
2012-02-24 16:26:20 +00:00
|
|
|
->where('criteres.idClient = ?', $user->idClient)
|
|
|
|
->where('criteres.login = ?', $user->username);
|
2012-02-24 15:32:15 +00:00
|
|
|
$encours = $enrichissementsM->fetchAll($sql);
|
2012-04-05 08:19:57 +00:00
|
|
|
$this->view->encours = $encours;
|
2012-05-02 18:19:07 +00:00
|
|
|
|
2012-04-05 08:19:57 +00:00
|
|
|
// Impossible de copie la varible issu d'un select car sinon elle conserve les meme propriété que sont parent
|
|
|
|
// donc les selects... donc obliger de faire deux requetes pour le moment.
|
|
|
|
$sql = $enrichissementsM->select()
|
|
|
|
->setIntegrityCheck(false)
|
|
|
|
->from(
|
|
|
|
array('i' => 'enrichissement_identifiants'),
|
|
|
|
array('id', 'reference', 'fichier', 'nbLigneTotales', 'nbLigneTraites', 'error', 'dateAdded', 'dateStart', 'dateStop')
|
|
|
|
)
|
|
|
|
->join(
|
2012-05-02 18:19:07 +00:00
|
|
|
array('c' => 'comptages'), 'i.idComptage = c.id',
|
2012-04-05 08:19:57 +00:00
|
|
|
array('')
|
|
|
|
)
|
|
|
|
->join(
|
|
|
|
array('criteres' => 'criteres'), 'i.idCriteres = criteres.id',
|
|
|
|
array('')
|
|
|
|
);
|
|
|
|
$sql->where('criteres.idClient = ?', $user->idClient)
|
|
|
|
->where('criteres.login = ?', $user->username)
|
|
|
|
->where('i.dateStart != ?', '0000-00-00 00:00:00');
|
|
|
|
$fini = $enrichissementsM->fetchAll($sql)->toArray();
|
|
|
|
$this->view->fini = $fini;
|
2012-04-12 09:25:37 +00:00
|
|
|
$this->view->pathfile = $config->path->data;
|
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-05-02 18:19:07 +00:00
|
|
|
|
|
|
|
}
|
2012-02-02 17:29:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|