2016-08-30 18:10:44 +02:00
|
|
|
<?php
|
|
|
|
class AdminGuide extends AdminTab
|
|
|
|
{
|
|
|
|
public function display()
|
|
|
|
{
|
2016-08-31 17:05:56 +02:00
|
|
|
global $smarty;
|
|
|
|
|
|
|
|
if(Configuration::get('PS_REWRITING_SETTINGS')) {
|
|
|
|
|
|
|
|
$module_name = Module::getModuleNameFromClass('AdminGuide');
|
|
|
|
|
|
|
|
$langs = Language::getLanguages(true);
|
|
|
|
|
|
|
|
$urls_i18n = array(
|
|
|
|
'fr' => 'guide',
|
|
|
|
'en' => 'guide',
|
|
|
|
);
|
|
|
|
|
|
|
|
$str_rewrite_rules = 'RewriteRule ^%s/([0-9]+)\-[a-zA-Z0-9-]*$ '.__PS_BASE_URI__.'modules/'.$module_name.'/page.php?id_guide_post=$1 [QSA,L]'."\n";
|
|
|
|
|
|
|
|
|
|
|
|
if(count($langs) > 1) {
|
|
|
|
$rewrite_rules = '';
|
|
|
|
foreach($langs as $lang) {
|
|
|
|
if(isset($urls_i18n[$lang['iso_code']])) {
|
|
|
|
$index = $lang['iso_code'];
|
|
|
|
} else {
|
|
|
|
$index = 'en';
|
|
|
|
}
|
|
|
|
$rewrite_rules .= sprintf($str_rewrite_rules, $lang['iso_code'].'/'.$urls_i18n[$index]);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if(isset($urls_i18n[$langs[0]['iso_code']])) {
|
|
|
|
$index = $langs[0]['iso_code'];
|
|
|
|
} else {
|
|
|
|
$index = 'en';
|
|
|
|
}
|
|
|
|
$rewrite_rules = sprintf($str_rewrite_rules, $urls_i18n[$index]);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$smarty->assign('rewrite_rules', htmlentities($rewrite_rules));
|
|
|
|
|
|
|
|
echo $smarty->fetch(__DIR__.'/templates/home_adminguide.tpl');
|
|
|
|
}
|
2016-08-30 18:10:44 +02:00
|
|
|
}
|
|
|
|
}
|