コード例 #1
0
 public function prepare_items()
 {
     $query = $this->parse_query();
     $this->total_items = AWPCP_CreditPlan::query(array_merge(array('fields' => 'count'), $query));
     $this->items = AWPCP_CreditPlan::query(array_merge(array('fields' => '*'), $query));
     $this->set_pagination_args(array('total_items' => $this->total_items, 'per_page' => $this->items_per_page));
     $this->_column_headers = array($this->get_columns(), array(), $this->get_sortable_columns());
 }
コード例 #2
0
ファイル: credit-plan.php プロジェクト: sabdev1/ljcdevsab
 public function __construct($data = array())
 {
     if (!is_array(self::$defaults)) {
         self::$defaults = array('id' => null, 'name' => null, 'description' => null, 'credits' => null, 'price' => null, 'created' => null, 'updated' => null);
     }
     $data = array_merge(self::$defaults, $data);
     $data = $this->sanitize($data);
     foreach (self::$defaults as $name => $value) {
         $this->{$name} = $data[$name];
     }
 }
コード例 #3
0
ファイル: payments-api.php プロジェクト: sabdev1/ljcdevsab
 public function get_credit_plan($id)
 {
     return AWPCP_CreditPlan::find_by_id($id);
 }
コード例 #4
0
 private function ajax_delete($id)
 {
     $errors = array();
     if (is_null(AWPCP_CreditPlan::find_by_id($id))) {
         $message = _x("The specified Credit Plan doesn't exists.", 'credit plans ajax', 'AWPCP');
         $response = array('status' => 'error', 'message' => $message);
     } else {
         if (isset($_POST['remove'])) {
             if (AWPCP_CreditPlan::delete($id, $errors)) {
                 $response = array('status' => 'success');
             } else {
                 $response = array('status' => 'error', 'message' => join('<br/>', $errors));
             }
         } else {
             $columns = 5;
             ob_start();
             include AWPCP_DIR . '/admin/templates/delete_form.tpl.php';
             $html = ob_get_contents();
             ob_end_clean();
             $response = array('status' => 'success', 'html' => $html);
         }
     }
     return $response;
 }