summaryrefslogtreecommitdiff
path: root/demos/blog/protected/Portlets
diff options
context:
space:
mode:
Diffstat (limited to 'demos/blog/protected/Portlets')
-rw-r--r--demos/blog/protected/Portlets/AccountPortlet.php60
-rw-r--r--demos/blog/protected/Portlets/ArchivePortlet.php122
-rw-r--r--demos/blog/protected/Portlets/CategoryPortlet.php74
-rw-r--r--demos/blog/protected/Portlets/CommentPortlet.php78
-rw-r--r--demos/blog/protected/Portlets/LoginPortlet.php76
-rw-r--r--demos/blog/protected/Portlets/Portlet.php46
-rw-r--r--demos/blog/protected/Portlets/SearchPortlet.php76
7 files changed, 266 insertions, 266 deletions
diff --git a/demos/blog/protected/Portlets/AccountPortlet.php b/demos/blog/protected/Portlets/AccountPortlet.php
index 2bbe55d3..40be36ae 100644
--- a/demos/blog/protected/Portlets/AccountPortlet.php
+++ b/demos/blog/protected/Portlets/AccountPortlet.php
@@ -1,31 +1,31 @@
-<?php
-/**
- * AccountPortlet class file
- *
- * @author Qiang Xue <qiang.xue@gmail.com>
- * @link http://www.pradosoft.com/
- * @copyright Copyright &copy; 2006 PradoSoft
- * @license http://www.pradosoft.com/license/
- * @version $Id$
- */
-
-Prado::using('Application.Portlets.Portlet');
-
-/**
- * AccountPortlet class
- *
- * @author Qiang Xue <qiang.xue@gmail.com>
- * @link http://www.pradosoft.com/
- * @copyright Copyright &copy; 2006 PradoSoft
- * @license http://www.pradosoft.com/license/
- */
-class AccountPortlet extends Portlet
-{
- public function logout($sender,$param)
- {
- $this->Application->getModule('auth')->logout();
- $this->Response->reload();
- }
-}
-
+<?php
+/**
+ * AccountPortlet class file
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright &copy; 2006 PradoSoft
+ * @license http://www.pradosoft.com/license/
+ * @version $Id$
+ */
+
+Prado::using('Application.Portlets.Portlet');
+
+/**
+ * AccountPortlet class
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright &copy; 2006 PradoSoft
+ * @license http://www.pradosoft.com/license/
+ */
+class AccountPortlet extends Portlet
+{
+ public function logout($sender,$param)
+ {
+ $this->Application->getModule('auth')->logout();
+ $this->Response->reload();
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/blog/protected/Portlets/ArchivePortlet.php b/demos/blog/protected/Portlets/ArchivePortlet.php
index 003eb0cc..f8bd488e 100644
--- a/demos/blog/protected/Portlets/ArchivePortlet.php
+++ b/demos/blog/protected/Portlets/ArchivePortlet.php
@@ -1,62 +1,62 @@
-<?php
-/**
- * ArchivePortlet class file
- *
- * @author Qiang Xue <qiang.xue@gmail.com>
- * @link http://www.pradosoft.com/
- * @copyright Copyright &copy; 2006 PradoSoft
- * @license http://www.pradosoft.com/license/
- * @version $Id$
- */
-
-Prado::using('Application.Portlets.Portlet');
-
-/**
- * ArchivePortlet class
- *
- * @author Qiang Xue <qiang.xue@gmail.com>
- * @link http://www.pradosoft.com/
- * @copyright Copyright &copy; 2006 PradoSoft
- * @license http://www.pradosoft.com/license/
- */
-class ArchivePortlet extends Portlet
-{
- private function makeMonthTime($timestamp)
- {
- $date=getdate($timestamp);
- return mktime(0,0,0,$date['mon'],1,$date['year']);
- }
-
- public function onLoad($param)
- {
- $currentTime=time();
- $startTime=$this->Application->getModule('data')->queryEarliestPostTime();
- if(empty($startTime)) // if no posts
- $startTime=$currentTime;
-
- // obtain the timestamp for the initial month
- $date=getdate($startTime);
- $startTime=mktime(0,0,0,$date['mon'],1,$date['year']);
-
- $date=getdate($currentTime);
- $month=$date['mon'];
- $year=$date['year'];
-
- $timestamps=array();
- while(true)
- {
- if(($timestamp=mktime(0,0,0,$month,1,$year))<$startTime)
- break;
- $timestamps[]=$timestamp;
- if(--$month===0)
- {
- $month=12;
- $year--;
- }
- }
- $this->MonthList->DataSource=$timestamps;
- $this->MonthList->dataBind();
- }
-}
-
+<?php
+/**
+ * ArchivePortlet class file
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright &copy; 2006 PradoSoft
+ * @license http://www.pradosoft.com/license/
+ * @version $Id$
+ */
+
+Prado::using('Application.Portlets.Portlet');
+
+/**
+ * ArchivePortlet class
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright &copy; 2006 PradoSoft
+ * @license http://www.pradosoft.com/license/
+ */
+class ArchivePortlet extends Portlet
+{
+ private function makeMonthTime($timestamp)
+ {
+ $date=getdate($timestamp);
+ return mktime(0,0,0,$date['mon'],1,$date['year']);
+ }
+
+ public function onLoad($param)
+ {
+ $currentTime=time();
+ $startTime=$this->Application->getModule('data')->queryEarliestPostTime();
+ if(empty($startTime)) // if no posts
+ $startTime=$currentTime;
+
+ // obtain the timestamp for the initial month
+ $date=getdate($startTime);
+ $startTime=mktime(0,0,0,$date['mon'],1,$date['year']);
+
+ $date=getdate($currentTime);
+ $month=$date['mon'];
+ $year=$date['year'];
+
+ $timestamps=array();
+ while(true)
+ {
+ if(($timestamp=mktime(0,0,0,$month,1,$year))<$startTime)
+ break;
+ $timestamps[]=$timestamp;
+ if(--$month===0)
+ {
+ $month=12;
+ $year--;
+ }
+ }
+ $this->MonthList->DataSource=$timestamps;
+ $this->MonthList->dataBind();
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/blog/protected/Portlets/CategoryPortlet.php b/demos/blog/protected/Portlets/CategoryPortlet.php
index d95b0661..0b451db8 100644
--- a/demos/blog/protected/Portlets/CategoryPortlet.php
+++ b/demos/blog/protected/Portlets/CategoryPortlet.php
@@ -1,38 +1,38 @@
-<?php
-/**
- * CategoryPortlet class file
- *
- * @author Qiang Xue <qiang.xue@gmail.com>
- * @link http://www.pradosoft.com/
- * @copyright Copyright &copy; 2006 PradoSoft
- * @license http://www.pradosoft.com/license/
- * @version $Id$
- */
-
-Prado::using('Application.Portlets.Portlet');
-
-/**
- * CategoryPortlet class
- *
- * @author Qiang Xue <qiang.xue@gmail.com>
- * @link http://www.pradosoft.com/
- * @copyright Copyright &copy; 2006 PradoSoft
- * @license http://www.pradosoft.com/license/
- */
-class CategoryPortlet extends Portlet
-{
- public function onLoad($param)
- {
- parent::onLoad($param);
- $cats=$this->Application->getModule('data')->queryCategories();
- foreach($cats as $cat)
- {
- $cat->ID=$this->Service->constructUrl('Posts.ListPost',array('cat'=>$cat->ID));
- $cat->Name.=' (' . $cat->PostCount .')';
- }
- $this->CategoryList->DataSource=$cats;
- $this->CategoryList->dataBind();
- }
-}
-
+<?php
+/**
+ * CategoryPortlet class file
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright &copy; 2006 PradoSoft
+ * @license http://www.pradosoft.com/license/
+ * @version $Id$
+ */
+
+Prado::using('Application.Portlets.Portlet');
+
+/**
+ * CategoryPortlet class
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright &copy; 2006 PradoSoft
+ * @license http://www.pradosoft.com/license/
+ */
+class CategoryPortlet extends Portlet
+{
+ public function onLoad($param)
+ {
+ parent::onLoad($param);
+ $cats=$this->Application->getModule('data')->queryCategories();
+ foreach($cats as $cat)
+ {
+ $cat->ID=$this->Service->constructUrl('Posts.ListPost',array('cat'=>$cat->ID));
+ $cat->Name.=' (' . $cat->PostCount .')';
+ }
+ $this->CategoryList->DataSource=$cats;
+ $this->CategoryList->dataBind();
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/blog/protected/Portlets/CommentPortlet.php b/demos/blog/protected/Portlets/CommentPortlet.php
index c3549928..ff8d075a 100644
--- a/demos/blog/protected/Portlets/CommentPortlet.php
+++ b/demos/blog/protected/Portlets/CommentPortlet.php
@@ -1,40 +1,40 @@
-<?php
-/**
- * CommentPortlet class file
- *
- * @author Qiang Xue <qiang.xue@gmail.com>
- * @link http://www.pradosoft.com/
- * @copyright Copyright &copy; 2006 PradoSoft
- * @license http://www.pradosoft.com/license/
- * @version $Id$
- */
-
-Prado::using('Application.Portlets.Portlet');
-
-/**
- * CommentPortlet class
- *
- * @author Qiang Xue <qiang.xue@gmail.com>
- * @link http://www.pradosoft.com/
- * @copyright Copyright &copy; 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();
- }
-}
-
+<?php
+/**
+ * CommentPortlet class file
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright &copy; 2006 PradoSoft
+ * @license http://www.pradosoft.com/license/
+ * @version $Id$
+ */
+
+Prado::using('Application.Portlets.Portlet');
+
+/**
+ * CommentPortlet class
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright &copy; 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();
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/blog/protected/Portlets/LoginPortlet.php b/demos/blog/protected/Portlets/LoginPortlet.php
index 6f400f0a..58c056b3 100644
--- a/demos/blog/protected/Portlets/LoginPortlet.php
+++ b/demos/blog/protected/Portlets/LoginPortlet.php
@@ -1,39 +1,39 @@
-<?php
-/**
- * LoginPortlet class file
- *
- * @author Qiang Xue <qiang.xue@gmail.com>
- * @link http://www.pradosoft.com/
- * @copyright Copyright &copy; 2006 PradoSoft
- * @license http://www.pradosoft.com/license/
- * @version $Id$
- */
-
-Prado::using('Application.Portlets.Portlet');
-
-/**
- * LoginPortlet class
- *
- * @author Qiang Xue <qiang.xue@gmail.com>
- * @link http://www.pradosoft.com/
- * @copyright Copyright &copy; 2006 PradoSoft
- * @license http://www.pradosoft.com/license/
- */
-class LoginPortlet extends Portlet
-{
- public function validateUser($sender,$param)
- {
- $authManager=$this->Application->getModule('auth');
- if(!$authManager->login(strtolower($this->Username->Text),$this->Password->Text))
- $param->IsValid=false;
- }
-
- public function loginButtonClicked($sender,$param)
- {
- if($this->Page->IsValid)
- $this->Response->reload();
- //$this->Response->redirect($this->Application->getModule('auth')->getReturnUrl());
- }
-}
-
+<?php
+/**
+ * LoginPortlet class file
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright &copy; 2006 PradoSoft
+ * @license http://www.pradosoft.com/license/
+ * @version $Id$
+ */
+
+Prado::using('Application.Portlets.Portlet');
+
+/**
+ * LoginPortlet class
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright &copy; 2006 PradoSoft
+ * @license http://www.pradosoft.com/license/
+ */
+class LoginPortlet extends Portlet
+{
+ public function validateUser($sender,$param)
+ {
+ $authManager=$this->Application->getModule('auth');
+ if(!$authManager->login(strtolower($this->Username->Text),$this->Password->Text))
+ $param->IsValid=false;
+ }
+
+ public function loginButtonClicked($sender,$param)
+ {
+ if($this->Page->IsValid)
+ $this->Response->reload();
+ //$this->Response->redirect($this->Application->getModule('auth')->getReturnUrl());
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/blog/protected/Portlets/Portlet.php b/demos/blog/protected/Portlets/Portlet.php
index 50cb634d..6a7cee70 100644
--- a/demos/blog/protected/Portlets/Portlet.php
+++ b/demos/blog/protected/Portlets/Portlet.php
@@ -1,24 +1,24 @@
-<?php
-/**
- * Portlet class file
- *
- * @author Qiang Xue <qiang.xue@gmail.com>
- * @link http://www.pradosoft.com/
- * @copyright Copyright &copy; 2006 PradoSoft
- * @license http://www.pradosoft.com/license/
- * @version $Id$
- */
-
-/**
- * Portlet class
- *
- * @author Qiang Xue <qiang.xue@gmail.com>
- * @link http://www.pradosoft.com/
- * @copyright Copyright &copy; 2006 PradoSoft
- * @license http://www.pradosoft.com/license/
- */
-class Portlet extends TTemplateControl
-{
-}
-
+<?php
+/**
+ * Portlet class file
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright &copy; 2006 PradoSoft
+ * @license http://www.pradosoft.com/license/
+ * @version $Id$
+ */
+
+/**
+ * Portlet class
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright &copy; 2006 PradoSoft
+ * @license http://www.pradosoft.com/license/
+ */
+class Portlet extends TTemplateControl
+{
+}
+
?> \ No newline at end of file
diff --git a/demos/blog/protected/Portlets/SearchPortlet.php b/demos/blog/protected/Portlets/SearchPortlet.php
index 10ef0499..4f7d6ebf 100644
--- a/demos/blog/protected/Portlets/SearchPortlet.php
+++ b/demos/blog/protected/Portlets/SearchPortlet.php
@@ -1,39 +1,39 @@
-<?php
-/**
- * SearchPortlet class file
- *
- * @author Qiang Xue <qiang.xue@gmail.com>
- * @link http://www.pradosoft.com/
- * @copyright Copyright &copy; 2006 PradoSoft
- * @license http://www.pradosoft.com/license/
- * @version $Id$
- */
-
-Prado::using('Application.Portlets.Portlet');
-
-/**
- * SearchPortlet class
- *
- * @author Qiang Xue <qiang.xue@gmail.com>
- * @link http://www.pradosoft.com/
- * @copyright Copyright &copy; 2006 PradoSoft
- * @license http://www.pradosoft.com/license/
- */
-class SearchPortlet extends Portlet
-{
- public function onInit($param)
- {
- parent::onInit($param);
- if(!$this->Page->IsPostBack && ($keyword=$this->Request['keyword'])!==null)
- $this->Keyword->Text=$keyword;
- }
-
- public function search($sender,$param)
- {
- $keyword=$this->Keyword->Text;
- $url=$this->Service->constructUrl('SearchPost',array('keyword'=>$keyword),false);
- $this->Response->redirect($url);
- }
-}
-
+<?php
+/**
+ * SearchPortlet class file
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright &copy; 2006 PradoSoft
+ * @license http://www.pradosoft.com/license/
+ * @version $Id$
+ */
+
+Prado::using('Application.Portlets.Portlet');
+
+/**
+ * SearchPortlet class
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright &copy; 2006 PradoSoft
+ * @license http://www.pradosoft.com/license/
+ */
+class SearchPortlet extends Portlet
+{
+ public function onInit($param)
+ {
+ parent::onInit($param);
+ if(!$this->Page->IsPostBack && ($keyword=$this->Request['keyword'])!==null)
+ $this->Keyword->Text=$keyword;
+ }
+
+ public function search($sender,$param)
+ {
+ $keyword=$this->Keyword->Text;
+ $url=$this->Service->constructUrl('SearchPost',array('keyword'=>$keyword),false);
+ $this->Response->redirect($url);
+ }
+}
+
?> \ No newline at end of file