function rcp_discounts_page() { global $rcp_options, $rcp_discounts_db_name, $wpdb; $page = admin_url('/admin.php?page=rcp-discounts'); ?> <div class="wrap"> <?php if (isset($_GET['edit_discount'])) { include 'edit-discount.php'; } else { ?> <h2><?php _e('Discount Codes', 'rcp'); ?> </h2> <table class="wp-list-table widefat fixed posts"> <thead> <tr> <th class="rcp-discounts-id-col"><?php _e('ID', 'rcp'); ?> </th> <th class="rcp-discounts-name-col" ><?php _e('Name', 'rcp'); ?> </th> <th class="rcp-discounts-desc-col"><?php _e('Description', 'rcp'); ?> </th> <th class="rcp-discounts-code-col" ><?php _e('Code', 'rcp'); ?> </th> <th class="rcp-discounts-subscription-col" ><?php _e('Subscription', 'rcp'); ?> </th> <th class="rcp-discounts-amount-col"><?php _e('Amount', 'rcp'); ?> </th> <th class="rcp-discounts-type-col"><?php _e('Type', 'rcp'); ?> </th> <th class="rcp-discounts-status-col"><?php _e('Status', 'rcp'); ?> </th> <th class="rcp-discounts-uses-col"><?php _e('Uses', 'rcp'); ?> </th> <th class="rcp-discounts-uses-left-col"><?php _e('Uses Left', 'rcp'); ?> </th> <th class="rcp-discounts-expir-col" ><?php _e('Expiration', 'rcp'); ?> </th> <?php do_action('rcp_discounts_page_table_header'); ?> <th class="rcp-discounts-actions-col" ><?php _e('Actions', 'rcp'); ?> </th> </tr> </thead> <tfoot> <tr> <th><?php _e('ID', 'rcp'); ?> </th> <th><?php _e('Name', 'rcp'); ?> </th> <th><?php _e('Description', 'rcp'); ?> </th> <th><?php _e('Code', 'rcp'); ?> </th> <th><?php _e('Subscription', 'rcp'); ?> </th> <th><?php _e('Amount', 'rcp'); ?> </th> <th><?php _e('Type', 'rcp'); ?> </th> <th><?php _e('Status', 'rcp'); ?> </th> <th><?php _e('Uses', 'rcp'); ?> </th> <th><?php _e('Uses Left', 'rcp'); ?> </th> <th><?php _e('Expiration', 'rcp'); ?> </th> <?php do_action('rcp_discounts_page_table_header'); ?> <?php if (current_user_can('rcp_manage_discounts')) { ?> <th><?php _e('Actions', 'rcp'); ?> </th> <?php } ?> </tr> </tfoot> <tbody> <?php $codes = rcp_get_discounts(); ?> <?php if ($codes) { $i = 1; foreach ($codes as $key => $code) { ?> <tr class="rcp_row <?php if (rcp_is_odd($i)) { echo 'alternate'; } ?> "> <td><?php echo $code->id; ?> </td> <td><?php echo stripslashes($code->name); ?> </td> <td><?php echo stripslashes($code->description); ?> </td> <td><?php echo $code->code; ?> </td> <td> <?php if ($code->subscription_id > 0) { echo rcp_get_subscription_name($code->subscription_id); } else { echo __('All Levels', 'rcp'); } ?> </td> <td><?php echo rcp_discount_sign_filter($code->amount, $code->unit); ?> </td> <td><?php echo $code->unit == '%' ? __('Percentage', 'rcp') : __('Flat', 'rcp'); ?> </td> <td> <?php if (rcp_is_discount_not_expired($code->id)) { echo rcp_get_discount_status($code->id) == 'active' ? __('active', 'rcp') : __('disabled', 'rcp'); } else { _e('expired', 'rcp'); } ?> </td> <td><?php if ($code->max_uses > 0) { echo rcp_count_discount_code_uses($code->code) . '/' . $code->max_uses; } else { echo rcp_count_discount_code_uses($code->code); } ?> </td> <td><?php echo rcp_discount_has_uses_left($code->id) ? 'yes' : 'no'; ?> </td> <td><?php echo $code->expiration == '' ? __('none', 'rcp') : date_i18n('Y-m-d', strtotime($code->expiration)); ?> </td> <?php do_action('rcp_discounts_page_table_column', $code->id); ?> <?php if (current_user_can('rcp_manage_discounts')) { ?> <td> <a href="<?php echo add_query_arg('edit_discount', $code->id, $page); ?> "><?php _e('Edit', 'rcp'); ?> </a> | <?php if (rcp_get_discount_status($code->id) == 'active') { ?> <a href="<?php echo add_query_arg('deactivate_discount', $code->id, $page); ?> "><?php _e('Deactivate', 'rcp'); ?> </a> | <?php } else { ?> <a href="<?php echo add_query_arg('activate_discount', $code->id, $page); ?> "><?php _e('Activate', 'rcp'); ?> </a> | <?php } ?> <a href="<?php echo add_query_arg('delete_discount', $code->id, $page); ?> " class="rcp_delete_discount"><?php _e('Delete', 'rcp'); ?> </a> </td> <?php } ?> </tr> <?php $i++; } } else { ?> <tr><td colspan="11"><?php _e('No discount codes added yet.', 'rcp'); ?> </td> <?php } ?> </table> <?php do_action('rcp_discounts_below_table'); ?> <?php if (current_user_can('rcp_manage_levels')) { ?> <h3><?php _e('Add New Discount', 'rcp'); ?> </h3> <form id="rcp-discounts" action="" method="POST"> <table class="form-table"> <tbody> <tr class="form-field"> <th scope="row" valign="top"> <label for="rcp-name"><?php _e('Name', 'rcp'); ?> </label> </th> <td> <input name="name" id="rcp-name" type="text" value="" style="width: 300px;"/> <p class="description"><?php _e('The name of this discount', 'rcp'); ?> </p> </td> </tr> <tr class="form-field"> <th scope="row" valign="top"> <label for="rcp-description"><?php _e('Description', 'rcp'); ?> </label> </th> <td> <textarea name="description" id="rcp-description" style="width: 300px;"></textarea> <p class="description"><?php _e('The description of this discount code', 'rcp'); ?> </p> </td> </tr> <tr class="form-field"> <th scope="row" valign="top"> <label for="rcp-code"><?php _e('Code', 'rcp'); ?> </label> </th> <td> <input type="text" id="rcp-code" name="code" value="" style="width: 300px;"/> <p class="description"><?php _e('Enter a code for this discount, such as 10PERCENT', 'rcp'); ?> </p> </td> </tr> <tr class="form-field"> <th scope="row" valign="top"> <label for="rcp-unit"><?php _e('Type', 'rcp'); ?> </label> </th> <td> <select name="unit" id="rcp-duration-unit"> <option value="%"><?php _e('Percentage', 'rcp'); ?> </option> <option value="flat"><?php _e('Flat amount', 'rcp'); ?> </option> </select> <p class="description"><?php _e('The kind of discount to apply for this discount.', 'rcp'); ?> </p> </td> </tr> <tr class="form-field"> <th scope="row" valign="top"> <label for="rcp-amount"><?php _e('Amount', 'rcp'); ?> </label> </th> <td> <input type="text" id="rcp-amount" name="amount" value="" style="width: 40px;"/> <p class="description"><?php _e('The amount of this discount code.', 'rcp'); ?> </p> </td> </tr> <tr class="form-field"> <th scope="row" valign="top"> <label for="rcp-subscription"><?php _e('Subscription', 'rcp'); ?> </label> </th> <td> <?php $levels = rcp_get_subscription_levels('all', false); if ($levels) { ?> <select name="subscription" id="rcp-subscription"> <option value="0"><?php _e('All Levels', 'rcp'); ?> </option> <?php foreach ($levels as $level) { echo '<option value="' . $level->id . '">' . $level->name . '</option>'; } ?> </select> <?php } ?> <p class="description"><?php _e('The subscription levels this discount code can be used for.', 'rcp'); ?> </p> </td> </tr> <tr class="form-field"> <th scope="row" valign="top"> <label for="rcp-expiration"><?php _e('Expiration date', 'rcp'); ?> </label> </th> <td> <input name="expiration" id="rcp-expiration" type="text" style="width: 120px;" class="rcp-datepicker"/> <p class="description"><?php _e('Enter the expiration date for this discount code in the format of yyyy-mm-dd. For no expiration, leave blank', 'rcp'); ?> </p> </td> </tr> <tr class="form-field"> <th scope="row" valign="top"> <label for="rcp-max-uses"><?php _e('Max Uses', 'rcp'); ?> </label> </th> <td> <input type="text" id="rcp-max-uses" name="max" value="" style="width: 40px;"/> <p class="description"><?php _e('The maximum number of times this discount can be used. Leave blank for unlimited.', 'rcp'); ?> </p> </td> </tr> <?php do_action('rcp_add_discount_form'); ?> </tbody> </table> <p class="submit"> <input type="hidden" name="rcp-action" value="add-discount"/> <input type="submit" value="<?php _e('Add Discount Code', 'rcp'); ?> " class="button-primary"/> </p> </form> <?php } ?> <?php } ?> </div><!--end wrap--> <?php }
} ?> name="rcp_level" rel="<?php echo esc_attr($level->price); ?> " value="<?php echo esc_attr(absint($level->id)); ?> " <?php if ($level->duration == 0) { echo 'data-duration="forever"'; } ?> /> <span class="rcp_subscription_level_name"><?php echo rcp_get_subscription_name($level->id); ?> </span><span class="rcp_separator"> - </span><span class="rcp_price" rel="<?php echo esc_attr($level->price); ?> "><?php echo $level->price > 0 ? rcp_currency_filter($level->price) : __('free', 'rcp'); ?> <span class="rcp_separator"> - </span></span> <span class="rcp_level_duration"><?php echo $level->duration > 0 ? $level->duration . ' ' . rcp_filter_duration_unit($level->duration_unit, $level->duration) : __('unlimited', 'rcp'); ?> </span> <div class="rcp_level_description"> <?php echo rcp_get_subscription_description($level->id); ?>
/** * Retrieves the pending subscription name of the member * * @access public * @since 2.4.12 */ public function get_pending_subscription_name() { $sub_name = rcp_get_subscription_name($this->get_pending_subscription_id()); return apply_filters('rcp_member_get_subscription_name', $sub_name, $this->ID, $this); }
/** * Show User's Subscription ID Shortcode * * @since 2.5 * @access public * * @return string */ function rcp_user_subscription_name_shortcode() { if (!is_user_logged_in()) { return ''; } if (!($id = rcp_get_subscription_id())) { return ''; } return rcp_get_subscription_name($id); }
function after_register() { $_GET['level'] = get_usermeta($_GET['id'], 'reg_type'); $levels = rcp_get_subscription_levels('active'); $gateways = rcp_get_enabled_payment_gateways(); rcp_show_error_messages('register'); ?> <form id="rcp_registration_form" class="rcp_form" method="POST" action="<?php echo esc_url(rcp_get_current_url()); if (isset($_GET['id'])) { echo '?id=' . $_GET['id']; } ?> "> <div class="saloginwrapper"> <h2 class="section-title"><span>Successful Registration!</span></h2> <div class="clear"></div> <ul id="rcp_subscription_levels" style="display:none;"> <?php foreach ($levels as $key => $level) { ?> <?php if (rcp_show_subscription_level($level->id)) { ?> <li id="rcp_subscription_level_<?php echo $level->id; ?> " class="rcp_subscription_level"> <input type="radio" class="required rcp_level" <?php if (isset($_GET['level']) && $_GET['level'] == $level->id) { echo 'checked="checked"'; } ?> name="rcp_level" rel="<?php echo esc_attr($level->price); ?> " value="<?php echo esc_attr(absint($level->id)); ?> " <?php if ($level->duration == 0) { echo 'data-duration="forever"'; } ?> /> <span class="rcp_subscription_level_name"><?php echo rcp_get_subscription_name($level->id); ?> </span><span class="rcp_separator"> - </span><span class="rcp_price" rel="<?php echo esc_attr($level->price); ?> "><?php echo $level->price > 0 ? rcp_currency_filter($level->price) : __('free', 'rcp'); ?> <span class="rcp_separator"> - </span></span> <span class="rcp_level_duration"><?php echo $level->duration > 0 ? $level->duration . ' ' . rcp_filter_duration_unit($level->duration_unit, $level->duration) : __('unlimited', 'rcp'); ?> </span> <div class="rcp_level_description"> <?php echo rcp_get_subscription_description($level->id); ?> </div> </li> <?php } ?> <?php } ?> </ul> <?php $gateways = rcp_get_enabled_payment_gateways(); if (count($gateways) > 1) { $display = rcp_has_paid_levels() ? '' : ' style="display: none;"'; ?> <fieldset class="rcp_gateways_fieldset"> <p> <label><?php _e('Choose Your Payment Method', 'rcp'); ?> </label> </p> <p id="rcp_payment_gateways"<?php echo $display; ?> > <select name="rcp_gateway" id="rcp_gateway" style="float:left; position:relative;"> <?php foreach ($gateways as $key => $gateway) { ?> <option value="<?php echo esc_attr($key); ?> "><?php echo esc_html($gateway); ?> </option> <?php } ?> </select> </p> </fieldset> <?php } ?> <?php do_action('rcp_before_registration_submit_field', $levels); ?> <p id="rcp_submit_wrap"> <input type="hidden" name="rcp_register_nonce" value="<?php echo wp_create_nonce('rcp-register-nonce'); ?> "/> <input type="submit" name="rcp_submit_registration" id="rcp_submit" value="<?php echo apply_filters('rcp_registration_register_button', __('Register', 'rcp')); ?> "/> </p> <div class="clear"></div> </div></form> <?php }
function rcp_get_subscription($user_id = 0) { if (empty($user_id) && is_user_logged_in()) { $user_id = get_current_user_id(); } $subscription_id = get_user_meta($user_id, 'rcp_subscription_level', true); $subscription = rcp_get_subscription_name($subscription_id); return $subscription; }
</fieldset> <?php } ?> <?php do_action( 'rcp_before_subscription_form_fields' ); ?> <fieldset class="rcp_subscription_fieldset"> <?php $levels = rcp_get_subscription_levels( 'active' ); if( $levels ) : ?> <p class="rcp_subscription_message"><?php echo apply_filters ( 'rcp_registration_choose_subscription', __( 'Choose your subscription level', 'rcp' ) ); ?></p> <ul id="rcp_subscription_levels"> <?php foreach( $levels as $key => $level ) : ?> <?php if( rcp_show_subscription_level( $level->id ) ) : ?> <li id="rcp_subscription_level_<?php echo $level->id; ?>" class="rcp_subscription_level"> <input type="radio" class="required rcp_level" <?php if( $key == 0 || ( isset( $_GET['level'] ) && $_GET['level'] == $key ) ) { echo 'checked="checked"'; } ?> name="rcp_level" rel="<?php echo esc_attr( $level->price ); ?>" value="<?php echo esc_attr( absint( $level->id ) ); ?>" <?php if( $level->duration == 0 ) { echo 'data-duration="forever"'; } ?>/> <span class="rcp_subscription_level_name"><?php echo rcp_get_subscription_name( $level->id ); ?></span><span class="rcp_separator"> - </span><span class="rcp_price" rel="<?php echo esc_attr( $level->price ); ?>"><?php echo $level->price > 0 ? rcp_currency_filter( $level->price ) : __( 'free', 'rcp' ); ?><span class="rcp_separator"> - </span></span> <span class="rcp_level_duration"><?php echo $level->duration > 0 ? $level->duration . ' ' . rcp_filter_duration_unit( $level->duration_unit, $level->duration ) : __( 'unlimited', 'rcp' ); ?></span> <div class="rcp_level_description"> <?php echo rcp_get_subscription_description( $level->id ); ?></div> </li> <?php endif; ?> <?php endforeach; ?> </ul> <?php else : ?> <p><strong><?php _e( 'You have not created any subscription levels yet', 'rcp' ); ?></strong></p> <?php endif; ?> </fieldset> <?php if( rcp_has_discounts() ) : ?> <fieldset class="rcp_discounts_fieldset"> <p id="rcp_discount_code_wrap"> <label for="rcp_discount_code">
public function draw_page() { global $wpdb; $page = admin_url('/admin.php?page=rcp-gifts'); ?> <div class="wrap"> <?php // get all discounts ids $discounts_db = rcp_get_discounts_db_name(); $discount_ids = $wpdb->get_col("SELECT meta_value FROM {$wpdb->postmeta} WHERE meta_key = '_edd_rcp_gift_id';"); $discount_ids = implode(',', $discount_ids); $discounts = $wpdb->get_results("SELECT * FROM {$discounts_db} WHERE id IN (" . $discount_ids . ");"); ?> <h2><?php _e('Restrict Content Pro Gifts', 'rcp-gifts'); ?> </h2> <table class="wp-list-table widefat fixed posts"> <thead> <tr> <th class="rcp-discounts-id-col"><?php _e('ID', 'rcp-gifts'); ?> </th> <th class="rcp-discounts-name-col" ><?php _e('Name', 'rcp-gifts'); ?> </th> <th class="rcp-discounts-desc-col"><?php _e('Description', 'rcp-gifts'); ?> </th> <th class="rcp-discounts-code-col" ><?php _e('Code', 'rcp-gifts'); ?> </th> <th class="rcp-discounts-subscription-col" ><?php _e('Subscription', 'rcp-gifts'); ?> </th> <th class="rcp-discounts-amount-col"><?php _e('Amount', 'rcp-gifts'); ?> </th> <th class="rcp-discounts-type-col"><?php _e('Type', 'rcp-gifts'); ?> </th> <th class="rcp-discounts-status-col"><?php _e('Status', 'rcp-gifts'); ?> </th> <th class="rcp-discounts-uses-col"><?php _e('Uses', 'rcp-gifts'); ?> </th> <th class="rcp-discounts-uses-left-col"><?php _e('Uses Left', 'rcp-gifts'); ?> </th> <th class="rcp-discounts-expir-col" ><?php _e('Expiration', 'rcp-gifts'); ?> </th> <th class="rcp-discounts-actions-col" ><?php _e('Actions', 'rcp-gifts'); ?> </th> </tr> </thead> <tfoot> <tr> <th><?php _e('ID', 'rcp-gifts'); ?> </th> <th><?php _e('Name', 'rcp-gifts'); ?> </th> <th><?php _e('Description', 'rcp-gifts'); ?> </th> <th><?php _e('Code', 'rcp-gifts'); ?> </th> <th><?php _e('Subscription', 'rcp-gifts'); ?> </th> <th><?php _e('Amount', 'rcp-gifts'); ?> </th> <th><?php _e('Type', 'rcp-gifts'); ?> </th> <th><?php _e('Status', 'rcp-gifts'); ?> </th> <th><?php _e('Uses', 'rcp-gifts'); ?> </th> <th><?php _e('Uses Left', 'rcp-gifts'); ?> </th> <th><?php _e('Expiration', 'rcp-gifts'); ?> </th> <th><?php _e('Actions', 'rcp-gifts'); ?> </th> </tr> </tfoot> <tbody> <?php if ($discounts) { $i = 1; foreach ($discounts as $key => $discount) { ?> <tr class="rcp_row <?php if (rcp_is_odd($i)) { echo 'alternate'; } ?> "> <td><?php echo $discount->id; ?> </td> <td><?php echo stripslashes($discount->name); ?> </td> <td><?php echo stripslashes($discount->description); ?> </td> <td><?php echo $discount->code; ?> </td> <td> <?php if ($discount->subscription_id > 0) { echo rcp_get_subscription_name($discount->subscription_id); } else { echo __('All Levels', 'rcp-gifts'); } ?> </td> <td><?php echo rcp_discount_sign_filter($discount->amount, $discount->unit); ?> </td> <td><?php echo $discount->unit == '%' ? __('Percentage', 'rcp-gifts') : __('Flat', 'rcp-gifts'); ?> </td> <td> <?php if (rcp_is_discount_not_expired($discount->id)) { echo rcp_get_discount_status($discount->id) == 'active' ? __('active', 'rcp-gifts') : __('disabled', 'rcp-gifts'); } else { _e('expired', 'rcp-gifts'); } ?> </td> <td><?php if ($discount->max_uses > 0) { echo rcp_count_discount_code_uses($discount->code) . '/' . $discount->max_uses; } else { echo rcp_count_discount_code_uses($discount->code); } ?> </td> <td><?php echo rcp_discount_has_uses_left($discount->id) ? 'yes' : 'no'; ?> </td> <td><?php echo $discount->expiration == '' ? __('none', 'rcp-gifts') : date_i18n('Y-m-d', strtotime($discount->expiration)); ?> </td> <?php do_action('rcp_discounts_page_table_column', $discount->id); ?> <td> <?php if (rcp_get_discount_status($discount->id) == 'active') { ?> <a href="<?php echo add_query_arg('deactivate_discount', $discount->id, $page); ?> "><?php _e('Deactivate', 'rcp-gifts'); ?> </a> | <?php } else { ?> <a href="<?php echo add_query_arg('activate_discount', $discount->id, $page); ?> "><?php _e('Activate', 'rcp-gifts'); ?> </a> | <?php } ?> <a href="<?php echo add_query_arg('delete_discount', $discount->id, $page); ?> " class="rcp_delete_discount"><?php _e('Delete', 'rcp-gifts'); ?> </a> </td> </tr> <?php $i++; } } else { ?> <tr><td colspan="11"><?php _e('No discount codes added yet.', 'rcp-gifts'); ?> </td> <?php } ?> </table> </div> <?php }
/** * Displays the earnings graph. * * @access public * @since 1.8 */ function rcp_earnings_graph() { global $rcp_options, $wpdb; // Retrieve the queried dates $dates = rcp_get_report_dates(); // Determine graph options switch ($dates['range']) { case 'today': $time_format = '%d/%b'; $tick_size = 'hour'; $day_by_day = true; break; case 'last_year': $time_format = '%b'; $tick_size = 'month'; $day_by_day = false; break; case 'this_year': $time_format = '%b'; $tick_size = 'month'; $day_by_day = false; break; case 'last_quarter': $time_format = '%b'; $tick_size = 'month'; $day_by_day = false; break; case 'this_quarter': $time_format = '%b'; $tick_size = 'month'; $day_by_day = false; break; case 'other': if ($dates['m_end'] - $dates['m_start'] >= 2) { $time_format = '%b'; $tick_size = 'month'; $day_by_day = false; } else { $time_format = '%d/%b'; $tick_size = 'day'; $day_by_day = true; } break; default: $time_format = '%d/%b'; // Show days by default $tick_size = 'day'; // Default graph interval $day_by_day = true; break; } $time_format = apply_filters('rcp_graph_timeformat', $time_format); $tick_size = apply_filters('rcp_graph_ticksize', $tick_size); $earnings = (double) 0.0; // Total earnings for time period shown $subscription = isset($_GET['subscription']) ? absint($_GET['subscription']) : false; $payments_db = new RCP_Payments(); $args = array('subscription' => rcp_get_subscription_name($subscription), 'date' => array()); ob_start(); ?> <script type="text/javascript"> jQuery( document ).ready( function($) { $.plot( $("#rcp_earnings_graph"), [{ data: [ <?php if ($dates['range'] == 'this_week' || $dates['range'] == 'last_week') { //Day by day $day = $dates['day']; $day_end = $dates['day_end']; $month = $dates['m_start']; while ($day <= $day_end) { $args = array('date' => array('day' => $day, 'month' => $month, 'year' => $dates['year']), 'fields' => 'amount'); $args['date'] = array('day' => $day, 'month' => $month, 'year' => $dates['year']); $payments = $payments_db->get_earnings($args); $earnings += $payments; $date = mktime(0, 0, 0, $month, $day, $dates['year']); ?> [<?php echo $date * 1000; ?> , <?php echo $payments; ?> ], <?php $day++; } } else { $y = $dates['year']; while ($y <= $dates['year_end']) { if ($dates['year'] == $dates['year_end']) { $month_start = $dates['m_start']; $month_end = $dates['m_end']; } elseif ($y == $dates['year']) { $month_start = $dates['m_start']; $month_end = 12; } else { $month_start = 1; $month_end = 12; } $i = $month_start; while ($i <= $month_end) { if ($day_by_day) { $num_of_days = cal_days_in_month(CAL_GREGORIAN, $i, $y); $d = 1; while ($d <= $num_of_days) { $args['date'] = array('day' => $d, 'month' => $i, 'year' => $y); $payments = $payments_db->get_earnings($args); $earnings += $payments; $date = mktime(0, 0, 0, $i, $d, $y); ?> [<?php echo $date * 1000; ?> , <?php echo $payments; ?> ], <?php $d++; } } else { $args['date'] = array('day' => null, 'month' => $i, 'year' => $y); $payments = $payments_db->get_earnings($args); $earnings += $payments; $date = mktime(0, 0, 0, $i, 1, $y); ?> [<?php echo $date * 1000; ?> , <?php echo $payments; ?> ], <?php } $i++; } $y++; } } ?> , ], yaxis: 2, label: "<?php _e('Earnings', 'rcp'); ?> ", id: 'sales' }], { series: { lines: { show: true }, points: { show: true } }, grid: { show: true, aboveData: false, color: '#ccc', backgroundColor: '#fff', borderWidth: 2, borderColor: '#ccc', clickable: false, hoverable: true }, xaxis: { mode: "time", timeFormat: "<?php echo $time_format; ?> ", minTickSize: [1, "<?php echo $tick_size; ?> "] }, yaxis: { min: 0, minTickSize: 1, tickDecimals: 0 } }); function rcp_flot_tooltip(x, y, contents) { $('<div id="rcp-flot-tooltip">' + contents + '</div>').css( { position: 'absolute', display: 'none', top: y + 5, left: x + 5, border: '1px solid #fdd', padding: '2px', 'background-color': '#fee', opacity: 0.80 }).appendTo("body").fadeIn(200); } var previousPoint = null; $("#rcp_earnings_graph").bind("plothover", function (event, pos, item) { if (item) { if (previousPoint != item.dataIndex) { previousPoint = item.dataIndex; $("#rcp-flot-tooltip").remove(); var x = item.datapoint[0].toFixed(2), y = item.datapoint[1].toFixed(2); if( rcp_vars.currency_pos == 'before' ) { rcp_flot_tooltip( item.pageX, item.pageY, item.series.label + ' ' + rcp_vars.currency_sign + y ); } else { rcp_flot_tooltip( item.pageX, item.pageY, item.series.label + ' ' + y + rcp_vars.currency_sign ); } } } else { $("#rcp-flot-tooltip").remove(); previousPoint = null; } }); }); </script> <h2><?php _e('Earnings Report', 'rcp'); ?> </h2> <div class="metabox-holder" style="padding-top: 0;"> <div class="postbox"> <div class="inside"> <?php rcp_reports_graph_controls(); ?> <div id="rcp_earnings_graph" style="height: 300px;"></div> <p class="rcp_graph_totals"><strong><?php _e('Total earnings for period shown: ', 'rcp'); echo rcp_currency_filter(number_format_i18n($earnings, 2)); ?> </strong></p> </div> </div> </div> <?php echo ob_get_clean(); }
<tbody style="vertical-align: top;"> <tr> <th><?php _e('Subscription', 'rcp'); ?> </th> <th><?php _e('Amount', 'rcp'); ?> </th> </tr> <tr> <td><?php echo rcp_get_subscription_name(rcp_get_registration()->get_subscription()); ?> </td> <td><?php echo rcp_get_subscription_price(rcp_get_registration()->get_subscription()) > 0 ? rcp_currency_filter(number_format(rcp_get_subscription_price(rcp_get_registration()->get_subscription()), rcp_currency_decimal_filter())) : __('free', 'rcp'); ?> </td> </tr> <?php if (rcp_get_subscription_price(rcp_get_registration()->get_subscription())) { ?> <?php if (rcp_get_registration()->get_fees() || rcp_get_registration()->get_discounts()) { ?> <tr>