summaryrefslogtreecommitdiff
path: root/demos/quickstart/protected/comments/CommentList.php
diff options
context:
space:
mode:
authorwei <>2006-06-01 00:10:37 +0000
committerwei <>2006-06-01 00:10:37 +0000
commitb01ee414775cc78aa47edb74263be9502168e472 (patch)
tree6fc3cb60cf6a4c26c594a685155cd92b98ac69ac /demos/quickstart/protected/comments/CommentList.php
parent5081873dda167cd224be2c4b42e57128f51c89da (diff)
Add comments option to quickstart.
Diffstat (limited to 'demos/quickstart/protected/comments/CommentList.php')
-rw-r--r--demos/quickstart/protected/comments/CommentList.php55
1 files changed, 55 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..7ea5be6b
--- /dev/null
+++ b/demos/quickstart/protected/comments/CommentList.php
@@ -0,0 +1,55 @@
+<?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', '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