PHPWord/src/PhpWord/Element/Comment.php

123 lines
2.8 KiB
PHP
Raw Normal View History

2017-05-15 22:49:02 +02:00
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.
*
* PHPWord is free software distributed under the terms of the GNU Lesser
* General Public License version 3 as published by the Free Software Foundation.
*
* For the full copyright and license information, please read the LICENSE
* file that was distributed with this source code. For the full list of
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
2017-09-26 22:00:02 +02:00
* @see https://github.com/PHPOffice/PHPWord
2018-03-08 23:52:25 +01:00
* @copyright 2010-2018 PHPWord contributors
2017-05-15 22:49:02 +02:00
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
2017-09-26 17:34:57 +02:00
2017-05-15 22:49:02 +02:00
namespace PhpOffice\PhpWord\Element;
/**
* Comment element
2017-12-13 22:48:58 +01:00
* @see http://datypic.com/sc/ooxml/t-w_CT_Comment.html
2017-05-15 22:49:02 +02:00
*/
class Comment extends TrackChange
{
/**
* Initials
*
* @var string
*/
private $initials;
/**
* The Element where this comment starts
*
2017-05-15 22:49:02 +02:00
* @var AbstractElement
*/
private $startElement;
/**
* The Element where this comment ends
*
2017-05-15 22:49:02 +02:00
* @var AbstractElement
*/
private $endElement;
/**
* Is part of collection
*
* @var bool
*/
protected $collectionRelation = true;
/**
* Create a new Comment Element
*
* @param string $author
* @param null|\DateTime $date
2017-05-15 22:49:02 +02:00
* @param string $initials
*/
public function __construct($author, $date = null, $initials = null)
2017-05-15 22:49:02 +02:00
{
parent::__construct(null, $author, $date);
2017-05-15 22:49:02 +02:00
$this->initials = $initials;
}
/**
* Get Initials
*
* @return string
*/
public function getInitials()
{
return $this->initials;
}
/**
* Sets the element where this comment starts
*
2017-05-15 22:49:02 +02:00
* @param \PhpOffice\PhpWord\Element\AbstractElement $value
*/
public function setStartElement(AbstractElement $value)
{
$this->startElement = $value;
if ($value->getCommentRangeStart() == null) {
$value->setCommentRangeStart($this);
2017-05-15 22:49:02 +02:00
}
}
/**
* Get the element where this comment starts
*
2017-05-15 22:49:02 +02:00
* @return \PhpOffice\PhpWord\Element\AbstractElement
*/
public function getStartElement()
{
return $this->startElement;
}
/**
* Sets the element where this comment ends
*
2017-05-15 22:49:02 +02:00
* @param \PhpOffice\PhpWord\Element\AbstractElement $value
*/
public function setEndElement(AbstractElement $value)
{
$this->endElement = $value;
if ($value->getCommentRangeEnd() == null) {
$value->setCommentRangeEnd($this);
2017-05-15 22:49:02 +02:00
}
}
/**
* Get the element where this comment ends
*
2017-05-15 22:49:02 +02:00
* @return \PhpOffice\PhpWord\Element\AbstractElement
*/
public function getEndElement()
{
return $this->endElement;
}
}