[ Index ]
 

Code source de eGroupWare 1.2.106-2

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/ -> set_box.php (source)

   1  <?php
   2    /**************************************************************************\
   3    * eGroupWare                                                               *
   4    * http://www.egroupware.org                                                *
   5    * The file written by Joseph Engo <jengo@phpgroupware.org>                 *
   6    * --------------------------------------------                             *
   7    *  This program is free software; you can redistribute it and/or modify it *
   8    *  under the terms of the GNU General Public License as published by the   *
   9    *  Free Software Foundation; either version 2 of the License, or (at your  *
  10    *  option) any later version.                                              *
  11    \**************************************************************************/
  12  
  13    /* $Id: set_box.php 20295 2006-02-15 12:31:25Z  $ */
  14  
  15      $GLOBALS['egw_info']['flags'] = Array(
  16          'noheader' => True,
  17          'nofooter' => True,
  18          'currentapp' => 'home'
  19      );
  20      include('header.inc.php');
  21  
  22      @reset($GLOBALS['egw_info']['user']['preferences']);
  23  
  24  	function move_boxes($curr_position,$new_order,$offset,$value_to_check,$max_num)
  25      {
  26          //echo "MOVE: $curr_position,$new_order,$offset,$value_to_check,$max_num<br>";
  27          if(isset($GLOBALS['egw_info']['user']['preferences']['portal_order'][$new_order]))
  28          {
  29              if($new_order == $max_num)
  30              {
  31                  if($offset < 0)
  32                  {
  33                      @ksort($GLOBALS['egw_info']['user']['preferences']['portal_order']);
  34                  }
  35                  else
  36                  {
  37                      @krsort($GLOBALS['egw_info']['user']['preferences']['portal_order']);
  38                  }
  39                  while(list($seq_order,$appid) = each($GLOBALS['egw_info']['user']['preferences']['portal_order']))
  40                  {
  41                      if($seq_order != $value_to_check)
  42                      {
  43                          $prev_seq = $seq_order + $offset;
  44                          $GLOBALS['egw']->preferences->delete('portal_order',$prev_seq);
  45                          $GLOBALS['egw']->preferences->add('portal_order',$prev_seq,$appid);
  46                      }
  47                  }
  48              }
  49              else
  50              {
  51                  $GLOBALS['egw']->preferences->delete('portal_order',$curr_position);
  52                  $GLOBALS['egw']->preferences->add('portal_order',$curr_position,(int)$GLOBALS['egw_info']['user']['preferences']['portal_order'][$new_order]);
  53              }
  54          }
  55          $GLOBALS['egw']->preferences->delete('portal_order',$new_order);
  56          $GLOBALS['egw']->preferences->add('portal_order',$new_order,(int)$_GET['app']);
  57  
  58          $GLOBALS['egw']->preferences->save_repository();
  59      }
  60  
  61      //error_reporting(E_ALL);
  62      switch($_GET['control'])
  63      {
  64          //print_debug('set_box', $GLOBALS['egw_info']['user']['preferences']['portal_order']),'app',5);
  65          case 'up':
  66              $curr_position = $GLOBALS['egw']->common->find_portal_order((int)$_GET['app']);
  67              $max_count = count($GLOBALS['egw_info']['user']['preferences']['portal_order']) - 1;
  68              $offset = -1;
  69              if($curr_position <= 0)
  70              {
  71                  $new_order = $max_count;
  72              }
  73              else
  74              {
  75                  $new_order = $curr_position + $offset;
  76              }
  77              move_boxes($curr_position,$new_order,$offset,0,$max_count);
  78              break;
  79          case 'down':
  80              $curr_position = $GLOBALS['egw']->common->find_portal_order((int)$_GET['app']);
  81              $max_count = count($GLOBALS['egw_info']['user']['preferences']['portal_order']) - 1;
  82              $offset = 1;
  83              if($curr_position >= $max_count)
  84              {
  85                  $new_order = 0;
  86              }
  87              else
  88              {
  89                  $new_order = $curr_position + $offset;
  90              }
  91              move_boxes($curr_position,$new_order,$offset,$max_count,0);
  92              break;
  93          case 'edit':
  94          case 'question':
  95          case 'close':
  96          default:
  97      }
  98  
  99      $GLOBALS['egw']->redirect_link('/home/index.php');
 100  ?>


Généré le : Sun Feb 25 17:20:01 2007 par Balluche grâce à PHPXref 0.7