blob: 4ba5a4d9cbc7d594f9768d2ee1e70c19a4bb5e53 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
<?php
/**
* CategoryPortlet class file
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @link https://github.com/pradosoft/prado
* @copyright Copyright © 2006-2015 The PRADO Group
* @license https://github.com/pradosoft/prado/blob/master/COPYRIGHT
*/
Prado::using('Application.Portlets.Portlet');
/**
* CategoryPortlet class
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @link https://github.com/pradosoft/prado
* @copyright Copyright © 2006-2015 The PRADO Group
* @license https://github.com/pradosoft/prado/blob/master/COPYRIGHT
*/
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();
}
}
|