示例#1
0
/**
* Show the banner edit page
*/
function showEdit()
{
    global $options_url;
    if (isset($_REQUEST['id'])) {
        $banner_id = $_REQUEST['id'];
    } else {
        $banner_id = "";
    }
    $bannersManager = new Banners();
    $banner = $bannersManager->getBanner($banner_id);
    ?>
<div class="wrap"> 
	<h2><?php 
    _e('WPAds - Edit banner');
    ?>
</h2> 
	
	<form name="banner_edit" method="post" action="<?php 
    echo $options_url;
    ?>
">
	<input type="hidden" name="action" value="edit2" />
	<input type="hidden" name="banner_id" value="<?php 
    echo $banner->banner_id;
    ?>
" />
	<table cellspacing="3">
		<tr>
			<td valign="top">ID</td>
			<td><?php 
    echo $banner->banner_id;
    ?>
</td>
		</tr>
		<tr>
			<td valign="top">Description</td>
			<td>
				<input name="banner_description" type="text" size="50" value="<?php 
    echo htmlentities($banner->banner_description);
    ?>
" /><br />
				Any text that helps you identify this banner
			</td>
		</tr>
		<tr>
			<td valign="top">HTML Code</td>
			<td>
				<textarea name="banner_html" rows="6" cols="80"><?php 
    echo htmlentities($banner->banner_html);
    ?>
</textarea><br />
				Copy and paste the HTML code to show the ad (for example, the Google AdSense code)
			</td>
		</tr>
		<tr>
			<td valign="top">Zones</td>
			<td>
				<input name="banner_zones" type="text" size="50" value="<?php 
    echo $banner->banner_zones;
    ?>
" /><br/>
				Enter names of the zones where this banner will show, separated by commas. Example: <em>sidebar1, sidebar2</em>
			</td>
		</tr>
		<tr>
			<td valign="top">Active</td>
			<td>
				<input name="banner_active" type="checkbox" value="Y" <?php 
    echo $banner->banner_active == "Y" ? "checked" : "";
    ?>
 />
			</td>
		</tr>
		<tr>
			<td valign="top">Weight</td>
			<td>
				<input name="banner_weight" type="text" size="10" value="<?php 
    echo $banner->banner_weight;
    ?>
" /><br />
				Sets how much a banner is displayed in relationship with other banners in the same zone. Default: 1
			</td>
		</tr>
		<tr>
			<td valign="top">Max views</td>
			<td>
				<input name="banner_maxviews" type="text" size="10" value="<?php 
    echo $banner->banner_maxviews;
    ?>
" /><br />
				Maximum number of times this banner will be shown. Default: 0 (unlimited views)
			</td>
		</tr>
		<tr>
			<td>&nbsp;</td>
			<td><input type="submit" name="submit" value="<?php 
    _e('Save');
    ?>
" /></td>
		</tr>
	</table>		
	
	</form>
</div>
<?php 
}