diff options
author | wei <> | 2006-06-01 00:10:37 +0000 |
---|---|---|
committer | wei <> | 2006-06-01 00:10:37 +0000 |
commit | b01ee414775cc78aa47edb74263be9502168e472 (patch) | |
tree | 6fc3cb60cf6a4c26c594a685155cd92b98ac69ac /demos/quickstart/protected/pages/Comments.php | |
parent | 5081873dda167cd224be2c4b42e57128f51c89da (diff) |
Add comments option to quickstart.
Diffstat (limited to 'demos/quickstart/protected/pages/Comments.php')
-rw-r--r-- | demos/quickstart/protected/pages/Comments.php | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/demos/quickstart/protected/pages/Comments.php b/demos/quickstart/protected/pages/Comments.php new file mode 100644 index 00000000..7af70ece --- /dev/null +++ b/demos/quickstart/protected/pages/Comments.php @@ -0,0 +1,76 @@ +<?php + +Prado::using('System.I18N.*'); + +/** + * Comments class. + * + * @author Wei Zhuo <weizhuo[at]gmail[dot]com> + * @version : $ Sat May 27 20:23:00 AZOST 2006 $ + * @package Demo.Quickstart + * @since 3.0 + */ +class Comments extends TPage +{ + private $_quickstart; + + public function onLoad($param) + { + parent::onLoad($param); + $this->_quickstart = new QuickStartComments; + if(!$this->getIsPostBack()) + $this->refreshData(); + } + + protected function refreshData() + { + $this->comments->setDataSource($this->_quickstart->getQuequedComments()); + $this->comments->dataBind(); + } + + public function approveComment($sender, $param) + { + $ID = $this->comments->DataKeys[$this->comments->SelectedItemIndex]; + $this->_quickstart->approveComment($ID); + $this->refreshData(); + $this->comments->SelectedItemIndex=-1; + } + + public function editComment($sender, $param) + { + $this->comments->SelectedItemIndex=-1; + $this->comments->EditItemIndex=$param->Item->ItemIndex; + $this->refreshData(); + } + + public function cancelEdit($sender, $param) + { + $this->comments->SelectedItemIndex=-1; + $this->comments->EditItemIndex=-1; + $this->refreshData(); + } + + public function deleteComment($sender, $param) + { + $ID = $this->comments->DataKeys[$param->Item->ItemIndex]; + $this->_quickstart->deleteComment($ID); + $this->comments->SelectedItemIndex=-1; + $this->comments->EditItemIndex=-1; + $this->refreshData(); + } + + public function updateComment($sender, $param) + { + $item=$param->Item; + $this->_quickstart->updateComment( + $this->comments->DataKeys[$item->ItemIndex], + $item->page->Text, + $item->email->Text, + $item->content->Text); + + $this->comments->EditItemIndex=-1; + $this->refreshData(); + } +} + +?>
\ No newline at end of file |