5
* @author Qiang Xue <qiang.xue@gmail.com>
6
* @link http://www.yiiframework.com/
7
* @copyright Copyright © 2008-2010 Yii Software LLC
8
* @license http://www.yiiframework.com/license/
12
* CPortlet is the base class for portlet widgets.
14
* A portlet displays a fragment of content, usually in terms of a block
15
* on the side bars of a Web page.
17
* To specify the content of the portlet, override the {@link renderContent}
18
* method, or insert the content code between the {@link CController::beginWidget}
19
* and {@link CController::endWidget} calls. For example,
22
* <?php $this->beginWidget('zii.widgets.CPortlet'); ?>
23
* ...insert content here...
24
* <?php $this->endWidget(); ?>
27
* A portlet also has an optional {@link title}. One may also override {@link renderDecoration}
28
* to further customize the decorative display of a portlet (e.g. adding min/max buttons).
30
* @author Qiang Xue <qiang.xue@gmail.com>
31
* @version $Id: CPortlet.php 104 2010-01-09 20:46:58Z qiang.xue $
32
* @package zii.widgets
35
class CPortlet extends CWidget
38
* @var string the tag name for the portlet container tag. Defaults to 'div'.
40
public $tagName='div';
42
* @var array the HTML attributes for the portlet container tag.
44
public $htmlOptions=array('class'=>'portlet');
46
* @var string the title of the portlet. Defaults to null.
47
* When this is not set, Decoration will not be displayed.
48
* Note that the title will not be HTML-encoded when rendering.
52
* @var string the CSS class for the decoration container tag. Defaults to 'portlet-decoration'.
54
public $decorationCssClass='portlet-decoration';
56
* @var string the CSS class for the portlet title tag. Defaults to 'portlet-title'.
58
public $titleCssClass='portlet-title';
60
* @var string the CSS class for the content container tag. Defaults to 'portlet-content'.
62
public $contentCssClass='portlet-content';
65
* Initializes the widget.
66
* This renders the open tags needed by the portlet.
67
* It also renders the decoration, if any.
69
public function init()
71
$this->htmlOptions['id']=$this->getId();
72
echo CHtml::openTag($this->tagName,$this->htmlOptions)."\n";
73
$this->renderDecoration();
74
echo "<div class=\"{$this->contentCssClass}\">\n";
78
* Renders the content of the portlet.
82
$this->renderContent();
84
echo CHtml::closeTag($this->tagName);
88
* Renders the decoration for the portlet.
89
* The default implementation will render the title if it is set.
91
protected function renderDecoration()
93
if($this->title!==null)
95
echo "<div class=\"{$this->decorationCssClass}\">\n";
96
echo "<div class=\"{$this->titleCssClass}\">{$this->title}</div>\n";
102
* Renders the content of the portlet.
103
* Child classes should override this method to render the actual content.
105
protected function renderContent()
b'\\ No newline at end of file'