Esempio n. 1
0
 function calendar_refresh($model)
 {
     $final_parent_refresh = array();
     $dates = $model->get_dates();
     foreach ($dates as $date) {
         $refresh_keys = array();
         $refresh_keys[] = 'dat-' . $date;
         $refresh_keys[] = $model->user_id ? 'use-' . $model->user_id : 'use-0';
         $this_parent_refresh = HC_Lib::get_combinations($refresh_keys);
         reset($this_parent_refresh);
         foreach ($this_parent_refresh as $pr) {
             $final_parent_refresh[join('-', $pr)] = 1;
         }
     }
     $return = $final_parent_refresh;
     return $return;
 }
Esempio n. 2
0
 function calendar_refresh($model)
 {
     $refresh_keys = array();
     $refresh_keys[] = 'dat-' . $model->date;
     $refresh_keys[] = $model->location_id ? 'loc-' . $model->location_id : 'loc-0';
     $refresh_keys[] = $model->user_id ? 'use-' . $model->user_id : 'use-0';
     $parent_refresh = HC_Lib::get_combinations($refresh_keys);
     $refresh_keys2 = array();
     $changes = $model->get_changes();
     if (!array_key_exists('id', $changes)) {
         if (array_intersect(array('date', 'user_id', 'location_id'), array_keys($changes))) {
             if (array_key_exists('user_id', $changes)) {
                 $refresh_keys2[] = $changes['user_id'] ? 'use-' . $changes['user_id'] : 'use-0';
             } else {
                 $refresh_keys2[] = $model->user_id ? 'use-' . $model->user_id : 'use-0';
             }
             if (array_key_exists('location_id', $changes)) {
                 $refresh_keys2[] = $changes['location_id'] ? 'loc-' . $changes['location_id'] : 'loc-0';
             } else {
                 $refresh_keys2[] = $model->location_id ? 'loc-' . $model->location_id : 'loc-0';
             }
             if (array_key_exists('date', $changes)) {
                 $refresh_keys2[] = $changes['date'] ? 'dat-' . $changes['date'] : 'dat-0';
             } else {
                 $refresh_keys2[] = 'dat-' . $model->date;
             }
         }
     }
     if ($refresh_keys2) {
         $parent_refresh2 = HC_Lib::get_combinations($refresh_keys2);
         $parent_refresh = array_merge($parent_refresh, $parent_refresh2);
     }
     $final_parent_refresh = array();
     foreach ($parent_refresh as $pr) {
         $final_parent_refresh[join('-', $pr)] = 1;
     }
     //		$return = array_keys( $final_parent_refresh );
     $return = $final_parent_refresh;
     return $return;
 }