PageRenderTime 26ms CodeModel.GetById 18ms RepoModel.GetById 1ms app.codeStats 0ms

/application/controllers/Usersetting.php

https://gitlab.com/ashish21590/rigalio.com
PHP | 272 lines | 210 code | 30 blank | 32 comment | 7 complexity | b3ad3f4340cc5a5581121637c37da1fb MD5 | raw file
  1. <?php
  2. defined('BASEPATH') OR exit('No direct script access allowed');
  3. require_once APPPATH.'libraries/facebook/facebook.php';
  4. class Usersetting extends CI_Controller {
  5. public function __construct(){
  6. parent::__construct();
  7. $this->load->helper('url_helper');
  8. $this->load->helper('form');
  9. $this->load->library('form_validation');
  10. $this->load->model('settingmodel');
  11. $this->load->library('session'); //Load the Session
  12. //$this->config->load('facebook');
  13. //$this->output->enable_profiler(True );
  14. //$this->output->cache(5); //Load the facebook.php file which is located in config directory
  15. }
  16. public function setting(){
  17. $this->load->model('getdata');
  18. $this->load->model('settingmodel');
  19. $data['seo']=$this->getdata->seo('page','usersetting');
  20. $data['products']=$this->getdata->getall();
  21. $data['all_cat']=$this->getdata->get_all_category();
  22. $data['avali_cat']=$this->getdata->availcat();
  23. $userregistrationid = $this->session->userdata('registrationid');
  24. // echo $userregistrationid;
  25. // $userregistrationid = $this->session->userdata('registrationid');
  26. if($userregistrationid != '')
  27. {
  28. $data['userdata'] = $this->settingmodel->getuserdata($userregistrationid);
  29. $data['getuserdataall'] = $this->settingmodel->getuserdataall($userregistrationid);
  30. $data['userpic'] = $this->settingmodel->getuserpic($userregistrationid);
  31. $data['usercrown'] = $this->settingmodel->getusercrown($userregistrationid);
  32. $data['usercomment'] = $this->settingmodel->getusercomment($userregistrationid);
  33. // print_r($data['usercomment']); exit;
  34. $data['userpost'] = $this->settingmodel->getuserpost($userregistrationid);
  35. $data['getuserpostimage'] = $this->settingmodel->getuserpostimage($userregistrationid);
  36. $data['getfollower'] = $this->settingmodel->getfollower($userregistrationid);
  37. $data['getbrand'] = $this->settingmodel->getbrand($userregistrationid);
  38. //print_r($data['getfollower']); exit;
  39. //print_r($getuserpostimage['is_active']); exit;
  40. $data['useremail'] = $this->settingmodel->alluseremail($userregistrationid);
  41. $data['userphoneno'] = $this->settingmodel->alluserphoneno($userregistrationid);
  42. // print_r($data['useremail']); exit;
  43. $this->load->view('pages/head.php',$data);
  44. $this->load->view('pages/usersetting.php' ,$data);
  45. $this->load->view('pages/footer.php');
  46. }
  47. else{
  48. redirect(base_url());
  49. }
  50. }
  51. public function userpassexist(){
  52. $this->load->model('settingmodel');
  53. $userregistrationid = $this->session->userdata('registrationid');
  54. $currentpass = $this->input->post('currentpass');
  55. $password = $this->settingmodel->passexist($currentpass, $userregistrationid);
  56. if(count($password) == 0)
  57. {
  58. echo '0';
  59. }
  60. else
  61. {
  62. echo '1';
  63. }
  64. }
  65. public function passwordchange(){
  66. $this->load->model('settingmodel');
  67. $userregistrationid = $this->session->userdata('registrationid');
  68. $newpass = $this->input->post('newpass');
  69. $newpassword = $this->settingmodel->passupdate($newpass, $userregistrationid);
  70. //redirect('main/logout');
  71. echo "logout";
  72. }
  73. public function dobchange(){
  74. $this->load->model('settingmodel');
  75. $userregistrationid = $this->session->userdata('registrationid');
  76. $newdob = $this->input->post('newdob');
  77. $newpassword = $this->settingmodel->dobupdate($newdob, $userregistrationid);
  78. }
  79. public function addphoneno(){
  80. $this->load->model('settingmodel');
  81. $userregistrationid = $this->session->userdata('registrationid');
  82. $phoneexist = $this->settingmodel->phonenoexist($userregistrationid);
  83. $addphone = $this->input->post('addphone');
  84. if($phoneexist[0]['phone']=='')
  85. {
  86. $addphoneno = $this->settingmodel->addphoneno($addphone, $userregistrationid);
  87. // echo '0';
  88. }
  89. else{
  90. $addmorephoneno = $this->settingmodel->addmorephoneno($addphone, $userregistrationid);
  91. //echo '1';
  92. }
  93. }
  94. public function addemail(){
  95. $this->load->model('settingmodel');
  96. $userregistrationid = $this->session->userdata('registrationid');
  97. $addemail = $this->input->post('addemail');
  98. $checkemail=$this->settingmodel->checkemailid($addemail, $userregistrationid);
  99. $checkemail1=$this->settingmodel->checkemailidreg($addemail, $userregistrationid);
  100. //print_r($checkemail); print_r($checkemail1); exit;
  101. if(count($checkemail)==0 && count($checkemail1)==0){
  102. $addmoreemail = $this->settingmodel->addmoreemail($addemail, $userregistrationid);
  103. echo "0";
  104. }
  105. else{
  106. echo "1";
  107. }
  108. //echo '1';
  109. }
  110. public function deleteemail()
  111. {
  112. $id = $this->uri->segment(3);
  113. $this->load->model('settingmodel');
  114. $this->settingmodel->deleteemailid($id);
  115. redirect($_SERVER['HTTP_REFERER']);
  116. }
  117. public function makeprimary()
  118. {
  119. $this->load->model('settingmodel');
  120. $userregistrationid = $this->session->userdata('registrationid');
  121. $primaryemailiddata = $this->settingmodel->getprimaryemail($userregistrationid);
  122. $primaryemailid = $primaryemailiddata[0]['email'];
  123. $id = $this->uri->segment(3);
  124. $wantstomake = $this->settingmodel->wantstomake($id);
  125. $wantstomakepe = $wantstomake[0]['useremail'];
  126. $updatenonprimary = $this->settingmodel->updatenonprimary($id, $primaryemailid);
  127. $updateprimary = $this->settingmodel->updateprimary($userregistrationid, $wantstomakepe);
  128. $updateprimaryuserlogin = $this->settingmodel->updateprimaryuserlogin($userregistrationid, $wantstomakepe);
  129. $updateprimaryuserdetail = $this->settingmodel->updateprimaryuserdetail($userregistrationid, $wantstomakepe);
  130. redirect($_SERVER['HTTP_REFERER']);
  131. }
  132. public function deletephoneno()
  133. {
  134. $id = $this->uri->segment(3);
  135. $this->load->model('settingmodel');
  136. $this->settingmodel->deletephoneno($id);
  137. redirect($_SERVER['HTTP_REFERER']);
  138. }
  139. public function makeprimaryphone()
  140. {
  141. $this->load->model('settingmodel');
  142. $userregistrationid = $this->session->userdata('registrationid');
  143. $primaryphonenodata = $this->settingmodel->getprimaryphoneno($userregistrationid);
  144. $primaryphoneno = $primaryphonenodata[0]['phone'];
  145. //echo $primaryphoneno;
  146. $id = $this->uri->segment(3);
  147. $wantstomakeph = $this->settingmodel->wantstomakeph($id);
  148. $wantstomakephpk = $wantstomakeph[0]['phoneno'];
  149. //echo $wantstomakephpk; exit;
  150. $updatenonprimaryph = $this->settingmodel->updatenonprimaryph($id, $primaryphoneno);
  151. $updateprimaryph = $this->settingmodel->updateprimaryph($userregistrationid, $wantstomakephpk);
  152. redirect($_SERVER['HTTP_REFERER']);
  153. }
  154. public function updateinfo()
  155. {
  156. $this->load->model('settingmodel');
  157. $userregistrationid = $this->session->userdata('registrationid');
  158. $updatedinfo = $this->input->post('updatedinfo');
  159. $updateinfodata = $this->settingmodel->updateinfo($userregistrationid, $updatedinfo);
  160. //echo $updatedinfo;
  161. redirect($_SERVER['HTTP_REFERER']);
  162. }
  163. public function updatecommunication()
  164. {
  165. $this->load->model('settingmodel');
  166. $userregistrationid = $this->session->userdata('registrationid');
  167. $keepyou = $this->input->get('keepyou');
  168. $updatecommunication = $this->settingmodel->updatecommunication($userregistrationid, $keepyou);
  169. //print_r($keepyou); exit;
  170. redirect($_SERVER['HTTP_REFERER']);
  171. }
  172. public function canseecrown()
  173. {
  174. $this->load->model('settingmodel');
  175. $userregistrationid = $this->session->userdata('registrationid');
  176. $seecrown = $this->input->post('seecrown');
  177. $updatecommunication = $this->settingmodel->updatecrownsetting($userregistrationid, $seecrown);
  178. //print_r($keepyou); exit;
  179. redirect($_SERVER['HTTP_REFERER']);
  180. }
  181. public function canseecomment()
  182. {
  183. $this->load->model('settingmodel');
  184. $userregistrationid = $this->session->userdata('registrationid');
  185. $seecomment = $this->input->post('seecomment');
  186. $updatecomment = $this->settingmodel->updatecommentsetting($userregistrationid, $seecomment);
  187. //print_r($keepyou); exit;
  188. redirect($_SERVER['HTTP_REFERER']);
  189. }
  190. public function canseestatus()
  191. {
  192. $this->load->model('settingmodel');
  193. $userregistrationid = $this->session->userdata('registrationid');
  194. $seestatus = $this->input->post('seestatus');
  195. $updatestatus = $this->settingmodel->updatestatussetting($userregistrationid, $seestatus);
  196. //print_r($keepyou); exit;
  197. redirect($_SERVER['HTTP_REFERER']);
  198. }
  199. public function canseephotos()
  200. {
  201. $this->output->enable_profiler(True );
  202. $this->load->model('settingmodel');
  203. $userregistrationid = $this->session->userdata('registrationid');
  204. $seephotos = $this->input->post('seephotos');
  205. //$imagenotnulldata = $this->settingmodel->postimagenotnull($userregistrationid);
  206. //print_r($me); exit;
  207. //if(count($imagenotnulldata)>0)
  208. //{
  209. //echo count($me); exit;
  210. $updatephotos = $this->settingmodel->updatephotossetting($userregistrationid, $seephotos);
  211. //print_r($keepyou); exit;
  212. //}
  213. redirect($_SERVER['HTTP_REFERER']);
  214. }
  215. public function canseefollower()
  216. {
  217. $this->output->enable_profiler(True );
  218. $this->load->model('settingmodel');
  219. $userregistrationid = $this->session->userdata('registrationid');
  220. $seefollower = $this->input->post('seefollower');
  221. $updatefollower = $this->settingmodel->updatefollowersetting($userregistrationid, $seefollower);
  222. //print_r($keepyou); exit;
  223. //}
  224. redirect($_SERVER['HTTP_REFERER']);
  225. }
  226. public function canseebrand()
  227. {
  228. $this->load->model('settingmodel');
  229. $userregistrationid = $this->session->userdata('registrationid');
  230. $seebrand = $this->input->post('seebrand');
  231. $updatebrand = $this->settingmodel->updatebrandsetting($userregistrationid, $seebrand);
  232. //print_r($keepyou); exit;
  233. //}
  234. redirect($_SERVER['HTTP_REFERER']);
  235. }
  236. public function logout(){
  237. $base_url=$this->config->item('base_url'); //Read the baseurl from the config.php file
  238. $this->session->sess_destroy(); //session destroy
  239. redirect($base_url); //redirect to the home page
  240. }
  241. }
  242. ?>