Location: PHPKode > projects > Enigma > Enigma2/Enigma2_Install/Themes/Enigma/portal/ResourceIndex.template.php
<?php

function template_script_above()
{
	global $context, $txt, $scripturl, $settings;

	echo '
<style>
#usenav
{
	border: 1px solid #808080;
	padding: 1;
	background-color: #E1E1E1;
	text-align: center;
}

.usenav, .usenav:link, .usenav:visited, a.usenav:hover
{
	letter-spacing: 2pt;
	font-weight: bold;
	color: #494949;
	text-decoration: none;
}
</style>
<form name="form1" method="post" action="', $scripturl, '?module=ResourceIndex;sa=search">
<div class="tborder">
	<table width="100%" border="0" cellspacing="1" cellpadding="3" align="center">
		<tr class="catbg">
			<td width="100%" height="19">', theme_linktree(), '</td>
		</tr>
	</table>
</div>
</form>';

	echo '
<table border="0" cellpadding="2" cellspacing="1" width="100%">
	<tr>
		<td width="20%" valign="top">', template_sections(), '</td>
		<td width="80%" valign="top">';
}

function template_script_below()
{
	global $context, $txt, $scripturl, $settings;

	echo '</td>
	</tr>
</table>

<form name="form1" method="post" action="', $scripturl, '?module=ResourceIndex;sa=search">
<div class="tborder">
	<table width="100%" border="0" cellspacing="1" cellpadding="3" align="center">
		<tr class="catbg">
			<td width="100%" height="19">', theme_linktree(), '</td>
		</tr>
	</table>
</div>
</form>';

}

function template_script_main()
{
	global $context, $txt, $scripturl, $settings;

	echo '
<div class="tborder" style="padding: 2px;">
	<div class="titlebg" style="margin-bottom: 1px; padding: 2px;">', $context['curr_sec']['Title'], ' Resource Index</div>
	<div class="windowbg2" style="padding: 2px;">', $context['curr_sec']['description'], '</div>
</div>
<br />';

	if ($context['no_cats'] != '0')
	{
		echo '
<div class="tborder">
	<table width="100%" border="0" cellspacing="1" cellpadding="3" align="center">
		<tr>';

		$x=0;
		$l=count($context['script_cat']);
		foreach ($context['script_cat'] AS $cat)
		{
			if ($x > $l) break;

			if ($x++ % 2 == 0)
				echo '
			</tr><tr>';

			echo '
				<td class="windowbg2" width="50%" valign="middle" style="margin-right: 0px; padding-right: 0px; margin-bottom: 0px; padding-bottom: 0px;">
					<div style="float: left; height: 20px;" valign="middle"><a href="', $scripturl, '?module=ResourceIndex;sa=add;id=', $cat['id'], ';id_sec=',$context['curr_sec']['ID_SEC'],'"><img src="', $settings['images_url'], ($cat['ct']!=0)?'/icons/new_script.gif':'/icons/script.gif', '" border="0" alt="Add A Resource to this Category" /></a> <a href="?module=ResourceIndex;sa=cat;id=', $cat['id'], ';id_sec=',$context['curr_sec']['ID_SEC'],'">', $cat['cat'], '</font></a> <i>(', $cat['ct'], ')</i>', $cat['isnew'], ($cat['isnew']) ? ' <small>(' . $cat['last'] . ' days old)</small>':'';

			if (!empty($context['script_scat'][$cat['id']]))
			{
				echo '<br /><small><div style="margin-left: 25px;">';
				foreach ($context['script_scat'][$cat['id']] AS $subcat)
				{
					echo ' &nbsp;<a href="?module=ResourceIndex;sa=cat;id=', $subcat['id'], ';id_sec=',$context['curr_sec']['ID_SEC'],'">', $subcat['cat'], '</font></a> <i>(', $subcat['ct'], ')</i>';
				}
				echo '</small></div>';
			}

			echo '</div></td>';

			if (($x % 2 == 1) && ($x == $l) && $context['no_cats'] != 1)
			echo '
				<td class="windowbg2" width="50%" valign="middle" style="margin-right: 0px; padding-right: 0px; margin-bottom: 0px; padding-bottom: 0px;"></td>';
		}

		echo '
			</td>
		</tr>
</table>
</div>
';
	}
	else
	{
		echo '<blockquote>No categories have been setup in this section.</blockquote>';
	}
}

function template_script_cats()
{
	global $context, $txt, $scripturl, $settings;

	if ($context['no_scats'] != '0')
	{
		echo '
<div class="tborder">
	<table width="100%" border="0" cellspacing="1" cellpadding="3" align="center">
		<tr>';

	$x=0;
	foreach ($context['script_cat'] AS $cat)
	{
		if ($x++ % 2 == 0)
			echo '
			</tr><tr>';

		echo '
				<td class="windowbg2" width="50%" valign="middle" style="margin-right: 0px; padding-right: 0px; margin-bottom: 0px; padding-bottom: 0px;">
					<div style="float: left; height: 20px;" valign="middle"><a href="', $scripturl, '?module=ResourceIndex;sa=add;id=', $cat['id'], ';id_sec=',$context['curr_sec']['ID_SEC'],'"><img src="', $settings['images_url'], ($cat['ct']!=0)?'/icons/new_script.gif':'/icons/script.gif', '" border="0" alt="Add A Resource to this Category" /></a> <a href="?module=ResourceIndex;sa=cat;id=', $cat['id'], ';id_sec=',$context['curr_sec']['ID_SEC'],'">', $cat['cat'], '</font></a> <i>(', $cat['ct'], ')</i></div></td>';

		if (($x % 2 != 0) && ($x >= $context['no_scats']) && $context['no_scats'] != 1)
		echo '
				<td class="windowbg2" width="50%" valign="middle" style="margin-right: 0px; padding-right: 0px; margin-bottom: 0px; padding-bottom: 0px;"></td>';

	}

	echo '
			</td>
		</tr>
</table>
</div>';
	}

	if ($context['no_scripts'] <= '0')
	{
		echo '<div class="tborder"><div class="windowbg2" style="padding: 3px;"><blockquote>No scripts have been submitted to this category.</blockquote></div></div>';
	}
	else
	{

		foreach ($context['cscripts'] AS $script)
		{
			$links = '<a href="' . $scripturl . '?module=ResourceIndex;sa=view;id=' . $script['id'] . ';id_sec=' . $context['ID_SEC'] . '">View More</a>';
			//if ($script['homeurl'])	$links .= '[<a href="out.php?id='.$script['id'].'&home=1" target="'.$script['id'].'">Homepage</a>]';
			//if ($script['dlurl'])		$links .= '[<a href="out.php?id='.$script['id'].'&dl=1">Download</a>]';
			//if ($script['demourl'])	$links .= '[<a href="out.php?id='.$script['id'].'&demo=1" target="'.$script['id'].'">Demo</a>]';

		echo '
<div class="tborder">
	<table width="100%" border="0" cellspacing="2" cellpadding="3" align="center">
		<tr> 
			<td class="titlebg" width="50%"><b><a href="', $scripturl, '?module=ResourceIndex;sa=view;id=',$script['id'],';id_sec=', $context['ID_SEC'], '">',$script['title'],'</a></td>
			<td class="titlebg" width="50%" align="right"><small>Added: '.$script['added'].'</small></td>
		</tr><tr> 
			<td class="windowbg2" colspan="2">
				<table border="0" cellpadding="3" cellspacing="2" style="margin-left: 10px;" width="100%">
					<tr>
						<td width="*">',$script['descr'], '</td>
						<td width="100" valign="top">
						<!-- viewer options, vote, view, blah, blah -->
							<div class="tborder">
								<table border="0" cellpadding="3" cellspacing="2" width="100%">
									<tr>
										<td class="windowbg" width="100%" id="usenav" onmouseover="this.style.backgroundColor=\'#BDD0C1\'" onmouseout="this.style.backgroundColor=\'#E1E1E1\'" onclick="this.style.backgroundColor=\'#C0C0C0\'; window.location.href=\'', $scripturl, '?module=ResourceIndex;sa=view;id=', $script['id'], ';id_sec=', $context['ID_SEC'], '\'" style="cursor: pointer;">
											<a href="', $scripturl, '?module=ResourceIndex;sa=view;id=', $script['id'], ';id_sec=', $context['ID_SEC'], '" class="usenav">View</a></td>
									</tr><tr>
										<td class="windowbg" width="100%" id="usenav" onmouseover="this.style.backgroundColor=\'#BDD0C1\'" onmouseout="this.style.backgroundColor=\'#E1E1E1\'" onclick="this.style.backgroundColor=\'#C0C0C0\'; window.location.href=\'', $scripturl, '?module=ResourceIndex;sa=view;id=', $script['id'], ';id_sec=', $context['ID_SEC'], '\'" style="cursor: pointer;">
											<a href="', $scripturl, '?module=ResourceIndex;sa=view;id=', $script['id'], ';id_sec=', $context['ID_SEC'], '#vote" class="usenav">Vote</a></td>
									</tr><tr>
										<td class="windowbg" width="100%" id="usenav" onmouseover="this.style.backgroundColor=\'#BDD0C1\'" onmouseout="this.style.backgroundColor=\'#E1E1E1\'" onclick="this.style.backgroundColor=\'#C0C0C0\'; window.location.href=\'', $scripturl, '?module=ResourceIndex;sa=view;id=', $script['id'], ';id_sec=', $context['ID_SEC'], '\'" style="cursor: pointer;">
											Review</td>
									</tr><tr>
										<td class="windowbg" width="100%" id="usenav" onmouseover="this.style.backgroundColor=\'#BDD0C1\'" onmouseout="this.style.backgroundColor=\'#E1E1E1\'" onclick="this.style.backgroundColor=\'#C0C0C0\'; window.location.href=\'', $scripturl, '?module=ResourceIndex;sa=view;id=', $script['id'], ';id_sec=', $context['ID_SEC'], '\'" style="cursor: pointer;">
											&nbsp;</td>
									</tr>
								</table></div>
						<!-- viewer options, vote, view, blah, blah --></td>
					</tr>
				</table><br />
			<div class="tborder">
				<table border="0" cellpadding="2" cellspacing="1" width="100%">
					<tr>
						<td class="windowbg" width="10%"><small>Price: ', $script['price'], '</small></td>
						<td class="windowbg" width="10%"><small>Hits: ', $script['hitsout'], '</small></td>
						<td class="windowbg" width="10%"><small>Views: ', $script['views'], '</small></td>
						<td class="windowbg" width="20%"><small>Downloads: ', $script['downloads'], '</small></td>
						<td class="windowbg" width="25%"><small>Reviews<br /><img src="', $settings['images_url'], '/rating.php?rating=', $script['rating'], '" border="0" alt="', $script['rating'], '%" /></small></td>
						<td class="windowbg" width="35%"><small>Rating<br /><img src="', $settings['images_url'], '/rating.php?rating=', $script['rating'], '" border="0" alt="', $script['rating'], '%" /></small></td>
					</tr>
				</table>
			</div></td>
		</tr>
	</table>
</div>
<br />';
		}
	}
}

function template_script_view()
{
	global $context, $txt, $scripturl, $settings;

	$script = $context['curr_script'];
	$links = '';
	if ($script['homeurl']) $links .= '[<a href="' . $scripturl . '?module=ResourceIndex;sa=goto;id='.$script['id'].';do=3" target="'.$script['id'].'">Homepage</a>]';
	if ($script['dlurl'])	$links .= '&nbsp;[<a href="' . $scripturl . '?module=ResourceIndex;sa=goto;id='.$script['id'].';do=1">Download</a>]';
	if ($script['demourl']) $links .= '&nbsp;[<a href="' . $scripturl . '?module=ResourceIndex;sa=goto;id='.$script['id'].';do=2" target="'.$script['id'].'">Demo</a>]';

	if (AllowedTo('admin_forum')) $links .= '&nbsp;[<a href="cat.php?admindelete='.$script['id'].'">X</a>]';
	$links .= '&nbsp;[<a href="' . $scripturl . '?module=ResourceIndex;sa=Edit;id='.$script['id'].';id_sec=' . $context['ID_SEC'] . '">Edit</a>]';

	echo '
<div class="tborder">
	<table width="100%" border="0" cellspacing="2" cellpadding="3" align="center">
		<tr>
			<td class="titlebg"><b>',$script['title'], ' ', $script['version'], '</b></td>
			<td class="titlebg"align="right"><small>',$links,'</small></td>
		</tr><tr>
			<td class="windowbg2" colspan="2">
				<div style="margin-left: 12px;">
					<b>Title:</b> ',$script['title'],'<br />
					<b>Version:</b> ',$script['version'],'<br />
					<b>Discription:</b><br /><br />',$script['descr'], '<br /><br />
					<ul>
						<li>Experience level: ',$script['experience'], '
						', !empty($script['phpext']) ? '<li>PHP Extentions: ' . $script['phpext'] : '', '
						', !empty($script['dbtype']) ? '<li>Database: ' . $script['dbtype'] : '', '
						', !empty($script['other'])  ? '<li>Other: ' . $script['other'] : '', '
					</ul>
				</div><br />
			<div class="tborder">
				<table border="0" cellpadding="2" cellspacing="1" width="100%">
					<tr>
						<td class="windowbg" width="15%"><small>Price: ', $script['price'], '</small></td>
						<td class="windowbg" width="35%"><small>Added: ', $script['added'], '</small></td>
						<td class="windowbg" width="10%"><small>Hits: ', $script['hitsout'], '</small></td>
						<td class="windowbg" width="10%"><small>Views: ', $script['views'], '</small></td>
						<td class="windowbg" width="35%"><small>Rating: <img src="', $settings['images_url'], '/rating.php?rating=', $script['rating'], '" border="0" alt="', $script['rating'], '%" /></small></td>
					</tr>
				</table>
			</div></td>
		</tr>
	</table>
</div>
<br /><a name="vote" />
<div width="150" class="tborder" style="padding: 2px;">
	<div class="windowbg2" style="padding: 2px; margin-bottom: 2px;">
		This Scripts Rating: <img src="', $settings['images_url'], '/rating.php?rating=', $script['rating'], '" border="0" alt="', $script['rating'], '%" /> ', $script['rating'], '%<br />
		<!-- This Scripts Over All Rating for "', $context['curr_cat']['Title'], '": ',/*$script['orating'],*/'<br />',$script['rating2'], '-->
	</div>
	<div class="windowbg2" style="padding: 2px;" align="center">
		<form method="post" action="', $scripturl, '?module=ResourceIndex;sa=RateMe;id=', $script['id'], ';id_sec=', $context['ID_SEC'], '">
			', LoadRateSelect('score', 'Rate this Resource'), '<br />
		</form>
	</div>
</div>';
}

function template_script_add()
{
	global $context, $txt, $scripturl, $settings;

	echo '
<form method="post" action="', $scripturl, '?module=ResourceIndex;sa=AddStuff;id=', $context['curr_sec']['ID_SEC'], '">
<div class="tborder">
	<table border="0" cellpadding="3" cellspacing="2" width="100%">
		<tr>
			<th class="titlebg" width="100%" colspan="2">Add a Resource to ', $context['curr_sec']['Title'], '</th>
		</tr><tr>
			<th class="windowbg" width="100%" colspan="2">Note: if you don\'t wish to add a Resource to the ', $context['curr_sec']['Title'], ' Section, Please goto the Section from the menu and then "Add Resource".</th>
		</tr><tr>
			<td class="windowbg2" width="21%">Title</td>
			<td class="windowbg2" width="79%"><input type="text" name="title" size="25" /></td>
		</tr> <tr>
			<td class="windowbg2" width="21%">Version</td>
			<td class="windowbg2" width="79%"><input type="text" name="version" size="16" /></td>
		</tr><tr>
			<td class="windowbg2" width="21%">Home Page URL</td>
			<td class="windowbg2" width="79%"><input type="text" name="homeurl" size="32" /></td>
		</tr><tr>
			<td class="windowbg2" width="21%">Download URL</td>
			<td class="windowbg2" width="79%"><input type="text" name="dlurl" size="32" /></td>
		</tr><tr>
			<td class="windowbg2" width="21%">Demo URL</td>
			<td class="windowbg2" width="79%"><input type="text" name="demourl" size="32" /></td>
		</tr><tr>
			<td class="windowbg2" width="21%">Price</td>
			<td class="windowbg2" width="79%"><input type="text" name="price" size="9" /></td>
		</tr><tr>
			<td class="windowbg2" width="21%">Description</td>
			<td class="windowbg2" width="79%"><textarea name="descr" rows="10" cols="75"></textarea></td>
		</tr><tr>
			<td class="windowbg2 "width="21%">Requirements</td>
			<td class="windowbg2 "width="79%">
				<table border="0" cellpadding="0" cellspacing="0" width="100%">
					<tr>
						<td width="50%">Database</td>
						<td width="50%"><input type="text" name="dbtype" size="20" /></td>
					</tr><tr>
						<td width="50%">PHP Extensions <small>(Not in the php distribution or optional)</small></td>
						<td width="50%"><input type="text" name="phpext" size="20" /></td>
					</tr><tr>
						<td width="50%">PHP Experience <small>(who is this for?)</small></td>
						<td width="50%">
							<select size="1" name="experience">
								<option selected="selected" />Any
								<option />Beginner
								<option />Intermediate
								<option />Advanced
							</select></td>
					</tr><tr>
						<td width="50%">Other</td>
						<td width="50%"><input type="text" name="other" size="20" /></td>
					</tr>
				</table>
			</td>
		</tr><!-- tr>
			<td class="windowbg2" width="21%">Section</td>
			<td class="windowbg2" width="79%">', $context['combolist'], '</td>
		</tr --><tr>
			<td class="windowbg" width="100%" colspan="2" style="padding: 0px;">
				<table border="0" cellpadding="3" cellspacing="2" width="100%">
					<tr>
						<th class="titlebg" width="50%"><b>Main Catagory Listing</b></th>
						<th class="titlebg" width="50%"><b>Extra Catagories to List under</b></th>
					</tr><tr>
						<td width="50%" class="windowbg2" align="center">
							<select size="10" name="subcat">';

	foreach ($context['combomeal'] AS $option)
		echo '
								<option value="', $option['id'], '">', $option['Title'], '</option>';

	echo '
							</select></td>
						<td width="50%" class="windowbg2" align="center">
							<select size="10" name="extracats[]" multiple>';

	foreach ($context['combomeal'] AS $option)
		echo '
								<option value="', $option['id'], '">', $option['Title'], '</option>';

	echo '
							</select></td>
					</tr>
				</table></td>
		</tr><tr>
			<td class="windowbg2" width="100%" colspan="2"><input type="submit" value="Submit" name="subzero" /></td>
		</tr>
	</table>
</div>
</form>
';
}

function template_script_edit()
{
	global $context, $txt, $scripturl, $settings;

	echo '
<form method="post" action="', $scripturl, '?module=ResourceIndex;sa=EditStuff;id=', $context['curr_script']['id'], ';id_sec=', $context['ID_SEC'], '">
<div class="tborder">
	<table border="0" cellpadding="3" cellspacing="2" width="100%">
		<tr>
			<th class="titlebg" width="100%" colspan="2">Edit: ', $context['curr_script']['title'], '</th>
		</tr><tr>
			<td class="windowbg2" width="21%">Title</td>
			<td class="windowbg2" width="79%"><input type="text" name="title" size="25" value="', $context['curr_script']['title'], '" /></td>
		</tr> <tr>
			<td class="windowbg2" width="21%">Version</td>
			<td class="windowbg2" width="79%"><input type="text" name="version" size="16" value="', $context['curr_script']['version'], '" /></td>
		</tr><tr>
			<td class="windowbg2" width="21%">Home Page URL</td>
			<td class="windowbg2" width="79%"><input type="text" name="homeurl" size="32" value="', $context['curr_script']['homeurl'], '" /></td>
		</tr><tr>
			<td class="windowbg2" width="21%">Download URL</td>
			<td class="windowbg2" width="79%"><input type="text" name="dlurl" size="32" value="', $context['curr_script']['dlurl'], '" /></td>
		</tr><tr>
			<td class="windowbg2" width="21%">Demo URL</td>
			<td class="windowbg2" width="79%"><input type="text" name="demourl" size="32" value="', $context['curr_script']['demourl'], '" /></td>
		</tr><tr>
			<td class="windowbg2" width="21%">Price</td>
			<td class="windowbg2" width="79%"><input type="text" name="price" size="9" value="', $context['curr_script']['price'], '" /></td>
		</tr><tr>
			<td class="windowbg2" width="21%">Description</td>
			<td class="windowbg2" width="79%"><textarea name="descr" rows="10" cols="75">', $context['curr_script']['descr'], '</textarea></td>
		</tr><tr>
			<td class="windowbg2 "width="21%">Requirements</td>
			<td class="windowbg2 "width="79%">
				<table border="0" cellpadding="0" cellspacing="0" width="100%">
					<tr>
						<td width="50%">Database</td>
						<td width="50%"><input type="text" name="dbtype" size="20" value="', $context['curr_script']['dbtype'], '" /></td>
					</tr><tr>
						<td width="50%">PHP Extensions <small>(Not in the php distribution or optional)</small></td>
						<td width="50%"><input type="text" name="phpext" size="20" value="', $context['curr_script']['phpext'], '" /></td>
					</tr><tr>
						<td width="50%">PHP Experience <small>(who is this for?)</small></td>
						<td width="50%">
							<select size="1" name="experience">
								<option selected="selected" />Any
								<option />Beginner
								<option />Intermediate
								<option />Advanced
							</select></td>
					</tr><tr>
						<td width="50%">Other</td>
						<td width="50%"><input type="text" name="other" size="20" value="', $context['curr_script']['other'], '" /></td>
					</tr>
				</table>
			</td>
		</tr><tr>
			<td class="windowbg" width="100%" colspan="2" style="padding: 0px;">
				<table border="0" cellpadding="3" cellspacing="2" width="100%">
					<tr>
						<th class="titlebg" width="50%"><b>Main Catagory Listing</b></th>
						<th class="titlebg" width="50%"><b>Extra Catagories to List under</b></th>
					</tr><tr>
						<td width="50%" class="windowbg2" align="center">
							<input type="hidden" name="oldcat" value="',$context['curr_script']['subcat'],'" />
							<select size="10" name="subcat">';

	foreach ($context['combomeal'] AS $option)
		echo '
								<option value="', $option['id'], '"', ($option['id'] == $context['curr_script']['subcat']) ? ' selected="selected"' : '', '>', $option['Title'], '</option>';

	echo '
							</select></td>
						<td width="50%" class="windowbg2" align="center">
							<select size="10" name="extracats[]" multiple>';

	foreach ($context['combomeal'] AS $option)
		echo '
								<option value="', $option['id'], '"', in_array($option['id'], $context['curr_script']['extracats']) ? ' selected="selected"' : '', '>', $option['Title'], '</option>';

	echo '
							</select></td>
					</tr>
				</table></td>
		</tr><tr>
			<td class="windowbg2" width="100%" colspan="2"><input type="submit" value="Submit" name="subzero" /></td>
		</tr>
	</table>
</div>
</form>
';
}

function template_index_stats()
{
	global $context, $scripturl, $settings;

	echo '
<div class="tborder">
	<table border="0" cellpadding="3" cellspacing="2" width="100%">
		<tr>
			<th class="titlebg" width="100%" colspan="2">Resource Index Stats</th>
		</tr><tr>
			<td class="windowbg2" width="50%">Total Sections:</td>
			<th class="windowbg" width="50%">', $context['num_stats']['sections'], '</th>
		</tr><tr>
			<td class="windowbg2" width="50%">Total Cats</td>
			<th class="windowbg" width="50%">', $context['num_stats']['cats'], '</th>
		</tr><tr>
			<td class="windowbg2" width="50%">Total Resources</td>
			<th class="windowbg" width="50%">', $context['num_stats']['resources'], '</th>
		</tr><tr>
			<td class="windowbg2" width="50%">Total Hits out of The Resource Index</td>
			<th class="windowbg" width="50%">', $context['num_stats']['total_out'], '</th>
		</tr><tr>
			<td class="windowbg2" width="50%">Average Resource rating</td>
			<th class="windowbg" width="50%">', @round($context['num_stats']['avg1']/$context['num_stats']['avg2'], 2)/10, ' %</th>
		</tr><tr>
			<td class="windowbg2" width="50%">Average Hits out / Resources</td>
			<th class="windowbg" width="50%">', @round($context['num_stats']['total_out']/$context['num_stats']['resources'], 2), ' %</th>
		</tr><tr>
			<td class="windowbg2" width="50%">Total Resources without Hits out</td>
			<th class="windowbg" width="50%">', $context['num_stats']['nohitcount'], '</th>
		</tr><tr>
			<td class="windowbg2" width="50%">Percent of Resources without Hits out</td>
			<th class="windowbg" width="50%">', @round($context['num_stats']['nohitcount']/$context['num_stats']['resources'], 2), ' %</th>
		</tr><tr>
			<td class="windowbg2" width="50%">&nbsp;</td>
			<td class="windowbg2" width="50%">&nbsp;</td>
		</tr><tr>
			<th class="catbg" width="50%" colspan="2">Newest & Oldest Resource</th>
		</tr><tr>
			<td class="windowbg2" width="50%">Newest Resource</td>
			<td class="windowbg" width="50%"><a href="', $scripturl, '?module=ResourceIndex;sa=view;id=', $context['num_stats']['newest']['id'], ';id_sec=', $context['num_stats']['newest']['ID_SEC'], '">', $context['num_stats']['newest']['title'], '</a></td>
		</tr><tr>
			<td class="windowbg2" width="50%">Oldest Resource</td>
			<td class="windowbg" width="50%"><a href="', $scripturl, '?module=ResourceIndex;sa=view;id=', $context['num_stats']['oldest']['id'], ';id_sec=', $context['num_stats']['oldest']['ID_SEC'], '">', $context['num_stats']['oldest']['title'], '</a></td>
		</tr><tr>
			<td class="windowbg2" width="50%">&nbsp;</td>
			<td class="windowbg2" width="50%">&nbsp;</td>
		</tr><tr>
			<th class="catbg" width="50%" colspan="2">Resource Popularity by Vote</th>
		</tr><tr>
			<td class="windowbg2" width="50%">Most Popular Resource</td>
			<td class="windowbg" width="50%"><a href="', $scripturl, '?module=ResourceIndex;sa=view;id=', $context['num_stats']['popular']['id'], ';id_sec=', $context['num_stats']['popular']['ID_SEC'], '">', $context['num_stats']['popular']['title'], '</a></td>
		</tr><tr>
			<td class="windowbg2" width="50%">Most Popular Rating</td>
			<th class="windowbg" width="50%">', @round($context['num_stats']['popular']['total']/$context['num_stats']['popular']['votes'], 2)/10, ' %</th>
		</tr><tr>
			<td class="windowbg2" width="50%">Least Popular Resource</td>
			<td class="windowbg" width="50%"><a href="', $scripturl, '?module=ResourceIndex;sa=view;id=', $context['num_stats']['lpopular']['id'], ';id_sec=', $context['num_stats']['lpopular']['ID_SEC'], '">', $context['num_stats']['lpopular']['title'], '</a></td>
		</tr><tr>
			<td class="windowbg2" width="50%">Least Popular Rating</td>
			<th class="windowbg" width="50%">', @round($context['num_stats']['lpopular']['total']/$context['num_stats']['lpopular']['votes'], 2)/10, ' %</th>
		</tr><tr>
			<td class="windowbg2" width="50%">&nbsp;</td>
			<td class="windowbg2" width="50%">&nbsp;</td>
		</tr><tr>
			<th class="catbg" width="50%" colspan="2">Resources by Downloads</th>
		</tr><tr>
			<td class="windowbg2" width="50%">Resource with the Most Hits out</td>
			<td class="windowbg" width="50%"><a href="', $scripturl, '?module=ResourceIndex;sa=view;id=', $context['num_stats']['mostdl']['id'], ';id_sec=', $context['num_stats']['mostdl']['ID_SEC'], '">', $context['num_stats']['mostdl']['title'], '</a></td>
		</tr><tr>
			<td class="windowbg2" width="50%">Most Hits Out</td>
			<th class="windowbg" width="50%">', $context['num_stats']['mostdl']['hitsout'], '</th>
		</tr><tr>
			<td class="windowbg2" width="50%">Resource with the Least Hits out</td>
			<td class="windowbg" width="50%"><a href="', $scripturl, '?module=ResourceIndex;sa=view;id=', $context['num_stats']['leastdl']['id'], ';id_sec=', $context['num_stats']['leastdl']['ID_SEC'], '">', $context['num_stats']['leastdl']['title'], '</a></td>
		</tr><tr>
			<td class="windowbg2" width="50%">Least Hits Out</td>
			<th class="windowbg" width="50%">', $context['num_stats']['leastdl']['hitsout'], '</th>
		</tr><tr>
			<th class="catbg" width="50%" colspan="2">Resources by Hits Out</th>
		</tr><tr>
			<td class="windowbg2" width="50%">Resource with the Most Hits out</td>
			<td class="windowbg" width="50%"><a href="', $scripturl, '?module=ResourceIndex;sa=view;id=', $context['num_stats']['mostdl']['id'], ';id_sec=', $context['num_stats']['mostdl']['ID_SEC'], '">', $context['num_stats']['mostdl']['title'], '</a></td>
		</tr><tr>
			<td class="windowbg2" width="50%">Most Hits Out</td>
			<th class="windowbg" width="50%">', $context['num_stats']['mostdl']['hitsout'], '</th>
		</tr><tr>
			<td class="windowbg2" width="50%">Resource with the Least Hits out</td>
			<td class="windowbg" width="50%"><a href="', $scripturl, '?module=ResourceIndex;sa=view;id=', $context['num_stats']['leastdl']['id'], ';id_sec=', $context['num_stats']['leastdl']['ID_SEC'], '">', $context['num_stats']['leastdl']['title'], '</a></td>
		</tr><tr>
			<td class="windowbg2" width="50%">Least Hits Out</td>
			<th class="windowbg" width="50%">', $context['num_stats']['leastdl']['hitsout'], '</th>
		</tr><tr>
			<td class="windowbg2" width="50%">&nbsp;</td>
			<td class="windowbg2" width="50%">&nbsp;</td>
		</tr>
	</table>
</div>
<br />
<div class="tborder">
	<table border="0" cellpadding="3" cellspacing="2" width="100%">
		<tr>
			<th class="titlebg" width="100%" colspan="13">View log</th>
		</tr><tr>
			<td class="windowbg2" width="45%" colspan="6">Total Views to date</td>
			<th class="windowbg" width="67%" colspan="7">', $context['num_stats']['hits_sum'], '</th>
		</tr><tr>
			<td class="windowbg2" width="100%" colspan="13">&nbsp;</td>
		</tr><tr class="titlebg">
			<th class="catbg" width="2%">Hour</th>
			<th width="8%">00</th>
			<th width="8%">01</th>
			<th width="8%">02</th>
			<th width="8%">03</th>
			<th width="8%">04</th>
			<th width="8%">05</th>
			<th width="8%">06</th>
			<th width="8%">07</th>
			<th width="8%">08</th>
			<th width="8%">09</th>
			<th width="8%">10</th>
			<th width="8%">11</th>
		</tr><tr>
			<th class="catbg" width="2%">Views</th>
			<th class="windowbg" width="8%">',	$context['num_stats']['hitsbyhour']['00']['views'], '</th>
			<th class="windowbg2" width="8%">',	$context['num_stats']['hitsbyhour']['01']['views'], '</th>
			<th class="windowbg" width="8%">',	$context['num_stats']['hitsbyhour']['02']['views'], '</th>
			<th class="windowbg2" width="8%">',	$context['num_stats']['hitsbyhour']['03']['views'], '</th>
			<th class="windowbg" width="8%">',	$context['num_stats']['hitsbyhour']['04']['views'], '</th>
			<th class="windowbg2" width="8%">',	$context['num_stats']['hitsbyhour']['05']['views'], '</th>
			<th class="windowbg" width="8%">',	$context['num_stats']['hitsbyhour']['06']['views'], '</th>
			<th class="windowbg2" width="8%">',	$context['num_stats']['hitsbyhour']['07']['views'], '</th>
			<th class="windowbg" width="8%">',	$context['num_stats']['hitsbyhour']['08']['views'], '</th>
			<th class="windowbg2" width="8%">',	$context['num_stats']['hitsbyhour']['09']['views'], '</th>
			<th class="windowbg" width="8%">',	$context['num_stats']['hitsbyhour']['10']['views'], '</th>
			<th class="windowbg2" width="8%">',	$context['num_stats']['hitsbyhour']['11']['views'], '</th>
		</tr><tr>
			<th class="catbg" width="2%">Avg.</th>
			<th class="windowbg" width="8%">',	@round($context['num_stats']['hitsbyhour']['00']['views']/$context['num_stats']['hits_sum'], 2), '</th>
			<th class="windowbg2" width="8%">',	@round($context['num_stats']['hitsbyhour']['01']['views']/$context['num_stats']['hits_sum'], 2), '</th>
			<th class="windowbg" width="8%">',	@round($context['num_stats']['hitsbyhour']['02']['views']/$context['num_stats']['hits_sum'], 2), '</th>
			<th class="windowbg2" width="8%">',	@round($context['num_stats']['hitsbyhour']['03']['views']/$context['num_stats']['hits_sum'], 2), '</th>
			<th class="windowbg" width="8%">',	@round($context['num_stats']['hitsbyhour']['04']['views']/$context['num_stats']['hits_sum'], 2), '</th>
			<th class="windowbg2" width="8%">',	@round($context['num_stats']['hitsbyhour']['05']['views']/$context['num_stats']['hits_sum'], 2), '</th>
			<th class="windowbg" width="8%">',	@round($context['num_stats']['hitsbyhour']['06']['views']/$context['num_stats']['hits_sum'], 2), '</th>
			<th class="windowbg2" width="8%">',	@round($context['num_stats']['hitsbyhour']['07']['views']/$context['num_stats']['hits_sum'], 2), '</th>
			<th class="windowbg" width="8%">',	@round($context['num_stats']['hitsbyhour']['08']['views']/$context['num_stats']['hits_sum'], 2), '</th>
			<th class="windowbg2" width="8%">',	@round($context['num_stats']['hitsbyhour']['09']['views']/$context['num_stats']['hits_sum'], 2), '</th>
			<th class="windowbg" width="8%">',	@round($context['num_stats']['hitsbyhour']['10']['views']/$context['num_stats']['hits_sum'], 2), '</th>
			<th class="windowbg2" width="8%">',	@round($context['num_stats']['hitsbyhour']['11']['views']/$context['num_stats']['hits_sum'], 2), '</th>
		</tr><tr class="titlebg">
			<th class="catbg" width="2%">Hour</th>
			<th width="8%">12</th>
			<th width="8%">13</th>
			<th width="8%">14</th>
			<th width="8%">15</th>
			<th width="8%">16</th>
			<th width="8%">17</th>
			<th width="8%">18</th>
			<th width="8%">19</th>
			<th width="8%">20</th>
			<th width="8%">21</th>
			<th width="8%">22</th>
			<th width="8%">23</th>
		</tr><tr>
			<th class="catbg" width="2%">Views</th>
			<th class="windowbg" width="8%">',	$context['num_stats']['hitsbyhour']['12']['views'], '</th>
			<th class="windowbg2" width="8%">',	$context['num_stats']['hitsbyhour']['13']['views'], '</th>
			<th class="windowbg" width="8%">',	$context['num_stats']['hitsbyhour']['14']['views'], '</th>
			<th class="windowbg2" width="8%">',	$context['num_stats']['hitsbyhour']['15']['views'], '</th>
			<th class="windowbg" width="8%">',	$context['num_stats']['hitsbyhour']['16']['views'], '</th>
			<th class="windowbg2" width="8%">',	$context['num_stats']['hitsbyhour']['17']['views'], '</th>
			<th class="windowbg" width="8%">',	$context['num_stats']['hitsbyhour']['18']['views'], '</th>
			<th class="windowbg2" width="8%">',	$context['num_stats']['hitsbyhour']['19']['views'], '</th>
			<th class="windowbg" width="8%">',	$context['num_stats']['hitsbyhour']['20']['views'], '</th>
			<th class="windowbg2" width="8%">',	$context['num_stats']['hitsbyhour']['21']['views'], '</th>
			<th class="windowbg" width="8%">',	$context['num_stats']['hitsbyhour']['22']['views'], '</th>
			<th class="windowbg2" width="8%">',	$context['num_stats']['hitsbyhour']['23']['views'], '</th>
		</tr><tr>
			<th class="catbg" width="2%">Avg.</th>
			<th class="windowbg" width="8%">',	@round($context['num_stats']['hitsbyhour']['12']['views']/$context['num_stats']['hits_sum'], 2), '</th>
			<th class="windowbg2" width="8%">',	@round($context['num_stats']['hitsbyhour']['13']['views']/$context['num_stats']['hits_sum'], 2), '</th>
			<th class="windowbg" width="8%">',	@round($context['num_stats']['hitsbyhour']['14']['views']/$context['num_stats']['hits_sum'], 2), '</th>
			<th class="windowbg2" width="8%">',	@round($context['num_stats']['hitsbyhour']['15']['views']/$context['num_stats']['hits_sum'], 2), '</th>
			<th class="windowbg" width="8%">',	@round($context['num_stats']['hitsbyhour']['16']['views']/$context['num_stats']['hits_sum'], 2), '</th>
			<th class="windowbg2" width="8%">',	@round($context['num_stats']['hitsbyhour']['17']['views']/$context['num_stats']['hits_sum'], 2), '</th>
			<th class="windowbg" width="8%">',	@round($context['num_stats']['hitsbyhour']['18']['views']/$context['num_stats']['hits_sum'], 2), '</th>
			<th class="windowbg2" width="8%">',	@round($context['num_stats']['hitsbyhour']['19']['views']/$context['num_stats']['hits_sum'], 2), '</th>
			<th class="windowbg" width="8%">',	@round($context['num_stats']['hitsbyhour']['20']['views']/$context['num_stats']['hits_sum'], 2), '</th>
			<th class="windowbg2" width="8%">',	@round($context['num_stats']['hitsbyhour']['21']['views']/$context['num_stats']['hits_sum'], 2), '</th>
			<th class="windowbg" width="8%">',	@round($context['num_stats']['hitsbyhour']['22']['views']/$context['num_stats']['hits_sum'], 2), '</th>
			<th class="windowbg2" width="8%">',	@round($context['num_stats']['hitsbyhour']['23']['views']/$context['num_stats']['hits_sum'], 2), '</th>
		</tr>
	</table>
</div>


<br />
<div class="tborder">
	<table border="0" cellpadding="3" cellspacing="2" width="100%">
		<tr>
			<th class="titlebg" width="100%" colspan="2">FAQ</th>
		</tr><tr>
			<td class="windowbg2" width="35%">Hits out?</td>
			<td class="windowbg2" width="65%">Hits out, means clicks to Resource Home Pages, or Demo views.</td>
		</tr>
	</table>
</div>';
}

function template_script_search()
{
	global $context, $scripturl, $settings;

	echo $context['searchterm'], '<br /><pre>';
	print_r ($context['cscripts']);
	echo '</pre>';
}

function template_sections()
{
	global $context, $scripturl, $settings;

	echo '
			<div class="tborder">
				<table border="0" cellpadding="2" cellspacing="1" width="100%">
					<tr>
						<th width="100%" class="titlebg">Script Index</th>
					</tr>';

	foreach ($context['sections'] AS $section)
	{
		if ($section['flag'] == '1')
			echo '<tr>
						<td width="100%" class="windowbg" style="text-align: center;"><a href="', $scripturl, '?module=ResourceIndex;id_sec=', $section['ID_SEC'], '"><b>', $section['Title'], '</b></a></td>
					</tr>';
		else
			echo '<tr>
						<td width="100%" class="windowbg" style="text-align: center;"><a href="', $scripturl, '?module=ResourceIndex;id_sec=', $section['ID_SEC'], '">', $section['Title'], '</a></td>
					</tr>';
	}

	echo '
					<tr>
						<th width="100%" class="titlebg">Script Search</th>
					</tr><tr>
						<td width="100%" class="windowbg" align="center">
							<form method="post" action="', $scripturl, '?module=ResourceIndex;sa=FindIt">
								<input type="text" name="search_phrase" size="15"><br /><input type="submit" value="Find It!"></td>
					</tr></form><tr>
						<td width="100%" class="windowbg2" style="text-align: center;"><a href="', $scripturl, '?module=ResourceIndex;sa=rehab;id_sec=', $context['ID_SEC'], '">Add Resource</a></td>
					</tr><tr>
						<td width="100%" class="windowbg2" style="text-align: center;"><a href="', $scripturl, '?module=ResourceIndex;sa=stats">Stats</a></td>
					</tr>
				</table>
			</div>';
}
?>
Return current item: Enigma