Пример #1
0
 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;
         }
     }
 }