[Alba-desarrollo] SVN Alba r4759 - in prosistem/alba/trunk/alba/apps/principal/modules/icalVisualizador: actions templates

commits en pressenter.com.ar commits en pressenter.com.ar
Mie Jun 20 18:55:06 CEST 2007


Author: josx
Date: 2007-06-20 13:55:03 -0300 (Wed, 20 Jun 2007)
New Revision: 4759

Modified:
   prosistem/alba/trunk/alba/apps/principal/modules/icalVisualizador/actions/actions.class.php
   prosistem/alba/trunk/alba/apps/principal/modules/icalVisualizador/actions/components.class.php
   prosistem/alba/trunk/alba/apps/principal/modules/icalVisualizador/templates/_verPorSemana.php
Log:
Mejora a la visualizacion del calendario por semana

Modified: prosistem/alba/trunk/alba/apps/principal/modules/icalVisualizador/actions/actions.class.php
===================================================================
--- prosistem/alba/trunk/alba/apps/principal/modules/icalVisualizador/actions/actions.class.php	2007-06-20 16:24:51 UTC (rev 4758)
+++ prosistem/alba/trunk/alba/apps/principal/modules/icalVisualizador/actions/actions.class.php	2007-06-20 16:55:03 UTC (rev 4759)
@@ -38,7 +38,18 @@
         default: $this->view = "verPorDia"; 
     }
 
+    // falta ver en el calendario mensual:
 
+    // de juntar la actuales dos
+    // partes donde se cicla por 4 trs y luego por cada dia de toda la semana
+    // Esto es por no poder discriminar entre en los que hay eventos o no previamente
+
+    // Además incorporar el tema de que funcione para todos los dias de la semana (no solo para el primero)
+
+    // También considerar si no empiezan en punto.
+    
+
+
     $this->archivo = "/tmp/pepe.ics";
 
   }

Modified: prosistem/alba/trunk/alba/apps/principal/modules/icalVisualizador/actions/components.class.php
===================================================================
--- prosistem/alba/trunk/alba/apps/principal/modules/icalVisualizador/actions/components.class.php	2007-06-20 16:24:51 UTC (rev 4758)
+++ prosistem/alba/trunk/alba/apps/principal/modules/icalVisualizador/actions/components.class.php	2007-06-20 16:55:03 UTC (rev 4759)
@@ -49,25 +49,30 @@
         require(sfConfig::get('sf_app_module_dir')."/icalVisualizador/".sfConfig::get('sf_app_module_lib_dir_name')."/ical_parser.php");
         $aEvent = @icalToArray($this->archivo);
 
-        $nbrGridCols = 1;
-        foreach($aEvent as $day) {
-            foreach($day as $time) {
-                foreach($time as $event) {
-                     $nbrGridCols = $this->kgv($nbrGridCols, ($event['event_overlap'] + 1));
-                }
-            }
-        }
-
-        $this->nbrGridCols = $nbrGridCols;
         $date = $this->getDate();
         $this->aEvent = $aEvent;
-        $this->aWeek = $this->getWeekRange($date);
+        $aWeek = $this->getWeekRange($date);
         $this->aTime = $this->getTimeRange();
         $this->l_calendar = "";
         $this->calendar_name = "XXXX";
         $this->date = strtotime($date);
-        $this->day_end_of_week = $this->aWeek[6]['day'];
-        $this->day_start_of_week =  $this->aWeek[0]['day'];
+        $this->day_end_of_week = $aWeek[6]['day'];
+        $this->day_start_of_week =  $aWeek[0]['day'];
+
+        foreach($aWeek as $week) {
+            $nbrGridCols[$week['day']] = 1;
+            $idx = date("Ymd", $week['day']);
+            if(array_key_exists($idx, $aEvent)) {
+                foreach($aEvent[$idx] as $day) {
+                    foreach($day as $event) {
+                        $nbrGridCols[$week['day']] = $this->kgv($nbrGridCols[$week['day']], ($event['event_overlap'] + 1));
+                    }
+                }
+            }
+        }
+        $this->nbrGridCols = $nbrGridCols;
+        $this->aWeek  = $aWeek;
+
     }
 
 

Modified: prosistem/alba/trunk/alba/apps/principal/modules/icalVisualizador/templates/_verPorSemana.php
===================================================================
--- prosistem/alba/trunk/alba/apps/principal/modules/icalVisualizador/templates/_verPorSemana.php	2007-06-20 16:24:51 UTC (rev 4758)
+++ prosistem/alba/trunk/alba/apps/principal/modules/icalVisualizador/templates/_verPorSemana.php	2007-06-20 16:55:03 UTC (rev 4759)
@@ -60,7 +60,7 @@
                                                     $day_of_week = date('w', $date);
                                                     foreach($aWeek as $week) {
                                                 ?> <!-- Aca va el colspan dinamico-->
-                                                <td width="80" colspan="1" align="center" class="<?php echo ($i == $day_of_week)?'rowToday':'rowOff';?>" onmouseover="this.className='rowOn'" onmouseout="this.className='<?php echo ($i == $day_of_week)?'rowToday':'rowOff';?>'" onclick="window.location.href='?view=day&amp;date=<?php echo date('Ymd',$week['day'])?>'">
+                                                <td width="80" colspan="<?php echo $nbrGridCols[$week['day']]?>" align="center" class="<?php echo ($i == $day_of_week)?'rowToday':'rowOff';?>" onmouseover="this.className='rowOn'" onmouseout="this.className='<?php echo ($i == $day_of_week)?'rowToday':'rowOff';?>'" onclick="window.location.href='?view=day&amp;date=<?php echo date('Ymd',$week['day'])?>'">
                                                 <a class="ps3" href="?view=day&amp;date=<?php echo date('Ymd',$week['day'])?>"><span class="V9BOLD"><?php echo date('F j, Y',$week['day'])?></span></a> 
                                                 </td>
                                                 <?php 
@@ -68,7 +68,7 @@
                                                     } 
                                                 ?>
                                             </tr>
--
+
                                             <tr valign="top" id="allday">
                                                 <td width="60" class="rowOff2" colspan="4"><img src="images/spacer.gif" width="60" height="1" alt=" " /></td>
                                                 <td width="1"></td>
@@ -76,15 +76,20 @@
                                                     $i=0; 
                                                     $day_of_week = date('w', $date);
                                                     foreach($aWeek as $week) {
-                                                ?> <!-- Aca va el colspan dinamico-->
-                                                <td width="80" colspan="1" class="rowOff"><!-- <div class="alldaybg_{CALNO}"> {ALLDAY}  <img src="images/spacer.gif" width="80" height="1 alt=" " /></div>--></td>
+                                                ?> 
+                                                <td width="80" colspan="<?php echo $nbrGridCols[$week['day']]?>" class="rowOff"><!-- <div class="alldaybg_{CALNO}"> {ALLDAY}  <img src="images/spacer.gif" width="80" height="1 alt=" " /></div>--></td>
                                                 <?php 
                                                         $i++;
                                                     }
                                                 ?>
                                             </tr>
 
-                                            <?php
+
+
+
+
+
+                                            <?php 
                                                 $date_ymd = date("Ymd", $date);
                                                 for($i = 0, $max = count($aTime); $i < $max; $i += 4) { 
                                                     $time_idx0 = date("Gi",$aTime[$i]);
@@ -92,56 +97,46 @@
                                                     $time_idx2 = date("Gi",$aTime[($i+2)]);
                                                     $time_idx3 = date("Gi",$aTime[($i+3)]);
 
+                                                    
                                                     if(!(  array_key_exists($date_ymd, $aEvent) AND 
                                                         (array_key_exists($time_idx0, $aEvent[$date_ymd]) OR
                                                         array_key_exists($time_idx1, $aEvent[$date_ymd]) OR
                                                         array_key_exists($time_idx2, $aEvent[$date_ymd]) OR
                                                         array_key_exists($time_idx3, $aEvent[$date_ymd])) 
                                                         )) { 
+
+
+
                                             ?>
+<?php
+ for($k=0;$k<4;$k++) {
+?>
                                             <tr>
-                                                <td colspan="4" rowspan="4" align="center" valign="top" width="60" class="timeborder"><?php echo date("H:i A",$aTime[$i])?></td>
-                                                <td bgcolor="#a1a5a9" width="1" height="15"></td>
-                                                <td width="40" colspan="1"  class="weekborder">&nbsp;</td>
-                                                <td width="40" colspan="1"  class="weekborder">&nbsp;</td>
-                                                <td width="40" colspan="1"  class="weekborder">&nbsp;</td>
-                                                <td width="40" colspan="1"  class="weekborder">&nbsp;</td>
-                                                <td width="40" colspan="1"  class="weekborder">&nbsp;</td>
-                                                <td width="40" colspan="1"  class="weekborder">&nbsp;</td>
-                                                <td width="40" colspan="1"  class="weekborder">&nbsp;</td>
+<?php if( $k==0) { ?>
+                                <td colspan="4" rowspan="4" align="center" valign="top" width="60" class="timeborder"><?php echo date("H:i A",$aTime[$i])?></td>
+<? } ?>
+                                <td bgcolor="#a1a5a9" width="1" height="15"></td>
+<?
+
+foreach($aWeek as $week) {
+    $drawWidth = 1;
+    $width = round ((80/$nbrGridCols[$week['day']])*$drawWidth);
+?>
+    <td width="<?php echo $width?>" colspan="<?php echo $nbrGridCols[$week['day']]?>"  class="weekborder">&nbsp;</td>
+<? }
+?>
                                             </tr>
+<?php
+}
+?>
 
-                                            <tr>
-                                                <td bgcolor="#a1a5a9" width="1" height="15"></td><td width="80" colspan="1"  class="weekborder">&nbsp;</td>
-                                                <td width="80" colspan="1"  class="weekborder">&nbsp;</td>
-                                                <td width="80" colspan="1"  class="weekborder">&nbsp;</td>
-                                                <td width="80" colspan="1"  class="weekborder">&nbsp;</td>
-                                                <td width="80" colspan="1"  class="weekborder">&nbsp;</td>
-                                                <td width="80" colspan="1"  class="weekborder">&nbsp;</td>
-                                                <td width="80" colspan="1"  class="weekborder">&nbsp;</td>
-                                            </tr>
-                                            <tr>
-                                                <td bgcolor="#a1a5a9" width="1" height="15"></td>
-                                                <td width="80" colspan="1"  class="weekborder">&nbsp;</td>
-                                                <td width="80" colspan="1"  class="weekborder">&nbsp;</td>
-                                                <td width="80" colspan="1"  class="weekborder">&nbsp;</td>
-                                                <td width="80" colspan="1"  class="weekborder">&nbsp;</td>
-                                                <td width="80" colspan="1"  class="weekborder">&nbsp;</td>
-                                                <td width="80" colspan="1"  class="weekborder">&nbsp;</td>
-                                                <td width="80" colspan="1"  class="weekborder">&nbsp;</td>
-                                            </tr>
-                                            <tr>
-                                                <td bgcolor="#a1a5a9" width="1" height="15"></td>
-                                                <td width="80" colspan="1"  class="weekborder">&nbsp;</td>
-                                                <td width="80" colspan="1"  class="weekborder">&nbsp;</td>
-                                                <td width="80" colspan="1"  class="weekborder">&nbsp;</td>
-                                                <td width="80" colspan="1"  class="weekborder">&nbsp;</td>
-                                                <td width="80" colspan="1"  class="weekborder">&nbsp;</td>
-                                                <td width="80" colspan="1"  class="weekborder">&nbsp;</td>
-                                                <td width="80" colspan="1"  class="weekborder">&nbsp;</td>
-                                            </tr>
+
+
                                             <?php 
                                                     } else {
+
+
+
                                                         for($j=0;$j<4;$j++) {
                                                             if($j!=0) { 
                                             ?>
@@ -149,37 +144,62 @@
                                                 <td width="80" colspan="1"  class="weekborder">&nbsp;</td>
 
                                             <?php           } else {  ?>
-
                                             <tr>
                                                 <td colspan="4" rowspan="4" align="center" valign="top" width="60" class="timeborder"><?php echo date("H:i A",$aTime[$i])?></td><td bgcolor="#a1a5a9" width="1" height="15"></td>
                                                         
                                             <?php           } 
-                                                            $var_time_idx = "time_idx".$j;
-                                                            if(array_key_exists($$var_time_idx, $aEvent[$date_ymd])) {
+
+$var_time_idx = "time_idx".$j;
+
+
+foreach($aWeek as $week) {
+$date_ymd = date("Ymd",$week['day']);
+$drawWidth = 1;
+$width = round ((80/$nbrGridCols[$week['day']])*$drawWidth);
+
+                                                            if(array_key_exists($date_ymd, $aEvent) AND array_key_exists($$var_time_idx, $aEvent[$date_ymd])) {
                                                                 $k=0;
                                                                 foreach($aEvent[$date_ymd][$$var_time_idx] as $event) {
                                                                     $k++;
-                                                                    $rowspan = ceil(($event['event_length'] / 60 ) / 15); // en el array esta en seg lo divido 60 y obtengo min luego divido 15 min (que es una linea de rowspan y obtengo cantidad de lineas hacia abajo a rellenar
-?>
-                                                <td width="80" rowspan="<?php echo $rowspan?>" colspan="1" align="left" valign="top" class="eventbg2_1">
+                                                                    $rowspan = ceil(($event['event_length'] / 60 ) / 15); ?>
+
+                                                <td width="<?php echo $width?>" rowspan="<?php echo $rowspan?>" colspan="<?php echo floor($nbrGridCols[$week['day']] / ($event['event_overlap']+1)) ?>" align="left" valign="top" class="eventbg2_1">
                                                     <div class="eventfont">
                                                         <div class="eventbg_1"><b><?php echo date("H:i A", $event['start_unixtime'])?></b></div>
                                                         <div class="padd"><a class="ps" title="<?php echo $event['event_text']?>" href="#" onclick="openEventWindow(0); return false;"><?php echo $event['event_text']?></a>
                                                         </div>
                                                     </div>
                                                 </td>
-                                        <?php                   }
-                                                            } 
+                                        <?php                   } 
+                                                            } else {
+
+                                                            ?><td width="80" colspan="1"  class="weekborder">&nbsp;</td><?
+                                                            }
                                         ?>
 
-                                            </tr>
+                                            
+<?  
+}
+?></tr>
 
+
+
+
+
+
+
+
                                             <?php
                                                         }
                                                     }
                                                 }
                                             ?>
 
+
+
+
+
+
                                         </table>	
                                     </td>
                                 </tr>




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