コード例 #1
0
ファイル: MonthView_0.php プロジェクト: 62BRAINS/EPESI
 public function month_array($date, $mark = array())
 {
     $first_day_of_month = strtotime(date('Y-m-', $date) . '01');
     $diff = date('w', $first_day_of_month) - Utils_PopupCalendarCommon::get_first_day_of_week();
     if ($diff < 0) {
         $diff += 7;
     }
     $currday = strtotime("-{$diff} days", $first_day_of_month);
     $curmonth = date('m', $date);
     $month = array();
     $today = date('Y-m-d', strtotime(Base_RegionalSettingsCommon::time2reg(null, false, true, true, false)));
     $colors = CRM_Calendar_EventCommon::get_available_colors();
     while (date('m', $currday) != $curmonth % 12 + 1) {
         $week = array();
         $weekno = date('W', $currday);
         $link = Base_BoxCommon::create_href($this, 'CRM_Calendar', null, null, null, array('jump_to_date' => $currday, 'switch_to_tab' => 'Week'));
         for ($i = 0; $i < 7; $i++) {
             $main_month = date('m', $currday) == $curmonth;
             $next = array('day' => date('j', $currday), 'day_link' => Base_BoxCommon::create_href($this, 'CRM_Calendar', null, null, null, array('jump_to_date' => $currday, 'switch_to_tab' => 'Day')), 'style' => ($main_month ? date('Y-m-d', $currday) == $today ? 'today' : 'current' : 'other') . (date('N', $currday) >= 6 ? '_weekend' : ''), 'time' => $currday);
             if ($main_month && isset($mark[date('Y-m-d', $currday)])) {
                 $next['style'] .= ' event-' . $colors[$mark[date('Y-m-d', $currday)]];
             }
             $week[] = $next;
             $currday = strtotime(date('Y-m-d', strtotime(date('Y-m-d 12:00:00', $currday)) + 3600 * 24) . ' ' . date('H:i:s', $currday));
         }
         $month[] = array('week_label' => $weekno, 'week_link' => $link, 'days' => $week);
     }
     return $month;
 }
コード例 #2
0
ファイル: Calendar_0.php プロジェクト: 62BRAINS/EPESI
	public function month_array($date, $mark = array()) {
		$first_day_of_month = strtotime(date('Y-m-', $date).'01');
		$diff = date('w', $first_day_of_month)-$this->settings['first_day_of_week'];
		if ($diff<0) $diff += 7;
		$currday = strtotime('-'.$diff.' days',$first_day_of_month);
		$curmonth = date('m', $date);

		$month = array();
		$today = Base_RegionalSettingsCommon::time2reg(null,false,true,true,false);
		$colors = CRM_Calendar_EventCommon::get_available_colors();
		while (date('m', $currday) != ($curmonth)%12+1) {
			$week = array();
			$weekno = date('W',$currday);
			$link = $this->create_unique_href(array('action'=>'switch','time'=>$currday, 'tab'=>'Week'));
			for ($i=0; $i<7; $i++) {
				$main_month = date('m', $currday)==$curmonth;
				$next = array(
							'day'=>date('j', $currday),
							'day_link' => $this->create_unique_href(array('action'=>'switch', 'time'=>$currday, 'tab'=>'Day')),
							'style'=>($main_month?(date('Y-m-d',$currday)==$today?'today':'current'):'other').(date('N',$currday)>=6?'_weekend':''),
							'time'=>Base_RegionalSettingsCommon::reg2time(date('Y-m-d',$currday).' 00:00:00')
							);
				if ($main_month && isset($mark[date('Y-m-d',$currday)])) {
					$next['style'].= ' event-'.$colors[$mark[date('Y-m-d',$currday)]];
				}
				$week[] = $next;
                $currday = strtotime('+1 day', $currday);
			}
			$month[] = array(
							'week_label'=>$weekno,
							'week_link' => $link,
							'days'=>$week);
		}
		return $month;
	}