APPENDICES
APPENDICES 1: Databasecreation script
-- Base de données: `portail_dev_du`
-- Structure de la table `articles`
CREATE TABLE IF NOT EXISTS `articles` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`state` set('0','1') COLLATE utf8_bin NOT NULL DEFAULT '1',
`title` varchar(200) COLLATE utf8_bin NOT NULL,
`content` text COLLATE utf8_bin NOT NULL,
`photo` varchar(255) COLLATE utf8_bin NOT NULL,
`video` varchar(255) COLLATE utf8_bin NOT NULL,
`date` varchar(30) COLLATE utf8_bin NOT NULL,
`author` varchar(100) COLLATE utf8_bin NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin
AUTO_INCREMENT=10 ;
-- Structure de la table `categories`
CREATE TABLE IF NOT EXISTS `categories` (
`cat_id` int(11) NOT NULL AUTO_INCREMENT,
`cat_title` varchar(255) COLLATE utf8_bin NOT NULL,
`cat_description` varchar(255) COLLATE utf8_bin NOT NULL,
PRIMARY KEY (`cat_id`),
UNIQUE KEY `cat_title` (`cat_title`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin
AUTO_INCREMENT=9 ;
-- Structure de la table `comments`
CREATE TABLE IF NOT EXISTS `comments` (
`com_id` bigint(20) NOT NULL AUTO_INCREMENT,
`id_sujet` int(11) NOT NULL,
`auteur` varchar(100) COLLATE utf8_bin NOT NULL,
`contenu` text COLLATE utf8_bin NOT NULL,
`date` varchar(30) COLLATE utf8_bin NOT NULL,
`time` varchar(10) COLLATE utf8_bin NOT NULL,
PRIMARY KEY (`com_id`),
KEY `id_sujet` (`id_sujet`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin
AUTO_INCREMENT=1 ;
-- Structure de la table `document`
CREATE TABLE IF NOT EXISTS `document` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(100) COLLATE utf8_bin NOT NULL,
`description` text COLLATE utf8_bin NOT NULL,
`type` enum('.pdf','.docx','.rar') COLLATE utf8_bin NOT
NULL,
`reference` varchar(150) COLLATE utf8_bin NOT NULL,
`status` set('0','1') COLLATE utf8_bin NOT NULL DEFAULT '1',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin
AUTO_INCREMENT=4 ;
-- Structure de la table `links`
CREATE TABLE IF NOT EXISTS `links` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(150) COLLATE utf8_bin NOT NULL,
`description` text COLLATE utf8_bin NOT NULL,
`reference` varchar(150) COLLATE utf8_bin NOT NULL,
`cathegory`
enum('formation','etat','ong','international','autre') COLLATE utf8_bin NOT
NULL DEFAULT 'autre',
`status` set('0','1') COLLATE utf8_bin NOT NULL DEFAULT '1',
PRIMARY KEY (`id`),
UNIQUE KEY `title` (`title`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin
AUTO_INCREMENT=6 ;
-- Structure de la table `messages`
CREATE TABLE IF NOT EXISTS `messages` (
`mess_id` bigint(20) NOT NULL AUTO_INCREMENT,
`status` enum('0','1') COLLATE utf8_bin NOT NULL DEFAULT
'0',
`title` varchar(255) COLLATE utf8_bin NOT NULL,
`content` text COLLATE utf8_bin NOT NULL,
`date` date NOT NULL,
`hour` time NOT NULL,
`sender_id` int(11) NOT NULL,
`receiver_id` int(11) NOT NULL,
PRIMARY KEY (`mess_id`),
KEY `sender_id` (`sender_id`,`receiver_id`),
KEY `receiver_id` (`receiver_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin
AUTO_INCREMENT=1 ;
-- Structure de la table `sujets`
CREATE TABLE IF NOT EXISTS `sujets` (
`id_sujet` int(11) NOT NULL AUTO_INCREMENT,
`cat_id` int(11) NOT NULL,
`title` varchar(200) COLLATE utf8_bin NOT NULL,
`description` varchar(200) COLLATE utf8_bin NOT NULL,
PRIMARY KEY (`id_sujet`),
UNIQUE KEY `title` (`title`),
KEY `cat_id` (`cat_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin
AUTO_INCREMENT=12 ;
-- Structure de la table `users`
CREATE TABLE IF NOT EXISTS `users` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(100) COLLATE utf8_bin NOT NULL,
`gender` enum('m','f') COLLATE utf8_bin NOT NULL,
`pseudo` varchar(50) COLLATE utf8_bin NOT NULL,
`pass` varchar(100) COLLATE utf8_bin NOT NULL,
`picture` varchar(150) COLLATE utf8_bin NOT NULL,
`email` varchar(150) COLLATE utf8_bin NOT NULL,
`location` varchar(50) COLLATE utf8_bin NOT NULL,
`profession` varchar(50) COLLATE utf8_bin NOT NULL,
`level` enum('1','2','3') COLLATE utf8_bin NOT NULL DEFAULT
'1',
`status` enum('0','1') COLLATE utf8_bin NOT NULL DEFAULT
'1',
PRIMARY KEY (`id`),
UNIQUE KEY `email` (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin
AUTO_INCREMENT=14 ;
-- Contraintes pour les tables exportées
-- Contraintes pour la table `comments`
ALTER TABLE `comments`
ADD CONSTRAINT `comments_ibfk_1` FOREIGN KEY (`id_sujet`)
REFERENCES `sujets` (`id_sujet`) ON DELETE CASCADE ON UPDATE CASCADE;
-- Contraintes pour la table `messages`
ALTER TABLE `messages`
ADD CONSTRAINT `messages_ibfk_1` FOREIGN KEY (`sender_id`)
REFERENCES `users` (`id`),
ADD CONSTRAINT `messages_ibfk_2` FOREIGN KEY (`receiver_id`)
REFERENCES `users` (`id`);
-- Contraintes pour la table `sujets`
ALTER TABLE `sujets`
ADD CONSTRAINT `sujets_ibfk_1` FOREIGN KEY (`cat_id`)
REFERENCES `categories` (`cat_id`) ON DELETE CASCADE ON UPDATE CASCADE;
/*!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
*/;
APPENDICES 2: Homepage script
<?php
require_once("php/config/db_connect.php");
require_once"php/classes/article.php";
require_once"php/templates/header.php";
?>
<article class=" col-sm-8 col-xs-12 home" id="section">
<div class="row" id="elastic_grid_demo">
</div>
</article>
<?php
require_once"php/templates/left.php";
require_once"php/templates/footer.php";
?>
|