Beispiel #1
0
 public function get_credit_plan($id)
 {
     return AWPCP_CreditPlan::find_by_id($id);
 }
 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;
 }