[-*Smarty*-]
[-config_load file="default.conf"-]
[-*Load the Language Definitions*-]
[-config_load file="lang.$USER_LANG"-]

[-* we want to include out stylesheet for this view*-]
[-fetch file="$TPL_STYLE_PATH/week.css" assign="css"-]
[-eval var=$css-]

[-if $PRINT_VIEW != 1-]
[-*Main Navigation*-]
[-include file="$TPL_NAME/views/global/navigation.html"-]
[-/if-]

<table width="100%" border="0" cellpadding="5" cellspacing="0" class="weekheader">
	<tr align="center">
    	<td width="100%" align="center" valign="middle" class="weekheader">
			<a href="[-$PREV_MONTH_URL-]">&lt;&lt;</a>
    		[-$DATE|pc_date_format:#_PC_DATE_FORMAT_MY#-]
			<a href="[-$NEXT_MONTH_URL-]">&gt;&gt;</a>
		</td>
		[-if $PRINT_VIEW != 1-]
		<td nowrap align="right" valign="top" class="monthheader">
			[-pc_view_select label=#_PC_TPL_VIEW_LABEL# class=""-]
		</td>
		[-/if-]
	</tr>
</table>

<table width="100%" border="0" cellpadding="0" cellspacing="0" class="calcontainer"><tr><td>
	[-* Loop through the EventsByDate array : This array contains data for each day in the view. *-]
	[-pc_sort_events var="S_EVENTS" sort="category" order="asc" value=$A_EVENTS-]
	[-foreach name=dates item=events key=cdate from=$S_EVENTS-]
	   	[-if $events|@count AND ($cdate >= $MONTH_START_DATE AND $cdate <= $MONTH_END_DATE)-]
			[-assign var="dayname" value=$cdate|date_format:"%w"-]
    		[-assign var="day" value=$cdate|date_format:"%d"|string_format:"%1d"-]
    		[-assign var="month" value=$cdate|date_format:"%m"|string_format:"%1d"-]
			[-assign var="month" value=$month-1-]
    		[-assign var="year" value=$cdate|date_format:"%Y"|string_format:"%4d"-]
			<table width="100%" border="0" cellpadding="5" cellspacing="0" class="dayheader">
        		<tr>
        			<td width="100%">
            			<a href="[-pc_url action=day date=$cdate-]">
						[-if $USE_INT_DATES eq true-]
							[-pc_date_format date=$cdate format=#_PC_DATE_FORMAT_INT#-]
						[-else-]	
							[-pc_date_format date=$cdate format=#_PC_DATE_FORMAT_STD#-]
						[-/if-]
						</a>
            		</td>
        		</tr>
    		</table>
			[-* Loop through the events for this day and display the event data *-]
			[-assign var="oldCat" value=""-]
			<table width="100%" border="0" cellpadding="0" cellspacing="0" class="eventslist">
        		<tr>
         			<td class="eventslist" width="100%">
					[-foreach name=eventloop key=id item=event from=$S_EVENTS.$cdate-]
    					[-assign var="cCat" value=$event.catname-]
							[-if $24HOUR_TIME-]
								[-assign var="timestamp" value=$event.startTime|date_format:#_PC_TIME_FORMAT_24#-]
							[-else-]
								[-assign var="timestamp" value=$event.startTime|date_format:#_PC_TIME_FORMAT_12#-]
							[-/if-]
							[-if $oldCat != $cCat-]
								[-if $smarty.foreach.eventloop.first != true-]
									</div>
								[-/if-]
								<div width="100%" style="padding: 2px; background-color: [-$event.catcolor-];">
									[-$event.catname-]
								</div>
								<div width="100%" style="padding: 2px; border:solid 1px [-$event.catcolor-];">
							[-/if-]
							[-if $event.alldayevent != true-]
								[-$timestamp-]
							[-/if-]
							<a href="[-pc_url action=detail eid=$event.eid date=$date-]" 
									 [-pc_popup delay="500" 
						            			bgcolor=$event.catcolor 
								    			caption=$event.title 
								    			text=$event.hometext-]>[-$event.title|strip_tags-]</a>
							[-if $event.alldayevent != true-]
                        		[-if $event.duration_hours > 0 or $event.duration_minutes > 0 -]
				    				([-$event.duration_hours-]:[-$event.duration_minutes-])
					    		[-/if-]
							[-/if-]
							<br />
							[-assign var="oldCat" value=$event.catname-]
							[-if $smarty.foreach.eventloop.last-]
								[-* we need to close out the <div> tag *-]
								</div>
							[-/if-]
					[-foreachelse-]
						&nbsp;
        			[-/foreach-]
					</td>
        		</tr>
    		</table>
		[-/if-]
	[-/foreach-]
</td></tr></table>
[-if $PRINT_VIEW != 1-]
<table width="100%" border="0" cellpadding="0" cellspacing="0">
    <tr>
        <td align="right">
            <a href="[-pc_url action="month" print="true"-]">[-#_PC_THEME_PRINT#-]</a>
        </td>
    </tr>
</table>
[-/if-]
[-*footer*-]
[-include file="$TPL_NAME/views/global/footer.html"-]
