Пример #1
0
/**
 * Show the metered content section
 */
function __tinypass_metered_display(TPPaySettings $ps)
{
    $metered = $ps->getMetered('count');
    $trial_period = $ps->getMeterTrialPeriod();
    $trial_period_type = $ps->getMeterTrialPeriodType();
    $lockout_period = $ps->getMeterLockoutPeriod('1');
    $lockout_period_type = $ps->getMeterLockoutPeriodType('week');
    $meter_count = $ps->getMeterMaxAccessAttempts(10);
    $times = TPSiteSettings::$PERIOD_CHOICES;
    ?>

	<div class="tp-section">
		<div class="info">
			<div class="heading">How many previews?</div>
			<div class="desc">After a user hits their preview count, they will be required
				to pay for access until your timer resets.
			</div>
		</div>
		<div class="body">

			<div class="postbox">
				<h3><?php 
    _e('Mode & Rules');
    ?>
 </h3>
				<div class="inside">

					<table class="form-table">
						<tr>
							<td width="120" valign="middle">
								<div>
									<?php 
    echo __tinypass_dropdown("tinypass[metered]", array('count' => 'Page views'), $metered, array("onchange" => "tinypass.showMeteredOptions(this)"));
    ?>
								</div>
							</td>
							<td style="border-left:1px solid #DFDFDF">

								<div id="tp-metered-count" class="tp-metered-options">
									<label>Users get</label>
									<input type="text" size="5" maxlength="5" name="tinypass[m_maa]" value="<?php 
    echo $meter_count;
    ?>
">
									<label>free views within</label>
									<input type="text" size="5" maxlength="5" name="tinypass[m_lp]" value="<?php 
    echo $lockout_period;
    ?>
">
									<?php 
    echo __tinypass_dropdown("tinypass[m_lp_type]", $times, $lockout_period_type);
    ?>
								</div>

								<div id="tp-metered-time" class="tp-metered-options">
									<label>Users will have access for</label>
									<input type="text" size="5" maxlength="5" name="tinypass[m_tp]" value="<?php 
    echo $trial_period;
    ?>
">
									<?php 
    echo __tinypass_dropdown("tinypass[m_tp_type]", $times, $trial_period_type);
    ?>
									<label>then they will be locked out for</label>
									<input type="text" size="5" maxlength="5" name="tinypass[m_lp]" value="<?php 
    echo $lockout_period;
    ?>
">
									<?php 
    echo __tinypass_dropdown("tinypass[m_lp_type]", $times, $lockout_period_type);
    ?>
								</div>

							</td>
						</tr>
					</table>
				</div>
			</div>
		</div>
		<div class="clear"></div>
	</div>
<?php 
}