<?php
defined('BASEPATH') or exit('Direct access is not allowed');
require_once ROOT . '/trainingportal/app/models/Settings/SettingsModel.php';//trainingportal
require_once LIBS_ROUTE .'Session.php';

/**
 * Automotive controller
 */
class SettingsController extends Controller
{
  /**
   * string 
   */
  public $nombre;
  private $session;
  /**
   * object 
   */
  public $model;

  /**
   * Inicializa valores 
   */
  public function __construct()
  {
    $this->model = new SettingsModel();
    $this->session = new Session();
  }

  /**
  * Método estándar
  */
  public function exec()
  {
    $this->show();
    
  }

  /**
  * Método de ejemplo
  */
  public function show()
  {
    $this->session->init();
    $params = array('selected_segment' => $this->session->get('selected_segment'),'email' => $this->session->get('email'),'user_name' => $this->session->get('user_name'),'role_id' => $this->session->get('role_id'),'emp_code' => $this->session->get('emp_code'),'segment_name' => $this->session->get('segment_name'),'rating' => $this->session->get('rating'),'designation' => $this->session->get('designation'),'enroll_courses' => $this->session->get('enroll_courses'),'profile_image_path' => $this->session->get('profile_image_path'));

    $this->render(__CLASS__,$params); 
  }

  /**
  * Método de ejemplo con model. Obtiene un usuario segun ID
  */

  public function update_password($param){
    $userId=$this->session->get('user_id');
    $segment_id=$this->session->get('selected_segment');
    $segment_name=$this->session->get('segment_name');
    $res = $this->model->update_password($param,$userId,$segment_id,$segment_name);
  }


  public function update_profile_pic($param){
    $userId=$this->session->get('user_id');
    $segment_id=$this->session->get('selected_segment');
    $emp_code=$this->session->get('emp_code');
    $res = $this->model->update_profile_pic($param,$userId,$segment_id,$emp_code);
  }
  
  public function herfpage(){
    $this->render("MainController",$params); 
    //echo "MeThod";
  }

}