getRequest(); $idClient = $request->getParam('idClient', null); $this->view->assign('idClient', $idClient); //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 = ''") ->order('dateStart DESC'); if ( intval($idClient)!=0 ) { $sql->where('fichier LIKE "'.$idClient.'-%"'); } else { $sql->limit(5); } $this->view->assign('fileFinish', $commandesM->fetchAll($sql)); //Récupérer les clients $dbConfig = array( 'host' => MYSQL_HOST, 'port' => MYSQL_PORT, 'username' => MYSQL_USER, 'password' => MYSQL_PASS, 'dbname' => MYSQL_DEFAULT_DB, 'driver_options' => array(MYSQLI_INIT_COMMAND => 'SET NAMES UTF8;'), //'driver_options' => array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES UTF8;') ); $sqlmetier = Zend_Db::factory('Mysqli', $dbConfig); $sql = $sqlmetier->select() ->from('sdv1.clients', array('id', 'nom')) ->where("actif = 'Oui'"); $clients = $sqlmetier->fetchAll($sql, null, Zend_Db::FETCH_OBJ); $this->view->assign('clients', $clients); } 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->nbLigneT, ); echo json_encode($output); } } public function getfileAction() { $this->_helper->layout()->disableLayout(); $this->_helper->viewRenderer->setNoRender(true); $request = $this->getRequest(); $file = $request->getParam('file', ''); $content_type = 'application/csv-tab-delimited-table'; $path = '/sites/dataenrichissement/export/'; //Envoi du fichier sur la sortie standard if ( file_exists($path.$file) ) { header('Content-Transfer-Encoding: none'); header('Content-type: ' . $content_type.''); header('Content-Length: ' . filesize($path.$file)); header('Content-MD5: ' . base64_encode(md5_file($path.$file))); header('Content-Disposition: filename="' . basename($path.$file) . '"'); header('Cache-Control: private, max-age=0, must-revalidate'); header('Pragma: public'); ini_set('zlib.output_compression', '0'); echo file_get_contents($path.$file); } else { echo 'Impossible de charger le fichier.'; } } public function restartAction() { $request = $this->getRequest(); $id = $request->getParam('id'); if (!empty($id)){ $commandesM = new Application_Model_Commandes(); $data = array( 'nbLigneT' => 0, 'error' => '', 'dateStart' => '0000-00-00 00:00:00', 'fichierOut' => '', ); $commandesM->update($data, "id=$id"); } } public function repriseAction() { $this->_helper->layout()->disableLayout(); $this->_helper->viewRenderer->setNoRender(true); $request = $this->getRequest(); $id = $request->getParam('id'); if (!empty($id)){ $commandesM = new Application_Model_Commandes(); $data = array( 'error' => '', ); $commandesM->update($data, "id=$id"); } exec("php ".APPLICATION_PATH."/../batch/enrichissement.php --reprise --id ".$id." &"); } }