Ver Mensaje Individual
  #17 (permalink)  
Antiguo 24/03/2008, 15:55
tuky
Usuario no validado
 
Fecha de Ingreso: julio-2003
Ubicación: <?="www.tuky.cl";?>
Mensajes: 132
Antigüedad: 21 años, 9 meses
Puntos: 4
Re: Calendario en ASP , se puede ???

calendario.asp
Código PHP:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<% 
Response.Expires = -%>
<%
    
Dim objXML
    Dim objItemList
    Dim objItem
    Dim event_ID
    Dim event_day
    Dim event_month
        
    Set objXML 
Server.CreateObject("MSXML2.FreeThreadedDOMDocument")
    
objXML.async False
    
    objXML
.setProperty "ServerHTTPRequest"True
    
    
If Request.QueryString("MES") <> "" AND Request.QueryString("ANIO") <> "" Then
        objXML
.Load("http://www.otroservidor.com/eventos/eventos.php?MES="&Request.QueryString("MES")&"&ANIO="&Request.QueryString("ANIO")&"")
    Else
        
objXML.Load("http://www.otroservidor.com/eventos/eventos.php")
    
End If
    
    If 
objXML.parseError.errorCode <> 0 Then
    End 
If
    
    
Set objItemList objXML.getElementsByTagName("item")
    
Set objXML Nothing

    
For Each objItem In objItemList
    
         event_ID 
objItem.childNodes(0).text&";"&event_ID
         event_day 
objItem.childNodes(1).text&";"&event_day
         event_month 
objItem.childNodes(2).text&";"&event_month
    
    Next
    
    Dim arrID
arrStartarrMonth
    arrID 
Split(event_ID,";")
    
arrDay Split(event_day,";")
    
arrMonth Split(event_month,";")

    
Set objItemList Nothing
    
    Dim todays_month
    Dim todays_year
    Dim today
    Dim todays_day
    Dim global_month
    Dim global_year
    Dim global_day
    
    today 
date
    global_day 
Day(today)
    
global_month Month(today)
    
global_year Year(today)

    If 
Request.QueryString("MES") <> "" AND Request.QueryString("ANIO") <> "" Then
        todays_day 
global_day
        todays_month 
Request.QueryString("MES")
        
todays_year Request.QueryString("ANIO")
    Else
        
todays_day day(today)
        
todays_month month(today)    
        
todays_year year(today)   
    
End If
         
month_names = Array("","ENERO","FEBRERO","MARZO","ABRIL","MAYO","JUNIO","JULIO","AGOSTO","SEPTIEMBRE","OCTUBRE","NOVIEMBRE","DICIEMBRE")                      
         
Response.Write("<div style=""border-top: 1px #148ECF solid;background-color: #7490D9;color: #FFFFFF;font-family: Arial Narrow, Arial, Helvetica, sans-serif;font-size: 14px;font-weight: normal;padding: 5px;margin-top: 0px;""><img src=""/lyd/eventos/dots.jpg"" />EVENTOS &gt; "&month_names(todays_month)&" "&todays_year&"</div>")
           
'#2D3192
         this_month = datevalue(todays_month & "/1/" & todays_year)                           
         next_month = datevalue(dateadd("m", 1, todays_month &  "/1/" & todays_year))
         
         '
Find out when this month starts and ends.         
         
first_week_day weekday(this_month2) - 1
         days_in_this_month 
datediff("d"this_monthnext_month)
         
         
         
' Obtener la cantidad de dias del mes anterior                 
                          
         calendar_html = "<table style=""border: #FFFFFF solid;margin:10px auto;"" align=""center"">"
                           
         calendar_html = calendar_html & "<tr>"
          
         '
Fill the first week of the month with the appropriate number of blanks.       
         for 
week_day 0 to first_week_day 1            
             calendar_html 
calendar_html "<td></td>"   
         
next
            
         week_day 
first_week_day
         total_day 
0
         
for day_counter 1 to days_in_this_month           
             week_day 
week_day mod 7
            
             
if week_day 0 then
                calendar_html 
calendar_html "</tr><tr>"
             
end if
            
             
'Do something different for the current day.
             
            arrID = Split(event_ID,";")
            arrDay = Split(event_day,";")
            arrMonth = Split(event_month,";")
            
            encontrado = 0
            
            For i = 0 to UBound(arrDay) - 1
                If CInt(arrDay(i)) = CInt(day_counter) and CInt(todays_month) = CInt(arrMonth(i)) Then
                     ' 
Si existe evento en actual dia                     
                     calendar_html 
calendar_html "<td style=""border: 0; font-family: Arial, Helvetica, sans-serif;    font-size: 12px; background-color: #FF6600;""><a href=""/eventos/"&arrID(i)&"/"" style=""color: #D8DEEA;text-align: center;font-weight: bold;padding: 5px; display: block; text-decoration: none;"">"day_counter &"</a></td>"
                    
encontrado 1
                End 
if
            
Next
            
            
if encontrado 0 then
                
            
            
             
if CInt(todays_day) = CInt(day_counter) and CInt(todays_month) = CInt(global_monththen
                calendar_html 
calendar_html "<td style=""border: 0;    font-family: Arial, Helvetica, sans-serif;    font-size: 12px;background-color: #3B5999;color: #D8DEEA;text-align: center;font-weight: bold;padding: 6px;font-weight: bold;"">" day_counter "</td>"
             
else
                
calendar_html calendar_html "<td style=""border: 0;    font-family: Arial, Helvetica, sans-serif;    font-size: 12px;background-color: #D8DEEA;text-align: center;font-weight: bold;padding: 6px;color:#3B5999;font-weight: normal;""> " day_counter "</td>"
             
end if
         
end if
             
week_day week_day 1
             total_day 
week_day
         next
        
         
if total_day 7 then
             total_day 
total_day
             
for day_next_month 1 to total_day

             calendar_html 
calendar_html "<td style=""border: 0; font-family: Arial, Helvetica, sans-serif;    font-size: 12px;background-color: #EEEEEE;text-align: center;font-weight: bold;padding: 6px;color: #999999;font-weight: normal;"">"&day_next_month&"</td>"
            
next
         end 
if
          
         
Dim next_month_link
         Dim last_month_link
          
         
if CInt(todays_month) = 12 then
             todays_year 
CInt(todays_year) + 1
             next_month_link 
"<a href=""/lyd/eventos/1/"&todays_year&"/"" onClick=""cargarMes('1', '"&todays_year&"', 'eventos_lyd'); return false;"">"&month_names(1)&"</a>"
            
todays_year CInt(todays_year) - 2
            last_month_link 
"<a href=""/lyd/eventos/11/"&todays_year&"/"" onClick=""cargarMes('11', '"&todays_year&"', 'eventos_lyd'); return false;"">"&month_names(11)&"</a>"
        
elseif CInt(todays_month) = 1 then
            todays_year 
CInt(todays_year)
            
next_month_link "<a href=""/lyd/eventos/2/"&todays_year&"/"" onClick=""cargarMes('2', '"&todays_year&"', 'eventos_lyd'); return false;"">"&month_names(2)&"</a>"
            
todays_year CInt(todays_year) - 1
            last_month_link 
"<a href=""/lyd/eventos/12/"&todays_year&"/"" onClick=""cargarMes('12', '"&todays_year&"', 'eventos_lyd'); return false;"">"&month_names(12)&"</a>"
        
else
            
todays_year CInt(todays_year)
            
next_month_link "<a href=""/lyd/eventos/"&(CInt(todays_month) + 1)&"/"&todays_year&"/"" onClick=""cargarMes('"&(CInt(todays_month) + 1)&"', '"&todays_year&"', 'eventos_lyd'); return false;"">"&month_names(CInt(todays_month) + 1)&"</a>"
            
last_month_link "<a href=""/lyd/eventos/"&(CInt(todays_month) - 1)&"/"&todays_year&"/"" onClick=""cargarMes('"&(CInt(todays_month) - 1)&"', '"&todays_year&"', 'eventos_lyd'); return false;"">"&month_names(CInt(todays_month) - 1)&"</a>"
        
end if
          
         
calendar_html calendar_html "</tr>"
         
calendar_html calendar_html "<tr><td colspan=""3"" style=""color: #3A8FC6;font-size: 11px;text-align: left;""><br />&laquo; "&last_month_link&"</td>"
         
calendar_html calendar_html "<td></td><td colspan=""3"" style=""color: #3A8FC6;font-size: 11px;text-align: right;""><br />"&next_month_link&" &raquo;</td></tr>"
         
calendar_html calendar_html "</table>"
                   
         
response.Write(calendar_html)
         
%> 
saludos,

tuky-