Location: PHPKode > projects > Enigma > Enigma2/Enigma2_Install/Themes/Enigma/portal/NewsManagement.template.php
<?php
// Version: 1.0 RC1; NewsManagement

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

	echo '
<div class="tborder">
	<table width="100%" border="0" class="bordercolor" cellspacing="1" align="center">
		<tr>
			<td class="catbg">
				<b>', $txt[102], '</b>
			</td>
			<td class="catbg">
				<b>', $txt['news_128'], '</b>
			</td>
			<td class="catbg">
				<b>', $txt['news_129'], '</b>
			</td>
		</tr>';

	foreach ($context['ncat'] AS $result)
	{
		$sub = ($result['sub'] == '1') ? 'Yes' : 'No';

		echo '<tr>
			<td class="windowbg2">', $result['name'], '</td>
			<td class="windowbg2" align="center"><img src="', $settings['images_url'], '/News/', $result['image'], '" width="80" height="80" alt="" /></td>
			<td class="windowbg2"><a href="', $scripturl, '?op=NewsManagement;sa=encat;id=', $result['ID_CATEGORY'], '">', $txt['news_130'], '</a> | <a href="', $scripturl, '?op=NewsManagement;sa=delncat;id=', $result['ID_CATEGORY'], '">', $txt['news_131'], '</a></td>
		</tr>';
	}

   echo '
	</table>
</div>
<br /><br />
	<script language="JavaScript1.2" type="text/javascript">
	<!--
		function setImage(ImageName)
		{
			document.images.NewsImage.src="', $settings['images_url'], '/News/"+ document.add_ncat.image.options[document.add_ncat.image.selectedIndex].value+"";
		}
	//-->
	</script>
	<form name="add_ncat" method="post" action="', $scripturl, '?op=NewsManagement;sa=ancat2">
	<a name="addNcat"></a>
	<div class="tborder">
		<table width="100%" border="0" cellspacing="0" cellpadding="4" align="center">
			<tr>
				<td class="titlebg" colspan="2">
					<b>', $txt['news_125'], '</b></td>
			</tr><tr>
				<td>', $txt['news_78'], '</td>
				<td><input type="text" name="name" size="30"></td>
			</tr><tr>
				<td>', $txt['news_134'], '</td>
				<td>
					<select name="image" onChange="setImage(document.add_ncat.image.options[document.add_ncat.image.selectedIndex].value)" size="6">
						<option value="blank.gif" selected>None</option>';

	foreach ($context['NewsImage'] as $line)
	{
		$filename = $line;
		$title = substr($line,0,(strlen($line)-strlen(strrchr($line,'.'))));

		echo '
						<option value="', $filename, '">', $title, '</option>';
	}

	echo '
					</select>&nbsp;<img src="', $settings['images_url'], '/News/', $context['encat']['image'] . '" name="NewsImage"  border="1" hspace="15" width="80" height="80" alt="', $context['encat']['name'], '"></td>
			</tr><tr>
				<td colspan="2" align="center">
					<input type="submit" name="submit" value="', $txt['news_83'], '">
				</td>
			</tr>
		</table>
	</div>
	</form>';
}

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

	echo '
	<script language="JavaScript1.2" type="text/javascript">
	<!--
		function setImage(ImageName)
		{
			document.images.NewsImage.src="', $settings['images_url'], '/News/"+ document.edit_ncat.image.options[document.edit_ncat.image.selectedIndex].value+"";
		}
	//-->
	</script>
	<form name="edit_ncat" method="post" action="', $scripturl, '?op=NewsManagement;sa=encat2">
	<a name="addNcat"></a>
	<div class="tborder">
		<table class="windowbg" width="100%" border="0" cellspacing="0" cellpadding="4" align="center">
			<tr>
				<td class="titlebg" colspan="2"><b>', $txt['news_289'], ' ', $context['encat']['name'], '</b></td>
			</tr><tr>
				<td>', $txt['news_78'], '</td>
				<td><input type="text" name="name" value="', $context['encat']['name'], '"></td>
			</tr><tr>
				<td>', $txt['news_134'], '</td>
				<td>
					<select name="image" onChange="setImage(document.edit_ncat.image.options[document.edit_ncat.image.selectedIndex].value)" size="6">
						<option value="blank.gif">None</option>';

	foreach ($context['NewsImage'] as $line)
	{
		$filename = $line;
		$title = substr($line,0,(strlen($line)-strlen(strrchr($line,'.'))));

		echo '
						<option value="', $filename, '"', ($context['encat']['image'] == $filename) ? ' selected' : '', '>', $title, '</option>';
	}

	echo '
					</select>&nbsp;<img src="', $settings['images_url'], '/News/', $context['encat']['image'] . '" name="NewsImage"  border="1" hspace="15" width="80" height="80" alt="', $context['encat']['name'], '"></td>
			</tr><tr>
				<td colspan="2" align="center"><input type="submit" name="submit" value="', $txt['news_130'], '"></td>
			</tr>
		</table>
	</div>
	<input type="hidden" name="id" value="', $context['id'], '">
	</form>';
}
?>
Return current item: Enigma