Advertisement
Guest User

user.php

a guest
Dec 20th, 2014
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.88 KB | None | 0 0
  1. <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
  2.  
  3. class User extends CI_Controller {
  4.  
  5. public function __construct()
  6. {
  7. parent::__construct();
  8. }
  9. public function orders($offset=0)
  10. {
  11. $this->load->helper('url');
  12. $this->load->model('usermodel');
  13. $limit=7;
  14. $db_result=$this->usermodel->fetchorders($limit,$offset);
  15. $result=$db_result['result'];
  16. $total=$db_result['count'];
  17. $this->load->library('pagination');
  18. $c=0;
  19.  
  20. foreach($result as $row)
  21. {
  22. $o='o'.$c;
  23. $data[$o] = array(
  24. 'orderid' => $row->id,
  25. 'uid' => $row->uid,
  26. 'uid2' => $row->uid2,
  27. 'trans_time' => $row->transaction_time,
  28. 'trans_id' => $row->transaction_id,
  29. 'merchant' => $row->merchant,
  30. 'product' => $row->product,
  31. 'store_commission' => $row->sr,
  32. 'status'=>$row->status,
  33. 'trans_value' => $row->transaction_value,
  34. 'admin_status'=>$row->admin_status,
  35. 'admin_cashback'=>$row->admin_cashback,
  36. 'remaining_cashback'=>$row->remaining_cashback);
  37. $c++;
  38. }
  39. $data['total']=$total;
  40. $data['length']=$c;
  41. $config=array();
  42. $config['base_url']=site_url('user/orders');
  43. $config['total_rows']=$total;
  44. $config['per_page']=$limit;
  45. $config['use_page_numbers']=TRUE;
  46. $config['uri_segment'] = 3;
  47. $config['full_tag_open'] = '<ul class="pagination">';
  48. $config['full_tag_close'] = '</ul>';
  49. $config['first_tag_open'] = '<li>';
  50. $config['first_tag_close'] = '</li>';
  51. $config['last_tag_open'] = '<li>';
  52. $config['last_tag_close'] = '</li>';
  53. $config['next_link'] = '&gt';
  54. $config['next_tag_open'] = '<li>';
  55. $config['next_tag_close'] = '</li>';
  56. $config['prev_link'] = '&lt';
  57. $config['prev_tag_open'] = '<li>';
  58. $config['prev_tag_close'] = '</li>';
  59. $config['cur_tag_open'] = '<li class="active"><a>';
  60. $config['cur_tag_close'] = '</a></li>';
  61. $config['num_tag_open'] = '<li>';
  62. $config['num_tag_close'] = '</li>';
  63. $this->pagination->initialize($config);
  64. $data['pagination']=$this->pagination->create_links();
  65. $this->load->view('myorders',$data);
  66. }
  67.  
  68. public function transactions($offset=0)
  69. {
  70. $this->load->helper('url');
  71. $this->load->view('mytransactions');
  72. }
  73.  
  74. public function ajax_recharge()
  75. {
  76. $data = array();
  77. $data['mobile_number_error']="";
  78. $data['mobile_amount_error']="";
  79. $data['mobile_operator_error']="";
  80. $data['error']="";
  81. if($_GET['mobile_number']==null)
  82. {
  83. $data['mobile_number_error'] = "Enter Mobile Number";
  84. $data['error']="yes";
  85. }
  86. if($_GET['mobile_amount']==null)
  87. {
  88. $data['mobile_amount_error'] = "Enter Amount";
  89. $data['error']="yes";
  90. }
  91. if($_GET['mobile_operator']==null)
  92. {
  93. $data['mobile_operator_error'] = "Select an Operator";
  94. $data['error']="yes";
  95. }
  96. if($data['error'] == "")
  97. {
  98. $operator=$_GET['mobile_operator'];
  99. $amount=$_GET['mobile_amount'];
  100. $number=$_GET['mobile_number'];
  101. $this->load->model('usermodel');
  102. $data = $this->usermodel->fetchordersall($operator,$amount,$number);
  103. echo json_encode($data);
  104. }
  105. else
  106. {
  107. echo json_encode($data);
  108. }
  109. }
  110.  
  111. public function referdata($offset=0)
  112. {
  113. $this->load->helper('url');
  114. $this->load->model('usermodel');
  115. $limit=10;
  116. $db_result=$this->usermodel->fetchreferers($limit,$offset);
  117. $result=$db_result['result'];
  118. $total=$db_result['count'];
  119. $this->load->library('pagination');
  120. $c=0;
  121. foreach($result as $row)
  122. {
  123. $uid=$row->Id;
  124. $amt=$this->usermodel->fetchcashback($uid);
  125. $o='o'.$c;
  126. $data[$o] = array(
  127. 'username' => $row->username,
  128. 'email' => $row->email,
  129. 'ref_earning'=>$amt);
  130. $c++;
  131. }
  132. $config=array();
  133. $data['total']=$total;
  134. $data['length']=$c;
  135. $config['base_url']=site_url('user/referdata');
  136. $config['total_rows']=$total;
  137. $config['per_page']=$limit;
  138. $config['use_page_numbers']=TRUE;
  139. $config['uri_segment'] = 3;
  140. $config['full_tag_open'] = '<ul class="pagination">';
  141. $config['full_tag_close'] = '</ul>';
  142. $config['first_tag_open'] = '<li>';
  143. $config['first_tag_close'] = '</li>';
  144. $config['last_tag_open'] = '<li>';
  145. $config['last_tag_close'] = '</li>';
  146. $config['next_link'] = '&gt';
  147. $config['next_tag_open'] = '<li>';
  148. $config['next_tag_close'] = '</li>';
  149. $config['prev_link'] = '&lt';
  150. $config['prev_tag_open'] = '<li>';
  151. $config['prev_tag_close'] = '</li>';
  152. $config['cur_tag_open'] = '<li class="active"><a>';
  153. $config['cur_tag_close'] = '</a></li>';
  154. $config['num_tag_open'] = '<li>';
  155. $config['num_tag_close'] = '</li>';
  156. $this->pagination->initialize($config);
  157. $data['pagination']=$this->pagination->create_links();
  158. $this->load->view('referraldata',$data);
  159. }
  160. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement