| 1234567891011121314151617181920212223242526272829303132333435363738 |
- <?php
- require('includes/PhpWord/Autoloader.php');
- \PhpOffice\PhpWord\Autoloader::register();
- class DocumentHandler {
- private $documentId = NULL;
- private $filename = "";
- private $documentDraft = "";
- private $documentHandle = NULL;
- public function __construct($filename, $draft) {
- $this->filename = $filename;
- $this->documentDraft = $draft;
- $this->documentHandle = new \PhpOffice\PhpWord\TemplateProcessor('drafts/' . $this->documentDraft);
- }
- public function getFilename() {
- return $this->filename;
- }
- public function saveFile() {
- $this->documentHandle->saveAs('documents/' . $this->filename);
- }
- public function getVariables() {
- return $this->documentHandle->getVariables();
- }
- public function setVal($key, $val) {
- $this->documentHandle->setValue($key, $val);
- }
- }
- ?>
|