public function get_payment_terms()
 {
     global $wpdb;
     if (!awpcp_payments_api()->payments_enabled()) {
         return array($this->get_free_payment_term());
     }
     $order = get_awpcp_option('fee-order');
     $direction = get_awpcp_option('fee-order-direction');
     switch ($order) {
         case 1:
             $orderby = array('adterm_name', $direction);
             break;
         case 2:
             $orderby = array("amount {$direction}, adterm_name", $direction);
             break;
         case 3:
             $orderby = array("imagesallowed {$direction}, adterm_name", $direction);
             break;
         case 5:
             $orderby = array("_duration_interval {$direction}, rec_period {$direction}, adterm_name", $direction);
             break;
     }
     if (awpcp_current_user_is_admin()) {
         $args = array('orderby' => $orderby[0], 'order' => $orderby[1]);
     } else {
         $args = array('where' => 'private = 0', 'orderby' => $orderby[0], 'order' => $orderby[1]);
     }
     return AWPCP_Fee::query($args);
 }
 public function prepare_items()
 {
     $query = $this->parse_query();
     $total_items = AWPCP_Fee::query(array_merge(array('fields' => 'count'), $query));
     $this->items = AWPCP_Fee::query(array_merge(array('fields' => '*'), $query));
     $this->set_pagination_args(array('total_items' => $total_items, 'per_page' => $this->items_per_page));
     $this->_column_headers = array($this->get_columns(), array(), $this->get_sortable_columns());
 }
?>
                    <?php 
$intervals = AWPCP_Fee::get_duration_intervals();
?>
                    <select name="duration_interval">
                        <?php 
foreach ($intervals as $interval) {
    ?>
                        <option value="<?php 
    echo $interval;
    ?>
" <?php 
    echo $selected == $interval ? 'selected="selected"' : '';
    ?>
><?php 
    echo AWPCP_Fee::get_duration_interval_label($interval);
    ?>
</option>
                        <?php 
}
?>
                    </select>
                </label>

        <?php 
// split form in two columns of fields if the categories list is not going to be shown
?>
        <?php 
if (!function_exists('awpcp_price_cats')) {
    ?>
        </fieldset>
示例#4
0
 private function ajax_delete($id)
 {
     $errors = array();
     if (is_null(AWPCP_Fee::find_by_id($id))) {
         $message = _x("The specified Credit Plan doesn't exists.", 'credit plans ajax', 'AWPCP');
         $response = array('status' => 'error', 'message' => $message);
     } else {
         $this->get_table();
         $columns = count($this->table->get_columns());
         ob_start();
         include AWPCP_DIR . '/admin/templates/admin-panel-fees-delete-form.tpl.php';
         $html = ob_get_contents();
         ob_end_clean();
         $response = array('status' => 'success', 'html' => $html);
     }
     return $response;
 }
 public function all()
 {
     return AWPCP_Fee::query();
 }