Changeset 4362 for contrib/Resources/inc/class.boresources.inc.php
- Timestamp:
- 05/12/11 11:52:50 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
contrib/Resources/inc/class.boresources.inc.php
r3524 r4362 267 267 } 268 268 269 /*$this->so = CreateObject('resources.soresources',269 $this->so = CreateObject('calendar.socalendar', 270 270 Array( 271 271 'owner' => $this->owner, … … 274 274 'g_owner' => $this->g_owner 275 275 ) 276 ); */276 ); 277 277 $this->rpt_day = array( // need to be after creation of soresources 278 278 MCAL_M_SUNDAY => 'Sunday', … … 589 589 590 590 $event = $this->so->read_entry($id); 591 echo $event;591 //echo $event; 592 592 593 593 594 594 return False; 595 } 596 597 598 function read_entry2($id,$ignore_acl=False) 599 { 600 601 602 $event = $this->so->read_entry($id); 603 if(!isset($event['participants'][$this->owner]) && $this->user_is_a_member($event,$this->owner)) 604 { 605 $this->so->add_attribute('participants','U',(int)$this->owner); 606 $this->so->add_entry($event); 607 $event = $this->get_cached_event(); 608 } 609 return $this->xmlrpc ? $this->xmlrpc_prepare($event) : $event; 610 595 611 } 596 612 … … 774 790 775 791 792 776 793 $send_to_ui = True; 777 794 //if ((!is_array($l_start) || !is_array($l_end)) && !isset($_GET['readsess'])) // xmlrpc call … … 799 816 foreach($params['participants'] as $user => $data) 800 817 { 818 801 819 $l_participants[] = $user.$data['status']; 802 820 } … … 1204 1222 } 1205 1223 1224 1206 1225 $overlapping_events = $this->overlap( 1207 1226 $this->maketime($event['start']), … … 1471 1490 } 1472 1491 1473 function overlap($starttime,$endtime,$participants,$owner=0,$id=0,$restore_cache=False)1492 function overlap($starttime,$endtime,$participants,$owner=0,$id=0,$restore_cache=False,$location='n/a') 1474 1493 { 1475 1494 // $retval = Array(); … … 1478 1497 /* This needs some attention.. by commenting this chunk of code it will fix bug #444265 */ 1479 1498 1499 // foreach($id as $c=>$v) 1500 // echo "<p>El 565vector con indice $c tiene el valor $v </p>"; 1501 1502 1503 1480 1504 if($restore_cache) 1481 1505 { … … 1488 1512 // $temp_end_time = (int)$GLOBALS['phpgw']->common->show_date($endtime,'Hi'); 1489 1513 $temp_start = (int)(date('Ymd',$starttime)); 1514 1490 1515 $temp_start_time = (int)(date('Hi',$starttime)); 1491 1516 $temp_end = (int)(date('Ymd',$endtime)); 1492 1517 $temp_end_time = (int)(date('Hi',$endtime)); 1518 // echo "<br>inicio".$temp_start_time." <br> fin ".$temp_end_time."<br> ".(int)(date('Hi a',$endtime))."<br>"; 1519 // echo "<br>inicio".$temp_start." <br> fin ".$temp_end."<br> ".(int)(date('Hi a',$endtime))."<br>"; 1520 1493 1521 if($this->debug) 1494 1522 { … … 1509 1537 $users[] = $this->owner; 1510 1538 } 1539 1511 1540 1512 1541 $possible_conflicts = $this->store_to_cache( … … 1518 1547 'eday' => substr(strval($temp_end),6,2), 1519 1548 'eyear' => substr(strval($temp_end),0,4), 1520 'owner' => $users 1549 'owner' => $users, 1550 'location' => $location 1521 1551 ) 1522 1552 ); … … 1527 1557 echo '<!-- Possible Conflicts ('.$temp_start.'): '.count($possible_conflicts[$temp_start]).' '.count($id).' -->'."\n"; 1528 1558 } 1529 1559 //echo "aaa".$possible_conflicts[$temp_start]; 1560 //echo "bbbb".$possible_conflicts[$temp_end]; 1530 1561 if($possible_conflicts[$temp_start] || $possible_conflicts[$temp_end]) 1531 1562 { … … 1569 1600 $temp_event_end = sprintf("%d%02d",$event['end']['hour'],$event['end']['min']); 1570 1601 // if((($temp_start_time <= $temp_event_start) && ($temp_end_time >= $temp_event_start) && ($temp_end_time <= $temp_event_end)) || 1602 1603 1604 /*}*/ 1605 1606 1607 1571 1608 if(($temp_start_time <= $temp_event_start && 1572 $temp_end_time > $temp_event_start && 1573 $temp_end_time <= $temp_event_end || 1574 $temp_start_time >= $temp_event_start && 1575 $temp_start_time < $temp_event_end && 1576 $temp_end_time >= $temp_event_end || 1577 $temp_start_time <= $temp_event_start && 1578 $temp_end_time >= $temp_event_end || 1579 $temp_start_time >= $temp_event_start && 1580 $temp_end_time <= $temp_event_end) && 1581 $this->participants_not_rejected($participants,$event)) 1609 $temp_end_time >= $temp_event_start && 1610 $temp_end_time <= $temp_event_end) || 1611 ($temp_start_time <= $temp_event_start && 1612 $temp_end_time >= $temp_event_start && 1613 $temp_end_time >= $temp_event_end)|| 1614 ($temp_start_time <= $temp_event_start && 1615 $temp_end_time >= $temp_event_end) || 1616 1617 ($temp_start_time >= $temp_event_start && 1618 $temp_start_time <= $temp_event_end && 1619 $temp_end_time >= $temp_event_end) || 1620 1621 ($temp_start_time >= $temp_event_start && 1622 $temp_end_time <= $temp_event_end)) 1582 1623 { 1583 1624 if($this->debug) … … 1585 1626 echo ' Conflicts'; 1586 1627 } 1587 $retval[] = $event ['id'];1628 $retval[] = $event; 1588 1629 } 1589 1630 if($this->debug) … … 1597 1638 else 1598 1639 { 1599 $retval = False; 1640 $retval1 = False; 1641 $retval = Array(); 1600 1642 } 1601 1643 … … 2022 2064 } 2023 2065 $repeated = $this->repeating_events; 2066 2067 //echo $repeated."repeat<br>" ; 2024 2068 $r_events = count($repeated); 2069 //echo $r_events." ".$this->repeating_event[1]. "repeat23<br>" ; 2025 2070 for ($i=0;$i<$r_events;$i++) 2026 2071 { 2027 2072 $rep_events = $this->repeating_events[$i]; 2073 2028 2074 $id = $rep_events['id']; 2075 //echo $id; 2029 2076 $event_beg_day = mktime(0,0,0,$rep_events['start']['month'],$rep_events['start']['mday'],$rep_events['start']['year']); 2030 2077 if($rep_events['recur_enddate']['month'] != 0 && $rep_events['recur_enddate']['mday'] != 0 && $rep_events['recur_enddate']['year'] != 0) … … 2160 2207 return False; 2161 2208 } 2162 if (isset($params['start']) && ($datearr = $GLOBALS['server']->iso86012date($params['start']))) 2209 $location=$params['location']; 2210 2211 //echo "location".$location; 2212 if (isset($params['start']) && ($datearr = $GLOBALS['server']->iso86012date($params['start']))) 2163 2213 { 2164 2214 $syear = $datearr['year']; … … 2219 2269 //Se $emonth nao tem valor, recebe o valor de $smonth (que recebe $params['smonth']) e soma 1. 2220 2270 //O valor $params['emonth'] indica o mes final para a pesquisa de eventos, e passou a ser 2221 //informado na a impressao de eventos mensais. Mudancas feitas em class.ui resources.inc.php,2271 //informado na a impressao de eventos mensais. Mudancas feitas em class.uicalendar.inc.php, 2222 2272 //function display_month_print(); 2223 2273 if(!$emonth) … … 2236 2286 $edate = mktime(23,59,59,$emonth,$eday,$eyear); 2237 2287 } 2238 //echo "<p>bo resources::store_to_cache(".print_r($params,True).") syear=$syear, smonth=$smonth, sday=$sday, eyear=$eyear, emonth=$emonth, eday=$eday, xmlrpc='$param[xmlrpc]'</p>\n";2288 //echo "<p>bocalendar::store_to_cache(".print_r($params,True).") syear=$syear, smonth=$smonth, sday=$sday, eyear=$eyear, emonth=$emonth, eday=$eday, xmlrpc='$param[xmlrpc]'</p>\n"; 2239 2289 if($this->debug) 2240 2290 { … … 2248 2298 if($owner_id) 2249 2299 { 2250 $cached_event_ids = "";//$this->so->list_events($syear,$smonth,$sday,$eyear,$emonth,$eday,$owner_id); 2251 $cached_event_ids_repeating = "";//$this->so->list_repeated_events($syear,$smonth,$sday,$eyear,$emonth,$eday,$owner_id); 2300 2301 $cached_event_ids = $this->so->list_events($syear,$smonth,$sday,$eyear,$emonth,$eday,$owner_id,$location); 2302 $cached_event_ids_repeating = $this->so->list_repeated_events($syear,$smonth,$sday,$eyear,$emonth,$eday,$owner_id,$location); 2252 2303 } 2253 2304 else 2254 2305 { 2255 $cached_event_ids = "";//$this->so->list_events($syear,$smonth,$sday,$eyear,$emonth,$eday); 2256 $cached_event_ids_repeating = "";//$this->so->list_repeated_events($syear,$smonth,$sday,$eyear,$emonth,$eday); 2306 2307 $cached_event_ids = $this->so->list_events($syear,$smonth,$sday,$eyear,$emonth,$eday,0,$location); 2308 $cached_event_ids_repeating = $this->so->list_repeated_events($syear,$smonth,$sday,$eyear,$emonth,$eday,0,$location); 2257 2309 } 2258 2310 2259 2311 $c_cached_ids = count($cached_event_ids); 2260 2312 $c_cached_ids_repeating = count($cached_event_ids_repeating); 2261 2313 //echo "totaless".$c_cached_ids." - ".$c_cached_ids_repeating; 2262 2314 if($this->debug) 2263 2315 { … … 2274 2326 2275 2327 $cache_start = (int)(sprintf("%04d%02d%02d",$syear,$smonth,$sday)); 2328 2276 2329 $cached_event=$this->get_cached_event(); 2330 2277 2331 if($c_cached_ids) 2278 2332 { 2333 2279 2334 for($i=0;$i<$c_cached_ids;$i++) 2280 2335 { 2281 $event = "";//$this->so->read_entry($cached_event_ids[$i]); 2336 $event = $this->so->read_entry($cached_event_ids[$i]); 2337 2338 //echo "<br>antrrrrroooo".$event['start']." a ".$event['end']." b ".$event['id']; 2282 2339 if ($event['recur_type']) 2283 2340 { … … 2287 2344 $enddate = (int)(date('Ymd',$this->maketime($event['end']))); 2288 2345 $this->cached_events[$startdate][] = $event; 2346 //echo "ver".$event['recur_type'].$startdate." ---".$enddate."<br>antrrrrroooo";; 2289 2347 if($startdate != $enddate) 2290 2348 { … … 2294 2352 for($j=$startdate,$k=0;$j<=$enddate;$k++,$j=(int)(date('Ymd',mktime(0,0,0,$start['month'],$start['mday'] + $k,$start['year'])))) 2295 2353 { 2354 2355 2296 2356 $c_evt_day = count($this->cached_events[$j]) - 1; 2357 //echo "<br>aaaa".$c_evt_day."<br>antrrrrroooo"; ; 2297 2358 if($c_evt_day < 0) 2298 2359 { … … 2310 2371 } 2311 2372 $this->cached_events[$j][] = $event; 2373 //echo "<br>llll:".$event."<br>antrrrrroooo";; 2312 2374 } 2313 2375 if ($j >= $cache_start && (@$params['no_doubles'] || @$this->xmlrpc)) … … 2323 2385 if($c_cached_ids_repeating) 2324 2386 { 2387 //echo "repeaiting".$c_cached_ids_repeating; 2388 2325 2389 for($i=0;$i<$c_cached_ids_repeating;$i++) 2326 2390 { 2327 $this->repeating_events[$i] = "";//$this->so->read_entry($cached_event_ids_repeating[$i]); 2391 $this->repeating_events[$i] = $this->so->read_entry($cached_event_ids_repeating[$i]); 2392 //echo "abc".$this->repeating_events[$i]."<br>"; 2328 2393 if($this->debug) 2329 2394 { … … 2339 2404 } 2340 2405 $this->check_repeating_events($date); 2406 2407 2341 2408 if($this->debug) 2342 2409 { … … 2349 2416 } 2350 2417 } 2418 2419 //echo "countt".count($this->cached_events); 2351 2420 $retval = Array(); 2352 2421 for($j=date('Ymd',mktime(0,0,0,$smonth,$sday,$syear)),$k=0;$j<=date('Ymd',mktime(0,0,0,$emonth,$eday,$eyear));$k++,$j=date('Ymd',mktime(0,0,0,$smonth,$sday + $k,$syear))) 2353 2422 { 2423 //echo "vueltaaaa".$j."<br>"; 2354 2424 if(is_array($this->cached_events[$j])) 2355 2425 { … … 2359 2429 { 2360 2430 $retval[] = $this->xmlrpc_prepare($event); 2431 //echo "cachhhhhheeeeeqqq2222".$this->xmlrpc_prepare($event)."<br>"; 2361 2432 } 2362 2433 } … … 2364 2435 { 2365 2436 $retval[$j] = $this->cached_events[$j]; 2366 } 2367 } 2437 //foreach($this->cached_events[$j][0] as $c=>$v) 2438 //echo "<p>El vector con indice $c tiene el valor $v </p>"; 2439 //echo "cachhhhhheeeeeqqq".$this->cached_events[$j][0]['public']."<br>"; 2440 } 2441 } 2442 2443 2368 2444 } 2369 2445 //echo "store_to_cache(".print_r($params,True).")=<pre>".print_r($retval,True)."</pre>\n"; 2370 //$this->so->cal->event = $cached_event;2446 $this->so->cal->event = $cached_event; 2371 2447 return $retval; 2372 2448 }
Note: See TracChangeset
for help on using the changeset viewer.