<div class="wrap">

<?php include(sprintf("%s/the_header.php", dirname(__FILE__))); ?>

<form method="post" action="<?php echo $_SERVER["REQUEST_URI"]; ?>">

<?php $id = $this->get_value( $args, 'id', 0 ); ?>
<input type="hidden" name="aoa_id" value="<?php echo $id; ?>" />

        <table class="form-table">  

<?php if ( $id ) : ?>
            <tr valign="top">
                <th scope="row"><?php esc_html_e( 'Ad Overlay ID:', 'ad-overlay-anything' );?></th>
		<td><?php echo $id;?></td>
            </tr>
            <tr valign="top">
                <th scope="row"><?php esc_html_e( 'Example Usage:', 'ad-overlay-anything' );?></th>
		<td><input type="text" onclick="this.focus();this.select()" readonly="readonly" size="40" maxlength="128" value="[aoa id='<?php echo $id;?>']anything[/aoa]" /></td>
            </tr>
<?php endif; ?>
            <tr valign="top">
                <th scope="row"><?php esc_html_e( 'Nickname for Ad Overlay:', 'ad-overlay-anything' );?></th>
                <td>
			<input type="text" size="40" maxlength="128" name="aoa_nickname" id="aoa_nickname" value="<?php echo $this->get_value( $args, 'name');?>" />
			&nbsp; Status: 
			<?php $optValue = $this->get_value( $args, 'status', '1' );?>
			<select name="aoa_status">
				<option value="1" <?php echo ($optValue == '1') ? "SELECTED" : "" ?>>Active</option>
				<option value="0" <?php echo ($optValue == '0') ? "SELECTED" : "" ?>>Inactive</option>
			</select>
		</td>
            </tr>
            <tr valign="top">
                <th scope="row"><?php esc_html_e( 'Ad Overlay Content:', 'ad-overlay-anything' );?></th>
		<?php $content = $this->get_value( $args, 'content'); ?>
                <td><?php wp_editor( $content, 'aoa_content', array( 'textarea_rows' => 10, 'media_buttons' => true ) ); ?></td>
            </tr>

<?php if ( ! empty( $content ) ) : ?>
            <tr valign="top">
                <th scope="row"><?php esc_html_e( 'Ad Preview:', 'ad-overlay-anything' );?></th>
                <td><?php echo do_shortcode( $content );?></td>
            </tr>
<?php endif; ?>

            <tr valign="top">
                <th scope="row"><?php esc_html_e( 'Text for Close Button:', 'ad-overlay-anything' );?></th>
                <td><input type="text" size="40" maxlength="128" name="aoa_close" id="aoa_close" value="<?php echo $this->get_value( $args, 'close', 'Close');?>" /></td>
            </tr>

            <tr valign="top">
                <th scope="row"><?php esc_html_e( 'Percent Chance to Show:', 'ad-overlay-anything' );?></th>
                <td><input type="text" size="3" maxlength="3" name="aoa_percent" id="aoa_percent" value="<?php echo $this->get_value( $args, 'percent', '100' );?>" />%</td>
            </tr>

            <tr valign="top">
                <th scope="row"><?php esc_html_e( 'Additional CSS Class:', 'ad-overlay-anything' );?></th>
                <td><input type="text" size="40" maxlength="128" name="aoa_class" id="aoa_class" value="<?php echo $this->get_value( $args, 'class', '');?>" /></td>
            </tr>


	</table>

	<input class="button-primary" type="submit" name="save_ad" value="<?php esc_html_e('Save Ad Overlay', 'ad-overlay-anything'); ?> &raquo;" />

</form>

</div>
