293 lines
12 KiB
PHP
Executable File

<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class Website_settings extends MX_Controller
{
function __construct()
{
parent::__construct();
$this->load->model('Website_model');
if (!$this->ion_auth->in_group(array('admin')))
{
redirect('home/permission');
}
}
public function index()
{
$this->load->view('home/dashboard'); // just the header file
$this->load->view('list');
$this->load->view('home/footer'); // just the header file
}
public function editBasicInfo()
{
if(!empty($_POST)){
//pre($_POST);die;
$success=$this->Website_model->savebasicInfo($_POST);
if($success>0){
$this->session->set_flashdata('msg_success', 'Basic information updated successfully.');
}
//redirect($_SERVER['HTTP_REFERER']);
redirect('website_settings');
}
$data['basic_info']=$this->Website_model->getbasicInfo();
//pre($data);die;
$this->load->view('home/dashboard'); // just the header file
$this->load->view('editBasicInfo',$data);
$this->load->view('home/footer'); // just the header file
}
public function editAboutUs(){
if(!empty($_POST)){
//pre($_POST);die;
$about_us['title']=$_POST['title'];
$about_us['description']=$_POST['description'];
$data['about_us']=json_encode($about_us);
$this->Website_model->savebasicInfo($data);
//redirect($_SERVER['HTTP_REFERER']);
redirect('website_settings');
}
$basic_info=$this->Website_model->getbasicInfo();
$data['about_us']=json_decode($basic_info->about_us);
$this->load->view('home/dashboard'); // just the header file
$this->load->view('editAboutUs',$data);
$this->load->view('home/footer'); // just the header file
}
public function bannerList(){
$data['banners']=$this->Website_model->getBannerList();
$this->load->view('home/dashboard'); // just the header file
$this->load->view('bannerList',$data);
$this->load->view('home/footer'); // just the header file
}
public function addBanner(){
if(!empty($_POST)){
$folder_name='uploads/Banner/';
$uploadData['folder_name']=$folder_name;
$uploadData['NAME']='banner_image';
$uploadData['NEW_FILENAME_START']='BAN';
//$uploadData['CONFIG']['allowed_types']='gif|jpg|png|jpeg|pdf';
$uploadData['CONFIG']['allowed_types']=array('gif','jpg','png','jpeg','pdf');
$uploadData['CONFIG']['max_size']='20480000';
$output=fileStore($_FILES,$uploadData);
//pre($output);die;
if($_POST['banner_heading']!=""){ $data['banner_heading']=$_POST['banner_heading']; }
if($_POST['banner_sub_heading']!=""){ $data['banner_sub_heading']=$_POST['banner_sub_heading']; }
if($_POST['banner_description']!=""){ $data['banner_description']=$_POST['banner_description']; }
if($output['NEW_FILE_NAME']!=""){ $data['banner_image']=$output['PATH'].''.$output['NEW_FILE_NAME']; }
if($_POST['id']!=""){
$success=$this->Website_model->updateBanner($data,$_POST['id']);
if($success>0){
$this->session->set_flashdata('msg_success', 'Banner Update Successfully.');
}else{
$this->session->set_flashdata('msg_error', 'Banner Not Updated.');
}
redirect('website_settings/bannerList');
}else{
//pre($data);die;
$insert_id=$this->Website_model->addBanner($data);
//echo $insert_id;die;
if($insert_id>0){
$this->session->set_flashdata('msg_success', 'Banner Added Successfully.');
}else{
$this->session->set_flashdata('msg_error', 'Banner Not Added.');
}
redirect('website_settings/bannerList');
}
}
if($_GET['id']!=""){
$data['banner']=$this->Website_model->getBannerByid($_GET['id']);
//pre($data['banner']);die;
}
$this->load->view('home/dashboard'); // just the header file
$this->load->view('banner',$data);
$this->load->view('home/footer'); // just the header file
}
public function contentList(){
$data['content']=$this->Website_model->getContentList();
//pre($data['content']);die;
$this->load->view('home/dashboard'); // just the header file
$this->load->view('contentList',$data);
$this->load->view('home/footer'); // just the header file
}
public function addContent(){
if(!empty($_POST)){
$folder_name='uploads/Content/';
$uploadData['folder_name']=$folder_name;
$uploadData['NAME']='image';
$uploadData['NEW_FILENAME_START']='CON';
//$uploadData['CONFIG']['allowed_types']='gif|jpg|png|jpeg|pdf';
$uploadData['CONFIG']['allowed_types']=array('gif','jpg','png','jpeg','pdf','svg');
$uploadData['CONFIG']['max_size']='20480000';
$output=fileStore($_FILES,$uploadData);
// pre($output);die;
if($_POST['heading']!=""){ $data['heading']=$_POST['heading']; }
if($_POST['sub_heading']!=""){ $data['sub_heading']=$_POST['sub_heading']; }
// if($_POST['description']!=""){ $data['description']=$_POST['description']; }
$datadesc = array('english'=>$_POST['description'],'spanish'=>$_POST['description_2']);
$data['description'] = json_encode($datadesc);
if($output['NEW_FILE_NAME']!=""){ $data['image']=$output['PATH'].''.$output['NEW_FILE_NAME']; }
if($_POST['id']!=""){
$success=$this->Website_model->updateContent($data,$_POST['id']);
if($success>0){
$this->session->set_flashdata('msg_success', 'Content Update Successfully.');
}else{
$this->session->set_flashdata('msg_error', 'Content Not Updated.');
}
redirect('website_settings/contentList');
}else{
//pre($data);die;
$insert_id=$this->Website_model->addContent($data);
//echo $insert_id;die;
if($insert_id>0){
$this->session->set_flashdata('msg_success', 'Content Added Successfully.');
}else{
$this->session->set_flashdata('msg_error', 'Content Not Added.');
}
redirect('website_settings/contentList');
}
}
if($_GET['id']!=""){
$data['content']=$this->Website_model->getContentByid($_GET['id']);
//pre($data['banner']);die;
}
$this->load->view('home/dashboard'); // just the header file
$this->load->view('content',$data);
$this->load->view('home/footer'); // just the header file
}
/*
| updated on 07-09-2021
|------------------------
| this contactMessage method was transfered
| to Auth controller from this
| controller(website_settings)
*/
// public function contactMessage()
// {
// //pre($_POST);die;
// $data['name']=$_POST['name'];
// $data['email']=$_POST['email'];
// $data['subject']=$_POST['subject'];
// $data['message']=$_POST['message'];
// if(!empty($data))
// {
// $success=$this->Website_model->saveContactMessage($data);
// if($success>0)
// {
// $this->session->set_flashdata('msg_success', 'Your message has been sent.');
// }
// else
// {
// $this->session->set_flashdata('msg_error', 'Your message not sent');
// }
// redirect('/#contact-section');
// }
// }
/*
| our specialities section
*/
public function specialitiesList()
{
$data['specialities']=$this->Website_model->getSpecialitiesList();
// pre($data['specialities']);die;
$this->load->view('home/dashboard'); // just the header file
$this->load->view('specialitiesList',$data);
$this->load->view('home/footer'); // just the header file
}
public function addSpecialities()
{
if(!empty($_POST))
{
$folder_name='uploads/Content/';
$uploadData['folder_name']=$folder_name;
$uploadData['NAME']='image';
$uploadData['NEW_FILENAME_START']='CON';
//$uploadData['CONFIG']['allowed_types']='gif|jpg|png|jpeg|pdf';
$uploadData['CONFIG']['allowed_types']=array('gif','jpg','png','jpeg','pdf');
$uploadData['CONFIG']['max_size']='20480000';
$output=fileStore($_FILES,$uploadData);
$data['heading']=$_POST['heading'];
$data['description']=$_POST['description'];
if($output['NEW_FILE_NAME']!=""){ $data['image']=$output['PATH'].''.$output['NEW_FILE_NAME']; }
$success=$this->Website_model->updateSpecialities($data,$_POST['id']);
if($success)
{
$this->session->set_flashdata('msg_success', 'Specialities Table Updated Successfully.');
}
else
{
$this->session->set_flashdata('msg_error', 'Specialities Table Not Updated.');
}
redirect('website_settings/specialitiesList');
}
if($_GET['id']!=""){
$data['specialities']=$this->Website_model->getSpecialitiesByid($_GET['id']);
// pre($data['specialities']);die;
}
$this->load->view('home/dashboard'); // just the header file
$this->load->view('specialities',$data);
$this->load->view('home/footer'); // just the header file
}
public function topNurses(){
$data['topNurses']=$this->Website_model->getTopNursesList();
// pre($data['specialities']);die;
$this->load->view('home/dashboard'); // just the header file
$this->load->view('top_nurses_list',$data);
$this->load->view('home/footer'); // just the header file
}
public function addTopNurses(){
if(!empty($_POST)){
$folder_name='uploads/Content/';
$uploadData['folder_name']=$folder_name;
$uploadData['NAME']='image';
$uploadData['NEW_FILENAME_START']='NRS';
//$uploadData['CONFIG']['allowed_types']='gif|jpg|png|jpeg|pdf';
$uploadData['CONFIG']['allowed_types']=array('gif','jpg','png','jpeg','pdf');
$uploadData['CONFIG']['max_size']='20480000';
$output=fileStore($_FILES,$uploadData);
$data['name']=$_POST['name'];
$data['address']=$_POST['address'];
if($output['NEW_FILE_NAME']!=""){ $data['image']=$output['PATH'].''.$output['NEW_FILE_NAME']; }
$success=$this->Website_model->updateTopNurses($data,$_POST['id']);
if($success){
$this->session->set_flashdata('msg_success', 'Nurses Table Updated Successfully.');
}else{
$this->session->set_flashdata('msg_error', 'Nurses Table Not Updated.');
}
redirect('website_settings/topNurses');
}
if($_GET['id']!=""){
$data['topNurses']=$this->Website_model->getTopNursesByid($_GET['id']);
}
$this->load->view('home/dashboard'); // just the header file
$this->load->view('top_nurses',$data);
$this->load->view('home/footer'); // just the header file
}
}
/* End of file accountant.php */
/* Location: ./application/modules/accountant/controllers/accountant.php */