当前位置: 首页>>代码示例>>PHP>>正文


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怎么用?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);
                 }
             }
         }
     }
 }
开发者ID:nickpro,项目名称:sugarcrm_dev,代码行数:43,代码来源:Calendar.php


注:本文中的SugarDateTime::get_day_by_index_this_year方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。