コード例 #1
0
ファイル: Calendar.php プロジェクト: aldridged/gtg-sugar
 function add_activities($user, $type = 'sugar')
 {
     if ($this->view == 'week' || $this->view == 'shared') {
         $end_date_time = $this->date_time->get_first_day_of_next_week();
     } else {
         $end_date_time = $this->date_time;
     }
     $acts_arr = array();
     if ($type == 'vfb') {
         $acts_arr = CalendarActivity::get_freebusy_activities($user, $this->date_time, $end_date_time);
     } else {
         $acts_arr = CalendarActivity::get_activities($user->id, $this->show_tasks, $this->date_time, $end_date_time, $this->view);
     }
     // loop thru each activity for this user
     for ($i = 0; $i < count($acts_arr); $i++) {
         $act = $acts_arr[$i];
         // get "hashed" time slots for the current activity we are looping through
         $hash_list = DateTimeUtil::getHashList($this->view, $act->start_time, $act->end_time);
         for ($j = 0; $j < count($hash_list); $j++) {
             if (!isset($this->slice_hash[$hash_list[$j]]) || !isset($this->slice_hash[$hash_list[$j]]->acts_arr[$user->id])) {
                 $this->slice_hash[$hash_list[$j]]->acts_arr[$user->id] = array();
             }
             $this->slice_hash[$hash_list[$j]]->acts_arr[$user->id][] = $act;
         }
     }
 }
コード例 #2
0
ファイル: Calendar.php プロジェクト: klou/SuiteCRM
 /**
  * loads array of objects
  * @param User $user user object
  * @param string $type
  */
 public function add_activities($user, $type = 'sugar')
 {
     global $timedate;
     $start_date_time = $this->date_time;
     if ($this->view == 'week' || $this->view == 'shared' || $this->view == 'mobile') {
         $start_date_time = CalendarUtils::get_first_day_of_week($this->date_time);
         $end_date_time = $start_date_time->get("+7 days");
     } else {
         if ($this->view == 'month') {
             $start_date_time = $this->date_time->get_day_by_index_this_month(0);
             $end_date_time = $start_date_time->get("+" . $start_date_time->format('t') . " days");
             $start_date_time = CalendarUtils::get_first_day_of_week($start_date_time);
             $end_date_time = CalendarUtils::get_first_day_of_week($end_date_time)->get("+7 days");
         } else {
             $end_date_time = $this->date_time->get("+1 day");
         }
     }
     $start_date_time = $start_date_time->get("-5 days");
     // 5 days step back to fetch multi-day activities that
     $acts_arr = array();
     if ($type == 'vfb') {
         $acts_arr = CalendarActivity::get_freebusy_activities($user, $start_date_time, $end_date_time);
     } else {
         $acts_arr = CalendarActivity::get_activities($user->id, $this->show_tasks, $start_date_time, $end_date_time, $this->view, $this->show_calls, $this->show_completed);
     }
     $this->acts_arr[$user->id] = $acts_arr;
 }
コード例 #3
0
ファイル: Calendar.php プロジェクト: nickpro/sugarcrm_dev
 function add_activities($user, $type = 'sugar')
 {
     global $timedate;
     if ($this->view == 'week' || $this->view == 'shared') {
         $end_date_time = $this->date_time->get("+7 days");
     } else {
         $end_date_time = $this->date_time;
     }
     $acts_arr = array();
     if ($type == 'vfb') {
         $acts_arr = CalendarActivity::get_freebusy_activities($user, $this->date_time, $end_date_time);
     } else {
         $acts_arr = CalendarActivity::get_activities($user->id, $this->show_tasks, $this->date_time, $end_date_time, $this->view);
     }
     // loop thru each activity for this user
     foreach ($acts_arr as $act) {
         // get "hashed" time slots for the current activity we are looping through
         $start = $timedate->tzUser($act->start_time);
         $end = $timedate->tzUser($act->end_time);
         $hash_list = SugarDateTime::getHashList($this->view, $start, $end);
         for ($j = 0; $j < count($hash_list); $j++) {
             if (!isset($this->slice_hash[$hash_list[$j]]) || !isset($this->slice_hash[$hash_list[$j]]->acts_arr[$user->id])) {
                 $this->slice_hash[$hash_list[$j]]->acts_arr[$user->id] = array();
             }
             $this->slice_hash[$hash_list[$j]]->acts_arr[$user->id][] = $act;
         }
     }
 }