<?php
#############################################################################
#                              Site@School
# Site@School is a website management system designed for schools.
#
# demodata_FR.php 
#$Id: demodata_FR.php,v 1.2 2006/10/15 19:08:53 fstuurman Exp $
############################################################################
if ($q == 1) 
{
$modtable_news_categories = "$dbprefix" . "m_news_cat";
$modtable_news_articles = "$dbprefix" . "m_news_articles";
$modtable_ads = "$dbprefix" . "adtext";
$modtable_guestbook = "$dbprefix" . "m_gbook";
$table_prot_pages = $dbprefix."prot_pages";
$table_prot_sections = $dbprefix."prot_sections";
mysql_query("INSERT INTO $modtable_ads (ad_id, email, ad_text, date, name) VALUES( '1', 'gnuoulipo@free.fr', 'Consultez notre site de démonstration de Site@School adapté à l\'école primaire française.', '2004-09-01', 'L\'école du libre')");
//Creating classes of french primary school
//Création des classes de l'école primaire française
mysql_query("INSERT INTO $table_classes (id, name, teachers, project) VALUES('', 'CP','','3')");
mysql_query("INSERT INTO $table_classes (id, name, teachers, project) VALUES( '3', 'testproject','' ,'1')");
mysql_query("INSERT INTO $table_classes (id, name, teachers, project) VALUES('', 'CE1','','3')");
mysql_query("INSERT INTO $table_classes (id, name, teachers, project) VALUES('', 'CE2','','3')");
mysql_query("INSERT INTO $table_classes (id, name, teachers, project) VALUES('', 'CM1','','3')");
mysql_query("INSERT INTO $table_classes (id, name, teachers, project) VALUES( '', 'CM2','','3')");

mysql_query("INSERT INTO $modtable_guestbook (id, name, email,homepage, date, message) VALUES( '1', 'M. le Ministre de l\'Education Nationale','','http://www.gouv.xxx', '2004-09-01 00:00:00','Félicitations pour ce site remarquable. Puisse-t-il donner envie à toutes les écoles primaires de France d\'utiliser cet outil : le CMS Site@School.')");
mysql_query("INSERT INTO $modtable_news_categories (id, title, ispage) VALUES('1', 'Informations générales', '0')");
mysql_query("INSERT INTO $modtable_news_articles (id, title, date, category, content, archive) VALUES( '1', 'Mise en ligne de L\'école du Libre', '1-4-2006', '1', 'Nous sommes heureux de vous informer de la mise en ligne de notre site construit avec le CMS Site@School, version 2.4', '0')");
mysql_query("INSERT INTO $table_studentpages (studentid, content, newcontent, pcheck, approved, send_email, title, dir_number) 
VALUES( '1', 'Voici ma première page','', '0', '0', '0', 'Première page', '1')");
mysql_query("INSERT INTO $table_studentpages (studentid, content, newcontent, pcheck, approved, send_email, title, dir_number) 
VALUES( 2, 'This is the teacher page.\r\n', '', 2, 0, 0, 'First page', 2)");
mysql_query("INSERT INTO $table_studentpages (studentid, content, newcontent, pcheck, approved, send_email, title, dir_number) 
VALUES( 3, 'This is the project page.\r\n', '', 0, 0, 0, 'Project page', 3)");

//Creating 11 pages linked with 5 site's sections
// Création de 11 pages rattachées aux 5 sections du site

mysql_query("INSERT INTO $table_pages (id, section, name, invisible, content, module, sort, count, createdate, lastvisitdate, category, lastupdate) VALUES( '1', '1', 'Informations générales','', 'Cette page sera la page de présentation de votre site et de votre école','', '1', '8', '2003-11-27', '2003-12-02','', '2003-11-28')");
mysql_query("INSERT INTO $table_pages (id, section, name, invisible, content, module, sort, count, createdate, lastvisitdate, category, lastupdate) VALUES( '2', '5', 'Le livre d\'or','','', 'sn_gbook/gbook.php', '1', '12', '2003-11-28', '2003-12-02','', '2003-11-28')");
mysql_query("INSERT INTO $table_pages (id, section, name, invisible, content, module, sort, count, createdate, lastvisitdate, category, lastupdate) VALUES( '3', '4', 'Connexion des maîtres','','', 'sn_studentpages/user_login.php', '1', '2', '2003-11-28', '2003-12-02','', '2003-11-28')");
mysql_query("INSERT INTO $table_pages (id, section, name, invisible, content, module, sort, count, createdate, lastvisitdate, category, lastupdate) VALUES( '4', '2', 'Informations','','', 'sn_news/frontpage.php', '2', '5', '2003-11-28', '2003-12-02','', '2003-11-28')");
mysql_query("INSERT INTO $table_pages (id, section, name, invisible, content, module, sort, count, createdate, lastvisitdate, category, lastupdate) VALUES( '5', '5', 'Voir les communiqués','','', 'sn_ads/view_ads.php', '1', '4', '2003-11-28', '2003-12-02','', '2003-11-28')");
mysql_query("INSERT INTO $table_pages (id, section, name, invisible, content, module, sort, count, createdate, lastvisitdate, category, lastupdate) VALUES( '7', '3', 'Pages des élèves','','', 'sn_studentpages/viewpage.php', '1', '9', '2003-11-28', '2003-12-02','', '2003-11-28')");
mysql_query("INSERT INTO $table_pages (id, section, name, invisible, content, module, sort, count, createdate, lastvisitdate, category, lastupdate) VALUES( '8', '3', 'Connexion des élèves','','', 'sn_studentpages/user_login.php', '2', '4', '2003-11-28', '2003-12-01','', '2003-11-28')");
mysql_query("INSERT INTO $table_pages (id, section, name, invisible, content, module, sort, count, createdate, lastvisitdate, category, lastupdate) VALUES( '9', '6', 'Recherche dans le site','','', 'dgs_search/search.php', '1', '4', '2003-11-28', '2003-12-01','', '2003-11-28')");
mysql_query("INSERT INTO $table_pages (id, section, name, invisible, content, module, sort, count, createdate, lastvisitdate, category, lastupdate) VALUES( '10', '6', 'Plan du site','','', 'sn_sitemap/view_sitemap.php', '2', '2', '2003-11-28', '2003-12-01','', '2003-11-28')");
mysql_query("INSERT INTO $table_pages (id, section, name, invisible, content, module, sort, count, createdate, lastvisitdate, category, lastupdate) VALUES( '11', '2', 'Vacances scolaires','','Passez dans le mode configuration pour éditer les dates des vacances scolaires pour l\'année scolaire 2004/2005', '', '1', '5', '2004-09-01', '2004-09-01','', '2004-09-01')");

// Creating multiple sections
// Création des différentes sections

mysql_query("INSERT INTO $table_sections (id, name, invisible, frontpage, parent, sort) VALUES( '1', 'Notre école','', '1','', '1')");
mysql_query("INSERT INTO $table_sections (id, name, invisible, frontpage, parent, sort) VALUES( '2', 'Informations générales','', '4','', '2')");
mysql_query("INSERT INTO $table_sections (id, name, invisible, frontpage, parent, sort) VALUES( '3', '&Eacute;lèves','', '7','', '3')");
mysql_query("INSERT INTO $table_sections (id, name, invisible, frontpage, parent, sort) VALUES( '4', 'Maîtres','', '3','', '4')");
mysql_query("INSERT INTO $table_sections (id, name, invisible, frontpage, parent, sort) VALUES( '5', 'Parents','', '2','', '5')");
mysql_query("INSERT INTO $table_sections (id, name, invisible, frontpage, parent, sort) VALUES( '6', 'Recherche','', '9','', '5')");

// Creating users
// Création d'utilisateurs

mysql_query("INSERT INTO $table_users (username, name, password, email, class, type, access, highvisibility, project) 
VALUES('papillon', '&Eacute;lève Papillon', md5('papillon'),'', '2', '1', '000000000000,000000000000', '1','3')");
mysql_query("INSERT INTO $table_users (username, name, password, email, class, type, access, highvisibility, project) 
VALUES('teacher', 'Mr. Teacher', md5('teacher'), ' ','2', '2', '000000000000,000000000000', '2','3')");
mysql_query("INSERT INTO $table_users (username, name, password, email, class, type, access, highvisibility, project) 
VALUES('testproject', 'testproject', md5('testproject'), ' ','3', '0', '000000000000,000000000000', '2','3')");

// Création de la page de ressources de l'élève papillon
// Creating papillon pupil's page of resources

$result=mysql_query("SELECT config_value FROM $table_configuration WHERE config_key='serverpath'");
$row=mysql_fetch_array($result);
$serverpath=$row["config_value"];
mysql_free_result($result);

$result=mysql_query("SELECT config_value FROM $table_configuration WHERE config_key='user_path'");
$row=mysql_fetch_array($result);
$userpath=$row["config_value"];
mysql_free_result($result);

$studentpath = $serverpath . $userpath . "/studentpages/1";
@mkdir($studentpath, 0777);

mysql_query("INSERT INTO $table_users (id, username, name, password, email, class, type, editor, access, highvisibility) 
VALUES( ' ', 'directeur', 'Le directeur', 'directeur', ' ','2', '22', 2, '1000000010001,0000000000000', '0')");

// Creating protected pages and sections
//Création de pages et de sections protégées

mysql_query("INSERT INTO $table_prot_pages (id, section, name, invisible, content, module, sort, count, createdate, lastvisitdate, category, lastupdate) VALUES( '1', '1', 'Téléchargement','','', 'sn_downloads/download_cat.php', '2', '0', '2003-12-02', '0000-00-00','', '2003-12-02')");
mysql_query("INSERT INTO $table_prot_pages (id, section, name, invisible, content, module, sort, count, createdate, lastvisitdate,category, lastupdate) VALUES( '2', '1', 'Page de présentation','','Ceci est la page de présentation de l\'intranet','', '1', '0', '2003-12-02', '0000-00-00','', '2003-12-02')");
mysql_query("INSERT INTO $table_prot_sections (id, name, invisible, frontpage, parent, sort) VALUES( '1', 'Intranet','', '2','', '1')");
mysql_query("UPDATE $table_configuration SET config_value='editable' WHERE config_key='protected_theme'");
} 
else 
{
// fill sections and pages with some initial data
include("../configuration/database.inc.php");                  // connecting to database
mysql_connect("$db_server", "$db_username", "$db_password");
mysql_select_db("$db_name");
$d = date("Y-m-d");
mysql_query("INSERT INTO $table_pages VALUES ('1', '1', 'Première page', '', 'Ceci sera votre première page. Pour l\'éditer, à la fin de l\'installation passez en mode configuration en vous connectant à http://adresse_de_votre_site/starnet. Cliquez sur la visite guidée, pour apprendre à modifier une section et une page' , '', '1', '0', '$d', '0000-00-00', ' ', '$d', '')");
mysql_query("INSERT INTO $table_pages VALUES ('2', '2', 'Première page', '', 'Ceci sera votre première page de la deuxième section. Pour l\'éditer, à la fin de l\'installation passez en mode configuration en vous connectant à http://adresse_de_votre_site/starnet. Cliquez sur la visite guidée, pour apprendre à modifier une section et une page' , '', '1', '0', '$d', '0000-00-00', ' ', '$d', '')");
mysql_query("INSERT INTO $table_sections  VALUES (1, 'Première Section', '', '1', '', 1)");
mysql_query("INSERT INTO $table_sections  VALUES (2, 'Deuxième section', '', '2', '', 1)");

}
?>