[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] sitemgr modules/class.module_news_side.inc.php ... [s
From: |
Dave Hall |
Subject: |
[Phpgroupware-cvs] sitemgr modules/class.module_news_side.inc.php ... [skwashd-16-compat] |
Date: |
Sat, 19 Aug 2006 03:56:01 +0000 |
CVSROOT: /cvsroot/phpgroupware
Module name: sitemgr
Branch: skwashd-16-compat
Changes by: Dave Hall <skwashd> 06/08/19 03:56:01
Added files:
modules : class.module_news_side.inc.php
sitemgr-site/templates/default/modules/news_side: news_side.tpl
Log message:
news summary block
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/sitemgr/modules/class.module_news_side.inc.php?cvsroot=phpgroupware&only_with_tag=skwashd-16-compat&rev=1.1.2.1
http://cvs.savannah.gnu.org/viewcvs/sitemgr/sitemgr-site/templates/default/modules/news_side/news_side.tpl?cvsroot=phpgroupware&only_with_tag=skwashd-16-compat&rev=1.1.2.1
Patches:
Index: modules/class.module_news_side.inc.php
===================================================================
RCS file: modules/class.module_news_side.inc.php
diff -N modules/class.module_news_side.inc.php
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ modules/class.module_news_side.inc.php 19 Aug 2006 03:56:01 -0000
1.1.2.1
@@ -0,0 +1,67 @@
+<?php
+
+ class module_news_side extends Module
+ {
+ function module_news_side()
+ {
+ //specification of options is postponed into the
get_user_interface function
+ $this->arguments = array(
+ 'category' => array('type' => 'select', 'label'
=> lang('Choose a category'), 'options' => array()),
+ );
+ $this->properties = array();
+ $this->title = lang('Side News module');
+ $this->description = lang("This module displayes news
from the news_admin application in a side bloack on your website. Be aware of
news_admin's ACL restrictions.");
+ $this->template;
+ }
+
+ function get_user_interface()
+ {
+ //we could put this into the module's constructor, but
by putting it here, we make it execute only when the block is edited,
+ //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);
+ if ($cats)
+ {
+ $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();
+ }
+
+ function get_content(&$arguments,$properties)
+ {
+ $bonews = CreateObject('news_admin.bonews');
+
+ $this->template = Createobject('phpgwapi.Template');
+ $this->template->set_root($this->find_template_dir());
+ $this->template->set_file('news','news_side.tpl');
+
$this->template->set_block('news','NewsBlock','newsitem');
+
+ $limit = 5;
+
+ $newslist =
$bonews->get_newslist($arguments['category'],0,'','',$limit,True);
+
+ $this->template->set_var('lang_read_more', lang('read
more'));
+
+ foreach($newslist as $null => $newsitem)
+ {
+ $this->render($newsitem);
+ }
+ return $this->template->parse('out','news');
+ }
+
+ function render($newsitem)
+ {
+ $this->template->set_var(array
+ (
+ 'news_title' => $newsitem['subject'],
+ 'news_teaser' => $newsitem['teaser'],
+ 'news_link' => "/news/{newsitem['id']}"
+ ));
+ $this->template->parse('newsitem','NewsBlock',True);
+ }
+ }
Index: sitemgr-site/templates/default/modules/news_side/news_side.tpl
===================================================================
RCS file: sitemgr-site/templates/default/modules/news_side/news_side.tpl
diff -N sitemgr-site/templates/default/modules/news_side/news_side.tpl
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ sitemgr-site/templates/default/modules/news_side/news_side.tpl 19 Aug
2006 03:56:01 -0000 1.1.2.1
@@ -0,0 +1,6 @@
+<!-- BEGIN NewsBlock -->
+<div class="news_side">
+ <h3><a href="{news_link}">{news_title}</a></h3>
+ <p class="news_side_sum">{news_teaser} [<a
href="{news_link}">{lang_read more}</a>]</p>
+</div>
+<!-- END NewsBlock -->
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] sitemgr modules/class.module_news_side.inc.php ... [skwashd-16-compat],
Dave Hall <=