2014-03-07 23:08:09 +01:00
|
|
|
<?php
|
|
|
|
|
/**
|
2014-03-26 16:33:20 +07:00
|
|
|
* PHPWord
|
2014-03-07 23:08:09 +01:00
|
|
|
*
|
2014-03-27 23:55:06 +07:00
|
|
|
* @link https://github.com/PHPOffice/PHPWord
|
|
|
|
|
* @copyright 2014 PHPWord
|
|
|
|
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
2014-03-07 23:08:09 +01:00
|
|
|
*/
|
|
|
|
|
|
2014-03-22 10:06:08 +04:00
|
|
|
namespace PhpOffice\PhpWord\Writer\Word2007;
|
|
|
|
|
|
2014-03-31 01:13:02 +07:00
|
|
|
use PhpOffice\PhpWord\Exception\Exception;
|
2014-03-22 10:06:08 +04:00
|
|
|
use PhpOffice\PhpWord\Shared\XMLWriter;
|
|
|
|
|
|
2014-03-24 00:26:10 +07:00
|
|
|
/**
|
|
|
|
|
* Word2007 footnotes rel part writer
|
|
|
|
|
*/
|
2014-03-30 18:51:25 +07:00
|
|
|
class FootnotesRels extends Base
|
2014-03-11 19:26:56 +07:00
|
|
|
{
|
2014-03-24 00:26:10 +07:00
|
|
|
/**
|
|
|
|
|
* Write word/_rels/footnotes.xml.rels
|
|
|
|
|
*
|
|
|
|
|
* @param mixed $_relsCollection
|
|
|
|
|
*/
|
2014-03-11 19:26:56 +07:00
|
|
|
public function writeFootnotesRels($_relsCollection)
|
|
|
|
|
{
|
|
|
|
|
// Create XML writer
|
2014-03-30 16:31:01 +07:00
|
|
|
$xmlWriter = $this->getXmlWriter();
|
2014-03-07 23:08:09 +01:00
|
|
|
|
2014-03-11 19:26:56 +07:00
|
|
|
// XML header
|
2014-03-22 10:06:08 +04:00
|
|
|
$xmlWriter->startDocument('1.0', 'UTF-8', 'yes');
|
2014-03-07 23:08:09 +01:00
|
|
|
|
2014-03-11 19:26:56 +07:00
|
|
|
// Relationships
|
2014-03-22 10:06:08 +04:00
|
|
|
$xmlWriter->startElement('Relationships');
|
|
|
|
|
$xmlWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/relationships');
|
2014-03-07 23:08:09 +01:00
|
|
|
|
2014-03-11 19:26:56 +07:00
|
|
|
// Relationships to Links
|
|
|
|
|
foreach ($_relsCollection as $relation) {
|
|
|
|
|
$relationType = $relation['type'];
|
|
|
|
|
$relationName = $relation['target'];
|
|
|
|
|
$relationId = $relation['rID'];
|
|
|
|
|
$targetMode = ($relationType == 'hyperlink') ? 'External' : '';
|
2014-03-07 23:08:09 +01:00
|
|
|
|
2014-03-30 18:51:25 +07:00
|
|
|
$this->writeRelationship($xmlWriter, $relationId, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/' . $relationType, $relationName, $targetMode);
|
2014-03-11 19:26:56 +07:00
|
|
|
}
|
2014-03-07 23:08:09 +01:00
|
|
|
|
2014-03-22 10:06:08 +04:00
|
|
|
$xmlWriter->endElement();
|
2014-03-07 23:08:09 +01:00
|
|
|
|
2014-03-11 19:26:56 +07:00
|
|
|
// Return
|
2014-03-22 10:06:08 +04:00
|
|
|
return $xmlWriter->getData();
|
2014-03-11 19:26:56 +07:00
|
|
|
}
|
|
|
|
|
}
|