fixed template copy
This commit is contained in:
parent
71f4307745
commit
936fb60b42
|
@ -345,14 +345,17 @@ function installPDFTemplates() {
|
|||
$entry = $templateDir->read();
|
||||
}
|
||||
}
|
||||
$basePath = dirname(__FILE__) . '/../config/pdf/' . $_SESSION['config']->getName() . '/';
|
||||
$basePath = dirname(__FILE__) . '/../config/pdf/' . $_SESSION['config']->getName();
|
||||
if (!file_exists($basePath)) {
|
||||
mkdir($basePath);
|
||||
}
|
||||
$typeManager = new \LAM\TYPES\TypeManager();
|
||||
foreach ($typeManager->getConfiguredTypes() as $type) {
|
||||
if (empty($allTemplates[$type->getScope()])) {
|
||||
continue;
|
||||
}
|
||||
foreach ($allTemplates[$type->getScope()] as $templateName) {
|
||||
$path = $basePath . $templateName . '.' . $type->getId() . '.xml';
|
||||
$path = $basePath . '/' . $templateName . '.' . $type->getId() . '.xml';
|
||||
if (!is_file($path)) {
|
||||
$template = $templatePath . '/' . $templateName . '.' . $type->getScope() . '.xml';
|
||||
logNewMessage(LOG_DEBUG, 'Copy template ' . $template . ' to ' . $path);
|
||||
|
@ -360,6 +363,23 @@ function installPDFTemplates() {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (!file_exists($basePath . '/logos')) {
|
||||
mkdir($basePath . '/logos');
|
||||
}
|
||||
$templatePath = dirname(__FILE__) . '/../config/templates/pdf/logos';
|
||||
$templateDir = @dir($templatePath);
|
||||
if ($templateDir) {
|
||||
$entry = $templateDir->read();
|
||||
while ($entry){
|
||||
$path = $basePath . '/logos/' . $entry;
|
||||
if ((strpos($entry, '.') !== 1) && !is_file($path)) {
|
||||
$template = $templatePath . '/' . $entry;
|
||||
logNewMessage(LOG_DEBUG, 'Copy template ' . $template . ' to ' . $path);
|
||||
@copy($template, $path);
|
||||
}
|
||||
$entry = $templateDir->read();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -5,7 +5,7 @@ use \LAMException;
|
|||
$Id$
|
||||
|
||||
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
|
||||
Copyright (C) 2003 - 2016 Roland Gruber
|
||||
Copyright (C) 2003 - 2017 Roland Gruber
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -251,14 +251,17 @@ function installProfileTemplates() {
|
|||
$entry = $templateDir->read();
|
||||
}
|
||||
}
|
||||
$basePath = dirname(__FILE__) . '/../config/profiles/' . $_SESSION['config']->getName() . '/';
|
||||
$basePath = dirname(__FILE__) . '/../config/profiles/' . $_SESSION['config']->getName();
|
||||
if (!file_exists($basePath)) {
|
||||
mkdir($basePath);
|
||||
}
|
||||
$typeManager = new \LAM\TYPES\TypeManager();
|
||||
foreach ($typeManager->getConfiguredTypes() as $type) {
|
||||
if (empty($allTemplates[$type->getScope()])) {
|
||||
continue;
|
||||
}
|
||||
foreach ($allTemplates[$type->getScope()] as $templateName) {
|
||||
$path = $basePath . $templateName . '.' . $type->getId();
|
||||
$path = $basePath . '/' . $templateName . '.' . $type->getId();
|
||||
if (!is_file($path)) {
|
||||
$template = $templatePath . '/' . $templateName . '.' . $type->getScope();
|
||||
logNewMessage(LOG_DEBUG, 'Copy template ' . $template . ' to ' . $path);
|
||||
|
|
Loading…
Reference in New Issue