enrichissement/application/controllers/IndexController.php
Michael RICOIS ae3d8595dd variable
2012-01-30 15:44:30 +00:00

59 lines
1.6 KiB
PHP

<?php
class IndexController extends Zend_Controller_Action
{
public function indexAction()
{
//Liste des profils
$profilM = new Application_Model_Profil();
$sql = $profilM->select();
$this->view->assign('listProfil', $profilM->fetchAll($sql));
$commandesM = new Application_Model_Commandes($db);
//Liste des fichiers en attente de profil
$sql = $commandesM->select()->where('idProfil = ?', 0);
$this->view->assign('fileAttenteProfil', $commandesM->fetchAll($sql));
//Liste des enrichissements en cours
$sql = $commandesM->select()
->where('idProfil != ?', 0)
->where("dateStop = '0000-00-00 00:00:00'");
$this->view->assign('fileEnCours', $commandesM->fetchAll($sql));
//Liste des enrichissements terminé
$sql = $commandesM->select()
->where("dateStop != '0000-00-00 00:00:00'")
->where("error = ''");
$this->view->assign('fileFinish', $commandesM->fetchAll($sql));
}
public function getinfoAction()
{
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
$request = $this->getRequest();
$id = $request->getParam('id');
if (!empty($id)){
$commandesM = new Application_Model_Commandes();
$result = $commandesM->find($id);
$info = $result->current();
$output = array(
'nbLigneT' => $info->nbLigne,
);
echo json_encode($output);
}
}
public function getfileAction()
{
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
$request = $this->getRequest();
$file = $request->getParam('file', '');
echo file_get_contents('/sites/dataenrichissement/export/'.$file);
}
}