Suppression de libs

This commit is contained in:
Michael RICOIS 2012-05-02 18:19:07 +00:00
parent b80891b53d
commit 1d87d5af73
15 changed files with 61 additions and 206 deletions

View File

@ -1,6 +1,5 @@
<?php
class ArborescenceController extends Libs_Controller
class ArborescenceController extends Zend_Controller_Action
{
/* Nafs */
public function nafAction()
@ -18,13 +17,13 @@ class ArborescenceController extends Libs_Controller
{
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender();
$request = $this->getRequest();
$key = $request->getParam('key');
$object = new Object_Naf();
echo $object->ajax($request->getParam('parent', ''),
$request->getParam('niveau', 1),
echo $object->ajax($request->getParam('parent', ''),
$request->getParam('niveau', 1),
$request->getParam('key')
);
}
@ -33,24 +32,24 @@ class ArborescenceController extends Libs_Controller
public function geographiqueAction()
{
$this->_helper->layout()->disableLayout();
$object = new Object_Codepostaux();
$key = $this->getRequest()->getParam('key');
$this->view->key = $key;
$this->view->regions = $object->_getRegions();
}
public function geographiqueajaxAction()
{
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender();
$request = $this->getRequest();
$id = $request->getParam('id');
$niveau = $request->getParam('niveau');
$object = new Object_Codepostaux();
if($niveau == 0) {
echo ($object->_getDepartements($id));
} else if ($niveau == 1) {
@ -62,14 +61,14 @@ class ArborescenceController extends Libs_Controller
public function juridiqueAction()
{
$this->_helper->layout()->disableLayout();
$object = new Object_Formejuridique();
$key = $this->getRequest()->getParam('key');
$this->view->key = $key;
$this->view->formejuridiques = $object->_getParents();
}
public function juridiqueajaxAction()
{
$this->_helper->layout()->disableLayout();
@ -77,7 +76,7 @@ class ArborescenceController extends Libs_Controller
$object = new Object_Formejuridique();
$request = $this->getRequest();
$id = $request->getParam('id');
echo ($object->_getFils($id));
}
}

View File

@ -1,5 +1,5 @@
<?php
class DashboardController extends Libs_Controller
class DashboardController extends Zend_Controller_Action
{
public function init()
{
@ -9,12 +9,12 @@ class DashboardController extends Libs_Controller
public function indexAction()
{
$object = new Object_Dashboard();
$object = new Object_Dashboard();
$this->view->comptages = $object->index();
$this->view->enrichissements = $object->enrichissements();
}
public function ciblagesAction()
@ -35,7 +35,7 @@ class DashboardController extends Libs_Controller
$request = $this->getRequest();
$comptage = $object->ciblagedetail($request->getParam('id'));
$enrichissement = $object->enrichissement($request->getParam('id'));
$this->view->comptageId = $request->getParam('id');
$this->view->label = new Fields();
$this->view->criteres = $comptage['criteres'];
@ -48,12 +48,12 @@ class DashboardController extends Libs_Controller
{
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
$request = $this->getRequest();
$q = $request->getParam('q');
$auth = Zend_Auth::getInstance();
$user = $auth->getIdentity();
$criteresM = new Table_Criteres();
$sql = $criteresM->select()
->from($criteresM, array('id', 'reference', "DATE_FORMAT(dateAjout, '%d/%m/%Y') as date"))
@ -92,7 +92,7 @@ class DashboardController extends Libs_Controller
array('id', 'reference', 'fichier', 'nbLigneTotales', 'nbLigneTraites', 'error', 'dateAdded', 'dateStart', 'dateStop')
)
->join(
array('c' => 'comptages'), 'i.idComptage = c.id',
array('c' => 'comptages'), 'i.idComptage = c.id',
array('')
)
->join(
@ -104,7 +104,7 @@ class DashboardController extends Libs_Controller
->where('criteres.login = ?', $user->username);
$encours = $enrichissementsM->fetchAll($sql);
$this->view->encours = $encours;
// 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()
@ -114,7 +114,7 @@ class DashboardController extends Libs_Controller
array('id', 'reference', 'fichier', 'nbLigneTotales', 'nbLigneTraites', 'error', 'dateAdded', 'dateStart', 'dateStop')
)
->join(
array('c' => 'comptages'), 'i.idComptage = c.id',
array('c' => 'comptages'), 'i.idComptage = c.id',
array('')
)
->join(
@ -134,8 +134,8 @@ class DashboardController extends Libs_Controller
*/
public function enrichissementAction()
{
}
}
}

View File

@ -1,6 +1,5 @@
<?php
class EconomiqueController extends Libs_Controller
class EconomiqueController extends Zend_Controller_Action
{
public function init()
{
@ -30,7 +29,7 @@ class EconomiqueController extends Libs_Controller
$this->_helper->viewRenderer->setNoRender();
$request = $this->getRequest();
$table = new Table_Nafs();
$sql = $table->select()
->where('lib LIKE "%'.$this->getRequest()->getParam('q').'%"');
$result = $table->fetchAll($sql);

View File

@ -1,6 +1,5 @@
<?php
class EntrepriseController extends Libs_Controller
class EntrepriseController extends Zend_Controller_Action
{
public function init()
{

View File

@ -1,33 +1,32 @@
<?php
class ErreurController extends Libs_Controller
class ErreurController extends Zend_Controller_Action
{
protected $correlation = array(
'siege' => array('fax', 'tel'),
'fax'=> array('siege'))
;
public function getAction()
{
$session = new Zend_Session_Namespace('erreurs');
$this->_helper->layout()->disableLayout();
$request = $this->getRequest();
$key = $request->getParam('key');
$valeur = $request->getParam('valeur');
$this->correlation($key, $valeur);
$this->view->erreurs = $session->erreurs;
}
protected function correlation($key, $valeurs)
{
$session = new Zend_Session_Namespace('erreurs');
$session->erreurs[$key] = array('erreur' => false, 'valeur' => $valeurs);
foreach($session->erreurs as $erreur => $valeurs)
foreach($session->erreurs as $erreur => $valeurs)
{
if(in_array($erreur, $this->correlation[$key]))
if(in_array($erreur, $this->correlation[$key]))
{
if($session->erreurs[$key]['valeur'] != 'tous')
$session->erreurs[$key]['erreur'] = true;
@ -35,7 +34,7 @@ class ErreurController extends Libs_Controller
unset($session->erreurs[$key]);
}
}
}

View File

@ -1,6 +1,5 @@
<?php
class FinancierController extends Libs_Controller
class FinancierController extends Zend_Controller_Action
{
public function init()

View File

@ -1,6 +1,5 @@
<?php
class GeographiqueController extends Libs_Controller
class GeographiqueController extends Zend_Controller_Action
{
public function init()
@ -32,7 +31,7 @@ class GeographiqueController extends Libs_Controller
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender();
$request = $this->getRequest();
if($request->getParam('dep')) {
$output = $this->completedDep($request->getParam('q'));
} else if ($request->getParam('reg')) {
@ -44,10 +43,10 @@ class GeographiqueController extends Libs_Controller
}else if($request->getParam('adr_com_ex')) {
$output = $this->completedVil($request->getParam('q'));
}
echo json_encode($output);
}
protected function completedDep($q)
{
$table = new Table_Departements();
@ -62,12 +61,12 @@ class GeographiqueController extends Libs_Controller
}
return ($output);
}
protected function completedVil($q)
{
$table = new Table_Codepostauxs();
$separator = ' ';
$sql = $table->select()->where('Commune LIKE "'.$q.'%"');
$result = $table->fetchAll($sql);
foreach ($result as $item) {
@ -78,7 +77,7 @@ class GeographiqueController extends Libs_Controller
}
return ($output);
}
protected function getDeptFromReg($dep)
{
$table = new Table_Departements();
@ -92,12 +91,12 @@ class GeographiqueController extends Libs_Controller
$string = substr($string, 0, strlen($string)-1);
return ($string);
}
protected function completedReg($q)
{
$table = new Table_Regions();
$separator = ' ';
$sql = $table->select()
->where('NCCENR LIKE "%'.$q.'%" OR REGION LIKE "%'.$q.'%"');
$result = $table->fetchAll($sql);

View File

@ -1,5 +1,5 @@
<?php
Class IndexController extends Libs_Controller
Class IndexController extends Zend_Controller_Action
{
public function init()
@ -28,11 +28,11 @@ Class IndexController extends Libs_Controller
require_once 'Scores/SessionCiblage.php';
require_once 'Scores/Field.php';
$session = new SessionCiblage();
$this->view->field = new Fields();
$this->view->criteres = $session->getCriteres();
}
public function removeAction()
{
require_once('Scores/SessionCiblage.php');

View File

@ -1,6 +1,5 @@
<?php
class JuridiqueController extends Libs_Controller
class JuridiqueController extends Zend_Controller_Action
{
public function init()
@ -31,7 +30,7 @@ class JuridiqueController extends Libs_Controller
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender();
$request = $this->getRequest();
$sql = $table->select()
->where('fjLibelle LIKE "'.$request->getParam('q').'%"');
$result = $table->fetchAll($sql);

View File

@ -1,18 +0,0 @@
<?php
class LoginController extends Libs_Controller
{
public function init()
{
/* Initialize action controller here */
}
public function indexAction()
{
// action body
}
}

View File

@ -1,10 +1,9 @@
<?php
class UserController extends Libs_Controller
class UserController extends Zend_Controller_Action
{
public function init()
{
require_once APPLICATION_PATH.'/modules/frontend/models/Forms/Login.php';
require_once 'Scores/WsScores.php';
}
@ -51,7 +50,7 @@ class UserController extends Libs_Controller
$this->_helper->layout()->disableLayout();
$this->render('login');
}
/**
* Gestion de la déconnexion
*/
@ -59,18 +58,18 @@ class UserController extends Libs_Controller
{
Zend_Auth::getInstance()->clearIdentity();
$this->_helper->layout()->disableLayout();
$request = $this->getRequest();
$message = $request->getParam('message');
$message = $request->getParam('message');
$this->view->assign('message', $message);
$url = 'http://'.$_SERVER['SERVER_NAME'].$this->view->url(array(
'controller' => 'user',
'action' => 'login',
));
));
$this->view->assign('url', $url);
$this->view->headMeta()->appendHttpEquiv('refresh', '5; url='.$url);
$this->view->headMeta()->appendHttpEquiv('refresh', '5; url='.$url);
$this->render('logout');
}

View File

@ -1,33 +0,0 @@
<?php
abstract class Libs_Controller extends Zend_Controller_Action
{
protected static $_loadedTables = array();
public function __get($prop)
{
$class = false;
if (substr($prop, 0, 5) == 'table') {
$class = 'Table_' . substr($prop, 5);
}else if (substr($prop, 0, 6) == 'object') {
$class = 'Object_' . substr($prop, 6);
}
if (!$class) {
trigger_error("Access to undefined property $prop", E_USER_WARNING);
return;
}
return self::loadTable($class);
}
public static function loadTable($class)
{
if (array_key_exists($class, self::$_loadedTables)) {
return self::$_loadedTables[$class];
}
if (!class_exists($class)) {
throw new Libs_Exception("Class $class not found");
}
self::$_loadedTables[$class] = new $class;
return self::$_loadedTables[$class];
}
}

View File

@ -1,5 +0,0 @@
<?php
Class Libs_Exception extends Zend_Exception
{
}

View File

@ -1,33 +0,0 @@
<?php
abstract class Libs_Row extends Zend_Db_Table_Row_Abstract
{
public function __construct(array $input = array())
{
$class = explode('_', get_class($this));
$this->_tableClass = 'Table_' . array_pop($class) . 's'; // le 's' final
parent::__construct($input);
$cols = $this->_table->info(Zend_Db_Table_Abstract::COLS);
if (!isset($input['data'])) {
$input['data'] = array_combine($cols, array_pad(array(),count($cols),null));
}
$this->_data = $input['data'];
}
public function getForm($form = null)
{
$formObject = $this->getTable()->getForm($form);
if ($this->_data[$this->_primary[1]] != null && $form == null) {
$formObject->populate($this->_data);
}
return $formObject;
}
public function save()
{
$form = $this->getForm();
if (!$form->isValid($this->_data)) {
return false;
}
return parent::save();
}
}

View File

@ -1,48 +0,0 @@
<?php
abstract class Libs_Table extends Zend_Db_Table_Abstract
{
protected static $_loadedForms = array();
const DEFAULT_FORM = 'Default';
public function __construct($config = array())
{
$class = explode('_', get_class($this));
$rowClass = 'Object_' . substr(array_pop($class), 0, -1);
if (!class_exists($rowClass)) {
throw new Libs_Exception("Class $rowClass not found");
}
$config = array_merge($config, array(self::ROW_CLASS => $rowClass));
parent::__construct($config);
}
public function getForm($form = null)
{
$form = ucfirst(strtolower($form));
if ($form == null) {
$form = self::DEFAULT_FORM;
}
$className = "Form_" . ucfirst($this->_name) . '_' . $form;
if (array_key_exists($className, self::$_loadedForms)) {
return self::$_loadedForms[$className];
}
if (class_exists($className, true)) {
self::$_loadedForms[$className] = new $className;
return self::$_loadedForms[$className];
} else {
throw new Libs_Exception("Class $className not found");
}
}
public function __call($meth, $args)
{
if (preg_match('|get(\w+)Form|', $meth, $matches)) {
return $this->getForm($matches[1]);
}
}
}
?>