source: companies/serpro/news_admin/inc/hook_home.inc.php @ 903

Revision 903, 3.3 KB checked in by niltonneto, 15 years ago (diff)

Importacao inicial do Expresso do Serpro

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