home
/
zktecojo
/
public_html
/
app
/
controllers
/
admin
➕ New
📤 Upload
✎ Editing:
DownloadController.php
← Back
<?php class DownloadController extends BaseController { public function __construct(){ $this->is_admin_login(); parent::__construct(); } public function index(){ $this->data['faqList']= DB::table('faq') ->get(); // dd($this->data['teamList']); return View::make('admin.faq.list',$this->data); } public function create(){ $this->data['messages']=''; if(Input::get('createbtnsubmit')){ $insertDatas = array( 'faq_name' =>Input::get('faq_ques'), 'faq_name_arabic' =>Input::get('faq_ques_ar'), 'faq_category' =>Input::get('faq_cat'), 'faq_description' =>Input::get('faq_ans'), 'faq_description_arabic' =>Input::get('faq_ans_ar'), 'faq_status' =>Input::get('faq_status'), 'faq_priority' =>Input::get('faq_priority'), ); DB::table('faq')->insert($insertDatas); $this->data['messages'] =$this->custom_message('Added Successfully','success'); } $this->data['faqCatlist'] = DB::table('pdf_category')->where('pc_cat_flag','=',2)->get(); return View::make('admin.faq.add',$this->data); } public function edit($editID){ if(empty($editID)) { return Redirect::to('admin/faq');} $this->data['messages'] =''; if(Input::get('updatebtnsubmit')){ $this->datasupdate = array( 'faq_name_arabic' =>Input::get('faq_ques_ar'), 'faq_category' =>Input::get('faq_cat'), 'faq_description' =>Input::get('faq_ans'), 'faq_description_arabic' =>Input::get('faq_ans_ar'), 'faq_status' =>Input::get('faq_status'), 'faq_priority' =>Input::get('faq_priority'), ); DB::table('faq')->where('faq_id', '=',$editID)->update($this->datasupdate); $this->data['messages'] = $this->custom_message('Data updated successfully','success'); } $this->data['faqCatlist'] = DB::table('pdf_category')->where('pc_cat_flag','=',2)->get(); $this->data['faqlist'] = DB::table('faq')->where('faq_id','=',$editID)->first(); return View::make('admin.faq.edit',$this->data); } public function changestatus($statusID,$currentStatus){ $currentStatus = ($currentStatus==0)?1:0; $currentStatusdatas = array("faq_status"=>$currentStatus); DB::table('faq')->where('faq_id', '=',$statusID)->update($currentStatusdatas); return Redirect::to('admin/faq')->with('flash_error','deleted'); } public function delete($deleteID){ if(empty($deleteID)) { return Redirect::to('admin/pdfcategory');} DB::table('faq')->where('faq_id', '=',$deleteID)->delete(); $this->data['messages'] = $this->custom_message('Deleted Successfully','success'); return Redirect::to('admin/faq')->with('flash_error','deleted'); } public function document_index(){ $this->data['docList']= DB::table('training_document') ->get(); return View::make('admin.training.document.list',$this->data); } public function create_document(){ $this->data['messages']=''; if(Input::get('createbtnsubmit')){ $insertDatas = array( 'td_label' =>Input::get('document_title'), 'td_desc' =>Input::get('document_short_content'), 'td_date' =>date('Y-m-d',strtotime(Input::get('document_publish_date'))), 'td_priority' =>Input::get('document_priority'), 'td_status' =>Input::get('document_status'), ); $file = Input::file('document_file'); if(!empty($file)){ $filename = $this->pdf_upload(Input::file('document_file'),'assets/uploads/training/pdf',Input::get('document_file')); $insertDatas['td_pdf_name']=$filename; } //print_r($insertDatas);exit; DB::table('training_document')->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.training.document.add',$this->data); } public function edit_document($editID){ if(empty($editID)) { return Redirect::to('admin/document');} $this->data['messages'] =''; if(Input::get('updatebtnsubmit')){ $this->datasupdate = array( 'td_label' =>Input::get('document_title'), 'td_desc' =>Input::get('document_short_content'), 'td_date' =>date('Y-m-d',strtotime(Input::get('document_publish_date'))), 'td_priority' =>Input::get('document_priority'), 'td_status' =>Input::get('document_status'), ); $file = Input::file('document_file'); if(!empty($file)){ $insertDatas['td_pdf_name'] = $this->pdf_upload($file,'assets/uploads/training/pdf',Input::get('product_image_old_name')); } DB::table('training_document')->where('td_id', '=',$editID)->update($this->datasupdate); $this->data['messages'] = $this->custom_message('Data updated successfully','success'); } $this->data['doclist'] = DB::table('training_document')->where('td_id','=',$editID)->first(); return View::make('admin.training.document.edit',$this->data); } public function changestatus_document($statusID,$currentStatus){ $currentStatus = ($currentStatus==0)?1:0; $currentStatusdatas = array("td_status"=>$currentStatus); DB::table('training_document')->where('td_id', '=',$statusID)->update($currentStatusdatas); return Redirect::to('admin/document')->with('flash_error','deleted'); } public function delete_document($deleteID){ if(empty($deleteID)) { return Redirect::to('admin/document');} DB::table('training_document')->where('td_id', '=',$deleteID)->delete(); $this->data['messages'] = $this->custom_message('Deleted Successfully','success'); return Redirect::to('admin/document')->with('flash_error','deleted'); } public function create_video(){ $this->data['messages'] =''; if(Input::get('creategeneral')){ $i=0; $videonamearray = Input::get('video_name'); $videoname_ar_array = Input::get('video_name_ar'); $videoarray = Input::get('youtube'); foreach($videoarray as $link){ $url = $link; if (strpos($url, 'youtube') > 0) { if(!empty($link)){ parse_str( parse_url( $url, PHP_URL_QUERY ), $my_array_of_vars ); $insertvideos = array( 'vg_video_name' =>$videonamearray[$i], 'vg_video_name_arabic' =>$videoname_ar_array[$i], 'vg_video_link' =>$link, 'vg_youtube_id' =>$my_array_of_vars['v'], 'vg_date' =>date("Y-m-d H:i:s"), ); DB::table('training_video')->insert($insertvideos); } } $i++; } } $this->data['vidlist'] = DB::table('training_video')->get(); return View::make('admin.training.video.edit',$this->data); } public function changestatus_video($statusID,$currentStatus){ $currentStatus = ($currentStatus==0)?1:0; $currentStatusdatas = array("td_status"=>$currentStatus); DB::table('training_document')->where('td_id', '=',$statusID)->update($currentStatusdatas); return Redirect::to('admin/document')->with('flash_error','deleted'); } public function delete_video(){ $temp=Input::get('delete_video'); if(Input::get('deleteVideo')){ if(!empty($temp)){ $delImgList=Input::get('delete_video'); foreach($delImgList as $key=>$val){ DB::table('training_video')->where('vg_id', '=',$val)->delete(); } } } return Redirect::to('admin/video')->with('flash_error','deleted'); } /*************************** Adding Download Subcategory *****************************/ public function download_subcategory_index(){ $this->data['dsubcatlist']= DB::table('download_subcategory as ds') ->join('pages as pg','pg.page_id','=','ds.ds_category_id') ->orderBy('ds_priority','asc') ->get(); // dd($this->data['teamList']); return View::make('admin.downloadSubcategory.list',$this->data); } public function download_subcategory_create(){ $this->data['messages']=''; if(Input::get('createbtnsubmit')){ $insertDatas = array( 'ds_category_id' =>Input::get('download_cat_name'), 'ds_name' =>Input::get('download_subcat_name'), 'ds_name_ar' =>Input::get('download_subcat_name_ar'), 'ds_status' =>Input::get('download_subcat_status'), 'ds_priority' =>Input::get('download_subcat_priority'), 'ds_publish_date' =>date("Y-m-d H:i:s") ); DB::table('download_subcategory')->insert($insertDatas); //print_r($insertDatas);exit; $this->data['messages'] =$this->custom_message('Added Successfully','success'); } return View::make('admin.downloadSubcategory.add',$this->data); } public function download_subcategory_edit($editID){ if(empty($editID)) { return Redirect::to('admin/subcategory');} $this->data['messages'] =''; if(Input::get('updatebtnsubmit')){ $this->datasupdate = array( 'ds_category_id' =>Input::get('download_cat_name'), 'ds_name' =>Input::get('download_subcat_name'), 'ds_name_ar' =>Input::get('download_subcat_name_ar'), 'ds_status' =>Input::get('download_subcat_status'), 'ds_priority' =>Input::get('download_subcat_priority'), 'ds_publish_date' =>date("Y-m-d H:i:s") ); DB::table('download_subcategory')->where('ds_id', '=',$editID)->update($this->datasupdate); $this->data['messages'] = $this->custom_message('Data updated successfully','success'); } $this->data['sub_cat_list'] = DB::table('download_subcategory')->where('ds_id','=',$editID)->first(); return View::make('admin.downloadSubcategory.edit',$this->data); } public function download_subcategory_changestatus($statusID,$currentStatus){ $currentStatus = ($currentStatus==0)?1:0; $currentStatusdatas = array("ds_status"=>$currentStatus); DB::table('download_subcategory')->where('ds_id', '=',$statusID)->update($currentStatusdatas); return Redirect::to('admin/subcategory')->with('flash_error','deleted'); } public function download_subcategory_delete($deleteID){ if(empty($deleteID)) { return Redirect::to('admin/subcategory');} DB::table('download_subcategory')->where('ds_id', '=',$deleteID)->delete(); $this->data['messages'] = $this->custom_message('Deleted Successfully','success'); return Redirect::to('admin/subcategory')->with('flash_error','deleted'); } /*************************** Adding Download Subcategory *****************************/ }
💾 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