Génére automatiquement les contenus des nouveaux cours
This commit is contained in:
parent
18063b85a8
commit
09894a7518
41
.htaccess
41
.htaccess
@ -1,5 +1,36 @@
|
||||
# Bloque l'accès aux données et aux log
|
||||
<Files ~ "\.(htaccess|json|log)$">
|
||||
Order deny,allow
|
||||
Deny from all
|
||||
</Files>
|
||||
# Active la compression GZIP - option Apache
|
||||
<IfModule mod_gzip.c>
|
||||
mod_gzip_on Yes
|
||||
mod_gzip_dechunk Yes
|
||||
mod_gzip_item_include file \.(html?|txt|css|js|php|pl)$
|
||||
mod_gzip_item_include handler ^cgi-script$
|
||||
mod_gzip_item_include mime ^text\.*
|
||||
mod_gzip_item_include mime ^application/x-javascript.*
|
||||
mod_gzip_item_exclude mime ^image\.*
|
||||
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
|
||||
</IfModule>
|
||||
|
||||
# Active la compression DEFLATE - option Apache
|
||||
<IfModule mod_deflate.c>
|
||||
AddOutputFilterByType DEFLATE text/plain
|
||||
AddOutputFilterByType DEFLATE text/html
|
||||
AddOutputFilterByType DEFLATE text/xml
|
||||
AddOutputFilterByType DEFLATE text/shtml
|
||||
AddOutputFilterByType DEFLATE text/css
|
||||
AddOutputFilterByType DEFLATE application/xml
|
||||
AddOutputFilterByType DEFLATE application/xhtml+xml
|
||||
AddOutputFilterByType DEFLATE application/rss+xml
|
||||
AddOutputFilterByType DEFLATE application/javascript
|
||||
AddOutputFilterByType DEFLATE application/x-javascript
|
||||
</IfModule>
|
||||
|
||||
# Bloque l'accès à la liste des fichiers
|
||||
Options -Indexes
|
||||
|
||||
# Désactive l'option de substitution automatique
|
||||
<IfModule mod_negotiation.c>
|
||||
Options -MultiViews
|
||||
</IfModule>
|
||||
|
||||
# ne pas supprimer la ligne URL rewriting !
|
||||
# URL rewriting
|
||||
|
@ -365,7 +365,7 @@ class common
|
||||
if (
|
||||
file_exists(self::DATA_DIR . self::$siteContent . '/' . $stageId . '.json') === false
|
||||
) {
|
||||
$this->initData($stageId);
|
||||
$this->initData($stageId, self::$siteContent);
|
||||
}
|
||||
}
|
||||
|
||||
@ -634,31 +634,31 @@ class common
|
||||
* Données valides : page ou module
|
||||
*/
|
||||
|
||||
public function initData($module)
|
||||
public function initData($module, $path)
|
||||
{
|
||||
|
||||
// Tableau avec les données vierges
|
||||
require_once('core/module/install/ressource/defaultdata.php');
|
||||
|
||||
// L'arborescence
|
||||
if (!file_exists(self::DATA_DIR . self::$siteContent)) {
|
||||
mkdir(self::DATA_DIR . self::$siteContent, 0755);
|
||||
if (!file_exists(self::DATA_DIR . $path)) {
|
||||
mkdir(self::DATA_DIR . $path, 0755);
|
||||
}
|
||||
if (!file_exists(self::DATA_DIR . self::$siteContent . '/content')) {
|
||||
mkdir(self::DATA_DIR . self::$siteContent . '/content', 0755);
|
||||
if (!file_exists(self::DATA_DIR . $path . '/content')) {
|
||||
mkdir(self::DATA_DIR . $path . '/content', 0755);
|
||||
}
|
||||
|
||||
/*
|
||||
* Le site d'accueil, home ne dispose pas des mêmes modèles
|
||||
*/
|
||||
$template = self::$siteContent === 'home' ? init::$siteTemplate : init::$courseDefault;
|
||||
$template = $path === 'home' ? init::$siteTemplate : init::$courseDefault;
|
||||
// Création de page ou de module
|
||||
$this->setData([$module, $template[$module]]);
|
||||
// Création des pages
|
||||
if ($module === 'page') {
|
||||
$content = self::$siteContent === 'home' ? init::$siteContent : init::$courseContent;
|
||||
$content = $path === 'home' ? init::$siteContent : init::$courseContent;
|
||||
foreach ($content as $key => $value) {
|
||||
$this->setPage($key, $value, self::$siteContent);
|
||||
$this->setPage($key, $value, $path);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -105,6 +105,10 @@ class course extends common
|
||||
|
||||
// Créer la structure de données
|
||||
mkdir(self::DATA_DIR . $courseId);
|
||||
$this->initDB('page', $courseId);
|
||||
$this->initDB('module', $courseId);
|
||||
$this->initData('page', $courseId);
|
||||
$this->initData('module', $courseId);
|
||||
|
||||
// BDD des inscrits
|
||||
$this->setData([
|
||||
|
Loading…
Reference in New Issue
Block a user