On utilise SessionCiblage car sinon à quoi sert cette classe

This commit is contained in:
Michael RICOIS 2011-12-29 21:43:52 +00:00
parent 5e87ef6e60
commit 6da7e8235c
4 changed files with 32 additions and 41 deletions

View File

@ -1,35 +1,20 @@
<?php
require_once 'commons/dates.php';
require_once 'Scores/SessionCiblage.php';
Class Zend_View_Helper_Interval extends Zend_View_Helper_Abstract
{
protected function getValueSession($name)
{
protected function getMinMax($name)
{
$session = new Zend_Session_Namespace('ciblage');
if(!empty($session->ciblage[$name]))
return ($session->ciblage[$name]);
}
protected function getMinMax($name){
$session = new Zend_Session_Namespace('ciblage');
switch ($name) {
case 'nbMPubli':
$min = ((!empty($session->ciblage['nbMPubli'][0]))?$session->ciblage['nbMPubli'][0]:'0');
$max = ((!empty($session->ciblage['nbMPubli'][0]))?$session->ciblage['nbMPubli'][1]:'1000');
return (array($min, $max));
case 'nbActio':
$min = ((!empty($session->ciblage['nbActio'][0]))?$session->ciblage['nbMPubli'][0]:'0');
$max = ((!empty($session->ciblage['nbActio'][0]))?$session->ciblage['nbMPubli'][1]:'100');
return (array($min, $max));
case 'nbPart':
return array('0', '100');
$session = new SessionCiblage();
$values = $session->getCritere($name);
if (is_array($values)){
return $values;
}
return array(0,0);
}
public function Interval($name, $libelle, $date = false)
{
$session = new Zend_Session_Namespace('ciblage');
$minMax = $this->getMinMax($name);
$champ = '<div class="ui-state-default" style="margin-top:5px;padding:5px;'/*.((empty($session->ciblage[$name]))?'display:none':null)*/.';">';

View File

@ -4,24 +4,26 @@ Class Zend_View_Helper_Select extends Zend_View_Helper_Abstract
public function Select($name, $libelle, $liste, $color = false)
{
$session = new Zend_Session_Namespace('ciblage');
$compar = $session->ciblage[$name][0];
$select = '<option value="tous">Tous</option>';
foreach($liste as $item => $value) {
$select .= '<option '.(($compar != 't' and $compar == $value)?'selected="selected"':null).' value="'.$value.'">'.$item.'</option>';
}
require_once 'Scores/SessionCiblage.php';
$session = new SessionCiblage();
$value = $session->getCritere($name);
$champ .= '<div class="'.$name.' ui-state-default" style="cursor:move;'.((!is_string($session->ciblage[$name]) or $session->ciblage[$name] == 'tous')?null:'background-color:#CCF8D2;').'padding:5px;">';
$champ .= '<li>';
$champ .= '<div style="float:left;text-align:left;">
<label>'.$libelle.'</label>
</div>';
$champ .= '<div style="text-align:right;">
<select class="criteres" name="'.$name.'">
'.$select.'
</select>
<select class="criteres" name="'.$name.'">';
$select = '';
if ($value == 'tous') { $select = ' selected'; }
$champ .= '<option value="tous">Tous</option>';
foreach($liste as $item => $v) {
if ($v == $value){ $select = ' selected'; }
$champ .= '<option value="'.$v.'"'.$select.'>'.$item.'</option>';
}
$champ .= '</select>
</div>';
$champ .= '</li>';
$champ .= '</div>';

View File

@ -11,15 +11,17 @@ Class Zend_View_Helper_Text extends Zend_View_Helper_Abstract
public function Text($name, $libelle)
{
$session = new Zend_Session_Namespace('ciblage');
$val = $session->ciblage[$name];
require_once 'Scores/SessionCiblage.php';
$session = new SessionCiblage();
$value = $session->getCritere($name);
$val = !empty($value) ? $this->printHistorique($value) : null;
$champ = '<div>';
$champ .= '<div style="float:left;text-align:left;">
<label>'.$libelle.'</label>
</div>';
$champ .= '<div style="text-align:right;padding-bottom:5px;margin-right:5px;">
<input style="border:1px inset silver;width:60%" class="criteres" type="text" name="'.$name.'" value="'.((!empty($val))?$this->printHistorique($val):null).'" />
<input style="border:1px inset silver;width:60%" class="criteres" type="text" name="'.$name.'" value="'.$val.'" />
</div>';
$champ .= '<div style="margin-top:5px;margin-bottom:5px">

View File

@ -11,15 +11,17 @@ Class Zend_View_Helper_Textarea extends Zend_View_Helper_Abstract
public function Textarea($name, $libelle)
{
$session = new Zend_Session_Namespace('ciblage');
$val = $session->ciblage[$name];
require_once 'Scores/SessionCiblage.php';
$session = new SessionCiblage();
$value = $session->getCritere($name);
$val = !empty($value) ? $this->printHistorique($value) : 'Code séparé par des virgules...';
$champ = '<div>';
$champ .= '<div style="float:left;text-align:left;">
<label>'.$libelle.'</label>
</div>';
$champ .= '<div style="text-align:right;">
<textarea style="border:1px inset silver;width:60%;height:40px;" name="'.$name.'">'.((!empty($val))?$this->printHistorique($val):'Code séparé par des virgules...').'</textarea>
<textarea style="border:1px inset silver;width:60%;height:40px;" name="'.$name.'">'.$val.'</textarea>
<br /><a class="interval" id="'.$name.'" href=""><img width="10%" src="/themes/default/images/valider.png" /></a>
</div>';
$champ .= '<div style="margin-top:5px;margin-bottom:5px">