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

/fp_ci/application/modules/Profile/controllers/Profile.php

https://gitlab.com/jLKisni/furandpaw-frontend
PHP | 406 lines | 339 code | 66 blank | 1 comment | 3 complexity | 81c2669e19df28abb31a40a5c1d586a7 MD5 | raw file
  1. <?php
  2. class Profile extends MY_Controller{
  3. function __construct(){
  4. parent::__construct();
  5. $this->load->model('Profile/M_Profile');
  6. $this->load->model('Auth/M_Auth');
  7. $this->load->model('Profile/Pets_pagination');
  8. if(!$this->session->userdata('id')){
  9. redirect('Home');
  10. }
  11. }
  12. function index(){
  13. $queryprofilephoto =$this->M_Profile->getprofilePhoto();
  14. $queryuserdata = $this->M_Auth->queryUser();
  15. $data = array(
  16. 'title'=>'Take a tour for your pets',
  17. 'content_view'=>'Home/home_v',
  18. 'id'=> $this->session->userdata('id'),
  19. 'username'=> $queryuserdata->username,
  20. 'email'=> $queryuserdata->email,
  21. 'profilepicture'=>$queryprofilephoto
  22. );
  23. $this->template->get_viewprofile($data);
  24. }
  25. function adoption(){
  26. $queryuserdata = $this->M_Auth->queryUser();
  27. $queryprofilephoto =$this->M_Profile->getprofilePhoto();
  28. $data = array(
  29. 'title'=>'Adoptions',
  30. 'content_view'=>'Home/adoption',
  31. 'id'=> $this->session->userdata('id'),
  32. 'username'=> $queryuserdata->username,
  33. 'email'=> $queryuserdata->email,
  34. 'profilepicture'=>$queryprofilephoto
  35. );
  36. $this->template->get_viewprofile($data);
  37. }
  38. function breeder(){
  39. $queryuserdata = $this->M_Auth->queryUser();
  40. $queryprofilephoto =$this->M_Profile->getprofilePhoto();
  41. $data = array(
  42. 'title'=>'Breeder',
  43. 'content_view'=>'Home/breeder',
  44. 'id'=> $this->session->userdata('id'),
  45. 'username'=> $queryuserdata->username,
  46. 'email'=> $queryuserdata->email,
  47. 'profilepicture'=>$queryprofilephoto
  48. );
  49. $this->template->get_viewprofile($data);
  50. }
  51. function petstore(){
  52. $queryuserdata = $this->M_Auth->queryUser();
  53. $queryprofilephoto =$this->M_Profile->getprofilePhoto();
  54. $data = array(
  55. 'title'=>'Pet Store',
  56. 'content_view'=>'Home/petstore',
  57. 'id'=> $this->session->userdata('id'),
  58. 'username'=> $queryuserdata->username,
  59. 'email'=> $queryuserdata->email,
  60. 'profilepicture'=>$queryprofilephoto
  61. );
  62. $this->template->get_viewprofile($data);
  63. }
  64. function clinics(){
  65. $queryuserdata = $this->M_Auth->queryUser();
  66. $queryprofilephoto =$this->M_Profile->getprofilePhoto();
  67. $data = array(
  68. 'title'=>'Clinics and Shops',
  69. 'content_view'=>'Home/clinics',
  70. 'id'=> $this->session->userdata('id'),
  71. 'username'=> $queryuserdata->username,
  72. 'email'=> $queryuserdata->email,
  73. 'profilepicture'=>$queryprofilephoto
  74. );
  75. $this->template->get_viewprofile($data);
  76. }
  77. function clinicsprofile(){
  78. $queryuserdata = $this->M_Auth->queryUser();
  79. $queryprofilephoto =$this->M_Profile->getprofilePhoto();
  80. $data = array(
  81. 'title'=>'Clinics Profile',
  82. 'content_view'=>'Home/clinicsprofile',
  83. 'css'=>'fontawesome-stars.css',
  84. 'id'=> $this->session->userdata('id'),
  85. 'username'=> $queryuserdata->username,
  86. 'email'=> $queryuserdata->email,
  87. 'profilepicture'=>$queryprofilephoto
  88. );
  89. $this->template->get_viewprofilestars($data);
  90. }
  91. function membersprofile(){
  92. $queryuserdata = $this->M_Auth->queryUser();
  93. $queryprofilephoto =$this->M_Profile->getprofilePhoto();
  94. $data = array(
  95. 'title'=>'Members Profile',
  96. 'content_view'=>'Home/members-profile',
  97. 'id'=> $this->session->userdata('id'),
  98. 'username'=> $queryuserdata->username,
  99. 'email'=> $queryuserdata->email,
  100. 'profilepicture'=>$queryprofilephoto
  101. );
  102. $this->template->get_viewprofile($data);
  103. }
  104. function petprofile(){
  105. $queryuserdata = $this->M_Auth->queryUser();
  106. $queryprofilephoto =$this->M_Profile->getprofilePhoto();
  107. $data = array(
  108. 'title'=>'Pet Profile',
  109. 'content_view'=>'Home/petprofile',
  110. 'id'=> $this->session->userdata('id'),
  111. 'username'=> $queryuserdata->username,
  112. 'email'=> $queryuserdata->email,
  113. 'profilepicture'=>$queryprofilephoto
  114. );
  115. $this->template->get_viewprofile($data);
  116. }
  117. function item(){
  118. $queryuserdata = $this->M_Auth->queryUser();
  119. $queryprofilephoto =$this->M_Profile->getprofilePhoto();
  120. $data = array(
  121. 'title'=>'Profile Items',
  122. 'content_view'=>'Home/item',
  123. 'id'=> $this->session->userdata('id'),
  124. 'username'=> $queryuserdata->username,
  125. 'email'=> $queryuserdata->email,
  126. 'password'=> $queryuserdata->password,
  127. 'profilepicture'=>$queryprofilephoto
  128. );
  129. $this->template->get_viewprofilestars($data);
  130. }
  131. function postsale(){
  132. $queryuserdata = $this->M_Auth->queryUser();
  133. $queryprofilephoto =$this->M_Profile->getprofilePhoto();
  134. $data = array(
  135. 'title'=>'Profile Post Sale',
  136. 'content_view'=>'Home/post-sale',
  137. 'id'=> $this->session->userdata('id'),
  138. 'username'=> $queryuserdata->username,
  139. 'email'=> $queryuserdata->email,
  140. 'password'=> $queryuserdata->password,
  141. 'profilepicture'=>$queryprofilephoto
  142. );
  143. $this->template->get_viewprofile($data);
  144. }
  145. function profileEdit(){
  146. $queryuserdata = $this->M_Auth->queryUser();
  147. $queryprofilephoto =$this->M_Profile->getprofilePhoto();
  148. $queryprofilecover =$this->M_Profile->getprofileCover();
  149. $queryenthusiastData = $this->M_Profile->getenthusiastData();
  150. if($queryenthusiastData == false){
  151. $data = array(
  152. 'title'=>'Profile Edit',
  153. 'content_view'=>'Profile/profile-edit',
  154. 'id'=> $this->session->userdata('id'),
  155. 'username'=> $queryuserdata->username,
  156. 'email'=> $queryuserdata->email,
  157. 'password'=> $queryuserdata->password,
  158. 'profilepicture'=>$queryprofilephoto,
  159. 'profilecover'=>$queryprofilecover,
  160. 'name'=> '',
  161. 'gender' => '',
  162. 'address'=>'',
  163. 'contactnumber'=>''
  164. );
  165. $this->template->get_viewprofile($data);
  166. }
  167. else{
  168. $data = array(
  169. 'title'=>'Profile Edit',
  170. 'content_view'=>'Profile/profile-edit',
  171. 'id'=> $this->session->userdata('id'),
  172. 'username'=> $queryuserdata->username,
  173. 'email'=> $queryuserdata->email,
  174. 'password'=> $queryuserdata->password,
  175. 'profilepicture'=>$queryprofilephoto,
  176. 'profilecover'=>$queryprofilecover,
  177. 'name'=> $queryenthusiastData->name,
  178. 'gender' => $queryenthusiastData->gender,
  179. 'address'=>$queryenthusiastData->address,
  180. 'contactnumber'=>$queryenthusiastData->contact_number
  181. );
  182. $this->template->get_viewprofile($data);
  183. }
  184. }
  185. function profilesetType(){
  186. $queryuserdata = $this->M_Auth->queryUser();
  187. $queryprofilephoto =$this->M_Profile->getprofilePhoto();
  188. $queryprofilecover =$this->M_Profile->getprofileCover();
  189. $data = array(
  190. 'title'=>'Profile Type',
  191. 'content_view'=>'Profile/profile-setType',
  192. 'id'=> $this->session->userdata('id'),
  193. 'username'=> $queryuserdata->username,
  194. 'email'=> $queryuserdata->email,
  195. 'password'=> $queryuserdata->password,
  196. 'profilepicture'=>$queryprofilephoto,
  197. 'profilecover'=>$queryprofilecover
  198. );
  199. $this->template->get_viewprofile($data);
  200. }
  201. function profileSettings(){
  202. $queryuserdata = $this->M_Auth->queryUser();
  203. $queryprofilephoto =$this->M_Profile->getprofilePhoto();
  204. $queryprofilecover =$this->M_Profile->getprofileCover();
  205. $data = array(
  206. 'title'=>'Profile Settings',
  207. 'content_view'=>'Profile/profile-settings',
  208. 'id'=> $this->session->userdata('id'),
  209. 'username'=> $queryuserdata->username,
  210. 'email'=> $queryuserdata->email,
  211. 'password'=> $queryuserdata->password,
  212. 'profilepicture'=>$queryprofilephoto,
  213. 'profilecover'=>$queryprofilecover
  214. );
  215. $this->template->get_viewprofile($data);
  216. }
  217. function profileDelete(){
  218. $queryuserdata = $this->M_Auth->queryUser();
  219. $queryprofilephoto =$this->M_Profile->getprofilePhoto();
  220. $queryprofilecover =$this->M_Profile->getprofileCover();
  221. $data = array(
  222. 'title'=>'Profile Delete',
  223. 'content_view'=>'Profile/profile-delete',
  224. 'id'=> $this->session->userdata('id'),
  225. 'username'=> $queryuserdata->username,
  226. 'email'=> $queryuserdata->email,
  227. 'password'=> $queryuserdata->password,
  228. 'profilepicture'=>$queryprofilephoto,
  229. 'profilecover'=>$queryprofilecover
  230. );
  231. $this->template->get_viewprofile($data);
  232. }
  233. function profileActivity(){
  234. $queryuserdata = $this->M_Auth->queryUser();
  235. $queryprofilephoto =$this->M_Profile->getprofilePhoto();
  236. $queryprofilecover =$this->M_Profile->getprofileCover();
  237. $data = array(
  238. 'title'=>'Profile Activity',
  239. 'content_view'=>'Profile/profile-activity',
  240. 'id'=> $this->session->userdata('id'),
  241. 'username'=> $queryuserdata->username,
  242. 'email'=> $queryuserdata->email,
  243. 'password'=> $queryuserdata->password,
  244. 'profilepicture'=>$queryprofilephoto,
  245. 'profilecover'=>$queryprofilecover
  246. );
  247. $this->template->get_viewprofile($data);
  248. }
  249. function profileAddpets(){
  250. $queryuserdata = $this->M_Auth->queryUser();
  251. $data = array(
  252. 'title'=>'Profile Add Pets',
  253. 'content_view'=>'Profile/profile-addpets',
  254. 'id'=> $this->session->userdata('id'),
  255. 'username'=> $queryuserdata->username,
  256. 'email'=> $queryuserdata->email,
  257. 'password'=> $queryuserdata->password,
  258. );
  259. $this->template->get_viewprofile($data);
  260. }
  261. function profilechangePhoto(){
  262. $queryuserdata = $this->M_Auth->queryUser();
  263. $queryprofilephoto =$this->M_Profile->getprofilePhoto();
  264. $queryprofilecover =$this->M_Profile->getprofileCover();
  265. $data = array(
  266. 'title'=>'Profile Change Photos',
  267. 'content_view'=>'Profile/profile-changephoto',
  268. 'id'=> $this->session->userdata('id'),
  269. 'username'=> $queryuserdata->username,
  270. 'email'=> $queryuserdata->email,
  271. 'password'=> $queryuserdata->password,
  272. 'profilepicture'=>$queryprofilephoto,
  273. 'profilecover'=>$queryprofilecover
  274. );
  275. $this->template->get_viewprofile($data);
  276. }
  277. function profilechangeCover(){
  278. $queryuserdata = $this->M_Auth->queryUser();
  279. $queryprofilephoto =$this->M_Profile->getprofilePhoto();
  280. $queryprofilecover =$this->M_Profile->getprofileCover();
  281. $data = array(
  282. 'title'=>'Profile Change Cover Photos',
  283. 'content_view'=>'Profile/profile-changecover',
  284. 'id'=> $this->session->userdata('id'),
  285. 'username'=> $queryuserdata->username,
  286. 'email'=> $queryuserdata->email,
  287. 'password'=> $queryuserdata->password,
  288. 'profilepicture'=>$queryprofilephoto,
  289. 'profilecover'=>$queryprofilecover
  290. );
  291. $this->template->get_viewprofile($data);
  292. }
  293. function profilepetProfile(){
  294. $queryuserdata = $this->M_Auth->queryUser();
  295. $data = array(
  296. 'title'=>'Profile Profile',
  297. 'content_view'=>'Profile/profile-petprofile',
  298. 'id'=> $this->session->userdata('id'),
  299. 'username'=> $queryuserdata->username,
  300. 'email'=> $queryuserdata->email,
  301. 'password'=> $queryuserdata->password,
  302. );
  303. $this->template->get_viewprofile($data);
  304. }
  305. function profileviewPets(){
  306. $this->load->library('pagination');
  307. $config =array();
  308. $config['base_url']= base_url().'Profile/profileviewPets';
  309. $config['total_rows'] = $this->Pets_pagination->count_pets();
  310. $config['per_page'] = 2;
  311. $config['num_links'] = 3;
  312. $config['display_page'] = FALSE;
  313. $config['num_tag_open']=' <a class="page-numbers">';
  314. $config['num_tag_close']='</a>';
  315. $config['cur_tag_open'] ='<a class="page-numbers" style="margin-left:5px;">';
  316. $config['cur_tag_close']='</a>';
  317. $config['next_link']='<a class="page-numbers"><span class="fa fa-long-arrow-right"></span></a>';
  318. $config['prev_link']='<a class="page-numbers"><span class="fa fa-long-arrow-left"></span></a>';
  319. $this->pagination->initialize($config);
  320. $petsdata =$this->Pets_pagination->fetch_pets($config['per_page'],$this->uri->segment(3));
  321. //echo print_r($petsdata);
  322. $queryuserdata = $this->M_Auth->queryUser();
  323. $queryprofilephoto =$this->M_Profile->getprofilePhoto();
  324. $queryprofilecover =$this->M_Profile->getprofileCover();
  325. $data = array(
  326. 'title'=>'Profile View Pets',
  327. 'content_view'=>'Profile/profile-viewpets',
  328. 'id'=> $this->session->userdata('id'),
  329. 'username'=> $queryuserdata->username,
  330. 'email'=> $queryuserdata->email,
  331. 'password'=> $queryuserdata->password,
  332. 'profilepicture'=>$queryprofilephoto,
  333. 'profilecover'=>$queryprofilecover,
  334. 'pets' => $petsdata,
  335. 'links'=> $this->pagination->create_links(),
  336. 'count_pets'=>$this->Pets_pagination->count_pets(),
  337. );
  338. $this->template->get_viewprofile($data);
  339. }
  340. }