日历php 价格 库存,台历价格表

当前位置:我的异常网» PHP » 台历价格表

台历价格表

www.myexceptions.net  网友分享于:2013-09-29  浏览:14次

日历价格表?

问题:价格人数信息不能对应数组里面有的日期才显示(比如数组里面有2013-10-12和2013-10-21才有价格和人数,但程序会依次从开始日期显示,而不是在生成的日历里面对应的日期里才显示),有高手请指点一下,越改逻辑越混乱了。

现在效果如图:

105928189.jpg

代码如下:

class productDate{

var $product_id = '';

var $date = '';

var $original_date = '';

var $nextDate = '';

var $prices = '';

var $count = 42;

var $nowWeek;

var $nowMonth;

var $nextMonth;

var $startDate;

var $lastDate;

function create($product_id, $date, $prices){

$this->product_id = $product_id;

$this->original_date = $this->date = strtotime($date);

$this->prices = $prices;

$this->_init();

$datesTmp = array_keys($this->prices);

$this->lastDate = array_pop($datesTmp);

}

/**

* 下一个月

*

*/

function createNext(){

$this->nextDate = $date; //下一月, 待处理

$this->create($this->nextDate);

}

function getNextMonth($tmp_date, $step = 1){

//切割出年份

$tmp_year= date('Y', $tmp_date);

//切割出月份

$tmp_mon =date('m', $tmp_date);

$tmp_nextmonth=mktime(0,0,0,$tmp_mon + $step,1,$tmp_year);

//得到当前月的下2个月 ,最晚的日期的下一个月的开始

return $tmp_nextmonth;

}

function getPreMonth($tmp_date, $step = 1){

//切割出年份

$tmp_year= date('Y', $tmp_date);

//切割出月份

$tmp_mon =date('m', $tmp_date);

$tmp_premonth=mktime(0,0,0,$tmp_mon - $step,1,$tmp_year);

//得到当前月的上一个月

return $tmp_premonth;

}

/**

* 初始化参数

*

*/

function _init(){

$this->nowWeek = date('w', $this->date);

$this->nowMonth = date('m', $this->date);

$this->nextMonth = date('m', $this->date + 86400 * $this->count);

$this->startDate = $this->date - 86400 * $this->nowWeek;//获取开始日期

}

/**

* 获取html

*

*/

function getHtml(){

$box = $this->getBox();

while($this->getNextMonth($this->date, 2) lastDate){

$this->date = $this->getNextMonth($this->date);

$this->_init();

$box .= $this->getBox();

}

return <<

product_id}">

{$box}

EOF;

}

/**

* 获取日历块

*

*/

function getBox(){

$result = '

  • ';

$startDate = $this->startDate;

for($i = 0; $i count; $i++){

文章评论

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值