[ Index ] |
|
Code source de PRADO 3.0.6 |
1 <?php 2 /** 3 * ArchivePortlet class file 4 * 5 * @author Qiang Xue <qiang.xue@gmail.com> 6 * @link http://www.pradosoft.com/ 7 * @copyright Copyright © 2006 PradoSoft 8 * @license http://www.pradosoft.com/license/ 9 * @version $Id: ArchivePortlet.php 1397 2006-09-07 07:55:53Z wei $ 10 */ 11 12 Prado::using('Application.Portlets.Portlet'); 13 14 /** 15 * ArchivePortlet class 16 * 17 * @author Qiang Xue <qiang.xue@gmail.com> 18 * @link http://www.pradosoft.com/ 19 * @copyright Copyright © 2006 PradoSoft 20 * @license http://www.pradosoft.com/license/ 21 */ 22 class ArchivePortlet extends Portlet 23 { 24 private function makeMonthTime($timestamp) 25 { 26 $date=getdate($timestamp); 27 return mktime(0,0,0,$date['mon'],1,$date['year']); 28 } 29 30 public function onLoad($param) 31 { 32 $currentTime=time(); 33 $startTime=$this->Application->getModule('data')->queryEarliestPostTime(); 34 if(empty($startTime)) // if no posts 35 $startTime=$currentTime; 36 37 // obtain the timestamp for the initial month 38 $date=getdate($startTime); 39 $startTime=mktime(0,0,0,$date['mon'],1,$date['year']); 40 41 $date=getdate($currentTime); 42 $month=$date['mon']; 43 $year=$date['year']; 44 45 $timestamps=array(); 46 while(true) 47 { 48 if(($timestamp=mktime(0,0,0,$month,1,$year))<$startTime) 49 break; 50 $timestamps[]=$timestamp; 51 if(--$month===0) 52 { 53 $month=12; 54 $year--; 55 } 56 } 57 $this->MonthList->DataSource=$timestamps; 58 $this->MonthList->dataBind(); 59 } 60 } 61 62 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 21:07:04 2007 | par Balluche grâce à PHPXref 0.7 |