phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] sitemgr/modules/class.module_news.inc.php, 1.7


From: nomail
Subject: [Phpgroupware-cvs] sitemgr/modules/class.module_news.inc.php, 1.7
Date: Wed, 21 Jul 2004 01:22:54 +0200

Update of /sitemgr/modules
Modified Files:
        Branch: 
          class.module_news.inc.php

date: 2004/07/20 23:22:54;  author: skwashd;  state: Exp;  lines: +13 -8

Log Message:
merge from 16
=====================================================================
Index: sitemgr/modules/class.module_news.inc.php
diff -u sitemgr/modules/class.module_news.inc.php:1.6 
sitemgr/modules/class.module_news.inc.php:1.7
--- sitemgr/modules/class.module_news.inc.php:1.6       Fri Jun  6 02:14:55 2003
+++ sitemgr/modules/class.module_news.inc.php   Tue Jul 20 23:22:54 2004
@@ -28,9 +28,13 @@
                        //and not when it is generated for the web site, thus 
speeding the latter up slightly
                        $cat = 
createobject('phpgwapi.categories','','news_admin');
                        $cats = 
$cat->return_array('all',0,False,'','','cat_name',True);
-                       while (list(,$category) = @each($cats))
+                       if ($cats)
                        {
-                               $cat_ids[$category['id']] = $category['name'];
+                               $cat_ids['all'] = lang('All categories');
+                               while (list(,$category) = each($cats))
+                               {
+                                       $cat_ids[$category['id']] = 
$category['name'];
+                               }
                        }
                        $this->arguments['category']['options'] = $cat_ids;
                        return parent::get_user_interface();
@@ -38,7 +42,7 @@
 
                function get_content(&$arguments,$properties)
                {
-                       $bonews = CreateObject('news_admin.bo');
+                       $bonews = CreateObject('news_admin.bonews');
 
                        $this->template = Createobject('phpgwapi.Template');
                        $this->template->set_root($this->find_template_dir());
@@ -46,6 +50,8 @@
                        
$this->template->set_block('news','NewsBlock','newsitem');
                        
$this->template->set_block('news','RssBlock','rsshandle');
 
+                       $limit = $arguments['limit'] ? $arguments['limit'] : 5;
+
                        if ($arguments['rsslink'])
                        {
                                $this->template->set_var('rsslink',
@@ -77,8 +83,7 @@
                                }
                        }
 
-                       $newslist = 
$bonews->get_newslist($arguments['category'],$arguments['start'],'','',$arguments['limit'],True);
-                       $total = $bonews->total($arguments['category'],True);
+                       $newslist = 
$bonews->get_newslist($arguments['category'],$arguments['start'],'','',$limit,True);
 
                        while (list(,$newsitem) = @each($newslist))
                        {
@@ -86,14 +91,14 @@
                        }
                        if ($arguments['start'])
                        {
-                               $link_data['start'] = $arguments['start'] - 
$arguments['limit'];
+                               $link_data['start'] = $arguments['start'] - 
$limit;
                                $this->template->set_var('lesslink',
                                        '<a href="' . $this->link($link_data) . 
'">&lt;&lt;&lt;</a>'
                                );
                        }
-                       if ($total > $arguments['start'] + $arguments['limit'])
+                       if ($bonews->total > $arguments['start'] + $limit)
                        {
-                               $link_data['start'] = $arguments['start'] + 
$arguments['limit'];
+                               $link_data['start'] = $arguments['start'] + 
$limit;
                                $this->template->set_var('morelink',
                                        '<a href="' . $this->link($link_data) . 
'">' . lang('More news') . '</a>'
                                );




reply via email to

[Prev in Thread] Current Thread [Next in Thread]