PageRenderTime 38ms CodeModel.GetById 8ms RepoModel.GetById 0ms app.codeStats 0ms

/option1/application/controllers/Usersetting.php

https://gitlab.com/akanshagupta/jigglylanding
PHP | 389 lines | 287 code | 56 blank | 46 comment | 9 complexity | ea38337e0f32eac183a8b35d80b3dc83 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. $data['user_all_detials']=$this->getdata->getuserdata($userregistrationid);
  25. // echo $userregistrationid;
  26. // $userregistrationid = $this->session->userdata('registrationid');
  27. if($userregistrationid != '')
  28. {
  29. $data['userdata'] = $this->settingmodel->getuserdata($userregistrationid);
  30. $data['getuserdataall'] = $this->settingmodel->getuserdataall($userregistrationid);
  31. $data['userpic'] = $this->settingmodel->getuserpic($userregistrationid);
  32. // $data['usercrown'] = $this->settingmodel->getusercrown($userregistrationid);
  33. // $data['usercomment'] = $this->settingmodel->getusercomment($userregistrationid);
  34. // print_r($data['usercomment']); exit;
  35. // $data['userpost'] = $this->settingmodel->getuserpost($userregistrationid);
  36. $data['getuserdetail'] = $this->settingmodel->getuserdetail($userregistrationid);
  37. // $data['getuserpostimage'] = $this->settingmodel->getuserpostimage($userregistrationid);
  38. // $data['getfollower'] = $this->settingmodel->getfollower($userregistrationid);
  39. // $data['getbrand'] = $this->settingmodel->getbrand($userregistrationid);
  40. //print_r($data['getfollower']); exit;
  41. //print_r($getuserpostimage['is_active']); exit;
  42. $data['useremail'] = $this->settingmodel->alluseremail($userregistrationid);
  43. $data['userphoneno'] = $this->settingmodel->alluserphoneno($userregistrationid);
  44. // print_r($data['useremail']); exit;
  45. $this->load->view('pages/head.php',$data);
  46. $this->load->view('pages/usersetting.php' ,$data);
  47. $this->load->view('pages/footer.php');
  48. }
  49. else{
  50. redirect(base_url());
  51. }
  52. }
  53. public function userpassexist(){
  54. $this->load->model('settingmodel');
  55. $userregistrationid = $this->session->userdata('registrationid');
  56. $currentpass = $this->input->post('currentpass');
  57. $password = $this->settingmodel->passexist($currentpass, $userregistrationid);
  58. if(count($password) == 0)
  59. {
  60. echo '0'; exit;
  61. }
  62. else
  63. {
  64. echo '1'; exit;
  65. }
  66. }
  67. public function passwordchange(){
  68. $this->load->model('settingmodel');
  69. $userregistrationid = $this->session->userdata('registrationid');
  70. $newpass = $this->input->post('newpass');
  71. $newpassword = $this->settingmodel->passupdate($newpass, $userregistrationid);
  72. redirect('main/logout');
  73. //echo "logout";
  74. }
  75. public function dobchange(){
  76. $this->load->model('settingmodel');
  77. $userregistrationid = $this->session->userdata('registrationid');
  78. $newdob = $this->input->post('newdob');
  79. $newpassword = $this->settingmodel->dobupdate($newdob, $userregistrationid);
  80. $getnewdob = $this->settingmodel->getnewdob($userregistrationid);
  81. echo $getnewdob[0]['dob'];
  82. }
  83. public function addphoneno(){
  84. $this->load->model('settingmodel');
  85. $userregistrationid = $this->session->userdata('registrationid');
  86. $phoneexist = $this->settingmodel->phonenoexist($userregistrationid);
  87. // $phoneexist = $this->settingmodel->phonenoexist1($userregistrationid);
  88. $addphone = $this->input->post('addphone');
  89. if($phoneexist[0]['phone']=='')
  90. {
  91. $addphoneno = $this->settingmodel->addphoneno($addphone, $userregistrationid);
  92. // echo '0';
  93. }
  94. else{
  95. $checkphoneno=$this->settingmodel->checkphonenomain($addphone, $userregistrationid);
  96. $checkphoneno1=$this->settingmodel->checkphoneno($addphone, $userregistrationid);
  97. if(count($checkphoneno)==0 && count($checkphoneno1)==0){
  98. $addmorephoneno = $this->settingmodel->addmorephoneno($addphone, $userregistrationid);
  99. $data['addphonenoajax'] = $this->settingmodel->ajaxphoneno($addmorephoneno);
  100. $this->load->view('pages/addphoneno.php',$data);
  101. }
  102. else{
  103. //echo "already exist";
  104. echo '1';
  105. }
  106. //echo '1';
  107. }
  108. }
  109. public function addemail(){
  110. $this->load->model('settingmodel');
  111. $userregistrationid = $this->session->userdata('registrationid');
  112. $addemail = $this->input->post('addemail');
  113. $checkemail=$this->settingmodel->checkemailid($addemail, $userregistrationid);
  114. $checkemail1=$this->settingmodel->checkemailidreg($addemail, $userregistrationid);
  115. //print_r($checkemail); print_r($checkemail1); exit;
  116. if(count($checkemail)==0 && count($checkemail1)==0){
  117. $addmoreemail = $this->settingmodel->addmoreemail($addemail, $userregistrationid);
  118. $data['addemailajax'] = $this->settingmodel->ajaxemail($addmoreemail);
  119. //print_r($addemailajax);
  120. $this->load->view('pages/addemail.php',$data);
  121. //echo "0";
  122. }
  123. else{
  124. echo "1";
  125. }
  126. //echo '1';
  127. }
  128. public function deleteemail()
  129. {
  130. $id = $this->uri->segment(3);
  131. $this->load->model('settingmodel');
  132. $this->settingmodel->deleteemailid($id);
  133. redirect($_SERVER['HTTP_REFERER']);
  134. }
  135. public function makeprimary()
  136. {
  137. $this->load->model('settingmodel');
  138. $userregistrationid = $this->session->userdata('registrationid');
  139. $primaryemailiddata = $this->settingmodel->getprimaryemail($userregistrationid);
  140. $primaryemailid = $primaryemailiddata[0]['email'];
  141. $id = $this->uri->segment(3);
  142. $wantstomake = $this->settingmodel->wantstomake($id);
  143. $wantstomakepe = $wantstomake[0]['useremail'];
  144. $updatenonprimary = $this->settingmodel->updatenonprimary($id, $primaryemailid);
  145. $updateprimary = $this->settingmodel->updateprimary($userregistrationid, $wantstomakepe);
  146. $updateprimaryuserlogin = $this->settingmodel->updateprimaryuserlogin($userregistrationid, $wantstomakepe);
  147. $updateprimaryuserdetail = $this->settingmodel->updateprimaryuserdetail($userregistrationid, $wantstomakepe);
  148. redirect($_SERVER['HTTP_REFERER']);
  149. }
  150. public function deletephoneno()
  151. {
  152. $id = $this->uri->segment(3);
  153. $this->load->model('settingmodel');
  154. $this->settingmodel->deletephoneno($id);
  155. redirect($_SERVER['HTTP_REFERER']);
  156. }
  157. public function makeprimaryphone()
  158. {
  159. $this->load->model('settingmodel');
  160. $userregistrationid = $this->session->userdata('registrationid');
  161. $primaryphonenodata = $this->settingmodel->getprimaryphoneno($userregistrationid);
  162. $primaryphoneno = $primaryphonenodata[0]['phone'];
  163. //echo $primaryphoneno;
  164. $id = $this->uri->segment(3);
  165. $wantstomakeph = $this->settingmodel->wantstomakeph($id);
  166. $wantstomakephpk = $wantstomakeph[0]['phoneno'];
  167. //echo $wantstomakephpk; exit;
  168. $updatenonprimaryph = $this->settingmodel->updatenonprimaryph($id, $primaryphoneno);
  169. $updateprimaryph = $this->settingmodel->updateprimaryph($userregistrationid, $wantstomakephpk);
  170. redirect($_SERVER['HTTP_REFERER']);
  171. }
  172. public function updateinfo()
  173. {
  174. $this->load->model('settingmodel');
  175. $userregistrationid = $this->session->userdata('registrationid');
  176. $updatedinfo = $this->input->post('updatedinfo');
  177. $updateinfodata = $this->settingmodel->updateinfo($userregistrationid, $updatedinfo);
  178. //echo $updatedinfo;
  179. redirect($_SERVER['HTTP_REFERER']);
  180. }
  181. public function updatecommunication()
  182. {
  183. $this->load->model('settingmodel');
  184. $userregistrationid = $this->session->userdata('registrationid');
  185. $keepyou = $this->input->get('keepyou');
  186. $updatecommunication = $this->settingmodel->updatecommunication($userregistrationid, $keepyou);
  187. //print_r($keepyou); exit;
  188. redirect($_SERVER['HTTP_REFERER']);
  189. }
  190. public function canseecrown()
  191. {
  192. $this->load->model('settingmodel');
  193. $userregistrationid = $this->session->userdata('registrationid');
  194. $seecrown = $this->input->post('seecrown');
  195. $updatecommunication = $this->settingmodel->updatecrownsetting($userregistrationid, $seecrown);
  196. //print_r($keepyou); exit;
  197. redirect($_SERVER['HTTP_REFERER']);
  198. }
  199. public function canseecomment()
  200. {
  201. $this->load->model('settingmodel');
  202. $userregistrationid = $this->session->userdata('registrationid');
  203. $seecomment = $this->input->post('seecomment');
  204. $updatecomment = $this->settingmodel->updatecommentsetting($userregistrationid, $seecomment);
  205. //print_r($keepyou); exit;
  206. redirect($_SERVER['HTTP_REFERER']);
  207. }
  208. public function canseestatus()
  209. {
  210. $this->load->model('settingmodel');
  211. $userregistrationid = $this->session->userdata('registrationid');
  212. $seestatus = $this->input->post('seestatus');
  213. $updatestatus = $this->settingmodel->updatestatussetting($userregistrationid, $seestatus);
  214. //print_r($keepyou); exit;
  215. redirect($_SERVER['HTTP_REFERER']);
  216. }
  217. public function canseephotos()
  218. {
  219. $this->output->enable_profiler(True );
  220. $this->load->model('settingmodel');
  221. $userregistrationid = $this->session->userdata('registrationid');
  222. $seephotos = $this->input->post('seephotos');
  223. //$imagenotnulldata = $this->settingmodel->postimagenotnull($userregistrationid);
  224. //print_r($me); exit;
  225. //if(count($imagenotnulldata)>0)
  226. //{
  227. //echo count($me); exit;
  228. $updatephotos = $this->settingmodel->updatephotossetting($userregistrationid, $seephotos);
  229. //print_r($keepyou); exit;
  230. //}
  231. redirect($_SERVER['HTTP_REFERER']);
  232. }
  233. public function canseefollower()
  234. {
  235. $this->output->enable_profiler(True );
  236. $this->load->model('settingmodel');
  237. $userregistrationid = $this->session->userdata('registrationid');
  238. $seefollower = $this->input->post('seefollower');
  239. $updatefollower = $this->settingmodel->updatefollowersetting($userregistrationid, $seefollower);
  240. //print_r($keepyou); exit;
  241. //}
  242. redirect($_SERVER['HTTP_REFERER']);
  243. }
  244. public function canseebrand()
  245. {
  246. $this->load->model('settingmodel');
  247. $userregistrationid = $this->session->userdata('registrationid');
  248. $seebrand = $this->input->post('seebrand');
  249. $updatebrand = $this->settingmodel->updatebrandsetting($userregistrationid, $seebrand);
  250. //print_r($keepyou); exit;
  251. //}
  252. redirect($_SERVER['HTTP_REFERER']);
  253. }
  254. public function canseecollection()
  255. {
  256. $this->load->model('settingmodel');
  257. $userregistrationid = $this->session->userdata('registrationid');
  258. $seecollection = $this->input->post('seecollection');
  259. $updatecollection = $this->settingmodel->updatecollectionsetting($userregistrationid, $seecollection);
  260. //print_r($keepyou); exit;
  261. //}
  262. redirect($_SERVER['HTTP_REFERER']);
  263. }
  264. public function logout(){
  265. $base_url=$this->config->item('base_url'); //Read the baseurl from the config.php file
  266. $this->session->sess_destroy(); //session destroy
  267. redirect($base_url); //redirect to the home page
  268. }
  269. public function accesstimeline()
  270. {
  271. $this->load->model('settingmodel');
  272. $userregistrationid = $this->session->userdata('registrationid');
  273. $seebrand = $this->input->post('type');
  274. $updatebrand = $this->settingmodel->updatetimeline($userregistrationid, $seebrand);
  275. //print_r($keepyou); exit;
  276. //}
  277. redirect($_SERVER['HTTP_REFERER']);
  278. }
  279. public function updateuser_name()
  280. {
  281. $this->load->model('settingmodel');
  282. $userregistrationid = $this->session->userdata('registrationid');
  283. $name = $this->input->post('user_name');
  284. $updatebrand = $this->settingmodel->update_user_name($userregistrationid,$name);
  285. $updatebrand = $this->settingmodel->update_user_name_logintb($userregistrationid,$name);
  286. }
  287. public function updateuser_username(){
  288. $this->load->model('settingmodel');
  289. $userregistrationid = $this->session->userdata('registrationid');
  290. $name = $this->input->post('user_username');
  291. $updatebrand = $this->settingmodel->update_user_username($userregistrationid,$name);
  292. $updatebrand = $this->settingmodel->update_user_username_logintb($userregistrationid,$name);
  293. }
  294. public function updateuser_occupation(){
  295. $this->load->model('settingmodel');
  296. $userregistrationid = $this->session->userdata('registrationid');
  297. $user_occupation = $this->input->post('user_occupation');
  298. $updatebrand = $this->settingmodel->update_user_occupation($userregistrationid,$user_occupation);
  299. }
  300. public function updateuser_organization(){
  301. $this->load->model('settingmodel');
  302. $userregistrationid = $this->session->userdata('registrationid');
  303. $user_organization = $this->input->post('user_organization');
  304. $updatebrand = $this->settingmodel->update_user_organization($userregistrationid,$user_organization);
  305. }
  306. public function updateuser_designation(){
  307. $this->load->model('settingmodel');
  308. $userregistrationid = $this->session->userdata('registrationid');
  309. $user_designation = $this->input->post('user_designation');
  310. $updatebrand = $this->settingmodel->update_user_designation($userregistrationid,$user_designation);
  311. }
  312. public function updateuser_gender(){
  313. $this->load->model('settingmodel');
  314. $userregistrationid = $this->session->userdata('registrationid');
  315. $gender = $this->input->post('gender');
  316. $updatebrand = $this->settingmodel->update_user_gender($userregistrationid,$gender);
  317. }
  318. public function updateuser_location(){
  319. $this->load->model('settingmodel');
  320. $userregistrationid = $this->session->userdata('registrationid');
  321. $location = $this->input->post('location');
  322. $updatebrand = $this->settingmodel->update_user_location($userregistrationid,$location);
  323. }
  324. public function updateuser_sociallink(){
  325. $this->load->model('settingmodel');
  326. $userregistrationid = $this->session->userdata('registrationid');
  327. $user_fblink = $this->input->post('user_fb');
  328. $user_linkedinlink = $this->input->post('user_linkedin');
  329. $user_twitterlink = $this->input->post('user_twitter');
  330. $updatebrand = $this->settingmodel->update_user_sociallink($userregistrationid,$user_fblink,$user_linkedinlink,$user_twitterlink);
  331. }
  332. }
  333. ?>