Suppression des objets

This commit is contained in:
Michael RICOIS 2012-05-18 07:52:40 +00:00
commit 996f785440
20 changed files with 573 additions and 1125 deletions

View File

@ -17,21 +17,18 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
->appendHttpEquiv('Content-Language', 'fr-FR'); ->appendHttpEquiv('Content-Language', 'fr-FR');
$view->headLink() $view->headLink()
->appendStylesheet($pathStyle.'/jquery.qtip.css', 'all') ->appendStylesheet('/libs/qtip/jquery.qtip.css', 'all')
->appendStylesheet('/themes/jstree/default/style.css') ->appendStylesheet('/themes/jstree/default/style.css')
->appendStylesheet('/themes/jqueryui/jquery-ui.css', 'all') ->appendStylesheet('/themes/jqueryui/jquery-ui.css', 'all')
->appendStylesheet($pathStyle.'/main.css', 'all'); ->appendStylesheet($pathStyle.'/main.css', 'all');
//->appendStylesheet('/themes/multiselect/css/ui.multiselect.css', 'all');
$view->headScript() $view->headScript()
->appendFile($pathScript.'/jquery.js', 'text/javascript') ->appendFile($pathScript.'/jquery.js', 'text/javascript')
->appendFile($pathScript.'/jquery.bgiframe.js', 'text/javascript') ->appendFile($pathScript.'/jquery.bgiframe.js', 'text/javascript')
->appendFile($pathScript.'/jquery.cookie.js', 'text/javascript') ->appendFile($pathScript.'/jquery.cookie.js', 'text/javascript')
->appendFile($pathScript.'/jquery-ui.js', 'text/javascript') ->appendFile($pathScript.'/jquery-ui.js', 'text/javascript')
->appendFile($pathScript.'/jquery.qtip.js', 'text/javascript') ->appendFile('/libs/qtip/jquery.qtip.js', 'text/javascript')
->appendFile($pathScript.'/upload.js', 'text/javascript')
->appendFile($pathScript.'/scripts.js', 'text/javascript'); ->appendFile($pathScript.'/scripts.js', 'text/javascript');
//->appendFile($pathScript.'/ui.multiselect.js', 'text/javascript');
$view->headTitle()->setSeparator(' - '); $view->headTitle()->setSeparator(' - ');
$view->headTitle('Odea'); $view->headTitle('Odea');

View File

@ -21,7 +21,6 @@ resources.view.basePath = APPLICATION_PATH "/views/default"
autoloaderNamespaces[] = "Application_" autoloaderNamespaces[] = "Application_"
autoloaderNamespaces[] = "Scores_" autoloaderNamespaces[] = "Scores_"
autoloaderNamespaces[] = "Form_" autoloaderNamespaces[] = "Form_"
autoloaderNamespaces[] = "Object_"
[staging : production] [staging : production]
phpSettings.display_startup_errors = 1 phpSettings.display_startup_errors = 1

View File

@ -136,12 +136,50 @@ class ArborescenceController extends Zend_Controller_Action
public function geographiqueAction() public function geographiqueAction()
{ {
$this->_helper->layout()->disableLayout(); $this->_helper->layout()->disableLayout();
$key = $this->getRequest()->getParam('key');
$object = new Object_Codepostaux(); $fields = new Scores_Fields();
$key = $this->getRequest()->getParam('key'); $val = $fields->getCritere($key);
$valuesChecked = array();
$valuesUndetermined = array();
if ($val != null){
$valuesChecked = $val['in'];
if (count($valuesChecked)>0) {
foreach($valuesChecked as $value) {
if ( substr($value,0,1)!='R' ) {
$valuesUndetermined = array_merge($valuesUndetermined, $this->getGeoParent($value));
}
}
}
}
$regionsM = new Application_Model_Regions();
$sql = $regionsM->select()->order('NCCENR ASC');
$regions = $regionsM->fetchAll($sql)->toArray();
$tabRegions = array();
foreach($regions as $item) {
$structure = array(
'data' => $item['NCCENR'],
'attr' => array(
'id' => 'R'.$item['REGION'],
'niveau' => 0,
),
'state' => 'closed',
'children' => array()
);
if (in_array('R'.$item['REGION'], $valuesChecked)){
$structure['attr']['class'] = 'jstree-checked';
}
if (in_array('R'.$item['REGION'], $valuesUndetermined)){
$structure['attr']['class'] = 'jstree-undetermined';
}
$tabRegions[] = $structure;
}
$this->view->key = $key; $this->view->key = $key;
$this->view->regions = $object->_getRegions(); $this->view->regions = json_encode($tabRegions);
} }
public function geographiqueajaxAction() public function geographiqueajaxAction()
@ -152,15 +190,113 @@ class ArborescenceController extends Zend_Controller_Action
$request = $this->getRequest(); $request = $this->getRequest();
$id = $request->getParam('id'); $id = $request->getParam('id');
$niveau = $request->getParam('niveau'); $niveau = $request->getParam('niveau');
$object = new Object_Codepostaux();
if($niveau == 0) { //Récupération des valeurs enregistrées en session
echo ($object->_getDepartements($id)); $fields = new Scores_Fields();
} else if ($niveau == 1) { $val = $fields->getCritere('geo');
echo ($object->_getCommunes($id)); $valuesChecked = array();
$valuesUndetermined = array();
if ($val != null){
$valuesChecked = $val['in'];
if (count($valuesChecked)>0) {
foreach($valuesChecked as $value){
$valuesUndetermined = array_merge($valuesUndetermined, $this->getGeoParent($value));
}
}
}
// R[code] => Régions => recherche département
if ( substr($id,0,1)=='R' ) {
$region = substr($id,1);
$departementsM = new Application_Model_Departements();
$sql = $departementsM->select()->where('codeRegionInsee = ?', $region);
$departements = $departementsM->fetchAll($sql)->toArray();
$tabDepartements = array();
foreach($departements as $item) {
$structure = array(
'data' => $item['libdep'].' ('.$item['numdep'].')',
'attr' => array(
'id' => 'D'.$item['numdep'],
'niveau' => 1,
),
'state' => 'closed',
'children' => array()
);
if (in_array('D'.$item['numdep'], $valuesChecked)){
$structure['attr']['class'] = 'jstree-checked';
}
if (in_array('D'.$item['numdep'], $valuesUndetermined)){
$structure['attr']['class'] = 'jstree-undetermined';
}
$tabDepartements[] = $structure;
}
echo json_encode($tabDepartements);
}
// D[code] => Départements => recherche commune
else if ( substr($id,0,1)=='D' ) {
$departement = substr($id,1);
$codePostauxM = new Application_Model_CodePostaux();
$sql = $codePostauxM->select()
->where('Codepos LIKE ?', $departement.'%')
->order('Commune ASC');
Zend_Registry::get('firebug')->info($sql->__toString());
$communes = $codePostauxM->fetchAll($sql)->toArray();
$tabCommunes = array();
foreach($communes as $item) {
$structure = array(
'data' => $item['Commune'],
'attr' => array(
'id' => 'C'.$item['INSEE'],
'niveau' => 1,
)
);
if (in_array('C'.$item['INSEE'], $valuesChecked)){
$structure['attr']['class'] = 'jstree-checked';
}
$tabCommunes[] = $structure;
}
echo json_encode($tabCommunes);
} }
} }
protected function getGeoParent($code)
{
if (substr($code,0,1)=='D') {
$departementsM = new Application_Model_Departements();
$sql = $departementsM->select()
->from($departementsM, array('codeRegionInsee'))
->where('numdep = ?', substr($code,1));
$departement = $departementsM->fetchRow($sql);
return array('R'.$departement->codeRegionInsee);
} elseif ( substr($code,0,1)=='C' ) {
$codePostauxM = new Application_Model_CodePostaux();
$sql = $codePostauxM->select()
->from($codePostauxM, array('Codepos'))
->where('INSEE = ?', substr($code,1));
$commune = $codePostauxM->fetchRow($sql);
$departement = 'D'.substr($commune->Codepos,0,2);
$region = $this->getGeoParent($departement);
return array_merge(array($departement), $region);
}
return array();
}
/* Forme Juridique */ /* Forme Juridique */
public function juridiqueAction() public function juridiqueAction()
{ {

View File

@ -75,8 +75,60 @@ class ComptageController extends Zend_Controller_Action
$this->_helper->layout()->disableLayout(); $this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true); $this->_helper->viewRenderer->setNoRender(true);
$request = $this->getRequest(); $request = $this->getRequest();
$object = new Object_Comptage(); $ref = $request->getParam('ref', '');
$object->saveComptage($request->getParam('ref', ''));
if (empty($ref)) {
echo json_encode(array(
'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');
//Informations utilisateur
$auth = Zend_Auth::getInstance();
$user = $auth->getIdentity();
//Enregistrement des critères
$criteresM = new Application_Model_Criteres();
$data = array(
'idClient' => $user->idClient,
'login' => $user->username,
'reference' => $ref,
'criteres' => json_encode($criteres),
'parent' => 0,
'dateAjout' => date('Y-m-d H:i:s'),
);
$id = $criteresM->insert($data);
if ($id){
//Enregistrement des valeurs du comptage
$comptageM = new Application_Model_Comptages();
$data = array(
'idDefinition' => $id,
'resultat' => $resultat,
'uniteInsee' => $nbInsee,
'dateAjout' => date('Y-m-d H:i:s'),
);
if ($comptageM->insert($data)) {
echo json_encode(array(
'error'=>0,
'msg'=> "Vos critères ont été sauvegardés sous la référence $ref",
'id' => $id));
} else {
echo json_encode(array(
'error'=>1,
'msg'=> "Erreur lors de l'enregistrement"));
}
} else {
echo json_encode(array(
'error'=>1,
'msg'=> "Erreur lors de l'enregistrement"));
}
}
} }
public function updateAction() public function updateAction()
@ -117,13 +169,20 @@ class ComptageController extends Zend_Controller_Action
$this->view->result = $result; $this->view->result = $result;
} }
/**
* Get a preview of data to extract
*/
public function previsualisationAction() public function previsualisationAction()
{ {
$this->_helper->layout()->disableLayout(); $this->_helper->layout()->disableLayout();
$request = $this->getRequest(); $fields = new Scores_Fields();
$object = new Object_Comptage();
$sirets = $object->count(null, null, true); //Comptage
require_once 'Scores/Ciblage.php';
$ciblage = new Ciblage($fields->getValues());
$sirets = $ciblage->execute(true, 10);
$dbConfig = Zend_Registry::get('configuration')->databases; $dbConfig = Zend_Registry::get('configuration')->databases;
try { try {

View File

@ -9,21 +9,126 @@ class DashboardController extends Zend_Controller_Action
public function indexAction() public function indexAction()
{ {
$object = new Object_Dashboard(); $auth = Zend_Auth::getInstance();
$user = $auth->getIdentity();
$this->view->comptages = $object->index(); $criteresM = new Application_Model_Criteres();
$this->view->enrichissements = $object->enrichissements(); $sql = $criteresM->select()
->from($criteresM, array('id', 'reference', 'dateAjout'))
->where("idClient = ?", $user->idClient)
->where("login = ?", $user->username)
->order('dateAjout DESC')
->limit(5);
$rows = $criteresM->fetchAll($sql);
//
$results = array();
$comptagesM = new Application_Model_Comptages();
foreach($rows->toArray() as $item)
{
$info = array(
'id' => $item['id'],
'reference' => $item['reference'],
'dateCriteres' => $item['dateAjout'],
);
//Recherche des comptages
$sql = $comptagesM->select()
->from($comptagesM, array('resultat', 'uniteInsee', "DATE_FORMAT(dateAjout, '%Y/%m/%d %H:%i:%s') as dateAjout"))
->where('idDefinition = ?', $item['id'])
->order('dateAjout DESC')->limit(1);
$comptage = $comptagesM->fetchAll($sql)->toArray();
if (count($comptage)>0){
$info['resultat'] = $comptage[0]['resultat'];
$info['uniteInsee'] = $comptage[0]['uniteInsee'];
$info['dateComptage'] = $comptage[0]['dateAjout'];
}
$results[] = $info;
}
$this->view->comptages = $results;
//
$enrichissements = new Application_Model_EnrichissementIdentifiants();
$sql = $enrichissements->select()
->setIntegrityCheck(false)
->from(
array('i' => 'enrichissement_identifiants'),
array('id', 'reference', 'fichier', 'nbLigneTotales', 'nbLigneTraites', 'error', 'dateAdded', 'dateStart', 'dateStop')
)
->join(
array('c' => 'criteres'), 'i.idCriteres = c.id',
array('')
)
->where('c.idClient = ?', $user->idClient)
->where('c.login = ?', $user->username)
->order('i.dateAdded DESC');
$this->view->enrichissements = $enrichissements->fetchAll($sql);
} }
public function ciblagesAction() public function ciblagesAction()
{ {
$object = new Object_Dashboard();
$request = $this->getRequest();
$assigns = $object->ciblage($request->getParam('page', 1));
$this->view->ciblages = $assigns['ciblages']; $request = $this->getRequest();
$this->view->nbCiblage = $assigns['nbCiblage']; $page = $request->getParam('page', 1);
$offset = 20;
//Liste des ciblages par paquet de n
$auth = Zend_Auth::getInstance();
$user = $auth->getIdentity();
$criteresM = new Application_Model_Criteres();
//Compter le nombre de page
$sql = $criteresM->select()
->from($criteresM, array('nb' => 'COUNT(*)'))
->where("idClient = ?", $user->idClient)
->where("login = ?", $user->username);
$count = $criteresM->fetchRow($sql);
$nbCiblage = $count->nb;
//Récupérer les informations
$position = ($page-1)*$offset+1;
$sql = $criteresM->select()
->from($criteresM, array('id', 'reference', 'dateAjout'))
->where("idClient = ?", $user->idClient)
->where("login = ?", $user->username)
->order('dateAjout DESC')
->limitPage($position, $offset);
$rows = $criteresM->fetchAll($sql);
$results = array();
$comptagesM = new Application_Model_Comptages();
foreach($rows->toArray() as $item)
{
$info = array(
'id' => $item['id'],
'reference' => $item['reference'],
'dateCriteres' => $item['dateAjout'],
);
//Recherche des comptages
$sql = $comptagesM->select()
->from($comptagesM, array('resultat', 'uniteInsee', "DATE_FORMAT(dateAjout, '%d/%m/%Y %H:%i:%s') as dateAjout"))
->where('idDefinition = ?', $item['id'])
->order('dateAjout DESC')->limit(1);
$comptage = $comptagesM->fetchAll($sql)->toArray();
if (count($comptage)>0){
$info['resultat'] = $comptage[0]['resultat'];
$info['uniteInsee'] = $comptage[0]['uniteInsee'];
$info['dateComptage'] = $comptage[0]['dateAjout'];
}
$results[] = $info;
}
$this->view->ciblages = $results;
$this->view->nbCiblage = $nbCiblage;
} }
public function ciblageAction() public function ciblageAction()
@ -119,6 +224,7 @@ class DashboardController extends Zend_Controller_Action
//Criteres => Comptages (last) => enrichissement_identifiants => enrichissement_commandes //Criteres => Comptages (last) => enrichissement_identifiants => enrichissement_commandes
$enrichissementsM = new Application_Model_EnrichissementIdentifiants(); $enrichissementsM = new Application_Model_EnrichissementIdentifiants();
// Pending
$sql = $enrichissementsM->select() $sql = $enrichissementsM->select()
->setIntegrityCheck(false) ->setIntegrityCheck(false)
->from( ->from(

View File

@ -18,11 +18,30 @@ class GestionController extends Zend_Controller_Action
} }
/**
* Display profils to get data
* Filter with login and idClient
*
*/
public function profilsAction() public function profilsAction()
{ {
$request = $this->getRequest();
$login = $request->getParam('login', '');
$idClient = $request->getParam('idClient', null);
$profilsM = new Application_Model_EnrichissementProfils(); $profilsM = new Application_Model_EnrichissementProfils();
$sql = $profilsM->select() $sql = $profilsM->select()
->from($profilsM, array('id', 'idClient', 'login', 'reference', 'tarifLigne', 'dateAjout', 'dateSuppr', 'actif')); ->from($profilsM, array('id', 'idClient', 'login', 'reference', 'tarifLigne', 'dateAjout', 'dateSuppr', 'actif'));
if ( !empty($login) ) {
$sql->where('login = ?', $login.'%');
}
if ( $idClient!=null ) {
$sql->where('idClient = ?', $idClient);
}
$profils = $profilsM->fetchAll($sql); $profils = $profilsM->fetchAll($sql);
$this->view->assign('profils', $profils); $this->view->assign('profils', $profils);
@ -88,14 +107,34 @@ class GestionController extends Zend_Controller_Action
$this->view->assign('fields', $allFields); $this->view->assign('fields', $allFields);
} }
public function profildelAction(){} /**
* Mark profil as deleted
*/
public function profildelAction()
{
}
public function comptagesAction() public function comptagesAction()
{ {
$table = new Application_Model_Comptages(); $comptagesM = new Application_Model_Comptages();
$sql = $table->select()
->order('dateAjout DESC'); $sql = $comptagesM->select()->setIntegrityCheck(false)
$this->view->comptages = $table->fetchAll($sql)->toArray(); ->from('comptages', array(
'comptages.idDefinition',
'comptages.resultat',
'comptages.uniteInsee',
"DATE_FORMAT(comptages.dateAjout, '%Y/%m/%d %H:%i:%s') as dateAjout"
))
->join('criteres', 'comptages.idDefinition = criteres.id', array('criteres.reference'))
->order('comptages.dateAjout DESC')
->group('criteres.id');
$comptages = $comptagesM->fetchAll($sql)->toArray();
Zend_Registry::get('firebug')->info($comptages);
$this->view->comptages = $comptages;
} }
public function enrichissementsAction() public function enrichissementsAction()
@ -115,7 +154,7 @@ class GestionController extends Zend_Controller_Action
$result = $table->fetchRow($sql); $result = $table->fetchRow($sql);
if(!empty($result)) { if(!empty($result)) {
$result = $result->toArray(); $result = $result->toArray();
$sirets = json_decode($result['identifiants']); $sirets = json_decode($result['identifiants'], true);
foreach($sirets as $siret) { foreach($sirets as $siret) {
echo $siret."\n"; echo $siret."\n";
} }

View File

@ -1,5 +1,5 @@
<?php <?php
Class IndexController extends Zend_Controller_Action class IndexController extends Zend_Controller_Action
{ {
public function init() public function init()

View File

@ -16,6 +16,11 @@ class Zend_View_Helper_Field extends Zend_View_Helper_Abstract
$label = $labelG = $fields->getLabel($name); $label = $labelG = $fields->getLabel($name);
$title = '';
if ( array_key_exists('title', $params) && !empty($params['title']) ) {
$title = $params['title'];
}
//How many type of fields is defined //How many type of fields is defined
$nbFields = count($params['fields']); $nbFields = count($params['fields']);
@ -62,7 +67,8 @@ class Zend_View_Helper_Field extends Zend_View_Helper_Abstract
case 'select': case 'select':
$html.= $this->structureHTML( $html.= $this->structureHTML(
$label, $label,
$this->selectHTML($name, $options) $this->selectHTML($name, $options),
$title
); );
break; break;
case 'selectMultiple': case 'selectMultiple':
@ -95,14 +101,6 @@ class Zend_View_Helper_Field extends Zend_View_Helper_Abstract
$this->dateHTML($name, $field)); $this->dateHTML($name, $field));
break; break;
case 'text': case 'text':
switch($name) {
case 'reg':
$label = 'Régions';
break;
case 'dep':
$label = 'Départements';
break;
}
$html.= $this->structureHTML( $html.= $this->structureHTML(
$label, $label,
$this->textHTML($name, $options) $this->textHTML($name, $options)
@ -136,7 +134,7 @@ class Zend_View_Helper_Field extends Zend_View_Helper_Abstract
return $html; return $html;
} }
private function structureHTML($label, $html) private function structureHTML($label, $html, $title='')
{ {
$out = ''; $out = '';
@ -145,7 +143,11 @@ class Zend_View_Helper_Field extends Zend_View_Helper_Abstract
if ( $this->display===false ) { if ( $this->display===false ) {
$style = ' style="display:none;"'; $style = ' style="display:none;"';
} }
$out.= '<div id="field_'.$this->name.'" '.$class.''.$style.'>'; if ( !empty($title) ) {
$title = ' title="'.$title.'"';
}
$out.= '<div id="field_'.$this->name.'" '.$class.''.$style.''.$title.'>';
$out.= $this->structureLabel($label); $out.= $this->structureLabel($label);
$out.= '<div class="field">'.$html.'</div>'; $out.= '<div class="field">'.$html.'</div>';
$out.= '</div>'; $out.= '</div>';

View File

@ -12,11 +12,11 @@
</tr> </tr>
<?php foreach($this->comptages as $comptage): ?> <?php foreach($this->comptages as $comptage): ?>
<tr> <tr>
<td><?php echo $comptage['id']; ?></td> <td><?=$comptage['idDefinition']?></td>
<td><?php echo $comptage['dateAjout']; ?></td> <td><?=$comptage['dateAjout']?></td>
<td></td> <td><?=$comptage['reference']?></td>
<td><?php echo $comptage['resultat']; ?></td> <td><?=$comptage['resultat']?></td>
<td><?php echo $comptage['uniteInsee']; ?></td> <td><?=$comptage['uniteInsee']?></td>
<td> <td>
<a href="">Actualiser</a> <a href="">Actualiser</a>
<a class="enrichissementref" href="<?=$this->url(array('controller'=> 'enrichissement','action'=>'reference', 'id'=>$comptage['idDefinition']))?>">Enrichissement</a> <a class="enrichissementref" href="<?=$this->url(array('controller'=> 'enrichissement','action'=>'reference', 'id'=>$comptage['idDefinition']))?>">Enrichissement</a>

View File

@ -1,5 +1,13 @@
<div id="dashboard"> <div id="dashboard">
<div>
<form method="post" action="<?=$this->url(array('controller'=>'gestion', 'action'=>'profils'), null, true)?>">
IdClient : <input type="text" name="idClient" /> - Login : <input type="text" name="login" />
<input type="submit" name="rechercher" value="Rechercher"/>
</form>
</div>
<h2>Liste des profils</h2> <h2>Liste des profils</h2>
<table> <table>
<thead> <thead>
@ -10,7 +18,6 @@
<th>tarifLigne</th> <th>tarifLigne</th>
<th>dateAjout</th> <th>dateAjout</th>
<th>dateSuppr</th> <th>dateSuppr</th>
<th>actif</th>
<th>Action</th> <th>Action</th>
</tr> </tr>
</thead> </thead>
@ -23,8 +30,13 @@
<td><?=$profil['tarifLigne']?></td> <td><?=$profil['tarifLigne']?></td>
<td><?=$profil['dateAjout']?></td> <td><?=$profil['dateAjout']?></td>
<td><?=$profil['dateSuppr']?></td> <td><?=$profil['dateSuppr']?></td>
<td><?=$profil['actif']?></td> <td>
<td></td> <?php if ($profil['actif']==1) {?>
<a href="<?=$this->url(array('controller'=>'gestion', 'action'=>'profildel', 'id'=>$profil['id']))?>">Désactiver</a>
<?php } else {?>
<a href="#">Activer</a>
<?php }?>
</td>
</tr> </tr>
<?php }?> <?php }?>
</tbody> </tbody>

View File

@ -11,31 +11,31 @@ class Application_Controller_Plugin_Auth extends Zend_Controller_Plugin_Abstract
{ {
$checkAuth = true; $checkAuth = true;
if ($request->getControllerName()=='user' && $request->getActionName()=='login'){ if ($request->getControllerName()=='user' && $request->getActionName()=='login'){
$checkAuth = false; $checkAuth = false;
} }
if ($checkAuth) if ($checkAuth)
{ {
$login = $request->getParam('login'); $login = $request->getParam('login');
$pass = $request->getParam('pass', ''); $pass = $request->getParam('pass', '');
$hach = $request->getParam('hach'); $hach = $request->getParam('hach');
$checkIp = $request->getParam('checkIp'); $checkIp = $request->getParam('checkIp');
$auth = Zend_Auth::getInstance(); $auth = Zend_Auth::getInstance();
//Est ce que l'on a checkIp=only lors de la requête //Est ce que l'on a checkIp=only lors de la requête
$iponly = false; $iponly = false;
if ($checkIp=='only') { if ($checkIp=='only') {
$hach = 'iponly:'.$_SERVER['REMOTE_ADDR']; $hach = 'iponly:'.$_SERVER['REMOTE_ADDR'];
$iponly = true; $iponly = true;
} }
//On vérifie le tout lors d'une connexion par url //On vérifie le tout lors d'une connexion par url
if ( !empty($login) && !empty($hach) ) { if ( !empty($login) && !empty($hach) ) {
$authAdapter = new Scores_AuthAdapter($login, $hach, $iponly); $authAdapter = new Scores_AuthAdapter($login, $hach, $iponly);
$result = $auth->authenticate($authAdapter); $result = $auth->authenticate($authAdapter);
if (!$result->isValid()) { if (!$result->isValid()) {
$messageF = ''; $messageF = '';
foreach ($result->getMessages() as $message) { foreach ($result->getMessages() as $message) {
@ -45,43 +45,49 @@ class Application_Controller_Plugin_Auth extends Zend_Controller_Plugin_Abstract
->setControllerName('user') ->setControllerName('user')
->setActionName('logout') ->setActionName('logout')
->setParam('message', $messageF); ->setParam('message', $messageF);
} else { } else {
$storage = new Zend_Auth_Storage_Session(); $storage = new Zend_Auth_Storage_Session();
$session = new Zend_Session_Namespace($storage->getNamespace()); $session = new Zend_Session_Namespace($storage->getNamespace());
//$session->setExpirationSeconds(86400); //$session->setExpirationSeconds(86400);
$auth->setStorage($storage); $auth->setStorage($storage);
} }
//Sinon on reste sur le standard //Sinon on reste sur le standard
} else { } else {
//Pas authentifié //Pas authentifié
if ( !$auth->hasIdentity() || time() > $auth->getIdentity()->time ) { if ( !$auth->hasIdentity() || time() > $auth->getIdentity()->time ) {
$auth->clearIdentity(); $auth->clearIdentity();
$session = new Zend_Session_Namespace('login'); $session = new Zend_Session_Namespace('login');
$session->url = $_SERVER['REQUEST_URI']; $session->url = $_SERVER['REQUEST_URI'];
$layout = Zend_Layout::getMVCInstance(); $layout = Zend_Layout::getMVCInstance();
if ( !$layout->isEnabled() ) { if ( !$layout->isEnabled() ) {
echo "Identification incorrect ou périmé."; echo "Identification incorrect ou périmé.";
} else { } else {
$this->_response->setRedirect('/user/login')->sendResponse(); $this->_response->setRedirect('/user/login')->sendResponse();
} }
//Authentifié => on met à jour la session //Authentifié => on met à jour la session
} else { } else {
$identity = $auth->getIdentity(); $identity = $auth->getIdentity();
$identity->time = time() + $identity->timeout; $identity->time = time() + $identity->timeout;
$auth->getStorage()->write($identity); $auth->getStorage()->write($identity);
if ( $identity->profil=="SuperAdministrateur" ) {
$layout = Zend_Layout::getMVCInstance();
$view = $layout->getView();
$view->admin = true;
}
if (Zend_Session::namespaceIsset('login')){ if (Zend_Session::namespaceIsset('login')){
Zend_Session::namespaceUnset('login'); Zend_Session::namespaceUnset('login');
} }
} }
} }
} }
} }
} }

View File

@ -1,151 +0,0 @@
<?php
class Object_Codepostaux
{
/* Selection des classes statut pour jstree */
public function _jstree_checked($type)
{
$fields = new Scores_Fields();
$valeurs = $fields->getCritere($type);
return (substr($valeurs, 0, strlen($valeurs)-1));
}
public function _jstree_undetermined($niveau, $type)
{
$table = new Application_Model_Departements();
$fields = new Scores_Fields();
$valeurs = explode(',', $fields->getCritere($type));
//print_r($valeurs);
/*$valeurs = array_merge($valeurs, explode(',', $session->getCritere('adr_com')));*/
$in = array();
foreach($valeurs as $valeur) {
if($niveau == 0) {
if ($type == 'adr_dept'){
$insee = $table->fetchAll($table->select('departements', array('codeRegionInsee'))
->where('numdep = ?', substr($valeur, 0, 2)))->toArray();
foreach ($insee as $code)
$in[] = 'adr_reg:'.$code['codeRegionInsee'];
} else{
$insee = $table->fetchAll($table->select('departements', array('codeRegionInsee'))
->where('numdep = ?', substr($valeur, 0, 2)))->toArray();
foreach ($insee as $code)
$in[] = 'adr_reg:'.$code['codeRegionInsee'];
}
} else if ($niveau == 1) {
$insee = $table->fetchAll($table->select('departements', array('codeRegionInsee'))
->where('numdep = ?', substr($valeur, 0, 2)))->toArray();
foreach ($insee as $code)
$in[] = 'adr_dept:'.$code['numdep'];
}
}
return ($in);
}
public function _getClass($valeur, $niveau)
{
$valeurs = explode(',', $valeur);
$key = ((strlen($valeur) < 5)?'adr_dept':'adr_com');
$fields = new Scores_Fields();
$session = explode(',', $fields->getCritere('adr_dept'));
$row = 0;
foreach ($session as $dept) {
if(in_array($dept, $valeurs))
$row++;
}
if($row == count($valeurs) and $row != 1) {
return ('jstree-checked');
}
else if($row > 1)
return ('jstree-undetermined');
/*$type = explode(':', $valeur);
if($type[1] == $this->_jstree_checked($type[0]))
return ('jstree-checked');
else if (in_array($valeur, $this->_jstree_undetermined($niveau, $type[0])))
return ('jstree-undetermined');*/
}
protected function getDepartement($region)
{
$table = new Application_Model_Departements();
$sql = $table->select()
->where('codeRegionInsee = '.$region);
$result = $table->fetchAll($sql)->toArray();
$depts = array();
foreach($result as $departement) {
$depts[] = $departement['numdep'];
}
return (implode(',', $depts));
}
/* Fonctions de construction de jstree */
public function _getRegions()
{
$region = new Application_Model_Regions();
$regions = $region->fetchAll($region->select()->order('NCCENR ASC'))->toArray();
$structure = array();
foreach($regions as $nom) {
$structure[] = array(
'data' => $nom['NCCENR'],
'attr' => array('id' => $this->getDepartement($nom['REGION']),
'niveau' => 0,
'class' => $this->_getClass($this->getDepartement($nom['REGION']), 0)
),
'state' => 'closed',
'children' => array()
);
}
return (json_encode($structure));
}
public function _getDepartements($codeRegionInsee)
{
//$code = explode(':', $codeRegionInsee);
$departement = new Application_Model_Departements();
foreach(explode(',', $codeRegionInsee) as $dept) {
$departements[] = $departement->fetchAll($departement->select()
->where('numdep ='.$dept))->toArray();
}
$structure = array();
foreach($departements as $nom) {
$structure[] = array(
'data' => $nom[0]['libdep'].' ('.$nom[0]['numdep'].')',
'attr' => array(
'id' => $nom[0]['numdep'],
'niveau' => 1,
'class' => $this->_getClass($nom[0]['numdep'], 1)
),
'state' => 'closed',
'children' => array()
);
}
return (json_encode($structure));
}
public function _getCommunes($numdep)
{
//$numdep = explode(':', $numdep);
$codepostau = new Application_Model_CodePostaux();
$codepostaux = $codepostau->fetchAll($codepostau->select()->where('codepos LIKE "'.$numdep.'%"'))->toArray();
$structure = array();
foreach($codepostaux as $nom) {
$structure[] = array(
'data' => $nom['Commune'].' ('.$nom['Codepos'].')',
'attr' => array(
'id'=> $nom['INSEE'],
'niveau' => 2,
'class' => $this->_getClass($nom['INSEE'], 2)
),
'state' => 'closed',
'children' => array()
);
}
return (json_encode($structure));
}
}

View File

@ -1,85 +0,0 @@
<?php
class Object_Comptage
{
public function saveComptage($ref)
{
if (empty($ref)) {
echo json_encode(array(
'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');
//Informations utilisateur
$auth = Zend_Auth::getInstance();
$user = $auth->getIdentity();
//Enregistrement des critères
$criteresM = new Application_Model_Criteres();
$data = array(
'idClient' => $user->idClient,
'login' => $user->username,
'reference' => $ref,
'criteres' => json_encode($criteres),
'parent' => 0,
'dateAjout' => date('Y-m-d H:i:s'),
);
$id = $criteresM->insert($data);
if ($id){
//Enregistrement des valeurs du comptage
$comptageM = new Application_Model_Comptages();
$data = array(
'idDefinition' => $id,
'resultat' => $resultat,
'uniteInsee' => $nbInsee,
'dateAjout' => date('Y-m-d H:i:s'),
);
if ($comptageM->insert($data)) {
echo json_encode(array(
'error'=>0,
'msg'=> "Vos critères ont été sauvegardés sous la référence $ref",
'id' => $id));
} else {
echo json_encode(array(
'error'=>1,
'msg'=> "Erreur lors de l'enregistrement"));
}
} else {
echo json_encode(array(
'error'=>1,
'msg'=> "Erreur lors de l'enregistrement"));
}
}
}
public function count($key, $valeur, $need = false)
{
$fields = new Scores_Fields();
//Comptage
require_once 'Scores/Ciblage.php';
$ciblage = new Ciblage($fields->getValues());
if($need) {
return $ciblage->execute(true, 10);
}
$total = $ciblage->execute();
$insee = $ciblage->calculRedevanceInsee();
$fields->setNb('total', $total);
$fields->setNb('insee', $insee);
//@todo : Ajouter les critères sous forme json_encode
//Retour comptage, unité Insee
$result = array(
'count' => number_format($total, 0, '', ' '),
'insee' => number_format($insee, 0, '', ' ')
);
return (json_encode($result));
}
}

View File

@ -1,196 +0,0 @@
<?php
Class Object_Dashboard
{
public function index()
{
$auth = Zend_Auth::getInstance();
$user = $auth->getIdentity();
$criteresM = new Application_Model_Criteres();
$sql = $criteresM->select()
->from($criteresM, array('id', 'reference', 'dateAjout'))
->where("idClient = ?", $user->idClient)
->where("login = ?", $user->username)
->order('dateAjout DESC')
->limit(5);
$rows = $criteresM->fetchAll($sql);
$results = array();
$comptagesM = new Application_Model_Comptages();
foreach($rows->toArray() as $item)
{
$info = array(
'id' => $item['id'],
'reference' => $item['reference'],
'dateCriteres' => $item['dateAjout'],
);
//Recherche des comptages
$sql = $comptagesM->select()
->from($comptagesM, array('resultat', 'uniteInsee', "DATE_FORMAT(dateAjout, '%Y/%m/%d %H:%i:%s') as dateAjout"))
->where('idDefinition = ?', $item['id'])
->order('dateAjout DESC')->limit(1);
$comptage = $comptagesM->fetchAll($sql)->toArray();
if (count($comptage)>0){
$info['resultat'] = $comptage[0]['resultat'];
$info['uniteInsee'] = $comptage[0]['uniteInsee'];
$info['dateComptage'] = $comptage[0]['dateAjout'];
}
$results[] = $info;
}
return ($results);
}
public function enrichissement($idComptage)
{
$enrichissements = new Application_Model_EnrichissementIdentifiants();
$auth = Zend_Auth::getInstance();
$user = $auth->getIdentity();
$sql = $enrichissements->select()
->setIntegrityCheck(false)
->from(
array('i' => 'enrichissement_identifiants'),
array('id', 'reference', 'fichier', 'nbLigneTotales', 'nbLigneTraites', 'error', 'dateAdded', 'dateStart', 'dateStop')
)
->join(
array('criteres' => 'criteres'), 'i.idCriteres = criteres.id',
array('')
)
->where('criteres.idClient = ?', $user->idClient)
->where('criteres.login = ?', $user->username)
->where('i.idCriteres = ?', $idComptage);
return ($enrichissements->fetchAll($sql));
}
public function enrichissements()
{
$enrichissementsM = new Application_Model_EnrichissementIdentifiants();
$auth = Zend_Auth::getInstance();
$user = $auth->getIdentity();
$sql = $enrichissementsM->select()
->setIntegrityCheck(false)
->from(
array('i' => 'enrichissement_identifiants'),
array('id', 'reference', 'fichier', 'nbLigneTotales', 'nbLigneTraites', 'error', 'dateAdded', 'dateStart', 'dateStop')
)
->join(
array('c' => 'comptages'), 'i.idComptage = c.id',
array('')
)
->join(
array('criteres' => 'criteres'), 'i.idCriteres = criteres.id',
array('')
)
->where('criteres.idClient = ?', $user->idClient)
->where('criteres.login = ?', $user->username)
->order('dateAdded DESC');
return ($enrichissementsM->fetchAll($sql));
}
public function menu()
{
}
public function ciblage($page)
{
$offset = 20;
//Liste des ciblages par paquet de n
$auth = Zend_Auth::getInstance();
$user = $auth->getIdentity();
$criteresM = new Application_Model_Criteres();
//Compter le nombre de page
$sql = $criteresM->select()
->from($criteresM, array('nb' => 'COUNT(*)'))
->where("idClient = ?", $user->idClient)
->where("login = ?", $user->username);
$count = $criteresM->fetchRow($sql);
$nbCiblage = $count->nb;
//Récupérer les informations
$position = ($page-1)*$offset+1;
$sql = $criteresM->select()
->from($criteresM, array('id', 'reference', 'dateAjout'))
->where("idClient = ?", $user->idClient)
->where("login = ?", $user->username)
->order('dateAjout DESC')
->limitPage($position, $offset);
$rows = $criteresM->fetchAll($sql);
$results = array();
$comptagesM = new Application_Model_Comptages();
foreach($rows->toArray() as $item)
{
$info = array(
'id' => $item['id'],
'reference' => $item['reference'],
'dateCriteres' => $item['dateAjout'],
);
//Recherche des comptages
$sql = $comptagesM->select()
->from($comptagesM, array('resultat', 'uniteInsee', "DATE_FORMAT(dateAjout, '%d/%m/%Y %H:%i:%s') as dateAjout"))
->where('idDefinition = ?', $item['id'])
->order('dateAjout DESC')->limit(1);
$comptage = $comptagesM->fetchAll($sql)->toArray();
if (count($comptage)>0){
$info['resultat'] = $comptage[0]['resultat'];
$info['uniteInsee'] = $comptage[0]['uniteInsee'];
$info['dateComptage'] = $comptage[0]['dateAjout'];
}
$results[] = $info;
}
return (array('ciblages' => $results, 'nbCiblage' => $nbCiblage));
}
public function ciblagedetail($id)
{
$auth = Zend_Auth::getInstance();
$user = $auth->getIdentity();
$table = new Application_Model_Criteres();
$sql = $table->select()
->where('idClient = ?', $user->idClient)
->where('login = ?', $user->username)
->where('id = ?', $id);
$criteres = $table->fetchRow($sql)->toArray();
if ($criteres != null){
$comptage = new Application_Model_Comptages();
$sql = $comptage->select()
->where('idDefinition = ?', $id)->order('dateAjout DESC');
$comptages = $comptage->fetchAll($sql)->toArray();
}
return (array_merge(array('comptages' => $comptages), array('criteres' => $criteres)));
}
public function rcomptage($q)
{
$auth = Zend_Auth::getInstance();
$user = $auth->getIdentity();
$criteresM = new Application_Model_Criteres();
$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,
'url' => $this->view->url(array('controller'=>'dashboard', 'action'=>'ciblage', 'id'=>$item->id)),
);
}
}
return (json_encode($output));
}
}

View File

@ -144,20 +144,25 @@ class Ciblage
/** /**
* *
* @param unknown_type $need * @param boolean $need
*/ */
public function execute($need = false) public function execute($need = false, $nbReturn = 0)
{ {
if($need) { if($need) {
$return = array(); $return = array();
$limit = 1000; $limit = 1000;
$maxMatches = 50000;
$this->sphinx->SetLimits(0, $limit, 50000); if ( $nbReturn > 0 ) {
$limit = $maxMatches = $nbReturn;
}
$this->sphinx->SetLimits(0, $limit, $maxMatches);
$resSphinx = $this->sphinx->Query($this->alpha, $this->index); $resSphinx = $this->sphinx->Query($this->alpha, $this->index);
$total = $resSphinx['total_found']; $total = $resSphinx['total_found'];
// //Make an array with only the data needed
$return = $this->getSiret($resSphinx); $return = $this->getSiret($resSphinx);
if ( $limit<$total ) { if ( $limit<$total ) {
@ -165,7 +170,7 @@ class Ciblage
//Get siret by $limit units for each request //Get siret by $limit units for each request
for($i=1; $i<$max; $i++){ for($i=1; $i<$max; $i++){
$offset = $i*$limit; $offset = $i*$limit;
$this->sphinx->SetLimits($offset, $limit, 50000); $this->sphinx->SetLimits($offset, $limit, $maxMatches);
$resSphinx = $this->sphinx->Query($this->alpha, $this->index); $resSphinx = $this->sphinx->Query($this->alpha, $this->index);
$tmpSiret = $this->getSiret($resSphinx); $tmpSiret = $this->getSiret($resSphinx);
$return = array_merge($return, $tmpSiret); $return = array_merge($return, $tmpSiret);
@ -177,11 +182,14 @@ class Ciblage
} else { } else {
$this->sphinx->SetLimits(0, 1); $this->sphinx->SetLimits(0, 1);
$resSphinx = $this->sphinx->Query($this->alpha, $this->index); Zend_Registry::get('firebug')->info("Sphinx : ".$this->alpha);
Zend_Registry::get('firebug')->info("Sphinx : ".$this->alpha); $resSphinx = $this->sphinx->Query($this->alpha, $this->index);
Zend_Registry::get('firebug')->info($resSphinx); Zend_Registry::get('firebug')->info($resSphinx);
return $resSphinx['total_found'];
if ($resSphinx === false)
return false;
return $resSphinx['total_found'];
} }
} }
@ -196,11 +204,10 @@ class Ciblage
} }
} }
//Valeur NULL dans BDD
protected function groupe($value) protected function groupe($value)
{ {
if ( array_key_exists('in', $value) ) { if ( array_key_exists('in', $value) ) {
//$this->setFilter('sirenGrp', $value); $this->setFilter('sirenGrp', $value);
} }
} }
@ -703,7 +710,108 @@ class Ciblage
*/ */
protected function geo($value) protected function geo($value)
{ {
$departementValueIn = $departementValueEx = array();
$communeValueIn = $communeValueEx = array();
if ( array_key_exists('in', $value) && is_array($value['in']) && count($value['in'])>0 ) {
foreach ( $value['in'] as $item ) {
switch( substr($item,0,1) ) {
case 'C':
$communeValueIn[] = intval(substr($item,1));
break;
case 'D':
$departementValueIn[] = intval(substr($item,1));
break;
case 'R':
$departementsM = new Application_Model_Departements();
$sql = $departementsM->select()
->from($departementsM, array('numdep'))
->where('codeRegionInsee = ?', substr($item,1));
$departements = $departementsM->fetchAll($sql)->toArray();
foreach ($departements as $d) {
$departementValueIn[] = intval($d['numdep']);
}
break;
}
}
}
if ( array_key_exists('ex', $value) && is_array($value['ex']) && count($value['ex'])>0 ) {
foreach ( $value['ex'] as $item ) {
switch( substr($item,0,1) ) {
case 'C':
$communeValueEx[] = intval(substr($item,1));
break;
case 'D':
$departementValueEx[] = intval(substr($item,1));
break;
case 'R':
$departementsM = new Application_Model_Departements();
$sql = $departementsM->select()
->from($departementsM, array('numdep'))
->where('codeRegionInsee = ?', substr($item,1));
$departements = $departementsM->fetchAll($sql)->toArray();
foreach ($departements as $d) {
$departementValueEx[] = intval($d['numdep']);
}
break;
}
}
}
if ( count($departementValueIn)>0 ) {
$this->setFilter('adr_dep', $departementValueIn);
}
if ( count($departementValueEx)>0 ) {
$this->setFilter('adr_dep', $departementValueEx, true);
}
if ( count($communeValueIn)>0 ) {
//Check if a departement include a codeCommune else remove this codeCommune
if (count($departementValueIn)>0) {
foreach ( $departementValueIn as $item ) {
$codePostauxM = new Application_Model_CodePostaux();
$sql = $codePostauxM->select()
->from($codePostauxM, array('INSEE'))
->where('Codepos LIKE ?', $item.'%');
$result = $codePostauxM->fetchAll($sql)->toArray();
$arrayDiff = array();
foreach ( $result as $insee ) {
$arrayDiff[] = intval($insee['INSEE']);
}
$communeValueIn = array_diff($communeValueIn, $arrayDiff);
}
}
if ( count($communeValueIn)>0 ) {
$this->setFilter('codeCommune', $communeValueIn);
}
}
if ( count($communeValueEx)>0 ) {
//Check if a departement include a codeCommune else remove this codeCommune
if (count($departementValueEx)>0) {
foreach ( $departementValueEx as $item ) {
$codePostauxM = new Application_Model_CodePostaux();
$sql = $codePostauxM->select()
->from($codePostauxM, array('INSEE'))
->where('Codepos LIKE ?', $item.'%');
$result = $codePostauxM->fetchAll($sql)->toArray();
$arrayDiff = array();
foreach ( $result as $insee ) {
$arrayDiff[] = intval($insee['INSEE']);
}
$communeValueEx = array_diff($communeValueEx, $arrayDiff);
}
}
if ( count($communeValueEx)>0 ) {
$this->setFilter('codeCommune', $communeValueEx, true);
}
}
} }
protected function getChildCJ($list) protected function getChildCJ($list)

View File

@ -11,7 +11,7 @@ class Scores_Fields
* ) * )
* famille => * famille =>
* activated => * activated =>
* type => * title =>
* ) * )
* ) * )
* *
@ -19,6 +19,7 @@ class Scores_Fields
* label : the string to display as title * label : the string to display as title
* famille : the key to identify where familly the field belongs to * famille : the key to identify where familly the field belongs to
* activated : true or false * activated : true or false
* title : Text to display as info or help
* *
* fields : define all different fields for the same element * fields : define all different fields for the same element
* => type : which type of element (select, text, tree, ...), it's the key for array * => type : which type of element (select, text, tree, ...), it's the key for array
@ -36,6 +37,7 @@ class Scores_Fields
), ),
'famille' => 'entreprise', 'famille' => 'entreprise',
'activated' => true, 'activated' => true,
'title' => 'Aide',
), ),
'groupe' => array( 'groupe' => array(
'label' => "Appartient à un groupe", 'label' => "Appartient à un groupe",
@ -711,7 +713,8 @@ class Scores_Fields
//Remove all space in string value //Remove all space in string value
$value = str_replace(' ', '', $value); $value = str_replace(' ', '', $value);
//Try to detect separator and transform as array //Try to detect separator and transform as array
if ( preg_match_all('/([0-9A-Z]{1,5})(,|;){0,1}/', $value, $matches) ){ //@todo : Schema a detecter
if ( preg_match_all('/([0-9A-Z]+)(?:,|;)?/', $value, $matches) ){
Zend_Registry::get('firebug')->info($matches); Zend_Registry::get('firebug')->info($matches);
$value = $matches[1]; $value = $matches[1];
} }

View File

@ -3,25 +3,21 @@ $(document).ready(function()
$( "#tabs" ).tabs({ $( "#tabs" ).tabs({
cookie: { expires: 1 } cookie: { expires: 1 }
}); });
$("li.tooltip").each(function(){
var title = $('a', this).attr('title');
var width = $(this).attr('width');
$(this).qtip({
solo:true,
content: title,
style: {
width: width,
classes: "ui-tooltip-dark"
},
position: {
my: 'top right',
at: 'bottom right'
}
});
});
$("input.datepicker").datepicker({ dateFormat: 'dd/mm/yy' } ); $("div.fieldgrp").each(function(){
var title = $(this).attr('title');
if (title) {
$(this).qtip({
solo:true, content: title,
style: { width: 600, classes: "ui-tooltip-dark" },
position: {
my: "top right",
at: "bottom right",
adjust: { y: 5 },
}
});
}
});
$('#tabs').delegate('select.criteres', 'change', function(e){ $('#tabs').delegate('select.criteres', 'change', function(e){
e.stopPropagation(); e.stopPropagation();
@ -122,7 +118,7 @@ $(document).ready(function()
$('#tabs').delegate('a.interval', 'click', function(e){ $('#tabs').delegate('a.interval', 'click', function(e){
e.preventDefault(); e.preventDefault();
var key = $(this).attr('id'); var key = $(this).attr('id'); //Remove id to find all input value
var val1 = $('input[name='+key+'1]').val(); var val1 = $('input[name='+key+'1]').val();
var val2 = $('input[name='+key+'2]').val(); var val2 = $('input[name='+key+'2]').val();
if(!val1) if(!val1)
@ -134,10 +130,11 @@ $(document).ready(function()
return false; return false;
}); });
//@todo : We have two event bind on each element why ?
$('.intervalSelect').change(function(){ $('.intervalSelect').change(function(){
var key = $(this).attr('id'); var key = $(this).attr('id'); //Remove id to find all input value
var number = $(this).attr('number'); var number = $(this).attr('number');
if(number == 1) { if(number == 1) {
$('span#'+key).html(' <span id="'+key+'"><a href="" class="intervalSelect" id="'+key+'">Valider</a></span>'); $('span#'+key).html(' <span id="'+key+'"><a href="" class="intervalSelect" id="'+key+'">Valider</a></span>');
}else { }else {
@ -152,6 +149,7 @@ $(document).ready(function()
set(key, values); set(key, values);
return false; return false;
}); });
$('#tabs').delegate('a.arborescence', 'click', function(e) { $('#tabs').delegate('a.arborescence', 'click', function(e) {
e.preventDefault(); e.preventDefault();
@ -195,7 +193,6 @@ $(document).ready(function()
} }
}); });
}); });
function set(key, value, ex) function set(key, value, ex)

File diff suppressed because one or more lines are too long

View File

@ -1,14 +0,0 @@
$(document).ready(function(){
$('.upload').change(function(){
term = $(this).val();
a = term.split('/');
$.ajax(
'/upload/arborescance/'+a,
{
type : "GET",
cache : false,
data : $(this).serializeArray()
}
);
});
});

View File

@ -1,557 +0,0 @@
/*
* qTip2 - Pretty powerful tooltips
* http://craigsworks.com/projects/qtip2/
*
* Version: 2.0.0pre
* Copyright 2009-2010 Craig Michael Thompson - http://craigsworks.com
*
* Dual licensed under MIT or GPLv2 licenses
* http://en.wikipedia.org/wiki/MIT_License
* http://en.wikipedia.org/wiki/GNU_General_Public_License
*
* Date: Fri Jan 6 22:07:57 2012 +0000
*/
/* Core qTip styles */
.ui-tooltip, .qtip{
position: absolute;
left: -28000px;
top: -28000px;
display: none;
max-width: 280px;
min-width: 50px;
font-size: 10.5px;
line-height: 12px;
}
/* Fluid class for determining actual width in IE */
.ui-tooltip-fluid{
display: block;
visibility: hidden;
position: static !important;
float: left !important;
}
.ui-tooltip-content{
position: relative;
padding: 5px 9px;
overflow: hidden;
border: 1px solid #000001;
text-align: left;
word-wrap: break-word;
overflow: hidden;
}
.ui-tooltip-titlebar{
position: relative;
min-height: 14px;
padding: 5px 35px 5px 10px;
overflow: hidden;
border: 1px solid #000001;
border-width: 1px 1px 0;
font-weight: bold;
}
.ui-tooltip-titlebar + .ui-tooltip-content{ border-top-width: 0px !important; }
/*! Default close button class */
.ui-tooltip-titlebar .ui-state-default{
position: absolute;
right: 4px;
top: 50%;
margin-top: -9px;
cursor: pointer;
outline: medium none;
border-width: 1px;
border-style: solid;
}
* html .ui-tooltip-titlebar .ui-state-default{ top: 16px; } /* IE fix */
.ui-tooltip-titlebar .ui-icon,
.ui-tooltip-icon .ui-icon{
display: block;
text-indent: -1000em;
}
.ui-tooltip-icon, .ui-tooltip-icon .ui-icon{
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
}
.ui-tooltip-icon .ui-icon{
width: 18px;
height: 14px;
text-align: center;
text-indent: 0;
font: normal bold 10px/13px Tahoma,sans-serif;
color: inherit;
background: transparent none no-repeat -100em -100em;
}
/* Applied to 'focused' tooltips e.g. most recently displayed/interacted with */
.ui-tooltip-focus{
}
/* Applied on hover of tooltips i.e. added/removed on mouseenter/mouseleave respectively */
.ui-tooltip-hover{
}
/*! Default tooltip style */
.ui-tooltip-default .ui-tooltip-titlebar,
.ui-tooltip-default .ui-tooltip-content{
border-color: #F1D031;
background-color: #FFFFA3;
color: #555;
}
.ui-tooltip-default .ui-tooltip-titlebar{
background-color: #FFEF93;
}
.ui-tooltip-default .ui-tooltip-icon{
border-color: #CCC;
background: #F1F1F1;
color: #777;
}
.ui-tooltip-default .ui-tooltip-titlebar .ui-state-hover{
border-color: #AAA;
color: #111;
}
/* Modal plugin */
#qtip-overlay{
position: fixed;
left: -10000em;
top: -10000em;
}
/* Applied to modals with show.modal.blur set to true */
#qtip-overlay.blurs{ cursor: pointer; }
/* Change opacity of overlay here */
#qtip-overlay div{
position: absolute;
left: 0; top: 0;
width: 100%; height: 100%;
background-color: black;
opacity: 0.7;
filter:alpha(opacity=70);
-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=70)";
}
/* Tips plugin */
.ui-tooltip .ui-tooltip-tip{
margin: 0 auto;
overflow: hidden;
z-index: 10;
}
.ui-tooltip .ui-tooltip-tip,
.ui-tooltip .ui-tooltip-tip *{
position: absolute;
line-height: 0.1px !important;
font-size: 0.1px !important;
color: #123456;
background: transparent;
border: 0px dashed transparent;
}
.ui-tooltip .ui-tooltip-tip canvas{ top: 0; left: 0; }
/*! Light tooltip style */
.ui-tooltip-light .ui-tooltip-titlebar,
.ui-tooltip-light .ui-tooltip-content{
border-color: #E2E2E2;
color: #454545;
}
.ui-tooltip-light .ui-tooltip-content{
background-color: white;
}
.ui-tooltip-light .ui-tooltip-titlebar{
background-color: #f1f1f1;
}
/*! Dark tooltip style */
.ui-tooltip-dark .ui-tooltip-titlebar,
.ui-tooltip-dark .ui-tooltip-content{
border-color: #303030;
color: #f3f3f3;
}
.ui-tooltip-dark .ui-tooltip-content{
background-color: #505050;
}
.ui-tooltip-dark .ui-tooltip-titlebar{
background-color: #404040;
}
.ui-tooltip-dark .ui-tooltip-icon{
border-color: #444;
}
.ui-tooltip-dark .ui-tooltip-titlebar .ui-state-hover{
border-color: #303030;
}
/*! Cream tooltip style */
.ui-tooltip-cream .ui-tooltip-titlebar,
.ui-tooltip-cream .ui-tooltip-content{
border-color: #F9E98E;
color: #A27D35;
}
.ui-tooltip-cream .ui-tooltip-content{
background-color: #FBF7AA;
}
.ui-tooltip-cream .ui-tooltip-titlebar{
background-color: #F0DE7D;
}
.ui-tooltip-cream .ui-state-default .ui-tooltip-icon{
background-position: -82px 0;
}
/*! Red tooltip style */
.ui-tooltip-red .ui-tooltip-titlebar,
.ui-tooltip-red .ui-tooltip-content{
border-color: #D95252;
color: #912323;
}
.ui-tooltip-red .ui-tooltip-content{
background-color: #F78B83;
}
.ui-tooltip-red .ui-tooltip-titlebar{
background-color: #F06D65;
}
.ui-tooltip-red .ui-state-default .ui-tooltip-icon{
background-position: -102px 0;
}
.ui-tooltip-red .ui-tooltip-icon{
border-color: #D95252;
}
.ui-tooltip-red .ui-tooltip-titlebar .ui-state-hover{
border-color: #D95252;
}
/*! Green tooltip style */
.ui-tooltip-green .ui-tooltip-titlebar,
.ui-tooltip-green .ui-tooltip-content{
border-color: #90D93F;
color: #3F6219;
}
.ui-tooltip-green .ui-tooltip-content{
background-color: #CAED9E;
}
.ui-tooltip-green .ui-tooltip-titlebar{
background-color: #B0DE78;
}
.ui-tooltip-green .ui-state-default .ui-tooltip-icon{
background-position: -42px 0;
}
/*! Blue tooltip style */
.ui-tooltip-blue .ui-tooltip-titlebar,
.ui-tooltip-blue .ui-tooltip-content{
border-color: #ADD9ED;
color: #5E99BD;
}
.ui-tooltip-blue .ui-tooltip-content{
background-color: #E5F6FE;
}
.ui-tooltip-blue .ui-tooltip-titlebar{
background-color: #D0E9F5;
}
.ui-tooltip-blue .ui-state-default .ui-tooltip-icon{
background-position: -2px 0;
}
/*! Add shadows to your tooltips in: FF3+, Chrome 2+, Opera 10.6+, IE6+, Safari 2+ */
.ui-tooltip-shadow{
-webkit-box-shadow: 1px 1px 3px 1px rgba(0, 0, 0, 0.15);
-moz-box-shadow: 1px 1px 3px 1px rgba(0, 0, 0, 0.15);
box-shadow: 1px 1px 3px 1px rgba(0, 0, 0, 0.15);
}
.ui-tooltip-shadow .ui-tooltip-titlebar,
.ui-tooltip-shadow .ui-tooltip-content{
filter: progid:DXImageTransform.Microsoft.Shadow(Color='gray', Direction=135, Strength=3);
-ms-filter:"progid:DXImageTransform.Microsoft.Shadow(Color='gray', Direction=135, Strength=3)";
_margin-bottom: -3px; /* IE6 */
.margin-bottom: -3px; /* IE7 */
}
/*! Add rounded corners to your tooltips in: FF3+, Chrome 2+, Opera 10.6+, IE9+, Safari 2+ */
.ui-tooltip-rounded,
.ui-tooltip-rounded .ui-tooltip-content,
.ui-tooltip-tipsy,
.ui-tooltip-tipsy .ui-tooltip-content,
.ui-tooltip-youtube,
.ui-tooltip-youtube .ui-tooltip-content{
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
border-radius: 4px;
}
.ui-tooltip-rounded .ui-tooltip-titlebar,
.ui-tooltip-tipsy .ui-tooltip-titlebar,
.ui-tooltip-youtube .ui-tooltip-titlebar{
-moz-border-radius: 5px 5px 0 0;
-webkit-border-radius: 5px 5px 0 0;
border-radius: 5px 5px 0 0;
}
.ui-tooltip-rounded .ui-tooltip-titlebar + .ui-tooltip-content,
.ui-tooltip-tipsy .ui-tooltip-titlebar + .ui-tooltip-content,
.ui-tooltip-youtube .ui-tooltip-titlebar + .ui-tooltip-content{
-moz-border-radius: 0 0 5px 5px;
-webkit-border-radius: 0 0 5px 5px;
border-radius: 0 0 5px 5px;
}
/*! Youtube tooltip style */
.ui-tooltip-youtube{
-webkit-box-shadow: 0 0 3px #333;
-moz-box-shadow: 0 0 3px #333;
box-shadow: 0 0 3px #333;
}
.ui-tooltip-youtube .ui-tooltip-titlebar,
.ui-tooltip-youtube .ui-tooltip-content{
_margin-bottom: 0; /* IE6 */
.margin-bottom: 0; /* IE7 */
background: transparent;
background: rgba(0, 0, 0, 0.85);
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#D9000000,endColorstr=#D9000000);
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#D9000000,endColorstr=#D9000000)";
color: white;
border-color: #CCCCCC;
}
.ui-tooltip-youtube .ui-tooltip-icon{
border-color: #222;
}
.ui-tooltip-youtube .ui-tooltip-titlebar .ui-state-hover{
border-color: #303030;
}
/* jQuery TOOLS Tooltip style */
.ui-tooltip-jtools{
background: #232323;
background: rgba(0, 0, 0, 0.7);
background-image: -moz-linear-gradient(top, #717171, #232323);
background-image: -webkit-gradient(linear, left top, left bottom, from(#717171), to(#232323));
border: 2px solid #ddd;
border: 2px solid rgba(241,241,241,1);
-moz-border-radius: 2px;
-webkit-border-radius: 2px;
border-radius: 2px;
-webkit-box-shadow: 0 0 12px #333;
-moz-box-shadow: 0 0 12px #333;
box-shadow: 0 0 12px #333;
}
/* IE Specific */
.ui-tooltip-jtools .ui-tooltip-titlebar{
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#717171,endColorstr=#4A4A4A);
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#717171,endColorstr=#4A4A4A)";
}
.ui-tooltip-jtools .ui-tooltip-content{
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#4A4A4A,endColorstr=#232323);
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#4A4A4A,endColorstr=#232323)";
}
.ui-tooltip-jtools .ui-tooltip-titlebar,
.ui-tooltip-jtools .ui-tooltip-content{
background: transparent;
color: white;
border: 0 dashed transparent;
}
.ui-tooltip-jtools .ui-tooltip-icon{
border-color: #555;
}
.ui-tooltip-jtools .ui-tooltip-titlebar .ui-state-hover{
border-color: #333;
}
/* Cluetip style */
.ui-tooltip-cluetip{
-webkit-box-shadow: 4px 4px 5px rgba(0, 0, 0, 0.4);
-moz-box-shadow: 4px 4px 5px rgba(0, 0, 0, 0.4);
box-shadow: 4px 4px 5px rgba(0, 0, 0, 0.4);
}
.ui-tooltip-cluetip .ui-tooltip-titlebar{
background-color: #87876A;
color: white;
border: 0 dashed transparent;
}
.ui-tooltip-cluetip .ui-tooltip-content{
background-color: #D9D9C2;
color: #111;
border: 0 dashed transparent;
}
.ui-tooltip-cluetip .ui-tooltip-icon{
border-color: #808064;
}
.ui-tooltip-cluetip .ui-tooltip-titlebar .ui-state-hover{
border-color: #696952;
color: #696952;
}
/* Tipsy style */
.ui-tooltip-tipsy{
border: 0;
}
.ui-tooltip-tipsy .ui-tooltip-titlebar,
.ui-tooltip-tipsy .ui-tooltip-content{
_margin-bottom: 0; /* IE6 */
.margin-bottom: 0; /* IE7 */
background: transparent;
background: rgba(0, 0, 0, .87);
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#D9000000,endColorstr=#D9000000);
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#D9000000,endColorstr=#D9000000)";
color: white;
border: 0px transparent;
font-size: 11px;
font-family: 'Lucida Grande', sans-serif;
font-weight: bold;
line-height: 16px;
text-shadow: 0 1px black;
}
.ui-tooltip-tipsy .ui-tooltip-titlebar{
padding: 6px 35px 0 10;
}
.ui-tooltip-tipsy .ui-tooltip-content{
padding: 6px 10;
}
.ui-tooltip-tipsy .ui-tooltip-icon{
border-color: #222;
text-shadow: none;
}
.ui-tooltip-tipsy .ui-tooltip-titlebar .ui-state-hover{
border-color: #303030;
}
/* Tipped style */
.ui-tooltip-tipped{
}
.ui-tooltip-tipped .ui-tooltip-titlebar,
.ui-tooltip-tipped .ui-tooltip-content{
border: 3px solid #959FA9;
filter: none; -ms-filter: none;
}
.ui-tooltip-tipped .ui-tooltip-titlebar{
background: #3A79B8;
background-image: -moz-linear-gradient(top, #3A79B8, #2E629D);
background-image: -webkit-gradient(linear, left top, left bottom, from(#3A79B8), to(#2E629D));
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#3A79B8,endColorstr=#2E629D);
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#3A79B8,endColorstr=#2E629D)";
color: white;
font-weight: normal;
font-family: serif;
border-bottom-width: 0;
-moz-border-radius: 3px 3px 0 0;
-webkit-border-radius: 3px 3px 0 0;
border-radius: 3px 3px 0 0;
}
.ui-tooltip-tipped .ui-tooltip-content{
background-color: #F9F9F9;
color: #454545;
-moz-border-radius: 0 0 3px 3px;
-webkit-border-radius: 0 0 3px 3px;
border-radius: 0 0 3px 3px;
}
.ui-tooltip-tipped .ui-tooltip-icon{
border: 2px solid #285589;
background: #285589;
}
.ui-tooltip-tipped .ui-tooltip-icon .ui-icon{
background-color: #FBFBFB;
color: #555;
}
/* IE9 fix - removes all filters */
.ui-tooltip:not(.ie9haxors) div.ui-tooltip-content,
.ui-tooltip:not(.ie9haxors) div.ui-tooltip-titlebar{
filter: none;
-ms-filter: none;
}