diff --git a/application/Bootstrap.php b/application/Bootstrap.php index 8900b759..a71e3429 100644 --- a/application/Bootstrap.php +++ b/application/Bootstrap.php @@ -25,12 +25,15 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap $view->headLink() ->appendStylesheet('/libs/bootstrap-3.1.1/css/bootstrap.min.css', 'all') + ->appendStylesheet('/libs/ui-1.10.3/themes/smoothness/jquery-ui.min.css', 'all') ->appendStylesheet($pathStyle.'/main.css', 'all'); $view->headScript() ->appendFile('/libs/html5shiv.js', 'text/javascript', array('conditional' => 'lt IE 9')) ->appendFile('/libs/respond.min.js', 'text/javascript', array('conditional' => 'lt IE 9')) ->appendFile('/libs/jquery-2.1.1.min.js', 'text/javascript') + ->appendFile('/libs/ui-1.10.3/jquery-ui.min.js', 'text/javascript') + ->appendFile('/libs/ui-1.10.3/jquery-ui-i18n.min.js', 'text/javascript') ->appendFile('/libs/bootstrap-3.1.1/js/bootstrap.min.js', 'text/javascript'); $view->headTitle()->setSeparator(' - '); diff --git a/application/controllers/ComptageController.php b/application/controllers/ComptageController.php index 79eade96..59e227db 100644 --- a/application/controllers/ComptageController.php +++ b/application/controllers/ComptageController.php @@ -26,8 +26,10 @@ class ComptageController extends Zend_Controller_Action $ex = true; } - $fields = new Scores_Fields(); - $insert = $fields->setCritere($cle, $valeur, $ex); + $fields = new Scores_Ciblage_FieldList(); + $sessionValue = new Scores_Ciblage_Session($fields); + + $insert = $sessionValue->setSelected($cle, $valeur, $ex); if ($insert) { //Informations utilisateur @@ -35,25 +37,23 @@ class ComptageController extends Zend_Controller_Action $user = $auth->getIdentity(); //Comptage - require_once 'Scores/Ciblage.php'; - $ciblage = new Ciblage($fields->getValues(), $user->globalRNCS); + $ciblage = new Scores_Ciblage_Engine($sessionValue->getSelectedValues(), $user->globalRNCS); //@todo : if $total = false then an error occured ? - // et si nous avons une erreur alors faut-il retirer les critères de la session $total = $ciblage->execute(); - //Define value return after counting - $fields->setNb('total', $total); + //Define value return after counting + $sessionValue->setCountTotal($total); if ( $user->preferences['interface']['insee'] == 1 ) { $insee = $ciblage->calculRedevanceInsee(); } else { $insee = null; } - $fields->setNb('insee', $insee); + $sessionValue->setCountInsee($insee); if ( $total !== false ) { //All is ok, save criteres and result to session - $fields->setCritereSession(); + $sessionValue->setCritereSession(); } else { $error = 1; } @@ -75,8 +75,8 @@ class ComptageController extends Zend_Controller_Action { $erreurs = new Zend_Session_Namespace('erreurs'); - $fields = new Scores_Fields(); - $fields->clearCiblage(); + $sessionValue = new Scores_Ciblage_Session(); + $sessionValue->clearCiblage(); unset($erreurs->erreurs); $this->_redirect('/'); @@ -90,8 +90,10 @@ class ComptageController extends Zend_Controller_Action $user = $auth->getIdentity(); //Récupération de la session pour le profil et les valeurs du comptage - $fields = new Scores_Fields(); - $criteres = $fields->getCriteres(); + $fields = new Scores_Ciblage_FieldList(); + $sessionValue = new Scores_Ciblage_Session($fields); + $criteres = $sessionValue->getSelectedValues(); + if (count($criteres) == 0) { $this->view->noSelection = true; } @@ -120,11 +122,12 @@ class ComptageController extends Zend_Controller_Action 'error'=>1, 'msg'=> "Référence non définie !")); } else { - //Session - $fields = new Scores_Fields(); - $criteres = $fields->getCriteres(); - $resultat = $fields->getNb('total'); - $nbInsee = $fields->getNb('insee'); + //Session + $fields = new Scores_Ciblage_FieldList(); + $sessionValue = new Scores_Ciblage_Session($fields); + $criteres = $sessionValue->getSelectedValues(); + $resultat = $sessionValue->getCountTotal(); + $nbInsee = $sessionValue->getCountInsee(); //Informations utilisateur $auth = Zend_Auth::getInstance(); @@ -145,8 +148,7 @@ class ComptageController extends Zend_Controller_Action if ($id) { //If nbInsee == null, need to count again if ($nbInsee===null) { - require_once 'Scores/Ciblage.php'; - $ciblage = new Ciblage($criteres, $user->globalRNCS); + $ciblage = new Scores_Ciblage_Engine($criteres, $user->globalRNCS); $nbInsee = $ciblage->calculRedevanceInsee(); } @@ -189,15 +191,12 @@ class ComptageController extends Zend_Controller_Action $criteres = $criteresRow->current(); $structure = json_decode($criteres->criteres, true); - $field = new Scores_Fields(); - $values = $field->getValues($structure); - + //Utilisateur $auth = Zend_Auth::getInstance(); $user = $auth->getIdentity(); //Comptage - require_once 'Scores/Ciblage.php'; - $ciblage = new Ciblage($values, $user->globalRNCS); + $ciblage = new Scores_Ciblage_Engine($structure, $user->globalRNCS); $data = array( 'idDefinition' => $idCriteres, @@ -228,11 +227,11 @@ class ComptageController extends Zend_Controller_Action $auth = Zend_Auth::getInstance(); $user = $auth->getIdentity(); - $fields = new Scores_Fields(); + $sessionValue = new Scores_Ciblage_Session(null); + $valueSelected = $sessionValue->getSelectedValues(); - //Comptage - require_once 'Scores/Ciblage.php'; - $ciblage = new Ciblage($fields->getValues(), $user->globalRNCS); + //Comptage + $ciblage = new Scores_Ciblage_Engine($values, $user->globalRNCS); $sirets = $ciblage->execute(true, 10); /** @@ -253,8 +252,7 @@ class ComptageController extends Zend_Controller_Action } $tabEntete = $tabEnteteLabel = array(); - require_once 'Scores/Enrichissement.php'; - $enrichissement = new Enrichissement(); + $enrichissement = new Scores_Ciblage_Extract(); $fields = $enrichissement->getFields(); $columns = array(); @@ -290,8 +288,8 @@ class ComptageController extends Zend_Controller_Action $joins[] = $join; } - } + } $db = Zend_Db_Table::getDefaultAdapter(); diff --git a/application/controllers/DashboardController.php b/application/controllers/DashboardController.php index 0cec73a9..0af6bb36 100644 --- a/application/controllers/DashboardController.php +++ b/application/controllers/DashboardController.php @@ -71,7 +71,7 @@ class DashboardController extends Zend_Controller_Action ->order('i.dateAdded DESC'); $this->view->enrichissements = $enrichissements->fetchAll($sql); - + } public function ciblagesAction() @@ -145,8 +145,6 @@ class DashboardController extends Zend_Controller_Action $comptageId = $request->getParam('id'); - $fields = new Scores_Fields(); - //Lecture des paramètres du ciblage $criteresM = new Application_Model_CiblageCriteres(); $sql = $criteresM->select() @@ -161,19 +159,44 @@ class DashboardController extends Zend_Controller_Action $decodeCriteres = json_decode($criteres['criteres'], true); - //Construction affichage des critères - foreach ( $decodeCriteres as $key => $item ) { + $fields = new Scores_Ciblage_FieldList(); + $sessionValue = new Scores_Ciblage_Session($fields); + $sessionValue->setSelectedValues($decodeCriteres, false); - $inValue = $fields->getValueLabel($key, $item['in']); - $exValue = $fields->getValueLabel($key, $item['ex']); + //Construction affichage des critères + $infosCriteres = array(); + $allFields = $fields->getItems(true); + foreach ( $allFields as $key => $params ) { + $valueSelected = $sessionValue->getSelectedValue($key); + if ( $valueSelected !== false ) { + $inValue = $valueSelected['in']; + $exValue = $valueSelected['ex']; - //Add label to struct for display - $infosCriteres[] = array( - 'label' => $fields->getLabel($key), - 'in' => $inValue, - 'ex' => $exValue, - ); - } + $inLabel = array(); + if ( count($inValue)>0 ) { + foreach ( $inValue as $value ) { + if ( array_key_exists($value, $params['values']) ) { + $inLabel[] = $params['values'][$value]; + } + } + } + + $exLabel = array(); + if ( count($exValue)>0 ) { + foreach ( $exValue as $value ) { + if ( array_key_exists($value, $params['values']) ) { + $exLabel[] = $params['values'][$value]; + } + } + } + + $infosCriteres[$key] = array( + 'label' => $params['label'], + 'in' => $inLabel, + 'ex' => $exLabel, + ); + } + } //Lecture des comptages $comptageM = new Application_Model_CiblageComptages(); diff --git a/application/controllers/FieldsController.php b/application/controllers/FieldsController.php index 861e17b2..f095a2f4 100644 --- a/application/controllers/FieldsController.php +++ b/application/controllers/FieldsController.php @@ -6,28 +6,31 @@ class FieldsController extends Zend_Controller_Action */ public function indexAction() { + $this->view->headLink() + ->appendStylesheet('/libs/slider/css/bootstrap-slider.min.css', 'all') + ->appendStylesheet('/libs/daterangepicker/daterangepicker-bs3.css', 'all'); + $this->view->headScript() + ->appendFile('/libs/moment.min.js', 'text/javascript') ->appendFile('/libs/tree/jquery.jstree.js', 'text/javascript') + ->appendFile('/libs/slider/bootstrap-slider.min.js') + ->appendFile('/libs/daterangepicker/daterangepicker.js') ->appendFile('/themes/default/scripts/fields.js', 'text/javascript'); - $field = new Scores_Fields(); - $this->view->fields = $field; - } + $families = array( + 'entreprise', + 'economique', + 'geographique', + 'juridique', + 'financier', + ); - /** - * Reset criteres by family - */ - public function resetAction() - { - $this->_helper->layout()->disableLayout(); - $this->_helper->viewRenderer->setNoRender(); + $fields = array(); - $request = $this->getRequest(); - $family = $request->getParam('family'); - if ( !empty($family) ) - { - $fields = new Scores_Fields(); - $fields->resetFamille($family); + $scoresFields = new Scores_Ciblage_FieldList(); + foreach ( $families as $family ) { + $fields = $scoresFields->getItemsByFamily($family); + $this->view->{'Fields'.ucfirst($family)} = $fields; } } diff --git a/application/controllers/GestionController.php b/application/controllers/GestionController.php index 35d5afa3..0279de5b 100644 --- a/application/controllers/GestionController.php +++ b/application/controllers/GestionController.php @@ -293,23 +293,47 @@ class GestionController extends Zend_Controller_Action $decodeCriteres = json_decode($criteres['criteres'], true); - $fields = new Scores_Fields(); + $fields = new Scores_Ciblage_FieldList(); + $sessionValue = new Scores_Ciblage_Session($fields); + $sessionValue->setSelectedValues($decodeCriteres); //Construction affichage des critères - foreach ( $decodeCriteres as $key => $item ) { + $infosCriteres = array(); + $allFields = $fields->getItems(true); + foreach ( $allFields as $key => $params ) { + $valueSelected = $sessionValue->getSelectedValue($key); + if ( $valueSelected !== false ) { + $inValue = $valueSelected['in']; + $exValue = $valueSelected['ex']; - $inValue = $fields->getValueLabel($key, $item['in']); - $exValue = $fields->getValueLabel($key, $item['ex']); + $inLabel = array(); + if ( count($inValue)>0 ) { + foreach ( $inValue as $value ) { + if ( array_key_exists($value, $params['values']) ) { + $inLabel[] = $params['values'][$value]; + } + } + } - //Add label to struct for display - $infosCriteres[] = array( - 'label' => $fields->getLabel($key), - 'in' => $inValue, - 'ex' => $exValue, - ); + $exLabel = array(); + if ( count($exValue)>0 ) { + foreach ( $exValue as $value ) { + if ( array_key_exists($value, $params['values']) ) { + $exLabel[] = $params['values'][$value]; + } + } + } + + $infosCriteres[$key] = array( + 'label' => $params['label'], + 'in' => $inLabel, + 'ex' => $exLabel, + ); + } } - $this->view->criteres = $infosCriteres; + $this->view->infos = $infosCriteres; + } /** diff --git a/application/controllers/IndexController.php b/application/controllers/IndexController.php index 35505fe3..29dc2716 100644 --- a/application/controllers/IndexController.php +++ b/application/controllers/IndexController.php @@ -11,6 +11,9 @@ class IndexController extends Zend_Controller_Action } } + /** + * Affichage des éléments de sélection avec leur valeurs + */ public function criteresAction() { $request = $this->getRequest(); @@ -22,13 +25,16 @@ class IndexController extends Zend_Controller_Action $auth = Zend_Auth::getInstance(); $user = $auth->getIdentity(); - $fields = new Scores_Fields(); + $fields = new Scores_Ciblage_FieldList(); + $sessionValue = new Scores_Ciblage_Session($fields); + //Nombre d'unités $total = $request->getParam('total'); if ( $total !== null ) { $this->view->dataCount = number_format($total, 0, '', ' '); } else { - $this->view->dataCount = number_format($fields->getNb('total'), 0, '', ' '); + //@todo : total quand aucune sélection + $this->view->dataCount = number_format($sessionValue->getCountTotal(), 0, '', ' '); } $insee = $request->getParam('insee'); @@ -36,28 +42,47 @@ class IndexController extends Zend_Controller_Action $this->view->dataInsee = number_format($insee, 0, '', ' '); } else { if ( $user->preferences['interface']['insee'] == 1 ) { - $insee = number_format($fields->getNb('insee'), 0, '', ' '); + $insee = number_format($sessionValue->getCountInsee(), 0, '', ' '); } else { $insee = null; } } - $decodeCriteres = $fields->getCriteres(); - //Construction affichage des critères - $infosCriteres = array(); - foreach ( $decodeCriteres as $key => $item ) { - - $inValue = $fields->getValueLabel($key, $item['in']); - $exValue = $fields->getValueLabel($key, $item['ex']); - - $infosCriteres[$key] = array( - 'label' => $fields->getLabel($key), - 'in' => $inValue, - 'ex' => $exValue, - ); - } + $infosCriteres = array(); + $allFields = $fields->getItems(true); + foreach ( $allFields as $key => $params ) { + $valueSelected = $sessionValue->getSelectedValue($key); + if ( $valueSelected !== false ) { + $inValue = $valueSelected['in']; + $exValue = $valueSelected['ex']; + $inLabel = array(); + if ( count($inValue)>0 ) { + foreach ( $inValue as $value ) { + if ( array_key_exists($value, $params['values']) ) { + $inLabel[] = $params['values'][$value]; + } + } + } + + $exLabel = array(); + if ( count($exValue)>0 ) { + foreach ( $exValue as $value ) { + if ( array_key_exists($value, $params['values']) ) { + $exLabel[] = $params['values'][$value]; + } + } + } + + $infosCriteres[$key] = array( + 'label' => $params['label'], + 'in' => $inLabel, + 'ex' => $exLabel, + ); + } + } + Zend_Registry::get('firebug')->info($infosCriteres); $this->view->infos = $infosCriteres; } @@ -68,26 +93,41 @@ class IndexController extends Zend_Controller_Action $request = $this->getRequest(); $critere = $request->getParam('key'); - $fields = new Scores_Fields(); - $values = $fields->getCritere($critere); + $fields = new Scores_Ciblage_FieldList(); + $sessionValue = new Scores_Ciblage_Session($fields); + $values = $sessionValue->getSelectedValue($key); $this->view->assign('critereName', $critere); - //Inclusion - if (count($values['in'])>0) { - $inLabels = $fields->getValueLabel($critere, $values['in']); - $inValues = array_values($values['in']); - $this->view->assign('inLabels', $inLabels); - $this->view->assign('inValues', $inValues); + if ( $valueSelected !== false ) { + $inValue = $valueSelected['in']; + $exValue = $valueSelected['ex']; + + $inLabel = array(); + if ( count($inValue)>0 ) { + foreach ( $inValue as $value ) { + if ( array_key_exists($value, $params['values']) ) { + $inLabel[] = $params['values'][$value]; + } + } + + $this->view->assign('inLabels', $inLabel); + $this->view->assign('inValues', $inValue); + } + + $exLabel = array(); + if ( count($exValue)>0 ) { + foreach ( $exValue as $value ) { + if ( array_key_exists($value, $params['values']) ) { + $exLabel[] = $params['values'][$value]; + } + } + + $this->view->assign('exLabels', $exLabel); + $this->view->assign('exValues', $exValue); + } } - //Exclusion - if (count($values['ex'])>0) { - $exLabels = $fields->getValueLabel($critere, $values['ex']); - $exValues = array_values($values['ex']); - $this->view->assign('exLabels', $exLabels); - $this->view->assign('exValues', $exValues); - } } @@ -101,33 +141,30 @@ class IndexController extends Zend_Controller_Action $posInList = $request->getParam('in', false); $posExList = $request->getParam('ex', false); - $fields = new Scores_Fields(); + $sessionValue = new Scores_Ciblage_Session(); if ($posInList!==false) { - $fields->unsetCritereValue($nameCritereToDelete, $posInList); + $sessionValue->unsetSelectedValue($nameCritereToDelete, $posInList); } elseif ($posExList!==false) { - $fields->unsetCritereValue($nameCritereToDelete, $posExList, true); + $sessionValue->unsetSelectedValue($nameCritereToDelete, $posInList, true); } else { - $fields->unsetCritere($nameCritereToDelete); + $sessionValue->unsetSelected($nameCritereToDelete); } $auth = Zend_Auth::getInstance(); $user = $auth->getIdentity(); //Comptage - require_once 'Scores/Ciblage.php'; - $ciblage = new Ciblage($fields->getValues(), $user->globalRNCS); - - $total = $ciblage->execute(); - $fields->setNb('total', $total); - + $ciblage = new Scores_Ciblage_Engine($sessionValue->getSelectedValues(), $user->globalRNCS); + $total = $ciblage->execute(); + $sessionValue->setCountTotal($total); if ($user->preferences['interface']['insee']==1) { - $insee = $ciblage->calculRedevanceInsee(); + $insee = $ciblage->calculRedevanceInsee(); } else { $insee = null; - } - $fields->setNb('insee', $insee); - $fields->setCritereSession(); + } + $sessionValue->setCountInsee($insee); + $sessionValue->setCritereSession(); $this->_redirect('/'); } diff --git a/application/views/default/helpers/Field.php b/application/views/default/helpers/Field.php index c5604ef9..2a7190aa 100644 --- a/application/views/default/helpers/Field.php +++ b/application/views/default/helpers/Field.php @@ -1,376 +1,18 @@ name = $name; + $field = new Scores_Ciblage_FieldList(); - //Read the dico - $fields = new Scores_Fields(); - $params = $fields->get($name); + //@todo : Get valueSeclected from session - $html = ''; + $html = $field->getItemHtml($name); - $label = $labelG = $fields->getLabel($name); + if ($html) { + return $html; + } - $title = ''; - if ( array_key_exists('title', $params) && !empty($params['title']) ) { - $title = $this->view->translate($params['title']); - } - - //How many type of fields is defined - $nbFields = count($params['fields']); - - $display = true; - $out = ''; - - //If more than one field exist we need to make a special display - if ( $nbFields > 1) { - $out.= '
'; - $out.= $this->structureLabel($label); - $out.= '
'; - foreach ( $params['fields'] as $type => $options ) - { - switch ($type) { - case 'tree': - $href = $this->view->url(array('controller' => 'arborescence', 'action' => $options['action'], 'key' => $name)); - $out.= ''; - $out.= 'Arborescence'; - $out.= ''; - break; - case 'text': - $out.= ''; - $out.= 'Recherche'; - $out.= ''; - break; - case 'list': - $out.= ''; - $out.= 'Liste'; - $out.= ''; - break; - } - $out.= ' '; - } - $out.= '
'; - $out.= '
'; - //Masquer les champs - $display = false; - } - - //Draw fields - foreach ( $params['fields'] as $type => $options ) - { - switch($type) - { - case 'select': - $html = $this->selectHTML($name, $options); - break; - case 'selectMultiple': - $html = $this->selectMultipleHTML($name, $options); - break; - case 'intervalSelect': - $html = $this->intervalSelectHTML($name, $options); - break; - case 'checkbox': - $html = $this->checkboxHTML($name, $options); - break; - case 'intervalDate': - $html = $this->intervalDateHTML($name, $options); - break; - case 'interval': - $html = $this->intervalHTML($name, $options); - break; - case 'date': - $html = $this->dateHTML($name, $options); - break; - case 'text': - $html = $this->textHTML($name, $options); - break; - case 'textarea': - $html = $this->textareaHTML($name, $options); - break; - case 'radio': - $html = $this->radioHTML($name, $options); - break; - case 'file': - $html = $this->fileuploadHtml($name, $options); - break; - case 'tree': - //Do nothing - break; - case 'list': - $html = $this->textareaHTML($name, $options); - break; - default: - $html = $this->structureHTML($name, ''); - break; - } - - $label = $labelG; - if ( array_key_exists('label', $options) ) { - $label = $options['label']; - } - - $style = ''; - $class = ' class="panel panel-info fieldgrp"'; - if ( $display===false ) { - $style = ' style="display:none;"'; - } - if ( !empty($title) ) { - $title = ' title="'.$title.'"'; - } - - $out.= '
'; - $out.= $this->structureLabel($this->view->translate($label)); - $out.= '
'.$html.'
'; - $out.= '
'; - - } - - return $out; - } - - /** - * Définition du label - * @param unknown_type $label - */ - private function structureLabel($label) - { - $return = '
'.$label.'
'; - return $return; - } - - protected function getMinMax($name, $valeur) - { - if(!empty($name)) { - //$fields = new Scores_Fields(); - //$default = $fields->getMinMax($name); - if(empty($valeur[0])){$valeur[0] = $default[0]['min'];} - if(empty($valeur[1])){$valeur[1] = $default[0]['max'];} - } - return ($valeur); - } - - private function intervalSelectHTML($name, $options) - { - $session = new Scores_Fields(); - $sessionValeur = explode(',', $session->getCritere($name)); - - $minMax = $this->getMinMax($name, array(0,0)); - - $return = ' '.$this->view->translate('à').' '; - $return .= ''; - $return .= ' '.$this->view->translate('Valider').''; - return ($return); - } - - /** - * - * @param unknown_type $name - * @param unknown_type $options - */ - protected function checkboxHTML($name, $options) - { - $session = new Scores_Fields(); - $sessionValeur = $session->getCritere($name); - - $select = ''; - if ($sessionValeur==1) $select = ' checked'; - $return = ''; - return $return; - } - - /** - * - * @param unknown_type $name - * @param unknown_type $options - * @return string - */ - protected function selectMultipleHTML($name, $options) - { - $session = new Scores_Fields(); - $sessionValeur = $session->getCritere($name); - $return = '
'; - foreach($options['value'] as $value => $label) { - $selected = ""; - if( !empty($sessionValeur) ) { - if ( is_array($sessionValeur) && in_array($value, $sessionValeur) ) { - $selected = "active"; - } - } - $return .= ''; - } - $return .= '
'; - $return .= ''; - $return .= ''; - return $return; - } - - /** - * - * @param unknown_type $name - * @param unknown_type $options - * @return string - */ - protected function selectHTML($name, $options) - { - $session = new Scores_Fields(); - $sessionValeur = $session->getCritere($name); - - if( is_array($sessionValeur) ) { - $sessionValeur = implode(',', $sessionValeur); - } - $return = '
'; - foreach($options['value'] as $value => $label) { - $selected = ""; - if( $sessionValeur!==null && $sessionValeur != "-" && $sessionValeur==$value ) - $selected = "active"; - $return .= ''; - } - $return .= '
'; - - return $return; - - } - - protected function intervalDateHTML($name, $options) - { - $session = new Scores_Fields(); - $sessionValeur = $session->getCritere($name); - - $return = ''; - - $return.= ''; - $return.= ''; - $return.= ''; - - $return.= ' '.$this->view->translate('au').' '; - - $return.= ''; - $return.= ''; - $return.= ''; - $return .= '
'.$this->view->translate('Valider').''; - - return $return; - } - - - /* Interval */ - private function intervalHTML($name, $field) - { - $session = new Scores_Fields(); - $valeur = $session->getCritere($name); - - $return = '
'; - $return .= ' '.$this->view->translate('à').' '; - $return .= ''; - $return .= ' '.$this->view->translate('Valider').''; - $return .= '
'; - - return $return; - } - - /* Dates */ - private function dateHTML($name, $field) - { - $session = new Scores_Fields(); - - $return = '
'; - $return .= ' a '; - $return .= ''; - $return .= '
'; - - return ($return); - } - - /* Textes */ - protected function textHTML($name, $options) - { - $return = ''; - $return.= ''; - $return.= 'Sélectionner'; - $return.= ' Exclure'; - return $return; - } - - /* Textarea */ - protected function textareaHTML($name, $field) - { - $return = ''; - $return.= 'Sélectionner'; - $return.= ' Exclure'; - return $return; - } - - private function fileuploadHtml($name, $field) - { - $return = ' '; - return ($return); - } - - /* Radios */ - private function radioHTML($name, $field, $item) - { - $return = ''; - return ($return); + return "
Impossible d'afficher ".$name."
"; } } \ No newline at end of file diff --git a/application/views/default/scripts/comptage/previsualisation.phtml b/application/views/default/scripts/comptage/previsualisation.phtml index 26ef0c42..274e7f14 100644 --- a/application/views/default/scripts/comptage/previsualisation.phtml +++ b/application/views/default/scripts/comptage/previsualisation.phtml @@ -1,29 +1,27 @@
- - - label as $label): ?> - - - - liste) > 0) { - foreach($this->liste as $line) { - echo ''; - foreach($line as $col) { - echo ''; - } - echo ''; - $i++; - } - } else { - echo ''; +
'.$col.'
Vous n\'avez selectionné aucuns critères
+ + label as $label): ?> + + + +liste) > 0) { + foreach($this->liste as $line) { + echo ''; + foreach($line as $col) { + echo ''; + } + echo ''; + $i++; } - ?> -
'.$col.'
+} else { + echo 'Vous n\'avez selectionné aucuns critères'; +} +?> +
\ No newline at end of file diff --git a/application/views/default/scripts/fields/index.phtml b/application/views/default/scripts/fields/index.phtml index 5498f417..4c67876a 100644 --- a/application/views/default/scripts/fields/index.phtml +++ b/application/views/default/scripts/fields/index.phtml @@ -11,25 +11,11 @@
- Field('siege')?> - Field('groupe')?> - Field('tel')?> - Field('fax')?> - Field('web')?> - Field('mail')?> - Field('presentRcs')?> - Field('adrDom')?> - Field('dirNom')?> - Field('dateCrea_etab')?> - Field('participation')?> - Field('nbMPubli')?> - Field('dateCrea_ent')?> - Field('action')?> - Field('nbActio')?> - Field('nbPart')?> -
-
@@ -48,21 +34,11 @@
-
    -
  • Field('capital')?>
  • -
  • Field('ape_entrep')?>
  • -
  • Field('ape_etab')?>
  • -
  • Field('age_entrep')?>
  • -
  • Field('age_etab')?>
  • -
  • Field('teff_entrep')?>
  • -
  • Field('teff_etab')?>
  • -
  • Field('eff_entrep')?>
  • -
  • Field('eff_etab')?>
  • -
  • Field('nbEtab')?>
  • -
-
-
- Réinitialiser les critères economiques + FieldsEconomique)>0 ) {?> + FieldsEconomique as $key => $params ) {?> + Field($key)?> + +
@@ -81,26 +57,11 @@
-
    -
  • - Field('geo')?> - Field('geo_domtom')?> - Field('geo_etranger')?> - Field('geo_corse')?> -
  • -
  • Field('codesdepts')?>
  • -
  • Field('codespostaux')?>
  • -
  • Field('codesinsee')?>
  • -
  • Field('zus')?>
  • -
  • Field('zru')?>
  • -
  • Field('zfu')?>
  • -
  • Field('cucs')?>
  • -
  • Field('zrr')?>
  • -
  • Field('zafr')?>
  • -
-
-
- Réinitialiser les critères geographiques + FieldsGeographique)>0 ) {?> + FieldsGeographique as $key => $params ) {?> + Field($key)?> + +
@@ -119,17 +80,11 @@
-
    -
  • Field('cj')?>
  • -
  • Field('cjlist')?>
  • -
  • Field('actifEco')?>
  • -
  • Field('procolHisto')?>
  • -
  • Field('dateImmat')?>
  • -
  • Field('tvaIntraValide')?>
  • -
-
-
- Réinitialiser les critères juridique + FieldsJuridique)>0 ) {?> + FieldsJuridique as $key => $params ) {?> + Field($key)?> + +
@@ -148,30 +103,11 @@
-
    -
  • Field('bilType')?>
  • -
  • Field('avisCs')?>
  • -
  • Field('bilAnnee')?>
  • -
  • Field('bilCloture')?>
  • -
  • Field('bilDuree')?>
  • -
  • Field('bilTca')?>
  • -
  • Field('bilFL')?>
  • -
  • Field('bilEE')?>
  • -
  • Field('bilFK')?>
  • -
  • Field('bilFR')?>
  • -
  • Field('bilGF')?>
  • -
  • Field('bilGP')?>
  • -
  • Field('bilGW')?>
  • -
  • Field('bilHD')?>
  • -
  • Field('bilHH')?>
  • -
  • Field('bilHL')?>
  • -
  • Field('bilHM')?>
  • -
  • Field('bilHN')?>
  • -
  • Field('bilYP')?>
  • -
-
-
- Réinitialiser les critères financiers + FieldsFinancier)>0 ) {?> + FieldsFinancier as $key => $params ) {?> + Field($key)?> + +
diff --git a/application/views/default/scripts/layout.phtml b/application/views/default/scripts/layout.phtml index fb782600..53b401f5 100644 --- a/application/views/default/scripts/layout.phtml +++ b/application/views/default/scripts/layout.phtml @@ -8,7 +8,7 @@ headScript(); ?> -
+
render('header.phtml') ?>
diff --git a/library/Application/Controller/Plugin/Auth.php b/library/Application/Controller/Plugin/Auth.php index 1139db46..79b810f1 100644 --- a/library/Application/Controller/Plugin/Auth.php +++ b/library/Application/Controller/Plugin/Auth.php @@ -139,7 +139,7 @@ class Application_Controller_Plugin_Auth extends Zend_Controller_Plugin_Abstract $view->admin = true; } - Zend_Registry::get('firebug')->info($identity); + //Zend_Registry::get('firebug')->info($identity); if (Zend_Session::namespaceIsset('login')){ Zend_Session::namespaceUnset('login'); diff --git a/library/Application/Controller/Plugin/Comptage.php b/library/Application/Controller/Plugin/Comptage.php index 376497d1..4ffecb8a 100644 --- a/library/Application/Controller/Plugin/Comptage.php +++ b/library/Application/Controller/Plugin/Comptage.php @@ -17,18 +17,17 @@ class Application_Controller_Plugin_Comptage extends Zend_Controller_Plugin_Abst $user = $auth->getIdentity(); //Load ciblage to get status of sphinxsearch - require_once 'Scores/Ciblage.php'; - $ciblage = new Ciblage(); + $ciblage = new Scores_Ciblage_Engine(); $status = $ciblage->Status(); - if ($status===false) { + if ( $status === false ) { $view->CiblageError = true; } else { //Load def and session values - $session = new Scores_Fields(); + $sessionValue = new Scores_Ciblage_Session(); // Chargement des critères de ciblage à partir de l'enregistrement en bdd $id = $request->getParam('id', 0); @@ -40,25 +39,28 @@ class Application_Controller_Plugin_Comptage extends Zend_Controller_Plugin_Abst ->where('id = ?', $id); $row = $criteresM->fetchRow($sql); if ($row != null) { + //On charge les critères - $session->setCriteres(json_decode($row->criteres, 'true')); + $sessionValue->setSelectedValues(json_decode($row->criteres, true)); + //Réalise le comptage - $fields = new Scores_Fields(); - $ciblage = new Ciblage($fields->getValues(), $user->globalRNCS); + $ciblage = new Scores_Ciblage_Engine($sessionValue->getSelectedValues(), $user->globalRNCS); + $total = $ciblage->execute(); - $session->setNb('total', $total); + $sessionValue->setCountTotal($total); if ($user->preferences['interface']['insee']==1) { $insee = $ciblage->calculRedevanceInsee(); } else { $insee = null; } - $session->setNb('insee', $insee); - $session->setCritereSession(); + $sessionValue->setCountInsee($insee); + $sessionValue->setCritereSession(); + } } - $view->total = $session->getNb('total'); - $view->insee = $session->getNb('insee'); + $view->total = $sessionValue->getCountTotal(); + $view->insee = $sessionValue->getCountInsee(); $view->msgComptage = true; } } diff --git a/library/Scores/Ciblage/Engine.php b/library/Scores/Ciblage/Engine.php index f3c4f28f..7e50a5ee 100644 --- a/library/Scores/Ciblage/Engine.php +++ b/library/Scores/Ciblage/Engine.php @@ -59,7 +59,7 @@ class Scores_Ciblage_Engine //Follow each elements if ( $structure!==null && count($structure)>0 ) { foreach($structure as $key => $valeur) { - if ($key!= 'NB' && method_exists($this, $key)) { + if ( method_exists($this, $key) ) { $this->{$key}($valeur); } else { Zend_Registry::get('firebug')->info('Method non exist KEY:'.$key); diff --git a/library/Scores/Ciblage/Field/List.php b/library/Scores/Ciblage/Field/List.php index 1c4a90a9..1b013c55 100644 --- a/library/Scores/Ciblage/Field/List.php +++ b/library/Scores/Ciblage/Field/List.php @@ -18,7 +18,7 @@ class Scores_Ciblage_Field_List public function getHTML($valueSelected = array()) { $html = '
' . - '
' . + '
' . '
'; $valueTxt = ''; @@ -34,8 +34,8 @@ class Scores_Ciblage_Field_List $html.= ''; - $html.= '
' . - '' . + $html.= '
' . + '' . '
'. '
'. '
'; diff --git a/library/Scores/Ciblage/Field/Many.php b/library/Scores/Ciblage/Field/Many.php index 3adfc3af..4e211a61 100644 --- a/library/Scores/Ciblage/Field/Many.php +++ b/library/Scores/Ciblage/Field/Many.php @@ -18,24 +18,22 @@ class Scores_Ciblage_Field_Many public function getHTML($valueSelected = array()) { $html = '
' . - '
' . - '
'; + '
'; if ( count($this->data)>0 ) { $html.= ''; } $html.= '
'. - '
' . + '
' . '' . '
'. - '
'. '
'; return $html; } diff --git a/library/Scores/Ciblage/Field/One.php b/library/Scores/Ciblage/Field/One.php index a9e82300..139bf1da 100644 --- a/library/Scores/Ciblage/Field/One.php +++ b/library/Scores/Ciblage/Field/One.php @@ -17,14 +17,15 @@ class Scores_Ciblage_Field_One public function getHTML($valueSelected = '') { - $html = '
'; + $html = '
'; if ( count($this->data)>0 ) { foreach ( $this->data as $value => $label ) { - $selected = ""; + $active = ''; if( $valueSelected === $value ) { - $selected = "active"; + $active = ' active'; } - $html.= '