Subversion-Projekte lars-tiefland.prado

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
<?php
2
/**
3
 * CommentPortlet class file
4
 *
5
 * @author Qiang Xue <qiang.xue@gmail.com>
6
 * @link http://www.pradosoft.com/
7
 * @copyright Copyright &copy; 2006 PradoSoft
8
 * @license http://www.pradosoft.com/license/
9
 * @version $Id: CommentPortlet.php 1398 2006-09-08 19:31:03Z xue $
10
 */
11
 
12
Prado::using('Application.Portlets.Portlet');
13
 
14
/**
15
 * CommentPortlet class
16
 *
17
 * @author Qiang Xue <qiang.xue@gmail.com>
18
 * @link http://www.pradosoft.com/
19
 * @copyright Copyright &copy; 2006 PradoSoft
20
 * @license http://www.pradosoft.com/license/
21
 */
22
class CommentPortlet extends Portlet
23
{
24
	public function onLoad($param)
25
	{
26
		parent::onLoad($param);
27
		$commentLimit=TPropertyValue::ensureInteger($this->Application->Parameters['RecentComments']);
28
		$comments=$this->Application->getModule('data')->queryComments('','ORDER BY create_time DESC',"LIMIT $commentLimit");
29
		foreach($comments as $comment)
30
		{
31
			$comment->ID=$this->Service->constructUrl('Posts.ViewPost',array('id'=>$comment->PostID)).'#c'.$comment->ID;
32
			if(strlen($comment->Content)>40)
33
				$comment->Content=substr($comment->Content,0,40).' ...';
34
		}
35
		$this->CommentList->DataSource=$comments;
36
		$this->CommentList->dataBind();
37
	}
38
}
39
 
40
?>