diff options
author | xue <> | 2006-06-02 18:27:02 +0000 |
---|---|---|
committer | xue <> | 2006-06-02 18:27:02 +0000 |
commit | 0f3a577bed4d828472469675e90fcab032e33f44 (patch) | |
tree | 3ca817247b8006563900d5fb8995d6a6f0627a2b /demos/quickstart/protected/comments/CommentList.php | |
parent | 067ab51fbd9b2f18f63fc80895476e5b0e2f9bfb (diff) |
merge from 3.0 branch till 1133.
Diffstat (limited to 'demos/quickstart/protected/comments/CommentList.php')
-rw-r--r-- | demos/quickstart/protected/comments/CommentList.php | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/demos/quickstart/protected/comments/CommentList.php b/demos/quickstart/protected/comments/CommentList.php new file mode 100644 index 00000000..4328991f --- /dev/null +++ b/demos/quickstart/protected/comments/CommentList.php @@ -0,0 +1,59 @@ +<?php + +Prado::using('System.I18N.*'); + +/** + * CommentList class. + * + * @author Wei Zhuo <weizhuo[at]gmail[dot]com> + * @version : $ Sat May 27 17:53:15 AZOST 2006 $ + * @package Demo.Quickstart.comments + * @since 3.0 + */ +class CommentList extends TTemplateControl +{ + private $_exclude = array( + 'Comments', + 'Markdown', + 'Search', + 'GettingStarted.Introduction'); + + private $_quickstart; + + public function onLoad($param) + { + parent::onLoad($param); + + $this->_quickstart = new QuickStartComments(); + + $page = $this->getService()->getRequestedPagePath(); + + $this->listComments($page); + } + + protected function listComments($page) + { + $this->comments->setDataSource($this->_quickstart->getComments($page)); + $this->comments->dataBind(); + } + + public function addComment_Clicked($sender, $param) + { + $page = $this->getService()->getRequestedPagePath(); + $this->_quickstart->addNewComment($page, + $this->email->getText(), $this->content->getText()); + $this->multiView1->setActiveViewIndex(1); + $this->listComments($page); + } + + public function setVisible($value) + { + $page = $this->getService()->getRequestedPagePath(); + if(in_array($page, $this->_exclude)) + parent::setVisible(false); + else + parent::setVisible($value); + } +} + +?>
\ No newline at end of file |