本文整理汇总了PHP中SugarDateTime::get_day_by_index_this_year方法的典型用法代码示例。如果您正苦于以下问题:PHP SugarDateTime::get_day_by_index_this_year方法的具体用法?PHP SugarDateTime::get_day_by_index_this_year怎么用?PHP SugarDateTime::get_day_by_index_this_year使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SugarDateTime
的用法示例。
在下文中一共展示了SugarDateTime::get_day_by_index_this_year方法的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);
}
}
}
}
}