Changeset 4437

Show
Ignore:
Timestamp:
Sun Feb 5 16:25:03 2006
Author:
sebastian
Message:

save ABCDEF to Users table

Files:

Legend:

Unmodified
Added
Removed
Modified
  • branches/D12/campsite/implementation/management/priv/lib_campsite.php

    r4416 r4437  
    282 282  
    283 283 /**  
    284    * Convert string using htmlspecialchars and print out  
      284  * Print string using htmlspecialchars  
    284 284  * @param string $string  
    285 285  * @return void  
    290 290     print(htmlspecialchars($string));  
    291 291 }  
      292  
      293 /**  
      294  * Print string urlencoded  
      295  * @param string $string  
      296  * @return void  
      297  */  
      298 function purl($string)  
      299 {  
      300     print(urlencode($string));  
      301 }  
    292 302 ?>  
  • branches/D12/campsite/implementation/management/priv/frontpage/list.php

    r4434 r4437  
    10 10     'filter_submission'    => $filter_submission,  
    11 11 );  
      12  
    12 13 $order = array(  
    13 14     'order_by'      => $order_by,  
    14 15     'order_dir'     => $order_dir  
    15 16 );  
    16   $articles = $D12->getFilteredArticles($filter, $order);  
      17  
      18 $articles  = $D12->getFilteredArticles($filter, $order);  
      19 $selection = $D12->alterUserABCDEF(Input::Get('ABCDEF', 'array', null), $User);  
    17 20 ?>  
    18 21 <script language="javascript">  
     
    24 27 }  
    25 28  
    26   function unsetABCDEF(name, which)  
      29 function unsetABCDEF(ID, which)  
    26 29 {  
    27 30     var i;  
    28 31     var articles = Array()  
    29 32     var article;  
    30       var status = document.forms['list'].elements["ABCDEF["+name+"]["+which+"]"].checked;  
      33     var status = document.forms['list'].elements["ABCDEF["+ID+"]["+which+"]"].checked;  
    30 33  
    31 34     // uncheck the column on other articles  
    32 35     for (i=0; i<document.forms['list'].elements.length; i++) {  
    33           if (document.forms['list'].elements[i].name.indexOf('span') !== -1) {  
      36         if (document.forms['list'].elements[i].name.indexOf('ID') !== -1) {  
    33 36             article = document.forms['list'].elements[i].value;   
    34 37             document.forms['list'].elements["ABCDEF["+article+"]["+which+"]"].checked = false;     
     
    40 43      
    41 44     // uncheck the row of this article  
    42       document.forms['list'].elements["ABCDEF["+name+"][A]"].checked = false;  
    43       document.forms['list'].elements["ABCDEF["+name+"][B]"].checked = false;  
    44       document.forms['list'].elements["ABCDEF["+name+"][C]"].checked = false;  
    45       document.forms['list'].elements["ABCDEF["+name+"][D]"].checked = false;  
    46       document.forms['list'].elements["ABCDEF["+name+"][E]"].checked = false;  
    47       document.forms['list'].elements["ABCDEF["+name+"][F]"].checked = false;  
      45     document.forms['list'].elements["ABCDEF["+ID+"][A]"].checked = false;  
      46     document.forms['list'].elements["ABCDEF["+ID+"][B]"].checked = false;  
      47     document.forms['list'].elements["ABCDEF["+ID+"][C]"].checked = false;  
      48     document.forms['list'].elements["ABCDEF["+ID+"][D]"].checked = false;  
      49     document.forms['list'].elements["ABCDEF["+ID+"][E]"].checked = false;  
      50     document.forms['list'].elements["ABCDEF["+ID+"][F]"].checked = false;  
    48 51      
    49       document.forms['list'].elements["ABCDEF["+name+"]["+which+"]"].checked = status;  
      52     document.forms['list'].elements["ABCDEF["+ID+"]["+which+"]"].checked = status;  
    49 52 }  
    50 53 </script>  
    51 54  
    52 55 <form name="list" action="bottom.php" method="post">  
      56 <?php p($D12->array2Input($filter)); ?>  
    53 57 <table border=1>  
    54 58     <tr>  
     
    75 79     $articleName    =  $articleObj->getName();  
    76 80     $sectionObj     =  $articleObj->getSection();  
      81     $articleId      = "$NrArticle.$IdLanguage";  
      82      
      83     if ($selection['A'] === $articleId) $A = 'checked'; else unset($A);  
      84     if ($selection['B'] === $articleId) $B = 'checked'; else unset($B);  
      85     if ($selection['C'] === $articleId) $C = 'checked'; else unset($C);  
      86     if ($selection['D'] === $articleId) $D = 'checked'; else unset($D);  
      87     if ($selection['E'] === $articleId) $E = 'checked'; else unset($E);  
      88     if ($selection['F'] === $articleId) $F = 'checked'; else unset($F);  
    77 89     ?>  
    78 90     <tr>  
     
    89 101         <td><?php putGS($D12->getArticleStatusName($articleObj->getPublished())); ?></td>  
    90 102         <td><?php p($articleObj->getCreationDate()); ?></td>  
    91           <td align="center"><a href="javascript: switchDisplay('<?php phtml($articleName); ?>')"><small><b>∨</b></small></a></td>  
      103         <td align="center"><a href="javascript: switchDisplay('<?php purl($articleId); ?>')"><small><b>∨</b></small></a></td>  
    91 103         <td>  
    92               <input type="hidden" name="ABCDEF[<?php phtml($articleName); ?>][span]" value='<?php phtml($articleName); ?>'>  
    93               <input type="checkbox" name="ABCDEF[<?php phtml($articleName); ?>][A]" onClick="unsetABCDEF('<?php phtml($articleName); ?>', 'A');">  
    94               <input type="checkbox" name="ABCDEF[<?php phtml($articleName); ?>][B]" onClick="unsetABCDEF('<?php phtml($articleName); ?>', 'B');">  
    95               <input type="checkbox" name="ABCDEF[<?php phtml($articleName); ?>][C]" onClick="unsetABCDEF('<?php phtml($articleName); ?>', 'C');">  
    96               <input type="checkbox" name="ABCDEF[<?php phtml($articleName); ?>][D]" onClick="unsetABCDEF('<?php phtml($articleName); ?>', 'D');">  
    97               <input type="checkbox" name="ABCDEF[<?php phtml($articleName); ?>][E]" onClick="unsetABCDEF('<?php phtml($articleName); ?>', 'E');">  
    98               <input type="checkbox" name="ABCDEF[<?php phtml($articleName); ?>][F]" onClick="unsetABCDEF('<?php phtml($articleName); ?>', 'F');">  
      104             <input type="hidden"   name="ABCDEF[<?php p($articleId); ?>][ID]" value='<?php p($articleId); ?>'>  
      105             <input type="checkbox" name="ABCDEF[<?php p($articleId); ?>][A]" onClick="unsetABCDEF('<?php p($articleId); ?>', 'A');" <?php p($A); ?>>  
      106             <input type="checkbox" name="ABCDEF[<?php p($articleId); ?>][B]" onClick="unsetABCDEF('<?php p($articleId); ?>', 'B');" <?php p($B); ?>>  
      107             <input type="checkbox" name="ABCDEF[<?php p($articleId); ?>][C]" onClick="unsetABCDEF('<?php p($articleId); ?>', 'C');" <?php p($C); ?>>  
      108             <input type="checkbox" name="ABCDEF[<?php p($articleId); ?>][D]" onClick="unsetABCDEF('<?php p($articleId); ?>', 'D');" <?php p($D); ?>>  
      109             <input type="checkbox" name="ABCDEF[<?php p($articleId); ?>][E]" onClick="unsetABCDEF('<?php p($articleId); ?>', 'E');" <?php p($E); ?>>  
      110             <input type="checkbox" name="ABCDEF[<?php p($articleId); ?>][F]" onClick="unsetABCDEF('<?php p($articleId); ?>', 'F');" <?php p($F); ?>>  
    99 111         </td>  
    100 112     </tr>  
    101       <tr id="<?php phtml($articleName); ?>_short"></tr>  
    102       <tr id="<?php phtml($articleName); ?>_full"  style="display: none">  
      113     <tr id="<?php p($articleId); ?>_short"></tr>  
      114     <tr id="<?php p($articleId); ?>_full"  style="display: none">  
    103 115         <td colspan="4"></td>  
    104 116         <td colspan="5">  
    155 167 }  
    156 168 ?>  
    157       <tr><td colspan="10"><input type="submit"></td></tr>  
      169     <tr><td colspan="10"><input type="submit" name="setABCDEF" value=<?php putGS('Save'); ?>></td></tr>  
    157 169 </table>  
    158 170 </form>  
  • branches/D12/campsite/implementation/management/priv/frontpage/bottom.php

    r4434 r4437  
    15 15 $order_dir               = Input::Get('order_dir', 'str', 'asc');  
    16 16  
    17   $D12->storeUserABCDEF(Input::Get('ABCDEF', 'array', null));  
    18    
    19 17 include 'filter.php';  
    20 18 include 'list.php';  
  • branches/D12/campsite/implementation/management/priv/d12/classes/D12.php

    r4434 r4437  
    260 260     }  
    261 261      
    262       function storeUserABCDEF($sel)  
    263       {  
    264           foreach ($sel as $v) {  
    265                    
      262     function alterUserABCDEF($selection, &$User)  
      263     {   
      264         $current = array_flip(unserialize($User->getProperty('Field1')));  
      265          
      266         if (is_array($selection)) {  
      267             foreach ($selection as $k => $v) {  
      268                 unset($current[$k]);  
      269             }  
      270             $current = array_flip($current);  
    266 271              
    267           }     
      272             foreach ($selection as $article) {  
      273                 foreach($article as $k => $v) {  
      274                     if ($v === 'on') {  
      275                         $current[$k]=$article['ID'];     
      276                     }     
      277                 }                 
      278             }  
      279  
      280             $User->setProperty('Field1', serialize($current));  
      281         } else {  
      282             $current = array_flip($current);     
      283         }  
    268 284          
      285         return $current;  
    269 286     }  
    270 287 }