diff --git a/application/config/autoload.php b/application/config/autoload.php
index 7cdc901..d2a8ead 100644
--- a/application/config/autoload.php
+++ b/application/config/autoload.php
@@ -58,7 +58,7 @@
|
| $autoload['libraries'] = array('user_agent' => 'ua');
*/
-$autoload['libraries'] = array();
+$autoload['libraries'] = array('database', 'session', 'form_validation');
/*
| -------------------------------------------------------------------
@@ -89,7 +89,7 @@
|
| $autoload['helper'] = array('url', 'file');
*/
-$autoload['helper'] = array();
+$autoload['helper'] = array('url');
/*
| -------------------------------------------------------------------
diff --git a/application/config/config.php b/application/config/config.php
index 58e1d3a..ddde084 100644
--- a/application/config/config.php
+++ b/application/config/config.php
@@ -23,7 +23,7 @@
| a PHP script and you can easily do that on your own.
|
*/
-$config['base_url'] = 'http://localhost:1024/m-okapi/';
+$config['base_url'] = 'http://localhost:82/m-okapi/';
/*
|--------------------------------------------------------------------------
diff --git a/application/config/database.php b/application/config/database.php
index d22321e..4493190 100644
--- a/application/config/database.php
+++ b/application/config/database.php
@@ -76,9 +76,9 @@
$db['default'] = array(
'dsn' => '',
'hostname' => 'localhost',
- 'username' => '',
+ 'username' => 'root',
'password' => '',
- 'database' => '',
+ 'database' => 'mokapi',
'dbdriver' => 'mysqli',
'dbprefix' => '',
'pconnect' => FALSE,
diff --git a/application/controllers/MOkapi.php b/application/controllers/MOkapi.php
index e35749c..bb27985 100644
--- a/application/controllers/MOkapi.php
+++ b/application/controllers/MOkapi.php
@@ -5,6 +5,46 @@ class MOkapi extends CI_Controller
{
public function index()
{
+ if($this->session->is_connected){
+ $this->load->view('utilisateur/acceuil');
+ }
+ $this->load->view('header.php');
$this->load->view('mokapi_home.php');
+ $this->load->view('footer.php');
+ }
+
+ //====================================================================================
+
+ public function add_entree() {
+ $this->form_validation->set_rules('nom','nom','required');
+ $this->form_validation->set_rules('montant','montant','required');
+ if($this->form_validation->run()){
+ $nom = $this->input->post('nom');
+ $montant = $this->input->post('montant');
+ $user = $this->session->id;
+ $date_ent = date('Y-m-d');
+ #mettre dans le model
+ }
+ }
+ public function add_catgorie_sortie() {
+ $this->form_validation->set_rules('nom','nom','required');
+ if($this->form_validation->run()){
+ $nom = $this->input->post('nom');
+ $user = $this->session->id;
+ #mettre dans le model
+ }
+ }
+ public function add_exercice_budgetaire() {
+ $this->form_validation->set_rules('datedebut','datedebut','required');
+ $this->form_validation->set_rules('datefin','datefin','required');
+ $this->form_validation->set_rules('budgetinitial','budgetinitial','required');
+ if($this->form_validation->run()){
+ $datedebut = $this->input->post('datedebut');
+ $datefin = $this->input->post('datefin');
+ $budgetinitial = $this->input->post('budgetinitial');
+ $user = $this->session->id;
+ $date_creation = date('Y-m-d');
+ #mettre dans le model
+ }
}
}
\ No newline at end of file
diff --git a/application/controllers/Utilisateur.php b/application/controllers/Utilisateur.php
new file mode 100644
index 0000000..2d6b00b
--- /dev/null
+++ b/application/controllers/Utilisateur.php
@@ -0,0 +1,91 @@
+vload->model('UtilisateurModel');
+ }
+ public function form_inscription()
+ {
+ $this->load->view('header.php');
+ $this->load->view('form_inscription.php');
+ $this->load->view('footer.php');
+ }
+ public function nouvel_utilisateur(){
+ $nomcomplet = $this->input->post('nomcomplet');
+ $login = $this->input->post('login');
+ $mdp = $this->input->post('mdp');
+ $mdp_conf = $this->input->post('mdp_conf');
+ $email = $this->input->post('email');
+ if($mdp == $mdp_conf){
+ $info= array(
+ 'id'=> NULL,
+ 'nomcomplet'=> $nomcomplet,
+ 'login'=> $login,
+ 'mdp'=> $mdp,
+ 'email'=> $email,
+ 'etat'=> FALSE
+
+ );
+ $this->UtilisateurModel->creer_utilisateur($info);
+ $lien = site_url();
+ echo "inscription reussie
acceuil";
+ }
+ else{
+ echo "Mot de passe non identique";
+ $this->load->view('header.php');
+ $this->load->view('form_inscription.php');
+ $this->load->view('footer.php');
+ }
+ }
+ public function connexion(){
+ $login = $this->input->post('login');
+ $mdp = $this->input->post('mdp');
+ $d = array(
+ 'login' => $login,
+ 'mdp' => $mdp
+ );
+
+ $r = $this->UtilisateurModel->login($d);
+ if(count($r) > 0){
+ $user = $r[0];
+ $d = array(
+ 'id' => $user->id,
+ 'nomcomplet' => $user->nomcomplet,
+ 'is_connected' => true
+ );
+ $this->session->set_userdata($d);
+ $this->load->view('header.php');
+ redirect('utilisateur/acceuil');
+ $this->load->view('footer.php');
+
+ }
+ else{
+ $error = array(
+ 'erreur'=> 'login ou mot de passe incorrect'
+ );
+ $this->session->set_flashdata($error);
+ $this->load->view('header.php');
+ $this->load->view('mokapi_home.php');
+ $this->load->view('footer.php');
+ }
+ }
+ public function acceuil(){
+ if($this->session->is_connected){
+ $this->load->view('header.php');
+ $this->load->view('utilisateur/acceuil');
+ $this->load->view('footer.php');
+ }
+ else{
+ redirect();
+
+ }
+ }
+ public function logout(){
+ $this->session->unset_userdata('is_connected');
+ redirect();
+ }
+}
\ No newline at end of file
diff --git a/application/models/UtilisateurModel.php b/application/models/UtilisateurModel.php
new file mode 100644
index 0000000..051d3e4
--- /dev/null
+++ b/application/models/UtilisateurModel.php
@@ -0,0 +1,93 @@
+db->where(['login' => $Log, 'mdp' => $Pass])
+ ->get($this->TableUtilisateur)->result();
+ }
+
+ /*===============================================================================================
+ @param string $Name
+ @param string $Pass
+ @param string $Log
+ @param string $Email
+ @return boolean
+ @explication ajoute un nom,password,login,email dans la table utilisateur
+ */
+ public function CreateAccountModel($Name, $Pass, $Log, $Email)
+ {
+ $DataBase = [
+ 'nomcomplet' => $Name,
+ 'login' => $Log,
+ 'mdp' => $Pass,
+ 'email' => $Email,
+ 'etat' => false
+ ];
+
+ return $this->db->insert($this->TableUtilisateur, $DataBase);
+ }
+
+ /*===============================================================================================
+ @param int $id
+ @param string $pass
+ @return boolean
+ @explication update le password du user
+ */
+ public function SetPassUserAccountModel($id, $Pass)
+ {
+ $this->db->where('id', $id)->set('mdp', $Pass);
+
+ return $this->db->update($this->TableUtilisateur);
+ }
+
+ /*===============================================================================================
+ @param string $categorie
+ @param string $Id
+ @return boolean
+ @explication ajoute une categorie dans la table categorie de sortie
+ */
+ public function CreateOneCategorieModel($Categorie, $Id)
+ {
+ $DataBase = ['nom' => $Categorie, 'id_utilisateur' => $Id];
+
+ return $this->db->insert($this->TableCategorie, $DataBase);
+ }
+
+ /*===============================================================================================
+ @param string $categorie
+ @param string $Id
+ @return object
+ @explication renvoi toutes les categories
+ */
+ public function GetAllCategoriesModel()
+ {
+ return $this->db->select()->get($this->TableCategorie)->result();
+ }
+}
\ No newline at end of file
diff --git a/application/views/footer.php b/application/views/footer.php
new file mode 100644
index 0000000..6f1dccb
--- /dev/null
+++ b/application/views/footer.php
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+