Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dolibarr
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Software_Artifact_Infrastructure_Repository
dolibarr
Commits
629ef78d
Commit
629ef78d
authored
12 years ago
by
Florian Henry
Browse files
Options
Downloads
Patches
Plain Diff
Add subtitution inside header and fotter document
parent
2f7be8d2
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
htdocs/core/modules/project/pdf/doc_generic_project_odt.modules.php
+1
-0
1 addition, 0 deletions
...e/modules/project/pdf/doc_generic_project_odt.modules.php
htdocs/includes/odtphp/odf.php
+27
-0
27 additions, 0 deletions
htdocs/includes/odtphp/odf.php
with
28 additions
and
0 deletions
htdocs/core/modules/project/pdf/doc_generic_project_odt.modules.php
+
1
−
0
View file @
629ef78d
...
@@ -511,6 +511,7 @@ class doc_generic_project_odt extends ModelePDFProjects
...
@@ -511,6 +511,7 @@ class doc_generic_project_odt extends ModelePDFProjects
else
// Text
else
// Text
{
{
$odfHandler
->
setVars
(
$key
,
$value
,
true
,
'UTF-8'
);
$odfHandler
->
setVars
(
$key
,
$value
,
true
,
'UTF-8'
);
$odfHandler
->
setVarsHeadFooter
(
$key
,
$value
,
true
,
'UTF-8'
);
}
}
}
}
catch
(
OdfException
$e
)
catch
(
OdfException
$e
)
...
...
This diff is collapsed.
Click to expand it.
htdocs/includes/odtphp/odf.php
+
27
−
0
View file @
629ef78d
...
@@ -128,6 +128,33 @@ class Odf
...
@@ -128,6 +128,33 @@ class Odf
return
$this
;
return
$this
;
}
}
/**
* Assing a template variable
*
* @param string $key name of the variable within the template
* @param string $value replacement value
* @param bool $encode if true, special XML characters are encoded
* @throws OdfException
* @return odf
*/
public
function
setVarsHeadFooter
(
$key
,
$value
,
$encode
=
true
,
$charset
=
'ISO-8859'
)
{
$tag
=
$this
->
config
[
'DELIMITER_LEFT'
]
.
$key
.
$this
->
config
[
'DELIMITER_RIGHT'
];
// TODO Warning string may be:
// <text:span text:style-name="T13">{</text:span><text:span text:style-name="T12">aaa</text:span><text:span text:style-name="T13">}</text:span>
// instead of {aaa} so we should enhance this function.
//print $key.'-'.$value.'-'.strpos($this->contentXml, $this->config['DELIMITER_LEFT'] . $key . $this->config['DELIMITER_RIGHT']).'<br>';
if
(
strpos
(
$this
->
stylesXml
,
$tag
)
===
false
&&
strpos
(
$this
->
stylesXml
,
$tag
)
===
false
)
{
//if (strpos($this->contentXml, '">'. $key . '</text;span>') === false) {
throw
new
OdfException
(
"var
$key
not found in the document"
);
//}
}
$value
=
$encode
?
htmlspecialchars
(
$value
)
:
$value
;
$value
=
(
$charset
==
'ISO-8859'
)
?
utf8_encode
(
$value
)
:
$value
;
$this
->
vars
[
$tag
]
=
str_replace
(
"
\n
"
,
"<text:line-break/>"
,
$value
);
return
$this
;
}
/**
/**
* Evaluating php codes inside the ODT and output the buffer (print, echo) inplace of the code
* Evaluating php codes inside the ODT and output the buffer (print, echo) inplace of the code
*
*
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment