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

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

	echo '
	 <script language="JavaScript1.2" type="text/javascript"><!--
		function DoConfirm(message, url)
		{
			if (confirm(message))
				location.href = url;
		}
	//--></script>
	<table class="bordercolor" width="100%" border="0" cellspacing="1" align="center">
		<tr>
			<td class="catbg">
				<a href="', $scripturl, '?op=BlockManagement;ob=1"><b>', $txt['blk_title'], '</b></a>
			</td>
			<td class="catbg">
				<a href="', $scripturl, '?op=BlockManagement;ob=2"><b>', $txt['blk_contents'], '</b></a>
			</td>
			<td class="catbg">
				<a href="', $scripturl, '?op=BlockManagement;ob=3"><b>', $txt['blk_order'], '</b></a>  <a href="', $scripturl, '?op=BlockManagement;ob=0">*</b></a>
			</td>
			<td class="catbg">
				<a href="', $scripturl, '?op=BlockManagement;ob=4"><b>', $txt['blk_side'], '</b></a> <a href="', $scripturl, '?op=BlockManagement;ob=0">*</b></a>
			</td>
			<td class="catbg">
				<b>', $txt['blk_type'], '</b>
			</td>
				<td class="catbg">
				<b>', $txt['blk_template'], '</b>
			</td>
		<td class="catbg">
				<b>', $txt['blk_functions'], '</b>
			</td>
		</tr>';

	foreach ($context['listblocks'] AS $block)
	{
		$side_text = 'blk_' . $block['side'];
		$type_text = 'blk_' . $block['type'];
		
			echo '
					<tr>
						<td class="windowbg2">
							',$block['name'],'
						</td>
						<td class="windowbg2" width="200px">
							<div style="width: 200px; overflow: auto;">
								',$block['contents'],'
							</div>
						</td>
						<td class="windowbg2" align="center">
							',$block['border'],'<br />
							<a href="',$scripturl,'?op=BlockManagement;sa=BlockUp;blockid=',$block['id'],'"><img src="',$settings['images_url'],'/ordUp.gif" border="0" alt="Order Up" align="center" /></a>
							<a href="',$scripturl,'?op=BlockManagement;sa=BlockDown;blockid=',$block['id'],'"><img src="',$settings['images_url'],'/ordDown.gif" border="0" alt="Order Down" align="center" /></a>
						</td>
						<td class="windowbg2">
							' , $txt[$side_text] , '
						</td>
						<td class="windowbg2">
							', $txt[$type_text], '
						</td>
						<td class="windowbg2">
							', $block['template'], '
						</td>
						<td class="windowbg2">
							<a href="',$scripturl,'?op=BlockManagement;sa=EditBlock;blockid=',$block['id'],'">', $txt['blk_edit'], '</a><br /><a href="javascript:DoConfirm(\'', $txt['blk_delConfirm'], '\',\'',$scripturl,'?op=BlockManagement;sa=DeleteBlock;blockid=',$block['id'],'\')">', $txt['blk_delete'], '</a><br /><a href="',$scripturl,'?op=BlockManagement;sa=BlockOnOff;blockid=',$block['id'],';active=', ($block['active']?'0':'1'), '"><img src="',$settings['images_url'],'/icons/', ($block['active']?'on':'off'), '.gif" border="0" alt="', ($block['active']?$txt['blk_off']:$txt['blk_on']), '" align="center" /></a>
						</td>
						</tr>';
	}
echo '
</table>';

	// Display add block template.
	template_add_block();
}

function template_add_block()
{
	global $txt, $scripturl, $context;
echo '
	<br /><br />
	<a name="addblock"></a>
	<table width="100%" border="0" cellspacing="1" cellpadding="0" class="bordercolor" align="center">
		<tr>
			<td>
				<table class="windowbg" width="100%" border="0" cellspacing="0" cellpadding="4" align="center">
					<tr>
						<td class="titlebg" colspan="2">
							<form name="addblock" method="post" action="', $scripturl, '?op=BlockManagement;sa=AddBlock">
							<a name="adb"></a>
							<b>', $txt['blk_addblock'], '</b>
						</td>
					</tr>
					<tr>
						<td>
							<b>', $txt['blk_title'], '</b>
						</td>
						<td>
							<input type="text" name="name" size="60">
						</td>
					</tr>
					<tr>
						<td colspan="2">
							<b>', $txt['blk_contents'], '</b>
						</td>
					</tr>
					<tr>
						<td align="center" colspan="2">
							<textarea class="editor" name="contents" rows="15" cols="50"></textarea>
						</td>
					</tr>
					<tr>
						<td>
							<b>', $txt['blk_order'], '</b>
						</td>
						<td>
							<input type="text" name="border" size="60" value="0">
						</td>
					</tr><tr>
						<td>
							<b>' . $txt['blk_mems'] . '</b><br />' . $txt['blk_help'] . '
						</td>
						<td>
',
		groupselect('','blockmg[]',true), '
						</td>
					</tr><tr>
						<td>
							<b>', $txt['blk_type'], ':</b><br />
						</td>
						<td>',
		blockTypes('','type',true), '
						</td>
					</tr>
					<tr>
						<td>
							<b>', $txt['blk_location'], '</b>
						</td>
						<td>
							<select name="side">
								<option value="left" selected>', $txt['blk_left'], '</option>
								<option value="right">', $txt['blk_right'], '</option>
								<option value="center">', $txt['blk_center'], '</option>
								<option value="top">', $txt['blk_top'], '</option>
								<option value="bottom">', $txt['blk_bottom'], '</option>
							</select>
						</td>
					</tr>
					<tr>
						<td>
							<b>', $txt['blk_phpe'], '</b>
						</td>
						<td>
							<input type="checkbox" name="phpe" value="1">
						</td>
					</tr><tr>
						<td>
 							<b>', $txt['blk_360'], '</b>
						</td>
						<td>
',
		block_control('visible[]'), '
						</td>
					</tr>
					<tr>
						<td>
							<b>', $txt['blk_templateField'], ':</b><br />
							<small>', $txt['blk_templateNote'], '</small>
						</td>
						<td>
							<input type="text" name="template" size="60">
						</td>
					</tr>
					<tr>
						<td>
							<b>', $txt['blk_active'], '</b>
						</td>
						<td>
							<input type="checkbox" checked="checked" name="active" value="1">
						</td>
					</tr><tr>
						<td colspan="2" align="center">
							<br /><input type="submit" name="func" value="', $txt['blk_add'], '"> <input type="reset" name="reset" value="', $txt['blk_reset'], '">
							</form>
						</td>
					</tr>
				</table>
			</td>
		</tr>
	</table>
';
}

function template_edit_block()
{
	global $context, $txt;

//print_r($context['this_block']);

//$context['this_block']
echo '
	<form name="editblock" method="post" action="index.php?op=BlockManagement;sa=EditBlock2">
	<table width="100%" border="0" cellspacing="1" cellpadding="0" class="bordercolor">
		<tr>
			<td>
				<table class="windowbg" width="100%" border="0" cellspacing="0" cellpadding="4" align="center">
					<tr>
						<td class="titlebg" colspan="2">
							<b>', $txt['blk_editingblock'], ' - </b>', $context['this_block']['name'], '
						</td>
					</tr>
					<tr>
						<td>
							<b>', $txt['blk_title'], '</b>
						</td>
						<td>
							<input type="text" name="name" value="', $context['this_block']['name'], '">
						</td>
					</tr>
					<tr>
						<td colspan="2">
							<b>', $txt['blk_contents'], '</b>
						</td>
					</tr>
					<tr>
						<td align="center" colspan="2">
							<textarea class="editor" name="contents" rows="15" cols="50">', $context['this_block']['contents'], '</textarea>
						</td>
					</tr>
					<tr>
						<td>
							<b>', $txt['blk_order'], '</b>
						</td>
						<td>
							<input type="text" name="border" value="', $context['this_block']['border'], '" size="50">
						</td>
					</tr><tr>
						<td>
							<b>' . $txt['blk_mems'] . '</b><br />' . $txt['blk_help'] . '
						</td>
						<td>',
		groupselect($context['this_block']['allowance'],'blockmg[]'), '
						</td>
					</tr><tr>
						<td>
							<b>', $txt['blk_type'], ':</b>
						</td>
						<td>',
		blockTypes($context['this_block']['type'],'type'), '
						</td>
					</tr>
				<tr>
					<td>
						<b>', $txt['blk_location'], '</b>
					</td>
					<td>
						<select name="side">';

				foreach ($context['this_block']['sides'] AS $side)
				{
					$side_text = 'blk_' . $side['name'];

					echo '
								<option value="', $side['name'],'" ', $side['selected'], '>', $txt[$side_text], '</option>
';
				}
			echo '
						</select>
					</td>
				</tr><tr>
					<td>
						<b>', $txt['blk_phpe'], '</b>
					</td>
					<td>
						<input type="checkbox" name="phpe" value="1" ', $context['this_block']['phpe'], '>
					</td>
				</tr><tr>
						<td>
 							<b>', $txt['blk_360'], '</b>
						</td>
						<td>
',
		block_control('visible[]', $context['this_block']['visible']), '
						</td>
					</tr>
					<tr>
						<td>
							<b>', $txt['blk_templateField'], ':</b><br />
							<small>', $txt['blk_templateNote'], '</small>
						</td>
						<td>
							<input type="text" name="template" size="60" value="', $context['this_block']['template'], '">
						</td>
					</tr>
					<tr>
					<td>
						<b>', $txt['blk_active'], '</b>
					</td>
					<td>
						<input type="checkbox" name="active" value="1" ', $context['this_block']['active'], '>
					</td>
				</tr><tr>
					<td align="center" colspan="2">
						<input type="hidden" name="blockid" value="', $context['this_block']['id'], '">
						<input type="submit" name="submit" value="', $txt['blk_editblock'], '"> <input type="reset" name="reset" value="', $txt['blk_reset'], '">
					</td>
				</tr>
			</table>
		</td>
	</tr>
</table>
</form>
';
}
?>
Return current item: Enigma