* @link http://www.pradosoft.com/ * @copyright Copyright © 2006 PradoSoft * @license http://www.pradosoft.com/license/ * @version $Id: CommentPortlet.php 3189 2012-07-12 12:16:21Z ctrlaltca $ */ 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); $commentLimit=TPropertyValue::ensureInteger($this->Application->Parameters['RecentComments']); $comments=$this->Application->getModule('data')->queryComments('','ORDER BY create_time DESC',"LIMIT $commentLimit"); 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(); } }