PageRenderTime 28ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/option1/application/controllers/Editorial.php

https://gitlab.com/akanshagupta/jigglylanding
PHP | 177 lines | 129 code | 28 blank | 20 comment | 8 complexity | a44ab35ade44eb2e06bc4a028d16e7c0 MD5 | raw file
  1. <?php
  2. class Editorial extends CI_Controller
  3. {
  4. public function __construct()
  5. {
  6. parent::__construct();
  7. $this->load->library('session');
  8. $this->load->model('Geteditorial');
  9. //$this->output->enable_profiler(True );
  10. }
  11. public function editorial(){
  12. $this->session->unset_userdata('inviteuserid');
  13. $userregistrationid = $this->session->userdata('registrationid');
  14. $this->load->model('getdata');
  15. if ($userregistrationid == '') {
  16. $data['products'] = $this->getdata->getall();
  17. //print_r($data['products']);exit;
  18. } else {
  19. $hideproduct = $this->getdata->hideproduct($userregistrationid);
  20. //print_r($hideproduct);
  21. $data['products'] = $this->getdata->removehideproduct($hideproduct);
  22. //print_r($data['products']); exit;
  23. }
  24. $data['avali_cat'] = $this->getdata->availcat();
  25. //print_r($data['avali_cat']); exit;
  26. $data['seo'] = $this->getdata->seo('page', 'home');
  27. $data['user_follow'] = $this->getdata->get_user_follow($userregistrationid);// To get user follow details
  28. $data['user_crown'] = $this->getdata->get_user_crown($userregistrationid);// To get user crown details
  29. $data['user_saveforlater'] = $this->getdata->get_saveforlater($userregistrationid);
  30. $data['userdata'] = $this->getdata->getuserdata($userregistrationid);
  31. $data['editorial']=$this->Geteditorial->all_editorial();
  32. //print_r($data);
  33. $data['all_cat'] = $this->getdata->get_all_category();//for getting all the category in the head section
  34. $data['heading'] = "See whats new here !";
  35. $this->load->view('pages/head_main.php', $data);//passing category in the head section
  36. $this->load->view('editorial/editorial.php');
  37. }
  38. public function editorial_subcat($editorial_category,$editorial_id){
  39. $this->session->unset_userdata('inviteuserid');
  40. $userregistrationid = $this->session->userdata('registrationid');
  41. $this->load->model('getdata');
  42. if ($userregistrationid == '') {
  43. $data['products'] = $this->getdata->getall();
  44. //print_r($data['products']);exit;
  45. } else {
  46. $hideproduct = $this->getdata->hideproduct($userregistrationid);
  47. //print_r($hideproduct);
  48. $data['products'] = $this->getdata->removehideproduct($hideproduct);
  49. //print_r($data['products']); exit;
  50. }
  51. $data['avali_cat'] = $this->getdata->availcat();
  52. $data['all_products_count'] = $this->getdata->record_count();
  53. //print_r($data['avali_cat']); exit;
  54. $data['slider_image'] = $this->getdata->slider('page', 'main');
  55. $data['seo'] = $this->getdata->seo('page', 'home');
  56. $data['user_follow'] = $this->getdata->get_user_follow($userregistrationid);// To get user follow details
  57. $data['user_crown'] = $this->getdata->get_user_crown($userregistrationid);// To get user crown details
  58. $data['user_saveforlater'] = $this->getdata->get_saveforlater($userregistrationid);
  59. $data['userdata'] = $this->getdata->getuserdata($userregistrationid);
  60. $data['editorial_cat_data']=$this->Geteditorial->all_subcat_editorial($editorial_id);
  61. //print_r($data);
  62. $data['all_cat'] = $this->getdata->get_all_category();//for getting all the category in the head section
  63. $data['heading'] = "See whats new here !";
  64. $this->load->view('pages/head_main.php', $data);//passing category in the head section
  65. $this->load->view('editorial/editorial_subcat.php');
  66. }
  67. public function followcurator(){
  68. $curator_id=$this->input->post('curator_id');
  69. $user_id=$this->input->post('userid');
  70. $check=$this->Geteditorial->follow_curator($user_id,$curator_id);
  71. if($check>0){
  72. echo "1"; //start following curator
  73. }
  74. else{
  75. echo "0";
  76. }
  77. }
  78. public function unfollowcurator(){
  79. $curator_id= $this->input->post('curator_id');
  80. $user_id=$this->input->post('userid');
  81. $check=$this->Geteditorial->unfollow_curator($user_id,$curator_id);
  82. if($check==0){
  83. echo "1"; //start unfollowing curator
  84. }
  85. else{
  86. echo "0";
  87. }
  88. }
  89. public function curator($curator_id)
  90. {
  91. $this->session->unset_userdata('inviteuserid');
  92. $userregistrationid = $this->session->userdata('registrationid');
  93. $this->load->model('getdata');
  94. $this->load->model('Geteditorial');
  95. $data['avali_cat'] = $this->getdata->availcat();
  96. //print_r($data['avali_cat']); exit;
  97. $data['slider_image'] = $this->getdata->slider('page', 'main');
  98. $data['seo'] = $this->getdata->seo('page', 'home');
  99. $data['user_follow'] = $this->Geteditorial->get_user_follow($userregistrationid);// To get user follow details
  100. $data['user_crown'] = $this->getdata->get_user_crown($userregistrationid);// To get user crown details
  101. $data['user_saveforlater'] = $this->getdata->get_saveforlater($userregistrationid);
  102. $data['userdata'] = $this->getdata->getuserdata($userregistrationid);
  103. //print_r($data);
  104. $data['all_cat'] = $this->getdata->get_all_category();//for getting all the category in the head section
  105. $data['curator_detail']= $this->Geteditorial->getcurator($curator_id);
  106. $data['editorial_detail'] = $this->Geteditorial->curator_wise($curator_id);
  107. $editorialcount = count($data['editorial_detail']);
  108. $this->load->view('pages/head_main.php', $data);
  109. $this->load->view('editorial/curator.php', $data);
  110. $this->load->view('pages/footer.php');
  111. }
  112. public function artical(){
  113. $editorialid = $this->uri->segment(3, 0);
  114. //echo $editorialid; exit;
  115. $this->session->unset_userdata('inviteuserid');
  116. $userregistrationid = $this->session->userdata('registrationid');
  117. $this->load->model('getdata');
  118. $this->load->model('ajaxrequest');
  119. $this->load->model('geteditorial');
  120. $data['avali_cat'] = $this->getdata->availcat();
  121. $data['all_products_count'] = $this->getdata->record_count();
  122. //print_r($data['avali_cat']); exit;
  123. $data['slider_image'] = $this->getdata->slider('page', 'main');
  124. $data['seo'] = $this->getdata->seo('page', 'home');
  125. $data['user_follow'] = $this->getdata->get_user_follow($userregistrationid);// To get user follow details
  126. $data['user_crown'] = $this->getdata->get_user_crown($userregistrationid);// To get user crown details
  127. $data['user_saveforlater'] = $this->getdata->get_saveforlater($userregistrationid);
  128. $data['userdata'] = $this->getdata->getuserdata($userregistrationid);
  129. $data['all_cat'] = $this->getdata->get_all_category();//for getting all the category in the head section
  130. $data['get_editorial_info'] = $this->geteditorial->get_editorial_info($editorialid); // editorial information
  131. //print_r($data['get_editorial_info']); exit;
  132. $curatorproductid = $data['get_editorial_info'][0]['cproduct_idfk'];
  133. $editorial_subcatid = $data['get_editorial_info'][0]['editorial_subcatidfk'];
  134. $curator_id = $data['get_editorial_info'][0]['curator_idfk'];
  135. $data['curator_product'] = $this->geteditorial->curator_product($curatorproductid);
  136. $data['all_comments']=$this->ajaxrequest->all_comments_cproduct($curatorproductid);
  137. //print_r($data['curator_product']); exit;
  138. //$data['editorialsubcat_wise_product'] = $this->getdata->editorial_subcat_wiseproduct($editorial_subcatid);
  139. //$data['curator_wise_product'] = $this->geteditorial->curator_wise_product($curator_id);
  140. $data['prod_image'] = $this->geteditorial->curator_product_image($curatorproductid);
  141. $curator_related_product = $this->geteditorial->curator_related_product($curator_id);
  142. $data['curator_all_product'] = $this->geteditorial->curator_all_product($curator_related_product);
  143. //print_r($data['curator_all_product']); exit;
  144. $data['heading'] = "See whats new here !";
  145. $this->load->view('pages/head_main.php', $data);//passing category in the head section
  146. $this->load->view('editorial/editorial_detail.php');
  147. }
  148. }
  149. ?>