diff --git a/core/module/translate/translate.php b/core/module/translate/translate.php index 254c6a1..c6058a7 100644 --- a/core/module/translate/translate.php +++ b/core/module/translate/translate.php @@ -96,6 +96,7 @@ class translate extends common { $success = (copy (self::DATA_DIR . $copyFrom . '/page.json', self::DATA_DIR . $toCreate . '/page.json') === true && $success === true) ? true : false; $success = ($this->copyDir (self::DATA_DIR . $copyFrom . '/content', self::DATA_DIR . $toCreate . '/content') === true && $success === true) ? true : false; $success = (copy ('core/module/translate/ressource/comment.json', self::DATA_DIR . $toCreate . '/comment.json') === true && $success === true) ? true : false; + $success = ($this->copyDir (self::DATA_DIR . $copyFrom . '/data_module', self::DATA_DIR . $toCreate . '/data_module') === true && $success === true) ? true : false; // Enregistrer la langue if ($success) { $this->setData(['config', 'i18n', $toCreate, 'site' ]); @@ -146,6 +147,15 @@ class translate extends common { } // Ajout des données dans content $success = (copy (self::DATA_DIR . $copyFrom . '/content/'.$pageId.'.html', self::DATA_DIR . $toCreate . '/content/'.$pageId.'.html') === true && $success === true) ? true : false; + // Ajout des données, externes à module.json, contenues dans data_module/nom_de_la_page.json + if( is_file( self::DATA_DIR . $copyFrom . '/data_module/'.$pageId.'.json' ) ) copy (self::DATA_DIR . $copyFrom . '/data_module/'.$pageId.'.json' , self::DATA_DIR . $toCreate . '/data_module/'.$pageId.'.json' ); + // Cas particuliers d'une page agenda + if( $this->getData(['page', $pageId, 'moduleId']) === 'agenda'){ + if(is_dir( self::DATA_DIR . $copyFrom . '/data_module/'.$pageId )) $this->copyDir(self::DATA_DIR . $copyFrom . '/data_module/'.$pageId, self::DATA_DIR . $toCreate . '/data_module/'.$pageId ); + if(is_dir( self::DATA_DIR . $copyFrom . '/data_module/'.$pageId .'_sauve' )) $this->copyDir(self::DATA_DIR . $copyFrom . '/data_module/'.$pageId .'_sauve', self::DATA_DIR . $toCreate . '/data_module/'.$pageId .'_sauve' ); + if(is_dir( self::DATA_DIR . $copyFrom . '/data_module/'.$pageId .'_affiche')) $this->copyDir(self::DATA_DIR . $copyFrom . '/data_module/'.$pageId .'_affiche', self::DATA_DIR . $toCreate . '/data_module/'.$pageId .'_affiche'); + if(is_dir( self::DATA_DIR . $copyFrom . '/data_module/'.$pageId .'_visible')) $this->copyDir(self::DATA_DIR . $copyFrom . '/data_module/'.$pageId .'_visible', self::DATA_DIR . $toCreate . '/data_module/'.$pageId .'_visible'); + } // Notification du titre court de la page copiée $notification = $this->getData(['page',$pageId,'shortTitle']).$text['core_translate']['copy'][7]. $langTarget; }