{tpl_array_rearrange arr=$definitions index_of_index="code" index_of_value="name" assign="defs"}
{php}
$GLOBALS['g_obj_tage0303']->_smrt->_tpl_vars['defs'] = array('1' => '--- Show all') + $GLOBALS['g_obj_tage0303']->_smrt->_tpl_vars['defs'];
{/php}
<div id="agenda_list_container">

	<form method=post action="/event/" name="frm_event_select">
	<div id="agenda_bar">

		<div id="agenda_def_selector">
			<h3>SUBSPECIALITY:</h3>
			{ctrl type="cmb" name="def_select" value=$custom.selected_def|default:'1' options=$defs flags="CTRL_READONLY" argv="javascript=onchange=\"document.forms['frm_event_select'].submit();\""}

			<!--div id="selector_current" onClick="toggle_element(document.getElementById('selector_list'));"> --- Show All</div>
			<ul id="selector_list" style="display:sssnone;">
				<li><a href="/event/def/"> --- Show all</a></li>
				{foreach from=$definitions item=def}
					<li><a href="/event/def/{$def.code}">{$def.name}</a></li>
				{/foreach}
			</ul-->
		</div>

		<h3>SORT BY:</h3>
		<ul id="agenda_sort_list">
<!--			<li><a href="javascript:tage_change_order('')" {if !$custom.selected_order}class="active"{/if}>Date</a>
			<li><a href="javascript:tage_change_order('GATT_LOCATIE')" {if $custom.selected_order == 'GATT_LOCATIE'}class="active"{/if}>Location</a>
			<li><a href="javascript:tage_change_order('GATT_LAND')" {if $custom.selected_order == 'GATT_LAND'}class="active"{/if}>Country</a>
-->
			<li><a href="javascript:tage_change_order('GATT_DESC')" {if $custom.selected_order == 'GATT_DESC'}class="active"{/if}>Description</a>
		</ul>
	</div>
	{ctrl type=hdn name=agenda_order value=$custom.selected_order}
	<div id="agenda_ext_search" style="margin-bottom: 5px;">
		<div style="height:24px; background-color: #337AAB; margin-top:5px; padding: 4px 10px 0 10px;">
			<h3 style="font-size: 10px;"><a style="color:white" href="javascript:toggle_element(document.getElementById('ext_search_container'));">Extended search</a></h3>
		</div>

		<div id="ext_search_container" style="
			{if !$custom.show_ext_search}display:none;{/if}background-color: #FFE166; border:1px solid #337AAB; padding: 10px; ">
	
		<table border="0" cellspacing="1" cellpadding="0" style="">
			<tr>
				<td><label for="search_name">Date from:</label></td>
				<td class="fld_ctrl">
					{ctrl type="cmb" name="search_datefrom_month" options=$custom.months value=$smarty.request.search_datefrom_month argv="max_rows=12" flags="CTRL_READONLY"}
					{ctrl type="cmb" name="search_datefrom_year" options=$custom.years value=$smarty.request.search_datefrom_year flags="CTRL_READONLY"}
				</td>
			</tr>
			<tr>
				<td><label for="search_name">Date till:</label></td>
				<td class="fld_ctrl">
					{ctrl type="cmb" name="search_datetill_month" value=$smarty.request.search_datetill_month options=$custom.months argv="max_rows=12" flags="CTRL_READONLY"}
					{ctrl type="cmb" name="search_datetill_year" value=$smarty.request.search_datetill_year options=$custom.years  flags="CTRL_READONLY"}
				</td>
			</tr>
			<tr>
				<td><label for="search_name">Name:</label></td>
				<td class="fld_ctrl">{ctrl type="txt" name="search_name" value=$smarty.request.search_name}</td>
			</tr>
			<tr>
				<td><label for="search_name">Description:</label></td>
				<td class="fld_ctrl">{ctrl type="txt" name="search_desc" value=$smarty.request.search_desc}</td>
			</tr>
			<tr>
				<td><label for="search_country">Country:</label></td>
				<td class="fld_ctrl">{ctrl type="cmb" name="search_country" value=$smarty.request.search_country|default:1 options=$custom.country_list flags="CTRL_READONLY"}</td>
			</tr>
			<tr>
				<td><label for="search_location">City:</label></td>
				<td class="fld_ctrl">{ctrl type="cmb" name="search_location" value=$smarty.request.search_location|default:1 options=$custom.location_list flags="CTRL_READONLY"}</td>
			</tr>
			<tr>
				<td><input class="submit_btn" type="button" value="Clear" onClick="document.location.href='/event/';"></td>
				<td><input class="submit_btn" type="submit" value="Search"></td>
			</tr>
		</table>
		</div>
	</div>

	</form>

	{foreach from=$agendapoints item=agp}
		
		<div class="agenda_point" style="width:100%;" onMouseOver="this.style.backgroundColor = '#FCF4D2';" onMouseOut="this.style.backgroundColor = 'white';" onClick="document.location.href='/event/item/{$agp.id}';">
			<div class="date_info" style="float:left; width: 15%;">
				<strong>{$agp.startdate|substr:0:2|trim}{if $agp.enddate && $agp.startdate|substr:0:2|trim != $agp.enddate|substr:0:2|trim}-{$agp.enddate|substr:0:2|trim}{/if}</strong>
				<br><br>
				{*$agp.startdate_timestamp|date_format:"%A, %B %e, %Y"*}
				{if !$agp.enddate}
					{$agp.startdate|substr:2|trim|replace:" 00:00":""}
				{else}
					{if $agp.startdate|substr:2:4|trim|replace:" 00:00":"" != $agp.enddate|substr:2:4|trim|replace:" 00:00":""}
						
						{$agp.startdate|substr:2:4|trim|replace:" 00:00":""} - {$agp.enddate|substr:2:9|trim|replace:" 00:00":""}
					{else}
						{$agp.startdate|substr:2:9|trim|replace:" 00:00":""}
					{/if}

				{/if}
				{if 0 && $agp.enddate}
					- {$agp.enddate|replace:" 00:00":""}
				{/if}
			</div>
			<div class="desc" style="float:left;width:85%;">
				<div class="def_name" style="color: #005996; font-size:10px;">{$defs[$agp.def_code]}</div>

				<h3><a href="/event/item/{$agp.id}">{$agp.name}</a></h3>
				{$agp.attributes.GATT_DESC.value|nl2br}
				<br><br>
		
				{if $agp.attributes.GATT_LAND.value}
					<b>Country:</b> {$agp.attributes.GATT_LAND.value}<br>
				{/if}
				{if $agp.attributes.GATT_LOCATIE.value}
					<b>City:</b> {$agp.attributes.GATT_LOCATIE.value}<br>
				{/if}


				<br>
				{$agp.startdate|replace:" 00:00":""}{if $agp.enddate} - {$agp.enddate|replace:" 00:00":""}{/if}
			</div>
			<br style="clear:both">
		</div>
	{foreachelse}
		<div class="agenda_point" style="width: 100%; padding: 30px;">
			Nothing found
		</div>
	{/foreach}

</div>