[ 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/ -> hook_home.inc.php (source)

   1  <?php
   2      /**************************************************************************\
   3      * eGroupWare - Webpage news admin                                          *
   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      * This program was sponsered by Golden Glair productions                   *
  12      * http://www.goldenglair.com                                               *
  13      \**************************************************************************/
  14  
  15      /* $Id: hook_home.inc.php 19414 2005-10-14 13:57:59Z ralfbecker $ */
  16  
  17      $showevents = (int)$GLOBALS['egw_info']['user']['preferences']['news_admin']['homeShowLatest'];
  18      if($showevents > 0)
  19      {
  20          $GLOBALS['egw']->translation->add_app('news_admin');
  21          $title = lang('News Admin');
  22          $portalbox =& CreateObject('phpgwapi.listbox',array(
  23              'title'     => $title,
  24              'primary'   => $GLOBALS['egw_info']['theme']['navbar_bg'],
  25              'secondary' => $GLOBALS['egw_info']['theme']['navbar_bg'],
  26              'tertiary'  => $GLOBALS['egw_info']['theme']['navbar_bg'],
  27              'width'     => '100%',
  28              'outerborderwidth' => '0',
  29              'header_background_image' => $GLOBALS['egw']->common->image('phpgwapi/templates/default','bg_filler')
  30          ));
  31  
  32          $latestcount = (int)$GLOBALS['egw_info']['user']['preferences']['news_admin']['homeShowLatestCount'];
  33          if($latestcount<=0) 
  34          {
  35              $latestcount = 10;
  36          }
  37          print_debug("showing $latestcount news items");
  38          $app_id = $GLOBALS['egw']->applications->name2id('news_admin');
  39          $GLOBALS['portal_order'][] = $app_id;
  40  
  41          $news =& CreateObject('news_admin.uinews');
  42  
  43          $newslist = $news->bo->get_newslist('all',0,'','',$latestcount,True);
  44  
  45          $image_path = $GLOBALS['egw']->common->get_image_path('news_admin');
  46  
  47          if(is_array($newslist))
  48          {
  49              foreach($newslist as $newsitem)
  50              {
  51                  $text = $newsitem['subject'];
  52                  if($showevents == 1)
  53                  {
  54                      $text .= ' - ' . lang('Submitted by') . ' ' . $GLOBALS['egw']->common->grab_owner_name($newsitem['submittedby']) . ' ' . lang('on') . ' ' . $GLOBALS['egw']->common->show_date($newsitem['date']);
  55                  }
  56                  $portalbox->data[] = array(
  57                      'text' => $text,
  58                      'link' => $GLOBALS['egw']->link('/index.php','menuaction=news_admin.uinews.read_news&news_id=' . $newsitem['id'])
  59                  );
  60              }
  61              unset($text);
  62          }
  63          else
  64          {
  65              $portalbox->data[] = array('text' => lang('no news'));
  66          }
  67  
  68          $GLOBALS['portal_order'][] = $app_id;
  69          $var = Array(
  70                  'up'    => Array('url'  => '/set_box.php', 'app'        => $app_id),
  71                  'down'  => Array('url'  => '/set_box.php', 'app'        => $app_id),
  72                  'close' => Array('url'  => '/set_box.php', 'app'        => $app_id),
  73                  'question'      => Array('url'  => '/set_box.php', 'app'        => $app_id),
  74                  'edit'  => Array('url'  => '/set_box.php', 'app'        => $app_id)
  75          );
  76  
  77          while(list($key,$value) = each($var))
  78          {
  79              $portalbox->set_controls($key,$value);
  80          }
  81  
  82          $tmp = "\r\n"
  83              . '<!-- start News Admin -->' . "\r\n"
  84              . $portalbox->draw()
  85              . '<!-- end News Admin -->'. "\r\n";
  86          print $tmp;
  87      }
  88  ?>


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