From b87fd00a62994d24a3708cec5f5613ed2e9a67ed Mon Sep 17 00:00:00 2001 From: xue <> Date: Tue, 30 May 2006 21:26:29 +0000 Subject: merge from 3.0 branch till 1111. --- demos/blog/protected/Portlets/CommentPortlet.php | 39 ++++++++++++++++++++++++ demos/blog/protected/Portlets/CommentPortlet.tpl | 15 +++++++++ 2 files changed, 54 insertions(+) create mode 100644 demos/blog/protected/Portlets/CommentPortlet.php create mode 100644 demos/blog/protected/Portlets/CommentPortlet.tpl (limited to 'demos/blog/protected/Portlets') diff --git a/demos/blog/protected/Portlets/CommentPortlet.php b/demos/blog/protected/Portlets/CommentPortlet.php new file mode 100644 index 00000000..4147d6d3 --- /dev/null +++ b/demos/blog/protected/Portlets/CommentPortlet.php @@ -0,0 +1,39 @@ + + * @link http://www.pradosoft.com/ + * @copyright Copyright © 2006 PradoSoft + * @license http://www.pradosoft.com/license/ + * @version $Revision: $ $Date: $ + */ + +Prado::using('Application.Portlets.Portlet'); + +/** + * CommentPortlet class + * + * @author Qiang Xue + * @link http://www.pradosoft.com/ + * @copyright Copyright © 2006 PradoSoft + * @license http://www.pradosoft.com/license/ + */ +class CommentPortlet extends Portlet +{ + public function onLoad($param) + { + parent::onLoad($param); + $comments=$this->Application->getModule('data')->queryComments('','ORDER BY create_time DESC','LIMIT 10'); + foreach($comments as $comment) + { + $comment->ID=$this->Service->constructUrl('Posts.ViewPost',array('id'=>$comment->PostID)).'#c'.$comment->ID; + if(strlen($comment->Content)>40) + $comment->Content=substr($comment->Content,0,40).' ...'; + } + $this->CommentList->DataSource=$comments; + $this->CommentList->dataBind(); + } +} + +?> \ No newline at end of file diff --git a/demos/blog/protected/Portlets/CommentPortlet.tpl b/demos/blog/protected/Portlets/CommentPortlet.tpl new file mode 100644 index 00000000..cebdabc6 --- /dev/null +++ b/demos/blog/protected/Portlets/CommentPortlet.tpl @@ -0,0 +1,15 @@ +
+ +

Latest comments

+ +
+ +
+ +
-- cgit v1.2.3