<?php
/*
=====================================================
 Модуль создал: REZER (http://rezer.net)
=====================================================
 Файл: blocks.php
=====================================================
 Данный код защищен авторскими правами
=====================================================
 Назначение: Вывод всех валют
=====================================================
*/

if( !defined( "DATALIFEENGINE" ) ) die( "Hacking attempt!" );

$list = "";	
if( count( $Board->DB['blocks'] ) > 0 )
	{
		$list .= showStart();
		foreach( $Board->DB['blocks'] as $key => $row )
			{
				$id = $row['id'];
				$title = stripslashes( $row['title'] );
				$position = intval( $row['sort'] );
				
$list .= <<<HTML

<div id="del_Blocks_{$id}">
	<table width="100%" border="0">
		<tr height="30px" onmouseover="this.bgColor='#F1F7FE'" onmouseout="this.bgColor='#FFFFFF'">
			<td width="70px" align="center" id="StatusIDBlocks_{$id}">{$id}</td>
			<td style="padding: 2px 0px 2px 0px;"><a href="javascript:void(0);" onclick="EditBlocks( '{$id}' ); return false;">{$title}</a></td>
			<td width="100px" align="center">
				<input type="text" name="position[{$id}]" value="{$position}" style="text-align: center; width: 50px;" class="edit" />
			</td>
			<td width="100px" align="center">
				<a onclick="return dropdownmenu( this, event, MenuBlocks( '{$id}' ), '120px')" href="javascript:void(0);">
					<img src="engine/skins/images/browser_action.gif" border="0">
				</a>
			</td>
			<td width="30px">
				<input type="checkbox" name="CheckBlocks[]" value="{$id}" />
			</td>
		</tr>
		<tr>
			<td colspan="10" background="engine/skins/images/mline.gif" height="1"></td>
		</tr>
	</table>
</div>

HTML;

			}
	}
		else
	{
		$list = showStart()."<div style=\"padding: 15px; text-align: center;\">Блоков не обнаружено</div>".showStart();
	}

$list = <<<HTML

<form name="blocks" method="post" action="" onsubmit="SetFormSubmit( 'blocks' ); return false;">
	<table width="100%" border="0" style="margin: 2px 0px 2px 0px;">
		<tr>
			<td width="70px" align="center">ID</td>
			<td>Название</td>
			<td width="100px" align="center">Позиция</td>
			<td width="100px" align="center">Действие</td>
			<td width="30px">
				<input type="checkbox" name="ChecboxAll" onclick="CheckboxAllSelect( 'blocks' );" />
			</td>
		</tr>
	</table>
	<div class="hr_line"></div>
	{$list}
	<div class="hr_line"></div>
	<div style="padding: 5px;">
		<table width="100%" border="0">
			<tr>
				<td>
					<input type="button" value="Добавить блок" class="edit" onclick="AddBlocks(); return false;" />
				</td>
				<td align="right">
					<span id="status_blocks"></span>
					<select name="action" id="action_blocks">
						<option value=""> - Выберите действие - </option>
						<option value="sort">Изменить позиции</option>
						<option value="del">Удалить</option>
					</select>
					<input type="submit" name="submit" value="Сохранить" class="edit" />
					<input type="hidden" name="TypeAction" value="blocks" />
				</td>
			</tr>
		</table>
	</div>
</form>

HTML;

opentable();
tableheader( "Список блоков" );
echo $list;
closetable();

?>