<?php
class FrontApplication extends CI_Controller
{
public $sendmail = "noreply@groupe-hammami.net";
public $data = array();
function __construct()
{
parent::__construct();
$this->load->database();
$this->load->helper('url');
$this->load->library('session');
/*
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'smtp-relay.gmail.com';
$config['smtp_port'] = '587';//"587";
$config['smtp_crypto']='ssl';
$config['smtp_user'] = 'hammamispecialite@gmail.com';
$config['smtp_pass'] = 'Bobert123452019';
$config['charset'] = 'UTF-8';
$config['mailtype'] = 'html';
$config['newline'] = "rn";
$config['wordwrap'] = TRUE;
$this->load->library('email',$config);
$this->load->model("Dashboard_model"); */
$config['protocol'] = 'smtp';
$config['wordwrap'] = TRUE;
$config['smtp_host'] = "ssl0.ovh.net";
$config['smtp_user'] = $this->sendmail;
$config['smtp_pass'] = 'noreply2019*';
$config['smtp_port'] = "465";//"587";
$config['smtp_crypto']='ssl';
$config['charset'] = 'UTF-8';
$config['mailtype'] = 'html';
$config['newline'] = "\r\n";
$config['crlf'] = "\n";
$this->load->library('email',$config);
/* foreach($this->db->get("module")->result() as $module){
foreach($this->db->get("action")->result() as $action){
$db = array(
"users_id"=>6,
"module_id"=>$module->id,
"action_id"=>$action->id
);
$this->db->insert("access",$db);
}
}*/
/*$actionuser=array(1,4,6,11);
$actionresponsable=array(1,3,4,5,6,7,8,9,11);
$actionadmin=array(1,2,3,4,5,6,7,8,9,10,11);
$moduleuser=array(3,4,6,8,24,20);
$moduleresponsable=array(3,4,6,8,24,20);
$moduleadmin=array(3,4,6,8,24,20);
foreach($this->db->query("select id from users where type=2")->result() as $user){
}
foreach($moduleadmin as $module){
foreach($actionadmin as $action){
$db = array(
"users_id"=>$user->id,
"module_id"=>$module,
"action_id"=>$action
);
$this->db->insert("access",$db);
}
}
}*/
/*foreach($this->db->query("select id,responsable_id from users")->result() as $user){
if($user->responsable_id!=0){
$param=array(
"users_id"=>$user->id,
"notifyto"=>$user->responsable_id
);
$this->db->insert("notifier",$param);
$param=array(
"users_id"=>$user->id,
"notifyto"=>154
);
$this->db->insert("notifier",$param);
$param=array(
"users_id"=>$user->id,
"notifyto"=>153
);
$this->db->insert("notifier",$param);
$param=array(
"users_id"=>$user->id,
"notifyto"=>155
);
$this->db->insert("notifier",$param);
}
}
foreach($this->db->query("select id,interim_id from users where id in (select users_id from affectation where service_id=16 )")->result() as $user){
if($user->interim_id!=0){
$param=array(
"users_id"=>$user->id,
"notifyto"=>$user->interim_id
);
$this->db->insert("notifier",$param);
}
}
*/
if($this->input->get("confirm")!= false or $this->input->get("reject")!= false and $this->session->userdata("auth") == false){
redirect("Login/index");
}else{
$user = $this->session->userdata("auth");
// $this->data["notifications"] = $this->Dashboard_model->NotiferDemande(array(),$user["type"]);
//Access------------------------------------
$modules =array();
$access = $this->db->query("select * from module where id in (select module_id from access where users_id='".$user["iduser"]."') order by `order`")->result();
foreach($access as $key =>$row ){
$actions = array();
foreach($this->db->query("(select id from action where id in (select action_id from access where module_id = ".$row->id." and users_id='".$user["iduser"]."'))")->result() as $value){
$actions[]= $value->id;
}
$access[$key]->actions= $actions;
$modules[$row->link]=$access[$key];
}
$this->data["access"] = $modules;
//horaire-------------------------------
$this->data["typehoraire"]=array(
"0"=>"Administratif",
"1"=>"Poste"
);
//Action--------------------------------
$this->data["add"] = 1;
$this->data["edit"] = 2;
$this->data["delete"] = 3;
$this->data["read"] = 4;
$this->data["export"] = 5;
$this->data["chart"] = 6;
$this->data["cancel"] = 7;
$this->data["confirm"] = 8;
$this->data["reject"] = 9;
$this->data["dalynotify"] = 10;
$this->data["print"] = 11;
$this->data["readException"] = 12;
}
}
}
?>