File: /home/barbeatleanalyti/www/public_html/application/controllers/Manage.php
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Manage extends CI_Controller {
/**
* Index Page for this controller.
*
* Maps to the following URL
* http://example.com/index.php/welcome
* - or -
* http://example.com/index.php/welcome/index
* - or -
* Since this controller is set as the default controller in
* config/routes.php, it's displayed at http://example.com/
*
* So any other public methods not prefixed with an underscore will
* map to /index.php/welcome/<method_name>
* @see https://codeigniter.com/user_guide/general/urls.html
*/
public function index()
{
// method to check profile completed or not
$this->validate_profile_complete_or_not();
$this->load->view('manage/cdashboard');
}
public function validate_profile_complete_or_not(){
$this->load->model('Front_model');
$rsProfileData = $this->Front_model->fetch_profile_data_only();
if(count($rsProfileData) <= 0)
redirect('index.php/manage/profilesetup');
}
public function cdashboard()
{
// method to check profile completed or not
$this->validate_profile_complete_or_not();
$rsData = $this->Front_model->fetchprofileuserinfo();
//$this->load->view('manage/cdashboard');
}
public function profilesetup()
{
$this->load->model('Front_model');
$rsProfileData = $this->Front_model->fetchprofileuserinfo();
$viewdata = array();
$viewdata['userinfo'] = $rsProfileData;
$action = $this->input->post('action');
if($action == 'insertprofiledata'){
$orgname = $this->input->post('orgname');
$department = $this->input->post('department');
$designation = $this->input->post('designation');
$address = $this->input->post('address');
$state = $this->input->post('state');
$city = $this->input->post('city');
$pincode = $this->input->post('pincode');
$insertArr = array();
$insertArr['bbuid'] = $_SESSION['loginid'];
$insertArr['ogrname'] = $orgname;
$insertArr['department'] = $department;
$insertArr['designation'] = $designation;
$insertArr['address'] = $address;
$insertArr['city'] = $city;
$insertArr['state'] = $state;
$insertArr['pincode'] = $pincode;
$insertArr['profile_created_date'] = date("Y-m-d H:i:s");
$this->Front_model->insertprofiledata($insertArr);
redirect('index.php/manage/profile');
}
$this->load->view('manage/profilesetup',$viewdata);
}
public function profile(){
// method to check profile completed or not
$this->validate_profile_complete_or_not();
$rsProfileData = $this->Front_model->fetchprofileuserinfo();
//echo "<pre>";
//print_r($rsProfileData);
//echo "</pre>";
$action = $this->input->post('action');
if($action == 'insertprofiledata'){
$orgname = $this->input->post('orgname');
$department = $this->input->post('department');
$designation = $this->input->post('designation');
$address = $this->input->post('address');
$state = $this->input->post('state');
$city = $this->input->post('city');
$pincode = $this->input->post('pincode');
$insertArr = array();
$insertArr['ogrname'] = $orgname;
$insertArr['department'] = $department;
$insertArr['designation'] = $designation;
$insertArr['address'] = $address;
$insertArr['city'] = $city;
$insertArr['state'] = $state;
$insertArr['pincode'] = $pincode;
//$insertArr['profile_created_date'] = date("Y-m-d H:i:s");
$this->Front_model->update_profile_data($insertArr);
redirect('index.php/manage/profile');
}
$viewdata = array();
$viewdata['userinfo'] = $rsProfileData;
$this->load->view('manage/profile',$viewdata);
}
public function manageorder()
{
// method to check profile completed or not
$this->validate_profile_complete_or_not();
$rsProfileData = $this->Front_model->fetchprofileuserinfo();
$viewdata = array();
$viewdata['userinfo'] = $rsProfileData;
$this->load->view('manage/manageorder',$viewdata);
}
}