diff --git a/conception.sql b/conception.sql new file mode 100644 index 0000000..04cd530 --- /dev/null +++ b/conception.sql @@ -0,0 +1,12 @@ +STATIQUES + - un utilisateur + - une machine + - un evenement -> journal + + +DYNAMIQUES + - options (utilisation des STATIQUES par cle etrangere) + + +MODELE + \ No newline at end of file diff --git a/config/bdd.sql b/config/bdd.sql new file mode 100644 index 0000000..e908dea --- /dev/null +++ b/config/bdd.sql @@ -0,0 +1,70 @@ +-- phpMyAdmin SQL Dump +-- version 4.0.10deb1 +-- http://www.phpmyadmin.net +-- +-- Client: localhost +-- Généré le: Mer 03 Février 2016 à 23:20 +-- Version du serveur: 5.5.47-0ubuntu0.14.04.1 +-- Version de PHP: 5.5.9-1ubuntu4.14 + +SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; +SET time_zone = "+00:00"; + + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; + +-- +-- Base de données: `stefproject` +-- + +-- -------------------------------------------------------- + +-- +-- Structure de la table `history` +-- + +CREATE TABLE IF NOT EXISTS `history` ( + `id_history` int(11) NOT NULL AUTO_INCREMENT, + `action` int(11) NOT NULL, + `id_acteur` varchar(20) NOT NULL, + `id_machine` varchar(20) NOT NULL, + PRIMARY KEY (`id_history`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + +-- +-- Structure de la table `machine` +-- + +CREATE TABLE IF NOT EXISTS `machine` ( + `id_machine` int(11) NOT NULL AUTO_INCREMENT, + `code` varchar(20) NOT NULL, + `name` int(11) NOT NULL, + PRIMARY KEY (`id_machine`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + +-- +-- Structure de la table `user` +-- + +CREATE TABLE IF NOT EXISTS `user` ( + `id_user` int(11) NOT NULL AUTO_INCREMENT, + `code` varchar(20) NOT NULL, + `username` varchar(30) NOT NULL, + `firstname` varchar(30) NOT NULL, + `lasname` varchar(30) NOT NULL, + `mail` varchar(50) NOT NULL, + `password` varchar(40) NOT NULL, + `status` int(11) NOT NULL, + PRIMARY KEY (`id_user`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; + +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; \ No newline at end of file diff --git a/config/database.json b/config/database.json new file mode 100755 index 0000000..d11c9a0 --- /dev/null +++ b/config/database.json @@ -0,0 +1,6 @@ +{ + "host" : "localhost", + "dbname" : "stefproject", + "user" : "php", + "password" : "Qt358nUdyeTxLDM8" +} \ No newline at end of file diff --git a/config/dispatcher-extensions.json b/config/dispatcher-extensions.json old mode 100644 new mode 100755 index 58ba435..a7b5c39 --- a/config/dispatcher-extensions.json +++ b/config/dispatcher-extensions.json @@ -1,7 +1,8 @@ { - "extensions": { - "svg": "image/svg+xml", - "css": "text/css", - "js": "text/js" - } + "svg": "image/svg+xml", + + "css": "text/css", + "js": "text/js", + + "json": "application/json" } \ No newline at end of file diff --git a/config/dispatcher-tree.json b/config/dispatcher-tree.json old mode 100644 new mode 100755 index b4469a1..f72aee7 --- a/config/dispatcher-tree.json +++ b/config/dispatcher-tree.json @@ -1,8 +1,12 @@ { - "parents": { - "st" : "/src/static", - "dy" : "/src/dynamic", - "css" : "/css", - "js" : "/js" - } + "st" : "/src/static", + "dy" : "/src/dynamic", + + "conf" : "/config", + + "css" : "/css", + "js" : "/js", + + "cssview" : "/view/css", + "jsview" : "/view/js" } \ No newline at end of file diff --git a/config/managers.json b/config/managers.json new file mode 100644 index 0000000..0954b60 --- /dev/null +++ b/config/managers.json @@ -0,0 +1,5 @@ +{ + "a" : "/firstManager", + "b" : "/secondManager", + "c" : "/thirdManager" +} \ No newline at end of file diff --git a/css/constants.css b/css/constants.css old mode 100644 new mode 100755 diff --git a/css/constants.scss b/css/constants.scss old mode 100644 new mode 100755 diff --git a/css/header.css b/css/header.css index 36e8b68..2c632fd 100755 --- a/css/header.css +++ b/css/header.css @@ -1,2 +1,2 @@ -#WRAPPER>#HEADER>.icon{display:block;position:absolute;top:0;left:0;width:4em;height:4em;background-color:#0082b8;background-image:url("../src/static/icon.svg");background-position:center center;background-repeat:no-repeat;background-size:50% 50%;cursor:pointer;transition:all .3s}#WRAPPER>#HEADER>.icon:hover{background-color:#00709f}#WRAPPER>#HEADER.loading>.icon{background-image:url("../src/static/loader.svg");background-size:70% 70%} +#WRAPPER>#HEADER>.icon{display:block;position:absolute;top:0;left:0;width:4em;height:4em;background-color:#0082b8;background-image:url("/f/svg/icon/st");background-position:center center;background-repeat:no-repeat;background-size:50% 50%;cursor:pointer;transition:all .3s}#WRAPPER>#HEADER>.icon:hover{background-color:#00709f}#WRAPPER>#HEADER.loading>.icon{background-image:url("/f/svg/loader/st");background-size:70% 70%} /*# sourceMappingURL=header.css.map */ diff --git a/css/header.scss b/css/header.scss index 6b7f148..7b93cc9 100755 --- a/css/header.scss +++ b/css/header.scss @@ -12,7 +12,7 @@ height: 4em; background-color: darken($theme-color, 10); - background-image: url('../src/static/icon.svg'); + background-image: url('/f/svg/icon/st'); background-position: center center; background-repeat: no-repeat; background-size: 50% 50%; @@ -30,7 +30,7 @@ /* Animation de chargement qudnd chargement ajax */ &.loading > .icon{ - background-image: url('../src/static/loader.svg'); + background-image: url('/f/svg/loader/st'); background-size: 70% 70%; } diff --git a/css/menu-side.css b/css/menu-side.css old mode 100644 new mode 100755 diff --git a/css/submenu-side.css b/css/submenu-side.css old mode 100644 new mode 100755 diff --git a/css/submenu-side.scss b/css/submenu-side.scss old mode 100644 new mode 100755 diff --git a/index.php b/index.php old mode 100644 new mode 100755 index df33010..1bfd0f8 --- a/index.php +++ b/index.php @@ -1,5 +1,5 @@ inclusion de la page $R->get('dashboard(?:/[\w-]+)*/?', function(){ include __ROOT__.'/view.php'; }); + $R->get('profile(?:/[\w-]+)*/?', function(){ include __ROOT__.'/view.php'; }); $R->get('machines(?:/[\w-]+)*/?', function(){ include __ROOT__.'/view.php'; }); $R->get('users(?:/[\w-]+)*/?', function(){ include __ROOT__.'/view.php'; }); $R->get('analytics(?:/[\w-]+)*/?', function(){ include __ROOT__.'/view.php'; }); $R->get('settings(?:/[\w-]+)*/?', function(){ include __ROOT__.'/view.php'; }); // nomPage -> nomPage/ - $R->get('dashboard', function(){ header('Location: /dashboard/'); }); - $R->get('machines', function(){ header('Location: /machines/'); }); - $R->get('users', function(){ header('Location: /users/'); }); - $R->get('analytics', function(){ header('Location: /analytics/'); }); - $R->get('settings', function(){ header('Location: /settings/'); }); + $R->get('dashboard', function(){ header('Location: /dashboard/'); }); + $R->get('profile', function(){ header('Location: /profile/'); }); + $R->get('machines', function(){ header('Location: /machines/'); }); + $R->get('users', function(){ header('Location: /users/'); }); + $R->get('analytics', function(){ header('Location: /analytics/'); }); + $R->get('settings', function(){ header('Location: /settings/'); }); - $R->get('dashboard/', function(){ include __ROOT__.'/view.php'; }); - $R->get('machines/', function(){ include __ROOT__.'/view.php'; }); - $R->get('users/', function(){ include __ROOT__.'/view.php'; }); - $R->get('analytics/', function(){ include __ROOT__.'/view.php'; }); - $R->get('settings/', function(){ include __ROOT__.'/view.php'; }); + // $R->get('dashboard/', function(){ include __ROOT__.'/view.php'; }); + // $R->get('machines/', function(){ include __ROOT__.'/view.php'; }); + // $R->get('users/', function(){ include __ROOT__.'/view.php'; }); + // $R->get('analytics/', function(){ include __ROOT__.'/view.php'; }); + // $R->get('settings/', function(){ include __ROOT__.'/view.php'; }); // Dispatcher $R->get('f(?:/([\w-]+))*/?', function(){ new manager\ResourcesDispatcher($_GET['url']); }); diff --git a/js/lib/page-manager.js b/js/lib/page-manager.js old mode 100644 new mode 100755 index a7f2bb1..d513b15 --- a/js/lib/page-manager.js +++ b/js/lib/page-manager.js @@ -22,8 +22,8 @@ pageManagerClass.prototype = { page: null, // l'indice de la page courante dans pagelist vars: [], // les variables suivant le nom de la page dans l'URL path: '', // le chemin du dossier contenant les pages (.php) - jsPath: 'js', // le chemin du dossier contenant les scripts (.js) - cssPath: 'css', // le chemin du dossier contenant les feuilles de style (.css) + jsPath: '/f/jsview/', // le chemin du dossier contenant les scripts (.js) + cssPath: '/f/cssview/', // le chemin du dossier contenant les feuilles de style (.css) pagelist: null, // la liste des pages pouvant être chargées container: null, // élément DOM qui contiendra le contenu des pages à charger /* ======================================================================= diff --git a/js/lib/reset.js b/js/lib/reset.js old mode 100644 new mode 100755 diff --git a/manager/Database.php b/manager/Database.php new file mode 100755 index 0000000..cf79f62 --- /dev/null +++ b/manager/Database.php @@ -0,0 +1,104 @@ +host = $host; + $this->dbname = $dbname; + $this->username = $username; + $this->password = $password; + + // password: Qt358nUdyeTxLDM8 + self::$pdo = new \PDO('mysql:host='.$host.';dbname='.$dbname, $username, $password); + } + + + /* retourne une instance de la classe */ + public static function getInstance(){ + if( self::$instance == null ){ + + // chargement de la configuration du server SQL + $conf = json_decode(file_get_contents('http://'.$_SERVER['HTTP_HOST'].'/f/json/database/conf'), true); + self::$instance = new DataBase($conf['host'], $conf['dbname'], $conf['user'], $conf['password']); + + } + + return self::$instance; + } + + /* retourne la connection statique */ + public static function getPDO(){ + $instance = self::getInstance(); + return self::$pdo; + } + + + /*************************************************************/ + /* _____ ______ _ _ ______ _____ _ */ + /* / ____| ____| \ | | ____| __ \ /\ | | */ + /* | | __| |__ | \| | |__ | |__) | / \ | | */ + /* | | |_ | __| | . ` | __| | _ / / /\ \ | | */ + /* | |__| | |____| |\ | |____| | \ \ / ____ \| |____ */ + /* \_____|______|_| \_|______|_| \_\/_/ \_\______| */ + /* */ + /*************************************************************/ + + /* SUPPRIME LES VALEURS À CLÉS NUMÉRIQUES DANS UN FETCH D'UNE TABLE DE LA BDD + * + * @fetchData le résultat d'une $requeteSQL->fetchAll() + * + * @return newFetchData retourne le tableau donné en paramètre mais sans les valeurs à clés numériques + * + */ + public static function delNumeric($fetchData, $oneDimension=false){ + + /* [1] 2 dimensions + ===============================================*/ + if( !$oneDimension ){ + + // on supprime les doublons des entrées (indice numérique) + for( $i = 0 ; $i < count($fetchData) ; $i++ ) // pour tout les utilisateurs + foreach($fetchData[$i] as $col => $val){ // pour toutes les entrées + + if( !mb_detect_encoding($val, 'UTF-8') ) + $fetchData[$i][$col] = utf8_encode($val); + + if( is_int($col) ) // si l'indice est un entier + unset( $fetchData[$i][$col] ); // on le supprime + } + + /* [2] 1 dimensions + ===============================================*/ + }else{ + + // on supprime les doublons des entrées (indice numérique) + foreach($fetchData as $i=>$val){ // pour toutes les entrées + + if( !mb_detect_encoding($val, 'UTF-8') ) + $fetchData[$i] = utf8_encode($val); + + if( is_int($i) ) // si l'indice est un entier + unset( $fetchData[$i] ); // on le supprime + } + + } + + return $fetchData; + } + + } + +?> diff --git a/manager/ResourcesDispatcher.php b/manager/ResourcesDispatcher.php index 5c2dac8..497a4d4 100755 --- a/manager/ResourcesDispatcher.php +++ b/manager/ResourcesDispatcher.php @@ -31,11 +31,11 @@ /* [0] On met a jour la configuration =====================================================*/ // Extensions supportees - $extensions_conf = json_decode( file_get_contents('http://'.$_SERVER['HTTP_HOST'].self::$extension_config_path), true )['extensions']; + $extensions_conf = json_decode( file_get_contents('http://'.$_SERVER['HTTP_HOST'].self::$extension_config_path), true ); self::$supported_extensions = $extensions_conf; // Dossiers supportes - $parents_conf = json_decode( file_get_contents('http://'.$_SERVER['HTTP_HOST'].self::$parents_config_path), true )['parents']; + $parents_conf = json_decode( file_get_contents('http://'.$_SERVER['HTTP_HOST'].self::$parents_config_path), true ); self::$supported_parents = $parents_conf; diff --git a/manager/autoloader.php b/manager/autoloader.php old mode 100644 new mode 100755 index a3838c1..eb5d9af --- a/manager/autoloader.php +++ b/manager/autoloader.php @@ -1,6 +1,6 @@ \ No newline at end of file diff --git a/router/Route.php b/router/Route.php old mode 100644 new mode 100755 diff --git a/router/Router.php b/router/Router.php old mode 100644 new mode 100755 diff --git a/src/dynamic/create.svg b/src/dynamic/create.svg old mode 100644 new mode 100755 diff --git a/src/dynamic/edit.svg b/src/dynamic/edit.svg old mode 100644 new mode 100755 diff --git a/src/dynamic/filter.svg b/src/dynamic/filter.svg old mode 100644 new mode 100755 diff --git a/src/dynamic/remove.svg b/src/dynamic/remove.svg old mode 100644 new mode 100755 diff --git a/src/dynamic/search.svg b/src/dynamic/search.svg old mode 100644 new mode 100755 diff --git a/src/static/loader.svg b/src/static/loader.svg old mode 100644 new mode 100755 diff --git a/src/static/menu-side/users2.svg b/src/static/menu-side/users2.svg old mode 100644 new mode 100755 diff --git a/src/static/sub-menu-side/analytics.svg b/src/static/sub-menu-side/analytics.svg old mode 100644 new mode 100755 diff --git a/src/static/sub-menu-side/create.svg b/src/static/sub-menu-side/create.svg old mode 100644 new mode 100755 diff --git a/src/static/sub-menu-side/edit.svg b/src/static/sub-menu-side/edit.svg old mode 100644 new mode 100755 diff --git a/src/static/sub-menu-side/filter.svg b/src/static/sub-menu-side/filter.svg old mode 100644 new mode 100755 diff --git a/src/static/sub-menu-side/password.svg b/src/static/sub-menu-side/password.svg new file mode 100644 index 0000000..b9a1676 --- /dev/null +++ b/src/static/sub-menu-side/password.svg @@ -0,0 +1,50 @@ + +image/svg+xml \ No newline at end of file diff --git a/src/static/sub-menu-side/remove.svg b/src/static/sub-menu-side/remove.svg old mode 100644 new mode 100755 diff --git a/src/static/sub-menu-side/search.svg b/src/static/sub-menu-side/search.svg old mode 100644 new mode 100755 diff --git a/src/static/sub-menu-side/sync.svg b/src/static/sub-menu-side/sync.svg old mode 100644 new mode 100755 diff --git a/src/static/sub-menu-side/view.svg b/src/static/sub-menu-side/view.svg old mode 100644 new mode 100755 diff --git a/todo.md b/todo.md old mode 100644 new mode 100755 index 29e8708..96f4ee4 --- a/todo.md +++ b/todo.md @@ -4,16 +4,27 @@ - [ ] Dev des managers et de l'API et liste des acces - [ ] Creation de la base des managers et de l'API - [ ] Conception des managers et de l'API -- [ ] Conception BDD + ameliorations - [ ] Definir graphiquement le #CONTAINER - [ ] Structure - [ ] Elements - [ ] Affichages - [ ] Styles globaux + ############ # EN COURS # ############ +- [x] Conception BDD + ameliorations + - [x] Liste des tables + - [x] Liste de attributs + - [ ] Attributs statiques + - utilisateur (id, ) + - machine + - journal + - [ ] Attributs dynamiques + - les options + - les addons des attributs statiques + - [ ] Ameliorations et genericite possibles ######## diff --git a/view.php b/view.php index cb73e5a..4589d5a 100755 --- a/view.php +++ b/view.php @@ -10,20 +10,20 @@ - - - - - - - - + + + + + + + + - + - + @@ -42,7 +42,7 @@