home
/
zktecojo
/
public_html
/
app
/
controllers
/
admin
➕ New
📤 Upload
✎ Editing:
HomesectionController.php
← Back
<?php class HomesectionController extends BaseController { public function __construct(){ $this->is_admin_login(); parent::__construct(); } public function index(){ $this->data['teamList']= DB::table('team') ->where('home_page_section','=',2) ->orderBy('team_priority','asc') ->get(); // dd($this->data['teamList']); return View::make('admin.homesection.list',$this->data); } public function create(){ $this->data['messages']=''; if(Input::get('createbtnsubmit')){ // $this->data = Input::get(); // echo "DD";exit(); $file = Input::file('team_image_name'); $insertDatas = array( 'team_member_name' =>Input::get('team_member_name'), // 'team_member_designation' =>Input::get('team_member_designation'), 'team_member_description' =>Input::get('team_member_description'), 'team_status' =>Input::get('team_status'), 'home_page_section' =>2, 'section_link' =>Input::get('section_link'), 'team_priority' =>Input::get('team_priority'), ); if($file){ $filename = $this->resize_and_crop_image('team_image_name','assets/uploads/homesection',array(array('width'=>329,'height'=>91,'folder'=>'recomended'),array('width'=>100,'height'=>23,'folder'=>'small')),null); $insertDatas['team_image_name'] = $filename; } // end file checking loop DB::table('team')->insert($insertDatas); $this->data['messages'] =$this->custom_message('Added Successfully','success'); } // $this->data['teamMenuList'] = DB::table('menus')->where('menu_status','=',1)->get(); return View::make('admin.homesection.add',$this->data); } public function edit($editID){ if(empty($editID)) { return Redirect::to('admin/homesection');} $this->data['messages'] =''; if(Input::get('updatebtnsubmit')){ $this->datasupdate = array( 'team_member_name' =>Input::get('team_member_name'), // 'team_member_designation' =>Input::get('team_member_designation'), 'team_member_description' =>Input::get('team_member_description'), 'team_status' =>Input::get('team_status'), 'home_page_section' =>2, 'section_link' =>Input::get('section_link'), 'team_priority' =>Input::get('team_priority'), ); $file = Input::file('team_image_name'); if($file){ $filename = $this->resize_and_crop_image('team_image_name','assets/uploads/homesection',array(array('width'=>329,'height'=>91,'folder'=>'recomended'),array('width'=>100,'height'=>23,'folder'=>'small')),Input::get('team_image_old_name')); $this->datasupdate['team_image_name'] = $filename; } DB::table('team')->where('team_id', '=',$editID)->update($this->datasupdate); $this->data['messages'] = $this->custom_message('Data updated successfully','success'); } // $this->data['teamMenuList'] = DB::table('menus')->where('menu_status','=',1)->get(); $this->data['rsTeam'] = DB::table('team')->where('team_id','=',$editID)->first(); return View::make('admin.homesection.edit',$this->data); } public function changestatus($statusID,$currentStatus){ $currentStatus = ($currentStatus==0)?1:0; $currentStatusdatas = array("team_status"=>$currentStatus); DB::table('team')->where('team_id', '=',$statusID)->where('home_page_section','=',1)->update($currentStatusdatas); return Redirect::to('admin/homesection')->with('flash_error','deleted'); } public function delete($deleteID){ if(empty($deleteID)) { return Redirect::to('admin/homesection');} $teamList = DB::table('team') ->where('team_id','=',$deleteID) ->where('home_page_section','=',2) ->get(); foreach($teamList as $team){ if(File::exists('assets/uploads/homesection/'.$team->team_image_name)){ File::delete('assets/uploads/homesection/'.$team->team_image_name); File::delete('assets/uploads/homesection/small/'.$team->team_image_name); File::delete('assets/uploads/homesection/recomended/'.$team->team_image_name); } } DB::table('team')->where('team_id', '=',$deleteID)->delete(); $this->data['messages'] = $this->custom_message('Deleted Successfully','success'); return Redirect::to('admin/homesection')->with('flash_error','deleted'); } //------------------------------------------------- public function edit_home_page_caption(){ // echo "DD";exit(); $this->data['messages'] =''; // print_r($_POST);exit(); if(Input::get('updatebtnsubmit')){ $datasupdate = array( 'banner_short_text' =>Input::get('home_section_text'), 'banner_status' =>Input::get('home_section_text_status'), ); DB::table('banners')->where('banner_page_id', '=',-1)->update($datasupdate); $this->data['messages'] = $this->custom_message('Home Section text updated successfully','success'); } $this->data['homeCaption'] = DB::table('banners')->where('banner_page_id','=',-1)->first(); return View::make('admin.homesection.editCaption',$this->data); } }
💾 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