EVOLUTION-NINJA
Edit File: exhibition_list.php
<?php namespace App\Controllers\admin; use App\Controllers\BaseController; use CodeIgniter\RESTful\ResourceController; use CodeIgniter\API\ResponseTrait; // use App\Models\RegisterUserModel; // use App\Models\OrganisationModel; // use App\Models\conference_AttendUserModel; // use App\Models\Conf_About; use App\Models\exhibitionModel; class exhibition_list extends BaseController{ use ResponseTrait; public function __construct() { helper(['form']); // helper(['url']); } public function index(){ // $dr_id = session()->get('dr_id'); $exhibition_list = new exhibitionModel(); $exhibition_details = $exhibition_list->findAll(); $data['details'] = $exhibition_details; // print_r($exhibition_details);die(); return view('admin/edit-industry',$data); } public function edit_industry(){ $industry_id = $this->request->getVar('id'); $models = new exhibitionModel(); $data = $models->where('id',$industry_id)->first(); // print_r($industry_id);die(); if($data){ return json_encode(array( 'result' => 1, 'message' => $data )); } else{ return json_encode(array( 'result' => 0, 'message' => 'Something went wrong...' )); } } public function trending(){ $id = $this->request->getVar('id'); $models = new exhibitionModel(); $models->select('trend_active,id'); $models->where('trend_active',1); $models->where('id',$id); $trending_no = $models->findAll(); $models2 = new exhibitionModel(); $models2->select('trend_active,id'); $models2->where('trend_active',1); $trending_no2 = $models2->findAll(); if(count($trending_no) == 1 ){ $models->set(['trend_active'=>0]); $models->where('id',$id); $update = $models->update(); return json_encode(array( 'result' => 1, 'message' => 'Added to Trending' // 'data'=> $conferene_id )); }else if( count($trending_no2) < 3){ $models->set(['trend_active'=>1]); $models->where('id',$id); $update = $models->update(); return json_encode(array( 'result' => 1, 'message' => 'Added to Trending' // 'data'=> $conferene_id )); }else{ return json_encode(array( 'result' => 0, 'message' => 'Only Three Trending Can Be Given' )); } } public function update_industry_exhibition(){ $id = $this->request->getVar('id_company'); // print_r($id);die(); $company_name = $this->request->getVar('company_name'); $about_company = $this->request->getVar('about_company'); $website = $this->request->getVar('website'); $mail = $this->request->getVar('mail'); $person_name = $this->request->getVar('person_name'); $products = $this->request->getVar('products'); $phone_number = $this->request->getVar('phone_number'); // $logo_name = $this->request->getVar('logo_name'); // $logo = $this->request->getVar('logo'); // // print_r($id);die(); $update = array( // // 'logo'=>$logo, 'company_name'=>$company_name, 'about_company'=>$about_company, 'website'=>$website, 'mail'=>$mail, 'contact_person'=>$person_name, 'phone'=>$phone_number, 'products'=>$products, // // ''=>, ); // print_r($update);die(); $model6 = new exhibitionModel(); $model6->set($update); $model6->where('id',$id); $updateID = $model6->update(); if($updateID){ return json_encode(array( 'result' => 1, 'message' => 'Updated successfully....' // 'data'=>$conference_id )); } else{ return json_encode(array( 'result' => 0, 'message' => 'Something went wrong.....' )); } } public function delete_industry(){ $org_id = session()->get('org_id'); $id = $this->request->getVar('id'); // print_r($dr_id);die(); $delete = new exhibitionModel(); $delete->where('org_id',$org_id)->where('id',$id); $deleteID = $delete->delete(); if($deleteID){ return json_encode(array( 'result' => 1, 'message' => 'Industry Exhibition Deleted Successfully' )); } else{ return json_encode(array( 'result' => 0, 'message' => 'Error' )); } } } ?>