home
/
zktecojo
/
public_html
/
app
/
controllers
➕ New
📤 Upload
✎ Editing:
HomeController.php
← Back
<?php //use Illuminate\Support\Facades\DB; class HomeController extends BaseController { protected $layout = 'layouts.frontend.master'; public function __construct(){ parent::__construct(); } public function index(){ //$this->ismobile(); //echo \Agent::isMobile(); exit(); $this->data['pageTitle'] .= 'Home'; $this->data['pageSubTitle'] = 'Home'; $this->data['homePage'] = true; $this->data['current_menu'] = 'home'; $this->data['current_parent_menu'] ='home'; $this->data['seo_title']= $this->data['websiteSettings']->home_page_title; $this->data['seo_description']= $this->data['websiteSettings']->site_meta_description; $this->data['seo_keyword']= $this->data['websiteSettings']->site_meta_keyword; if($this->data['lang']=='ar'){ $this->data['bannerSliders'] = DB::table('banners') ->where('banner_type','=',1) ->where('banner_status','=',1) ->where('banner_image_name_arabic','!=','') //->whereNotNUll('banner_image_name_arabic') ->orderBy('banner_priority','desc') ->get(); }else{ $this->data['bannerSliders'] = DB::table('banners') ->where('banner_type','=',1) ->where('banner_status','=',1) ->whereNotNUll('banner_image_name') ->orderBy('banner_priority','desc') ->get(); } //echo $this->data['lang']; echo '<pre>';print_r($this->data['bannerSliders']);exit; $this->data['medDivisions'] = DB::table('banners') // ->leftJoin('pages','pages.page_id','=','banners.banner_page_id') // ->leftJoin('menus','pages.page_menu_id','=','menus.menu_id') ->join('pages','pages.page_id','=','banners.banner_page_id') ->where('banner_type','=',2) ->where('banner_status','=',1) ->orderBy('banner_priority','asc') ->get(); //dd($this->data['medDivisions']); $this->data['homeProductContent'] = DB::table('pages') // ->leftJoin('menus','menus.menu_id','=','pages.page_link_to_id') ->where('page_status','=',1) ->where('page_parent_id','=',1) ->where('show_submenu_in_page','=',1) ->orderBy('page_priority','asc') ->take(5) ->get(); // dd($this->data['homeProductContent']); //$this->data['homeCaption'] = DB::table('banners')->where('banner_page_id','=',-1)->first(); $this->data['homePageNews'] = DB::table('news') ->where('news_status','=',1) ->where('news_type','=',1) ->orderBy('news_publish_date','desc') ->take(2) ->get(); /* $this->data['footerSections'] = DB::table('team') ->where('home_page_section','=',2) ->orderBy('team_priority','asc') ->get(); */ // dd($this->data['bannerMenus']); return View::make('frontend.index',$this->data); } public function our_people(){ $this->data['current_menu'] = 'our-people'; $this->data['pageTitle'] .= 'Our people'; $this->data['pageSubTitle'] = 'Meet The Team'; $pageBanner = DB::table('banners') ->where('banner_page_id','=',2) ->where('banner_status','=',1) ->orderBy('banner_priority','asc') ->first(); if(!empty($pageBanner)){ $this->data['pageBanner'] = $pageBanner->banner_image_name; } $this->data['teamMembers'] = DB::table('team') ->where('team_status','=',1) ->orderBy('team_priority','asc') ->get(); return View::make('frontend.our_people',$this->data); } /* public function news(){ $this->data['current_menu'] = 'news'; $this->data['pageTitle'] .= 'News'; $this->data['pageSubTitle'] = 'News'; $this->data['mainNewsList'] = DB::table('news') ->where('news_status','=',1) ->orderBy('news_priority','asc') ->take(1) ->get(); $this->data['subNewsList'] = DB::table('news') ->where('news_status','=',1) ->orderBy('news_priority','asc') ->skip(1) ->take(2) ->get(); // dd($this->data['subNewsList']); $this->data['newsList'] = DB::table('news') ->where('news_status','=',1) ->orderBy('news_priority','asc') ->skip(3) ->take(1999999999) ->get(); $pageBanner = DB::table('banners') ->where('banner_page_id','=',3) ->where('banner_status','=',1) ->orderBy('banner_priority','asc') ->first(); if(!empty($pageBanner)){ $this->data['pageBanner'] = $pageBanner->banner_image_name; } return View::make('frontend.news',$this->data); } */ /* public function news_details($slug){ $this->data['current_menu'] = 'news-detail'; $this->data['pageTitle'] .= 'News'; $this->data['pageSubTitle'] = 'News Details'; // echo $slug;exit(); if(empty($slug)){ return App::make('HomeController')->callAction('errorpage',$this->data); } $this->data['newsDetails'] = DB::table('news') ->where('news_status','=',1) ->where('news_alias','=',$slug) ->first(); // dd($this->data['newsDetails']); if(empty($this->data['newsDetails'])){ return App::make('HomeController')->callAction('errorpage',$this->data); } return View::make('frontend.news_details',$this->data); } */ /*public function contact_as_ajax(){ $returnData = array(); if(Input::get('fname')){ $rules = array('captcha_code' => array('required', 'captcha')); $validator = Validator::make(Input::all(), $rules); if ($validator->fails()){ $Message = '<div class="alert alert-danger"> <button type="button" class="close" data-dismiss="alert">×</button> Incorrect captcha code!.</div>'; $returnData = array('status'=>'fail','contactinfo'=>$Message); }else{ //============= Mail Send =================== $dataContactInfo = array( "name"=>Input::get('fname'), "email"=>Input::get('femail'), "phone"=>Input::get('fnumber'), "usermessage"=>Input::get('fmsg')); Mail::send('frontend.emails.contactus',$dataContactInfo, function($message){ $message->from(Input::get('femail'),Input::get('name')) ->to($this->data['websiteSettings']->enquiry_send_email) ->subject('New Enquiry'); }); //======== Auto Reply mail ======= Mail::send('frontend.emails.contactusautoreply',$dataContactInfo, function($message){ $message->from('admin@medsol.me','Medicalsolution website') ->to(Input::get('femail'),Input::get('name')) ->subject('New Enquiry - '); }); //======== Mail Send ============================= $Message = '<div class="alert alert-success"> <button type="button" class="close" data-dismiss="alert">×</button> Thank you for contact us, we will contact you soon</div>'; $returnData = array('status'=>'sucess','contactinfo'=>$Message); } } $returnData = json_encode($returnData); return $returnData; } private function _sendEmail(){ } */ public function download_submit(){ $returnData = array(); if(Input::get('fname')){ $fleID=Input::get('file_id'); //echo $this->data['websiteSettings']->enquiry_send_email;exit; $fileList=DB::table('product_pdf_download') ->where('ppd_id','=',$fleID) ->first(); //print_r($fileList);exit; //============= Mail Send =================== $dataContactInfo = array( "name"=>Input::get('fname'), "companyName"=>Input::get('organization'), "phone"=>Input::get('mobnumber'), "email"=>Input::get('email'), "location"=>$fileList->ppd_pdf_name, "fileName"=>Input::get('file_name'), ); $temp = Session::get('downloadFormData'); if(!$temp){ Session::put('downloadFormData',$dataContactInfo); // Session::put('senderEmail',Input::get('email')); } // $this->data['senderEmail'] = Input::get('email'); Mail::send('frontend.emails.contactus',$dataContactInfo, function($message){ $message->from(Input::get('email'),Input::get('name')) ->to($this->data['websiteSettings']->enquiry_send_email) ->subject('New Download Request'); }); //======== Auto Reply mail ======= Mail::send('frontend.emails.contactusautoreply',$dataContactInfo, function($message){ $message->from('info@zkteco.me','zkteco website') ->to(Input::get('email'),Input::get('name')) ->subject('Thank You For downloading '); }); //======== Mail Send ============================= /* $Message = '<div class="alert alert-success"> <button type="button" class="close" data-dismiss="alert">×</button> Thank you for Submitting your Details, you can download from <a href="'.asset('download-file/'.$fileList->ppd_pdf_name ).'">here</a> </div>'; $returnData = array('status'=>'sucess','contactinfo'=>$Message); */ $Message = '<div class="alert alert-success"> Thank you for Submitting your Details, Please wait for 5 secondes, this page will refresh automatically.</div>'; $returnData = array('status'=>'sucess','contactinfo'=>$Message,'downloadLocation'=>asset('download-file/'.$fileList->ppd_pdf_name )); } $returnData = json_encode($returnData); return $returnData; } public function careers(){ $this->data['pageTitle'] .= 'Careers'; $this->data['pageSubTitle'] = 'Careers'; $this->data['current_menu'] = 'careers'; $this->data['careerList'] = DB::table('careers') ->where('career_status','=',1) ->where('career_page_content','=',0) ->orderBy('career_id','DESC') ->get(); $this->data['currentCareer'] = DB::table('careers') ->where('career_status','=',1) ->where('career_page_content','=',0) ->orderBy('career_id','DESC') ->first(); return View::make('frontend.careers',$this->data); } public function job_list(){ $this->data['jobList'] = DB::table('careers') ->where('career_status','=',1) ->where('career_page_content','=',0) ->orderBy('career_id','DESC') ->get(); return View::make('frontend.job_list',$this->data); } public function job_details($jobSlug){ $this->data['jobsDetails'] = DB::table('careers') ->where('career_slug','=',$jobSlug) ->first(); if(empty($this->data['jobsDetails'])){ return App::make('HomeController')->callAction('errorpage',$this->data); } return View::make('frontend.job_details',$this->data); } /* public function apply_career($jobSlug){ $this->data['current_menu'] = 'careers'; if(empty($jobSlug)){ return App::make('HomeController')->callAction('errorpage',$this->data); } $this->data['jobsDetails'] = DB::table('careers') ->where('career_slug','=',$jobSlug) ->first(); if(empty($this->data['jobsDetails'])){ return App::make('HomeController')->callAction('errorpage',$this->data); } if(Input::get('btnsubmit')){ $validator = Validator::make( array( 'firstname'=>Input::get('firstname'), 'lastname'=>Input::get('lastname'), 'email'=>Input::get('email'), /* 'telephone'=>Input::get('telephone'), 'city'=>Input::get('city'), 'country'=>Input::get('country'), 'job_title'=>Input::get('job_title'), 'captcha'=>Input::get('captcha'), ), array( 'firstname'=>array('required'), 'lastname'=>array('required'), 'email'=>array('required','email'), /* 'telephone'=>Input::get('telephone'), 'city'=>Input::get('city'), 'country'=>Input::get('country'), 'job_title'=>Input::get('job_title'), 'captcha'=>array('required','captcha'), ) ); // $validator = Validator::make(Input::all(), $rules); if($validator->fails()){ $messages = $validator->messages(); $this->data['userMessage'] = ' '; // $data = Input::all(); var_dump($data); // echo Input::old('firstname');exit; foreach($messages->all() as $message){ $this->data['userMessage'] .= "<span class='errormsg' style='color:red;'>".$message."</span><br/>"; } }else{ $userUpload = null; if (Request::hasFile('cv')){ $file = Input::file('cv'); $extension = $file->getClientOriginalExtension(); $filename = md5(date('Y-m-d-H:i:s')."-".$file->getClientOriginalName()).'.'.$extension; $imageUpload = Input::file('cv')->move('assets/uploads/cv/', $filename); $userUpload = 'assets/uploads/cv/'.DIRECTORY_SEPARATOR.$filename; } $data = array( 'firstname'=>Input::get('firstname'), 'lastname'=>Input::get('lastname'), 'email'=>Input::get('email'), 'telephone'=>Input::get('telephone'), 'city'=>Input::get('city'), 'country'=>Input::get('country'), 'job_title'=>Input::get('job_title'), 'website_name'=>$this->data['websiteSettings']->sitename, 'website_logo'=>$this->data['websiteSettings']->sitelogo ); $settings = array( 'from'=>Input::get('email'), 'to'=>$this->data['websiteSettings']->enquiry_send_email, 'subject'=>'Job Application-'.Input::get('job_title'), 'attachment'=>$userUpload ); $this->send_career_mail($settings,$data,$userUpload); Mail::send('email_template.jobsapply_autoreply',$data, function($message){ $message->from('admin@fng.com','FNG') ->to(Input::get('email'),Input::get('name')) ->subject('FNG - Your Job Application Auto Reply Mail '.Input::get('job_title')); }); //======== Mail Send ============================= $this->data['userMessage'] = '<span class="success green">Mail sent successfully. We will contact you back.<span>'; } }/* else{ echo "<pre>"; print_r($_POST); exit(); } $this->data['countryList'] = DB::table('country') // ->where('country_status','=',1) ->orderBy('country_name','ASC') ->get(); $this->data['jobList'] = DB::table('careers') ->where('career_status','=',1) ->orderBy('career_title','ASC') ->get(); return View::make('frontend.job_apply',$this->data); } public function apply_job(){ $returnData = array(); $Message=''; if(Input::get('firstname')){ $rules = array('captcha_code' => array('required', 'captcha')); $validator = Validator::make(Input::all(), $rules); if ($validator->fails()){ $messages = $validator->messages(); foreach($messages->all() as $message){ $Message = "<div class='alert alert-danger'> <button type='button' class='close' data-dismiss='alert'>×</button> <span class='errormsg' style='color:red;'>".$message."</span><br/>"; } /* $Message = '<div class="alert alert-danger"> <button type="button" class="close" data-dismiss="alert">×</button> Incorrect captcha code!</div>'; $returnData = array('status'=>'fail','contactinfo'=>$Message); }else{ $datainsert = array('firstname'=>Input::get('firstname'), 'lastname'=>Input::get('lastname'), 'email'=>Input::get('email'), 'telephone'=>Input::get('telephone'), 'city'=>Input::get('city'), 'country'=>Input::get('country'), 'job_title'=>Input::get('job_title') ); //============= Mail Send =================== Mail::send('email_template.contactus',$datainsert, function($message){ $message->from(Input::get('email'),Input::get('name')) ->to($this->data['websiteSettings']->enquiry_send_email,$this->data['websiteSettings']->sitename) ->subject('FNG Website Enquiry'); }); //======== Auto Reply mail ======= Mail::send('email_template.contactusautoreply',$datainsert, function($message){ $message->from('admin@FNG.com','FNG') ->to(Input::get('email'),Input::get('name')) ->subject('FNG Enquiry-Auto Reply Mail'); }); //======== Mail Send ============================= $Message = '<div class="alert alert-success"> <button type="button" class="close" data-dismiss="alert">×</button> Thank you for contacting us, we will get back to you very soon.</div>'; $returnData = array('status'=>'sucess','contactinfo'=>$Message); } } $returnData = json_encode($returnData); return $returnData; } */ public function office_locations(){ $this->data['current_menu'] = 'contact-us'; $this->data['pageTitle'] .= 'Office Locations'; $this->data['pageSubTitle'] = 'Office Locations'; $this->data['officeLocations'] = DB::table('location') ->where('location_status','=',1) ->get(); $pageBanner = DB::table('banners') ->where('banner_page_id','=',2) ->where('banner_status','=',1) ->orderBy('banner_priority','asc') ->first(); if(!empty($pageBanner)){ $this->data['pageBanner'] = $pageBanner->banner_image_name; } return View::make('frontend.office_locations',$this->data); } /* public function contact_us(){ $this->data['pageTitle'] .= 'Contact Us'; $this->data['pageSubTitle'] = 'Contact Us'; $this->data['current_menu'] = 'contact-us'; // echo '<pre>'; // print_r($_POST); // exit(); if(Input::get('submitd')){ // $rules = array('captchacode'=>array('required','captcha')); $validator = Validator::make( array( 'name'=>Input::get('name'), 'email'=>Input::get('email'), 'phone'=>Input::get('phone'), 'subject'=>Input::get('subject'), 'message'=>Input::get('fmsg'), 'captcha'=>Input::get('captcha'), ), array( 'name'=>array('required'), 'email'=>array('required','email'), 'phone'=>array('required'), 'subject'=>array('required'), 'message'=>array('required'), 'captcha'=>array('required','captcha'), ) ); if($validator->fails()){ // $this->data['errorMessage'] = $validator->messages(); $messages = $validator->messages(); $this->data['errorMessage'] = ''; foreach($messages->all() as $message){ $this->data['errorMessage'] .= "<span class='errormsg' style='color:red;'>".$message."</span><br/>"; } // $returnData = array('status'=>'fail','registerinfo'=>$errorMessage); }else{ $data = array( 'name' => Input::get('name'), 'email'=> Input::get('email'), 'phone'=> Input::get('phone'), 'subject'=> Input::get('subject'), 'usermessage'=> Input::get('fmsg'), ); //======== Mail Send ======= Mail::send('frontend.emails.contactus',$data, function($message){ $message->from('admin@medsol.com','Medsol') ->to($this->data['websiteSettings']->enquiry_send_email) ->subject('Medsol Enquiry-Auto Reply Mail'); }); //======== Mail Send ============================= Mail::send('frontend.emails.contactus',$data, function($message){ $message->from(Input::get('email'),Input::get('name')) ->to('admin@medsol.com','Medsol') ->subject('Medsol Enquiry-Auto Reply Mail'); }); //======== Auto Reply ============================= $this->data['errorMessage'] = '<span class="success green">Message sent successfully. We will contact you back.<span>'; } } $this->data['pageContent'] = DB::table('pages') // ->join('menus','menus.menu_id','=','pages.page_menu_id') ->where('pages.page_slug','=','contact-us') ->where('pages.page_status','=',1) ->first(); $this->data['officeLocations'] = DB::table('location') ->where('location_status','=',1) ->get(); $this->data['contactUs'] = DB::table('contactus') ->first(); // dd($this->data); return View::make('frontend.design_layout.contact',$this->data); } public function subscribe_news_letter(){ if(Input::get('ns_email')){ // $rules = array('captchacode'=>array('required','captcha')); $validator = Validator::make( array( 'email'=>Input::get('ns_email') ), array( 'email'=>array('required','email') ) ); if($validator->fails()){ // $this->data['errorMessage'] = $validator->messages(); //$messages = $validator->messages(); $errorMessage = 'Invalid email'; $returnData = array('status'=>'fail','newsinfo'=>$errorMessage); }else{ $data = array( 'nsl_created_date' => date('Y-m-d'), 'nsl_email'=> Input::get('ns_email'), ); DB::table('newsletter_subscription_list')->insert($data); /* $settings = array( 'from'=>'info@fng.com', 'to'=>Input::get('email'), 'subject'=>'New Contact Request', 'mailns'=>Input::get('email'), ); $this->send_mail($settings,$data); $Message = 'Thank you for subscribing '; $cookie = Cookie::forever('fngSubscribe', 'true'); $returnData = array('status'=>'sucess','newsinfo'=>$Message); return Response::json($returnData)->withCookie($cookie); } } // $returnData = json_encode($returnData); // return $returnData; return Response::json($returnData); } */ public function errorpage(){ // echo $alias;exit(); $this->data['pageTitle'] .= '404-Page Not Found'; return View::make('errors.404',$this->data); } public function create_captcha(){ return Captcha::create(null); } public function force_download($fileName){ if (File::exists('assets/uploads/brochure/'.$fileName)){ return Response::download('assets/uploads/brochure/'.$fileName,'esolutions-brochure.pdf'); } } public function setlanguage($lang=''){ $redirectURL = Input::get('redirect'); if($this->data['websiteSettings']->disable_arabic==-1){ Session::put('lang', 'en'); if(!empty($redirectURL)){ return Redirect::to($redirectURL); } } if($lang==''){ $lang='en';} Session::put('lang', $lang); App::setLocale($lang); if(!empty($redirectURL)){ return Redirect::to($redirectURL); } return Redirect::back(); } public function check_session(){ $email = Session::get('popUpEmail'); $fileID = Input::get('file_id'); if( empty($email) || empty($fileID) ){ return Response::json(array('status'=>false)); } $fileList=DB::table('product_pdf_download') ->where('ppd_id','=',$fileID) ->first(); if(empty($fileList)){ return Response::json(array('status'=>false)); } $info = Session::get('popUpFormInfo'); $info['location'] = $fileList->ppd_pdf_name; $fileName = $fileList->ppd_pdf_name; Mail::send('frontend.emails.contactus',$info, function($message){ $message->from(Session::get('email'),Session::get('name')) ->to($this->data['websiteSettings']->enquiry_send_email) ->subject('New Download Request'); }); //======== Auto Reply mail ======= Mail::send('frontend.emails.contactusautoreply',$info, function($message){ $message->from('info@zkteco.me','zkteco website') ->to(Session::get('email'),Session::get('name')) ->subject('Thank You For downloading '); }); if (File::exists('assets/uploads/brochure/'.$fileName)){ return Response::download('assets/uploads/brochure/'.$fileName,'esolutions-brochure.pdf'); } return Response::json(array('status'=>true)); } }
💾 Save Changes
Cancel
📤 Upload File
×
Select File
Upload
Cancel
➕ Create New
×
Type
📄 File
📁 Folder
Name
Create
Cancel
✎ Rename Item
×
Current Name
New Name
Rename
Cancel
🔐 Change Permissions
×
Target File
Permission (e.g., 0755, 0644)
0755
0644
0777
Apply
Cancel