PHPRtfLite::setProperty PHP Method

setProperty() public method

sets document information properties
public setProperty ( string $name, mixed $value )
$name string Property of document. Possible properties:
'title' => title of the document (value string)
'subject' => subject of the document (value string)
'author' => author of the document (value string)
'manager' => manager of the document (value string)
'company' => company of author (value string)
'operator' => operator of document. Operator is a person who last made changes to the document. (value string)
'category' => category of document (value string)
'keywords' => keywords of document (value string)
'doccomm' => comments of document (value string)
'creatim' => creation time (value int)
'revtim' => last revision time (value int)
'buptim' => last backup time (value int)
'printim' => last print time (value int)
$value mixed Value
    public function setProperty($name, $value)
    {
        switch ($name) {
            case 'creatim':
            case 'revtim':
            case 'buptim':
            case 'printim':
                $year = date('Y', $value);
                $month = date('m', $value);
                $day = date('d', $value);
                $hours = date('H', $value);
                $minutes = date('i', $value);
                $value = '\\yr' . $year . '\\mo' . $month . '\\dy' . $day . '\\hr' . $hours . '\\min' . $minutes;
                break;
            default:
                $value = self::quoteRtfCode($value);
        }
        $this->_properties[$name] = $value;
    }

Usage Example

コード例 #1
0
 /**
  * @covers PHPRtfLite::getProperty
  * @dataProvider provideSetProperty
  */
 public function testSetProperty($name, $timestamp, $expected)
 {
     $this->_rtf->setProperty($name, $timestamp);
     $this->assertEquals($expected, $this->_rtf->getProperty($name));
 }