Changeset 409

Show
Ignore:
Timestamp:
11/30/07 10:28:15 (1 year ago)
Author:
gcroes
Message:

Il est maintenant possible de spécifier des iterateurs dans les tags qui attendent des array (pas de cast dans les objets si un iterateur est passé).
corrige #87
Module tag démo mis à jour pour vérifier le fonctionnement des exemples.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/project/modules/public/stable/tutorials/tags_demo/actiongroups/default.actiongroup.php

    r1 r409  
    7070        $arObjects[] = $obj; 
    7171 
    72         return _arPpo (new CopixPPO (array ('TITLE_PAGE'=>'Utilisation de select', 'arObjects'=>$arObjects)), 'select.tpl'); 
     72        return _arPpo (new CopixPPO (array ('TITLE_PAGE'=>'Utilisation de select', 'arObjects'=>$arObjects, 'iteratorObjects'=>new ArrayIterator ($arObjects))), 'select.tpl'); 
    7373    } 
    7474    /** 
     
    8888        $arObjects[] = $obj; 
    8989 
    90         return _arPpo (new CopixPPO (array ('TITLE_PAGE'=>'Utilisation de multipleselect', 'arObjects'=>$arObjects)), 'multipleselect.tpl'); 
     90        return _arPpo (new CopixPPO (array ('TITLE_PAGE'=>'Utilisation de multipleselect', 'arObjects'=>$arObjects, 'iteratorObjects'=>new ArrayIterator ($arObjects))), 'multipleselect.tpl'); 
    9191    } 
    9292     
     
    107107        $arObjects[] = $obj; 
    108108         
    109         return _arPpo (new CopixPPO (array ('TITLE_PAGE'=>'Utilisation de radio boutton', 'arObjects'=>$arObjects)), 'radiobutton.tpl'); 
     109        return _arPpo (new CopixPPO (array ('TITLE_PAGE'=>'Utilisation de radio boutton', 'arObjects'=>$arObjects, 'iteratorObjects'=>new ArrayIterator ($arObjects))), 'radiobutton.tpl'); 
    110110    } 
    111111     
     
    126126        $arObjects[] = $obj; 
    127127 
    128         return _arPpo (new CopixPPO (array ('TITLE_PAGE'=>'Utilisation d\'un checkbox', 'arObjects'=>$arObjects)), 'checkbox.tpl'); 
     128        return _arPpo (new CopixPPO (array ('TITLE_PAGE'=>'Utilisation d\'un checkbox', 'arObjects'=>$arObjects, 'iteratorObjects'=>new ArrayIterator ($arObjects))), 'checkbox.tpl'); 
    129129    } 
    130130     
  • trunk/project/modules/public/stable/tutorials/tags_demo/templates/checkbox.tpl

    r1 r409  
    3636<p>{checkbox name=checkbox values=$ppo->arObjects objectMap="id;caption"}</p> 
    3737 
     38<h2>Iterateur d'objets avec spécification de clef / valeurs</h2> 
     39{ldelim}checkbox name=checkbox values=$ppo->iteratorObjects objectMap="id;caption"{rdelim} 
     40<p>{checkbox name=checkbox values=$ppo->iteratorObjects objectMap="id;caption"}</p> 
     41 
    3842<h2>Paramètre extra pour rajouter des informations à la balise</h2> 
    3943{ldelim}checkbox extra='style="background-color: #ccc;"' name=checkbox values="1;2;3;4;5"|toarray{rdelim} 
    4044<p>{checkbox extra='style="background-color: #ccc;"' name=checkbox values="1;2;3;4;5"|toarray}</p> 
    4145 
    42  
    4346<p><a href="{copixurl dest="default"}">Retour à la page de liste</a></p> 
  • trunk/project/modules/public/stable/tutorials/tags_demo/templates/multipleselect.tpl

    r1 r409  
    5454 
    5555 
    56 {ldelim}multipleselect name=multipleselect id=autrechose values=$ppo->arObjects objectMap="id;caption"{rdelim} 
    57 <p>{multipleselect name=multipleselect8 id=autrechose values=$ppo->arObjects objectMap="id;caption"}</p> 
     56{ldelim}multipleselect name=multipleselect8 values=$ppo->arObjects objectMap="id;caption"{rdelim} 
     57<p>{multipleselect name=multipleselect8 values=$ppo->arObjects objectMap="id;caption"}</p> 
     58 
     59<h2>Iterateur d'objets avec spécification de clef / valeurs</h2> 
     60{ldelim}multipleselect name=multipleselect8b values=$ppo->iteratorObjects objectMap="id;caption"{rdelim} 
     61<p>{multipleselect name=multipleselect8b values=$ppo->iteratorObjects objectMap="id;caption"}</p> 
    5862 
    5963<h2>Paramètre extra pour rajouter des informations à la balise</h2> 
  • trunk/project/modules/public/stable/tutorials/tags_demo/templates/radiobutton.tpl

    r1 r409  
    4040<p>{radiobutton name=radio4 values=$ppo->arObjects objectMap="id;caption"}</p> 
    4141 
     42<h2>Iterateur d'objets avec spécification de clef / valeurs</h2> 
     43{ldelim}radiobutton name=radio4 values=$ppo->iteratorObjects objectMap="id;caption"{rdelim} 
     44<p>{radiobutton name=radio4 values=$ppo->iteratorObjects objectMap="id;caption"}</p> 
     45 
    4246<h2>Paramètre extra pour rajouter des informations à la balise</h2> 
    4347Les styles sur les radio button ne marche pas très bien :`(<br/> 
  • trunk/project/modules/public/stable/tutorials/tags_demo/templates/select.tpl

    r1 r409  
    5252<p>{select name=select id=autrechose values=$ppo->arObjects objectMap="id;caption"}</p> 
    5353 
     54<h2>Iterateur d'objets avec spécification de clef / valeurs</h2> 
     55{ldelim}select name=select id=autrechose values=$ppo->iteratorObjects objectMap="id;caption"{rdelim} 
     56<p>{select name=select id=autrechose values=$ppo->iteratorObjects objectMap="id;caption"}</p> 
     57 
    5458<h2>Paramètre extra pour rajouter des informations à la balise</h2> 
    5559{ldelim}select extra='style="background-color: #ccc;"' name=select values="1;2;3;4;5"|toarray{rdelim} 
  • trunk/utils/copix/taglib/checkbox.templatetag.php

    r1 r409  
    3030           $values = array (); 
    3131       } 
     32       if ((!is_array ($values)) || ! ($values instanceof Iterator)){ 
     33        $values = (array) $values; 
     34       } 
    3235       if (empty ($selected)){ 
    3336           $selected = null; 
     
    5255       //each of the values. 
    5356       if (empty ($objectMap)){ 
    54           foreach ((array) $values  as $key=>$caption) { 
     57          foreach ($values  as $key=>$caption) { 
    5558             $selectedString = ((array_key_exists('selected', $pParams)) && (in_array($key,(is_array($selected) ? $selected : array($selected))))) ? ' checked="checked" ' : ''; 
    5659             $classString = (!empty($class)) ? ' class="'.$class.'"' : ''; 
  • trunk/utils/copix/taglib/multipleselect.templatetag.php

    r332 r409  
    5757           $values = array (); 
    5858       } 
     59       if ((!is_array ($values)) || ! ($values instanceof Iterator)){ 
     60        $values = (array) $values; 
     61       } 
    5962       if (empty ($height)) { 
    6063           $height = 'auto'; 
     
    8083           $arValues = $values; 
    8184           $compteur=0; 
    82            foreach ((array) $values  as $key=>$caption) { 
     85           foreach ($values  as $key=>$caption) { 
    8386               $selectedString = ((isset($selected) && (in_array($key,(is_array($selected) ? $selected : array($selected)), true)))) ? ' checked="checked" ' : ''; 
    8487               $currentId = uniqid ('ch'); 
  • trunk/utils/copix/taglib/radiobutton.templatetag.php

    r1 r409  
    3939           $values = array (); 
    4040       } 
     41       if ((!is_array ($values)) || ! ($values instanceof Iterator)){ 
     42        $values = (array) $values; 
     43       } 
    4144       if (empty ($selected)){ 
    4245           $selected = null; 
     
    7073       //each of the values. 
    7174       if (empty ($objectMap)){ 
    72           foreach ((array) $values  as $key=>$caption) { 
     75          foreach ($values  as $key=>$caption) { 
    7376             $selectedString = ((array_key_exists('selected', $pParams)) && ($key == $selected)) ? ' checked="checked" ' : ''; 
    7477             $toReturn .= '<input type="radio" '.$class.' id="'.$id.'" name="'.$name.'" '.$extra.' value="'.$key.'"'.$selectedString.' />' .  _copix_utf8_htmlentities ($caption).$separator; 
  • trunk/utils/copix/taglib/select.templatetag.php

    r1 r409  
    6262           $values = array (); 
    6363       } 
    64      
     64       if ((!is_array ($values)) || ! ($values instanceof Iterator)){ 
     65        $values = (array) $values; 
     66       }     
    6567       //proceed 
    6668       $toReturn  = '<select name="'.$name.'" id="'.$id.'" '.$extra.'>'; 
    6769       if ((!isset ($emptyShow)) || $emptyShow == true){ 
    6870          //the "empty" element. If no key is the selected value, then its the one. 
    69           $selectedString = (isset ($selected) && in_array ($selected, array_keys ((array) $values))) ? '' : ' selected="selected" '; 
     71          $selectedString = (isset ($selected) && in_array ($selected, array_keys ($values))) ? '' : ' selected="selected" '; 
    7072          list ($keyEmpty, $valueEmpty) = each ($emptyValues); 
    7173          $toReturn .= '<option value="'.$keyEmpty.'"'.$selectedString.'>'.$valueEmpty.'</option>'; 
     
    7476       //each of the values. 
    7577       if (empty ($objectMap)){ 
    76           foreach ((array) $values  as $key=>$caption) { 
     78          foreach ($values  as $key=>$caption) { 
    7779             $selectedString = ((!empty($selected)) && ($key == $selected)) ? ' selected="selected" ' : ''; 
    7880             $toReturn .= '<option value="'.$key.'"'.$selectedString.'>' . _copix_utf8_htmlentities ($caption) . '</option>';