[ Index ]
 

Code source de eGroupWare 1.2.106-2

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

title

Body

[fermer]

/news_admin/inc/ -> class.uiexport.inc.php (source)

   1  <?php
   2      /**************************************************************************\
   3      * eGroupWare - News                                                        *
   4      * http://www.egroupware.org                                                *
   5      * --------------------------------------------                             *
   6      *  This program is free software; you can redistribute it and/or modify it *
   7      *  under the terms of the GNU General Public License as published by the   *
   8      *  Free Software Foundation; either version 2 of the License, or (at your  *
   9      *  option) any later version.                                              *
  10      * --------------------------------------------                             *
  11      \**************************************************************************/
  12  
  13      /* $Id: class.uiexport.inc.php 19414 2005-10-14 13:57:59Z ralfbecker $ */
  14  
  15      class uiexport
  16      {
  17          var $start = 0;
  18          var $query = '';
  19          var $sort  = '';
  20          var $order = '';
  21          var $bo;
  22          var $nextmatchs = '';
  23          var $public_functions = array(
  24              'exportlist'     => True,
  25              );
  26          var $exporttypes;
  27  
  28  		function uiexport()
  29          {
  30              $this->bo =& CreateObject('news_admin.boexport',True);
  31              $this->nextmatchs =& CreateObject('phpgwapi.nextmatchs');
  32              $this->start = $this->bo->start;
  33              $this->query = $this->bo->query;
  34              $this->order = $this->bo->order;
  35              $this->sort = $this->bo->sort;
  36              $this->exporttypes = array(
  37                  0 => lang('No RSS export'),
  38                  1 => 'RSS 0.91',
  39                  2 => 'RSS 1.0',
  40                  3 => 'RSS 2.0'
  41              );
  42              $this->itemsyntaxtypes = array(
  43                  0 => '?item=n',
  44                  1 => '&item=n',
  45                  2 => '?news%5Bitem%5D=n',
  46                  3 => '&news%5Bitem%5D=n'
  47              );
  48          }
  49          
  50  		function exportlist()
  51          {
  52              if (!$GLOBALS['egw']->acl->check('run',1,'admin'))
  53              {
  54                  $this->deny();
  55              }
  56  
  57              if ($_POST['btnDone'])
  58              {
  59                  $GLOBALS['egw']->redirect_link('/admin/index.php');
  60              }
  61  
  62              $GLOBALS['egw']->common->egw_header();
  63              echo parse_navbar();
  64  
  65              if ($_POST['btnSave'])
  66              {
  67                  foreach($_POST['catids'] as $cat_id)
  68                  {
  69                      $this->bo->saveconfig($cat_id,$_POST['inputconfig'][$cat_id]);
  70                  }
  71              }
  72  
  73              $GLOBALS['egw']->template->set_file('export', 'export.tpl');
  74              $GLOBALS['egw']->template->set_block('export','cat_list','Cblock');
  75              $GLOBALS['egw']->template->set_block('cat_list','config','confblock');
  76              $GLOBALS['egw']->template->set_var(array(
  77                  'title' => $GLOBALS['egw_info']['apps']['news_admin']['title'] . ' - ' . lang('Configure RSS exports'),
  78                  'lang_search' => lang('Search'),
  79                  'lang_save' => lang('Save'),
  80                  'lang_done' => lang('Done'),
  81                  'lang_search' => lang('Search'),
  82                  'lang_configuration' => lang('Configuration'),
  83              ));
  84  
  85              $left  = $this->nextmatchs->left('/index.php',$this->start,$this->bo->catbo->total_records,'menuaction=news_admin.uiexport.exportlist');
  86              $right = $this->nextmatchs->right('/index.php',$this->start,$this->bo->catbo->total_records,'menuaction=news_admin.uiexport.exportlist');
  87  
  88              
  89              $GLOBALS['egw']->template->set_var(array(
  90                  'left' => $left,
  91                  'right' => $right,
  92                  'lang_showing' => $this->nextmatchs->show_hits($this->bo->catbo->total_records,$this->start),
  93                  'th_bg' => $GLOBALS['egw_info']['theme']['th_bg'],
  94                  'sort_cat' => $this->nextmatchs->show_sort_order(
  95                      $this->sort,'cat_name','cat_name','/index.php',lang('Category'),'&menuaction=news_admin.uiexport.exportlist'
  96                  ),
  97                  'query' => $this->query,
  98              ));
  99  
 100              @reset($this->bo->cats);
 101              while (list(,$cat) = @each($this->bo->cats))
 102              {
 103                  $config = $this->bo->readconfig($cat['id']);
 104                  $tr_color = $this->nextmatchs->alternate_row_color($tr_color);
 105                  $GLOBALS['egw']->template->set_var(array(
 106                      'tr_color' => $tr_color,
 107                      'catname' => $cat['name'],
 108                      'catid' => $cat['id'],
 109                      'lang_type' => lang('Format of export'),
 110                      'typeselectlist' => $this->selectlist($this->exporttypes,$config['type']),
 111                      'lang_item' => lang('Format for links to items'),
 112                      'itemsyntaxselectlist' => $this->selectlist($this->itemsyntaxtypes,$config['itemsyntax'])
 113                  ));
 114                  $GLOBALS['egw']->template->set_var('confblock','');
 115                  foreach (array(
 116                      'title'        => lang('Title'),
 117                      'link'         => lang('Link'),
 118                      'description'  => lang('description'),
 119                      'img_title'    => lang('Image Title'),
 120                      'img_url'      => lang('Image URL'),
 121                      'img_link'     => lang('Image Link')) as $setting => $label)
 122                  {
 123                      $GLOBALS['egw']->template->set_var(array(
 124                          'setting' => $label,
 125                          'value' => ('<input size="80" type="text" name="inputconfig[' . $cat['id'] . '][' . $setting . ']" value="' . 
 126                              $config[$setting] . '" />'
 127                          )
 128                      ));
 129                      $GLOBALS['egw']->template->parse('confblock','config',True);
 130                  }
 131                  $GLOBALS['egw']->template->parse('Cblock','cat_list',True);
 132              }
 133              $GLOBALS['egw']->template->pfp('out','export',True);
 134          }
 135  
 136  		function selectlist($values,$default)
 137          {
 138              while (list($value,$type) = each($values))
 139              {
 140                  $selectlist .= '<option value="' . $value . '"';
 141                  if ($value == $default)
 142                  {
 143                      $selectlist .= ' selected="selected"';
 144                  }
 145                  $selectlist .= '>' . $type  . '</option>' . "\n";
 146              }
 147              return $selectlist;
 148          }
 149  
 150  		function deny()
 151          {
 152              echo '<p><center><b>'.lang('Access not permitted').'</b></center>';
 153              $GLOBALS['egw']->common->egw_exit(True);
 154          }
 155      }
 156  ?>


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