<?php
require_once('admin.php');
//____________________________________________________
$Display->Title = 'Options';
$Display->Subtitle = 'Manage Blocks';
//_____________________________________________________
if(!$_GET['action']) $Action = 'new';
else $Action = $_GET['action'];
if($Action === 'edit')
{
if(!$_GET['id'])
$Action = 'new';
else
{
$ID = intval($_GET['id']);
$Block = $DC->Select('block', 'block_id', $ID);
if(!$Block)
$Action = 'new';
else
{
$BlockID = $Block[0]['block_id'];
$BlockName = $Block[0]['block_name'];
$BlockValue = $Block[0]['block_value'];
$BlockCategory = $Block[0]['block_category'];
$BlockStatus = $Block[0]['block_status'];
$FormAction = 'action=update&id='.$BlockID;
}
}
}
if($Action === 'new')
{
$BlockID =
$BlockName =
$BlockValue =
$BlockCategory =
$BlockStatus = null;
$FormAction = 'action=new';
}
require_once('./admin-display-header.php');
?>
<h2> Please enter the following information to create the block </h2>
<form method="post" action="option-block-update.php?<?php _P($FormAction); ?>">
<table>
<tr> <td align="right"> Block Name (required) </td>
<td width="30"> <input type="text" size="48" name="block_name" value="<?php _P($BlockName); ?>" /> </td>
</tr>
<tr> <td align="right"> Block Category </td>
<td> <select name="block_category">
<option value="footer" <?php if($BlockCategory === 'footer') _P('selected="selected"'); ?> >Footer</option>
<option value="sidebar" <?php if($BlockCategory === 'sidebar') _P('selected="selected"'); ?> >Sidebar</option>
</select>
</td>
</tr>
<tr> <td align="right">Block Status</td>
<td> <select name="block_status">
<option value="show" <?php if($BlockStatus === 'show') _P('selected="selected"'); ?> >Show</option>
<option value="hide" <?php if($BlockStatus === 'hide') _P('selected="selected"'); ?> >Hide</option>
</select>
</td>
</tr>
<tr> <td align="right">Block Code</td>
<td> May contain some HTML. Please note currently PHP codes are not allowed (they will be shown as plain text!).</td>
</tr>
<tr> <td> </td>
<td> <textarea cols="48" rows="15" name="block_value"><?php _P($BlockValue); ?></textarea> </td>
</tr>
<tr> <td> </td>
<td align="right"> <input type="submit" value="Submit »" /> </td>
</tr>
</table>
<?php _foot(); ?>