[Alba-desarrollo] SVN Alba r5132 - prosistem/alba/trunk/alba/apps/principal/modules/cal/lib

commits en pressenter.com.ar commits en pressenter.com.ar
Lun Sep 24 19:42:16 CEST 2007


Author: josx
Date: 2007-09-24 14:42:15 -0300 (Mon, 24 Sep 2007)
New Revision: 5132

Modified:
   prosistem/alba/trunk/alba/apps/principal/modules/cal/lib/draw_functions.php
   prosistem/alba/trunk/alba/apps/principal/modules/cal/lib/ical_parser.php
   prosistem/alba/trunk/alba/apps/principal/modules/cal/lib/overlapping_events.php
   prosistem/alba/trunk/alba/apps/principal/modules/cal/lib/template.php
Log:
Se arreglo el problema de visualizacion de los calendarios. Existia una variable gridlength que estaba como global en varias funciones y no se habia modificado

Modified: prosistem/alba/trunk/alba/apps/principal/modules/cal/lib/draw_functions.php
===================================================================
--- prosistem/alba/trunk/alba/apps/principal/modules/cal/lib/draw_functions.php	2007-09-24 13:42:08 UTC (rev 5131)
+++ prosistem/alba/trunk/alba/apps/principal/modules/cal/lib/draw_functions.php	2007-09-24 17:42:15 UTC (rev 5132)
@@ -1,8 +1,8 @@
 <?php
 // function returns starttime and endtime and event length for drawing into a grid
 
-function drawEventTimes ($start, $end) {
-	global $gridLength;
+function drawEventTimes ($start, $end, $gridLength) {
+// 	global $gridLength;
 	
 	preg_match ('/([0-9]{2})([0-9]{2})/', $start, $time);
 	$sta_h = $time[1];

Modified: prosistem/alba/trunk/alba/apps/principal/modules/cal/lib/ical_parser.php
===================================================================
--- prosistem/alba/trunk/alba/apps/principal/modules/cal/lib/ical_parser.php	2007-09-24 13:42:08 UTC (rev 5131)
+++ prosistem/alba/trunk/alba/apps/principal/modules/cal/lib/ical_parser.php	2007-09-24 17:42:15 UTC (rev 5132)
@@ -227,7 +227,7 @@
 							unset($master_array[$start_date_tmp][$old_start_time]);
 						}
 					}
-					
+// 					print_R($overlap_array);
 					$write_processed = false;
 				} else {
 					$write_processed = true;
@@ -265,7 +265,7 @@
 						$length = ($time2[1]*60+$time2[2]) - ($time[1]*60+$time[2]);
 					}
 					
-					$drawKey = drawEventTimes($start_time, $end_time);
+					$drawKey = drawEventTimes($start_time, $end_time, $gridLength);
 					preg_match ('/([0-9]{2})([0-9]{2})/', $drawKey['draw_start'], $time3);
 					$hour = $time3[1];
 					$minute = $time3[2];
@@ -360,7 +360,7 @@
 							if (isset($display_end_tmp)){
 								$master_array[$start_date_tmp][$time_tmp][$uid]['display_end'] = $display_end_tmp;
 							}
-							checkOverlap($start_date_tmp, $time_tmp, $uid, $master_array, $overlap_array);
+							checkOverlap($start_date_tmp, $time_tmp, $uid, $master_array, $overlap_array, $gridLength);
 							$start_tmp = strtotime('+1 day',$start_tmp);
 						}
 						if (!$write_processed) $master_array[$start_date][($hour.$minute)][$uid]['exception'] = true;
@@ -395,7 +395,7 @@
 							if (isset($display_end_tmp)){
 								$master_array[($start_date)][($hour.$minute)][$uid]['display_end'] = $display_end_tmp;
 							}
-							checkOverlap($start_date, ($hour.$minute), $uid, $master_array, $overlap_array);
+							checkOverlap($start_date, ($hour.$minute), $uid, $master_array, $overlap_array, $gridLength);
 							if (!$write_processed) $master_array[($start_date)][($hour.$minute)][$uid]['exception'] = true;
 						}
 					}
@@ -857,7 +857,7 @@
 																if (isset($display_end_tmp)){
 																	$master_array[$start_date_tmp][$time_tmp][$uid]['display_end'] = $display_end_tmp;
 																}
-																checkOverlap($start_date_tmp, $time_tmp, $uid, $master_array, $overlap_array);
+																checkOverlap($start_date_tmp, $time_tmp, $uid, $master_array, $overlap_array, $gridLength);
 															}
 															$start_tmp = strtotime('+1 day',$start_tmp);
 														}
@@ -894,7 +894,7 @@
 															if (isset($display_end_tmp)){
 																$master_array[($recur_data_date)][($hour.$minute)][$uid]['display_end'] = $display_end_tmp;
 															}
-															checkOverlap($recur_data_date, ($hour.$minute), $uid, $master_array, $overlap_array);
+															checkOverlap($recur_data_date, ($hour.$minute), $uid, $master_array, $overlap_array, $gridLength);
 														}
 													}
 												}
@@ -1213,12 +1213,12 @@
 //If you want to see the values in the arrays, uncomment below.
 
 // print '<pre>';
-// print_r($master_array);
+//  print_r($master_array);
 // print_r($overlap_array);
 // print_r($day_array);
-// print_r($rrule_array);
-// print_r($recurrence_delete);
-// print_r($cal_displaynames);
-// print_r($cal_filelist);
-// print '</pre>';
+//  print_r($rrule_array);
+//  print_r($recurrence_delete);
+//  print_r($cal_displaynames);
+//  print_r($cal_filelist);
+ // print '</pre>';die;
 ?>

Modified: prosistem/alba/trunk/alba/apps/principal/modules/cal/lib/overlapping_events.php
===================================================================
--- prosistem/alba/trunk/alba/apps/principal/modules/cal/lib/overlapping_events.php	2007-09-24 13:42:08 UTC (rev 5131)
+++ prosistem/alba/trunk/alba/apps/principal/modules/cal/lib/overlapping_events.php	2007-09-24 17:42:15 UTC (rev 5132)
@@ -1,12 +1,4 @@
 <?php
-
-// Josx en este archivo esta el comienzo de los problemas.
-// Yo ya hice algunas modficaciones, en las funciones que reciben "ahora" $master y $overlap_array
-// fijate que estan comentadas la variables globales
-// Las invocaciones a estas funciones estan en el archivo ical_parser.php y creo que en ningun otro archivo
-// Hay que probar como llegan, es decir con que valores, llegan las variables a la invocacion
-
-
 // function to determine maximum necessary columns per day
 // actually an algorithm to get the smallest multiple for two numbers
 function kgv($a, $b) {
@@ -79,7 +71,7 @@
 }
 
 // Merges overlapping blocks
-function flatten_ol_blocks($event_date, $ol_blocks, $new_block_key, $master_array) {
+function flatten_ol_blocks($event_date, $ol_blocks, $new_block_key, &$master_array) {
 
 // 	global $master_array;
 
@@ -117,14 +109,14 @@
 }
 
 // Builds $overlap_array structure, and updates event_overlap in $master_array for the given events.
-function checkOverlap($event_date, $event_time, $uid, $master_array, $overlap_array) {
+function checkOverlap($event_date, $event_time, $uid, &$master_array, &$overlap_array, $gridLength) {
 // 	global $master_array, $overlap_array;
 	//@annotation las globales se reemplazaron por parametros en las invocaciones de iacl_parser y aca
 	if (!isset($event_date)) return;
 	$event = $master_array[$event_date][$event_time][$uid];
 	// Copy out the array - we replace this at the end.
 	$ol_day_array = $overlap_array[$event_date];
-	$drawTimes = drawEventTimes($event['event_start'], $event['event_end']);
+	$drawTimes = drawEventTimes($event['event_start'], $event['event_end'], $gridLength);
 
 	// For a given date,
 	// 	- check to see if the event's already in a block, and if so, add it.
@@ -189,7 +181,7 @@
 			foreach ($time as $loop_event_key => $loop_event) {
 				// Make sure we haven't already dealt with the event, and we're not checking against ourself.
 				if ($loop_event['event_overlap'] == 0 && $loop_event_key != $uid) {
-					$loopDrawTimes = drawEventTimes($loop_event['event_start'], $loop_event['event_end']);
+					$loopDrawTimes = drawEventTimes($loop_event['event_start'], $loop_event['event_end'], $gridLength);
 					if ($loopDrawTimes['draw_start'] < $drawTimes['draw_end'] && $loopDrawTimes['draw_end'] > $drawTimes['draw_start']) {
 						if ($loopDrawTimes['draw_start'] < $drawTimes['draw_start']) {
 							$block_start = $loopDrawTimes['draw_start'];
@@ -239,7 +231,7 @@
 
 // Remove an event from the overlap data.
 // This could be completely bogus, since overlap array is empty when this gets called in my tests, but I'm leaving it in anyways.
-function removeOverlap($ol_start_date, $ol_start_time, $ol_key, $master_array, $overlap_array) {
+function removeOverlap($ol_start_date, $ol_start_time, $ol_key, &$master_array, &$overlap_array) {
 // 	global $master_array, $overlap_array;
 	//@annotation las globales se reemplazaron por parametros en las invocaciones de iacl_parser y aca
 	if (isset($overlap_array[$ol_start_date])) {

Modified: prosistem/alba/trunk/alba/apps/principal/modules/cal/lib/template.php
===================================================================
--- prosistem/alba/trunk/alba/apps/principal/modules/cal/lib/template.php	2007-09-24 13:42:08 UTC (rev 5131)
+++ prosistem/alba/trunk/alba/apps/principal/modules/cal/lib/template.php	2007-09-24 17:42:15 UTC (rev 5132)
@@ -471,7 +471,7 @@
 					#print "</pre>";
 
 					foreach ($this_time_arr as $eventKey => $loopevent) {
-						$drawEvent = drawEventTimes ($cal_time, $loopevent["event_end"]);
+						$drawEvent = drawEventTimes ($cal_time, $loopevent["event_end"], $this->gridLength);
 						$j = 0;
 						while (isset($event_length[$thisday][$j])) {
 							if ($event_length[$thisday][$j]["state"] == "ended") {
@@ -681,7 +681,7 @@
 			// check for eventstart 
 			if (isset($this_time_arr) && sizeof($this_time_arr) > 0) {
 				foreach ($this_time_arr as $eventKey => $loopevent) {
-					$drawEvent = drawEventTimes ($cal_time, $loopevent['event_end']);
+					$drawEvent = drawEventTimes ($cal_time, $loopevent['event_end'], $this->gridLength);
 					$j = 0;
 					while (isset($event_length[$j])) {
 						if ($event_length[$j]['state'] == 'ended') {




Más información sobre la lista de distribución Alba-desarrollo