當前位置: 首頁>>代碼示例>>PHP>>正文


PHP SugarDateTime::get_day_by_index_this_week方法代碼示例

本文整理匯總了PHP中SugarDateTime::get_day_by_index_this_week方法的典型用法代碼示例。如果您正苦於以下問題:PHP SugarDateTime::get_day_by_index_this_week方法的具體用法?PHP SugarDateTime::get_day_by_index_this_week怎麽用?PHP SugarDateTime::get_day_by_index_this_week使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在SugarDateTime的用法示例。


在下文中一共展示了SugarDateTime::get_day_by_index_this_week方法的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_week方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。