本文整理匯總了PHP中SugarDateTime::get_day_by_index_this_month方法的典型用法代碼示例。如果您正苦於以下問題:PHP SugarDateTime::get_day_by_index_this_month方法的具體用法?PHP SugarDateTime::get_day_by_index_this_month怎麽用?PHP SugarDateTime::get_day_by_index_this_month使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類SugarDateTime
的用法示例。
在下文中一共展示了SugarDateTime::get_day_by_index_this_month方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: Slice
function create_slices()
{
global $current_user;
if ($this->view == 'month') {
$days_in_month = $this->date_time->days_in_month;
$first_day_of_month = $this->date_time->get_day_by_index_this_month(0);
$num_of_prev_days = $first_day_of_month->day_of_week;
// do 42 slices (6x7 grid)
for ($i = 0; $i < 42; $i++) {
$slice = new Slice('day', $this->date_time->get_day_by_index_this_month($i - $num_of_prev_days));
$this->slice_hash[$slice->start_time->get_mysql_date()] = $slice;
array_push($this->slices_arr, $slice->start_time->get_mysql_date());
}
} else {
if ($this->view == 'week' || $this->view == 'shared') {
$days_in_week = 7;
for ($i = 0; $i < $days_in_week; $i++) {
$slice = new Slice('day', $this->date_time->get_day_by_index_this_week($i));
$this->slice_hash[$slice->start_time->get_mysql_date()] = $slice;
array_push($this->slices_arr, $slice->start_time->get_mysql_date());
}
} else {
if ($this->view == 'day') {
$hours_in_day = 24;
for ($i = 0; $i < $hours_in_day; $i++) {
$slice = new Slice('hour', $this->date_time->get_datetime_by_index_today($i));
$this->slice_hash[$slice->start_time->get_mysql_date() . ":" . $slice->start_time->hour] = $slice;
$this->slices_arr[] = $slice->start_time->get_mysql_date() . ":" . $slice->start_time->hour;
}
} else {
if ($this->view == 'year') {
for ($i = 0; $i < 12; $i++) {
$slice = new Slice('month', $this->date_time->get_day_by_index_this_year($i));
$this->slice_hash[$slice->start_time->get_mysql_date()] = $slice;
array_push($this->slices_arr, $slice->start_time->get_mysql_date());
}
} else {
sugar_die("not a valid view:" . $this->view);
}
}
}
}
}