creates formatted output for calendar component property related-to

@author Kjell-Inge Gustafsson <ical@kigkonsult.se>
@since 2.3.2 - 2007-11-25
@return string
320885
function createRelatedTo() {
    $cnt = count( $this->relatedto );
    if( 0 >= $cnt )
      return;
    $output = null;
    foreach( $this->relatedto as $relation ) {
      $attributes = $this->_createParams( $relation['params'] );
      $content    = '<'.$this->_strrep( $relation['value'] ).'>';
      $output    .= $this->_createElement( 'RELATED-TO', $attributes, $content );
    }
    return $output;
  }
626036
protected function formatGedcomMonth(): string
    {
        // Our simple lookup table doesn't work correctly for Adar on leap years
        if ($this->month === 7 && $this->calendar instanceof JewishCalendar && !$this->calendar->isLeapYear($this->year)) {
            return 'ADR';
        }

        return array_search($this->month, static::MONTH_ABBREVIATIONS, true);
    }
153883
function createAttach() {
    $cnt = count( $this->attach );
    if( 0 >= $cnt )
      return;
    $output    = null;
    foreach( $this->attach as $attachPart ) {
      $attributes = $this->_createParams( $attachPart['params'] );
      $output    .= $this->_createElement( 'ATTACH', $attributes, $attachPart['value'] );
    }
    return $output;
  }
455626
public function xmlOutput() {
        $o = '';
        $o.= '    <TABLE NAME="' . $this->name . '"';
        if ($this->comment) {
            $o.= ' COMMENT="' . htmlspecialchars($this->comment) . '"';
        }
        $o.= '>' . "\n";
        // Now the fields
        if ($this->fields) {
            $o.= '      <FIELDS>' . "\n";
            foreach ($this->fields as $field) {
                $o.= $field->xmlOutput();
            }
            $o.= '      </FIELDS>' . "\n";
        }
        // Now the keys
        if ($this->keys) {
            $o.= '      <KEYS>' . "\n";
            foreach ($this->keys as $key) {
                $o.= $key->xmlOutput();
            }
            $o.= '      </KEYS>' . "\n";
        }
        // Now the indexes
        if ($this->indexes) {
            $o.= '      <INDEXES>' . "\n";
            foreach ($this->indexes as $index) {
                $o.= $index->xmlOutput();
            }
            $o.= '      </INDEXES>' . "\n";
        }
        $o.= '    </TABLE>' . "\n";

        return $o;
    }
1224156
public function getDisplayString()
    {
        $results[] = $this->getAdmissionTime()->toString($this->agenda->appointmentDisplayFormat);
        $results[] = $this->getActivityDescription();
        $results[] = $this->getProcedureDescription();
        $results[] = $this->getLocationDescription();
        $results[] = $this->getSubject();

        return implode($this->_('; '), array_filter($results));
    }
224089
public function toString()
    {
        if ($this->isEmpty()) {
            return '';
        }

        $tabulationFormatted = $this->getTabulationFormatted();

        $string = '{' . PHP_EOL;
        $string .= $this->toStringMethods();
        $string .= $tabulationFormatted . '}';
        return $string . PHP_EOL;
    }
161413
public function getContent()
    {
        ksort($this->relations);

        $relations = '';

        foreach ($this->relations as $name => $relation) {
            $relations .= $relation->getContent();
        }

        return strtr($this->getStubContent('relations'), [
            '{{namespace}}' => $this->namespace,
            '{{name}}'      => $this->name,
            '{{relations}}' => $relations,
        ]);
    }
1229376
function _createFormat() {
    $objectname                   = null;
    switch( $this->format ) {
      case 'xcal':
        $objectname               = ( isset( $this->timezonetype )) ?
                                 strtolower( $this->timezonetype )  :  strtolower( $this->objName );
        $this->componentStart1    = $this->elementStart1 = '<';
        $this->componentStart2    = $this->elementStart2 = '>';
        $this->componentEnd1      = $this->elementEnd1   = '</';
        $this->componentEnd2      = $this->elementEnd2   = '>'.$this->nl;
        $this->intAttrDelimiter   = '<!-- -->';
        $this->attributeDelimiter = $this->nl;
        $this->valueInit          = null;
        break;
      default:
        $objectname               = ( isset( $this->timezonetype )) ?
                                 strtoupper( $this->timezonetype )  :  strtoupper( $this->objName );
        $this->componentStart1    = 'BEGIN:';
        $this->componentStart2    = null;
        $this->componentEnd1      = 'END:';
        $this->componentEnd2      = $this->nl;
        $this->elementStart1      = null;
        $this->elementStart2      = null;
        $this->elementEnd1        = null;
        $this->elementEnd2        = $this->nl;
        $this->intAttrDelimiter   = '<!-- -->';
        $this->attributeDelimiter = ';';
        $this->valueInit          = ':';
        break;
    }
    return $objectname;
  }
102636
public function getDateFormat()
    {
        $formatter = new IntlDateFormatter(
            $this->getLocale(),
            IntlDateFormatter::MEDIUM,
            IntlDateFormatter::NONE
        );
        $format = $formatter->getPattern();

        $this->extend('updateDateFormat', $format);

        return $format;
    }
1084956
function calendarComponent() {
    $this->objName         = ( isset( $this->timezonetype )) ?
                          strtolower( $this->timezonetype )  :  get_class ( $this );
    $this->uid             = array();
    $this->dtstamp         = array();

    $this->action          = array();
    $this->attach          = array();
    $this->attendee        = array();
    $this->categories      = array();
    $this->class           = array();
    $this->comment         = array();
    $this->completed       = array();
    $this->contact         = array();
    $this->created         = array();
    $this->description     = array();
    $this->dtend           = array();
    $this->dtstart         = array();
    $this->due             = array();
    $this->duration        = array();
    $this->exdate          = array();
    $this->exrule          = array();
    $this->freebusy        = array();
    $this->geo             = array();
    $this->lastmodified    = array();
    $this->location        = array();
    $this->organizer       = array();
    $this->percentcomplete = array();
    $this->priority        = array();
    $this->rdate           = array();
    $this->recurrenceid    = array();
    $this->relatedto       = array();
    $this->repeat          = array();
    $this->requeststatus   = array();
    $this->resources       = array();
    $this->sequence        = array();
    $this->rrule           = array();
    $this->status          = array();
    $this->summary         = array();
    $this->transp          = array();
    $this->trigger         = array();
    $this->tzid            = array();
    $this->tzname          = array();
    $this->tzoffsetfrom    = array();
    $this->tzoffsetto      = array();
    $this->tzurl           = array();
    $this->url             = array();
    $this->xprop           = array();

    $this->components      = array();

    $this->language        = null;
    $this->nl              = null;
    $this->unique_id       = null;
    $this->allowEmpty      = TRUE;
    $this->xcaldecl        = array();

    $this->_makeDtstamp();
  }
1017180
public function outputElement() : string
    {
        if ('1' == $this->getValue()) {
            $this->setChecked(true);
        } else {
            $this->setChecked(false);
        }
        $attributes = [];
        foreach ($this->attributes as $name => $value) {
            $attributes[$name] = $name . '="' . $value . '"';
        }
        $attributes['value'] = 'value="1"';
        return '<input ' . implode(' ', $attributes) . ' />';
    }
1169898
private function _renderproperties() {
        $out = '';

        $out   .= '<divisions>'.$this->divisions.'</divisions>';
        $staves = 1;

        if (isset($this->key)) {
            $out .= $this->key->toMusicXML();
        }

        if (isset($this->time)) {
            $time = $this->time;
            if (!$time instanceof Time) {
                $time = new Time($time);
            }

            $out .= $this->time->toMusicXML();
        }

        // we count the number of clefs, and that is our number of staves
        $clefs = '';
        if (isset($this->clef)) {
            if (!is_array($this->clef)) {
                $this->clef = array($this->clef);
            }

            $num = 0;
            foreach ($this->clef as $clef) {
                $num++;
                $clefs .= $clef->toMusicXML($num);
            }

            $staves = $num;
        }

        if (isset($this->staves)) {
            $staves = $this->staves;
        }

        // output staves first, and then clefs.
        $out .= '<staves>'.$staves.'</staves>';
        $out .= $clefs;

        return $out;

    }
142209
protected function getInternalFormatter()
    {
        $formatter = $this->getCustomFormatter(DBDate::ISO_LOCALE, DBDatetime::ISO_DATETIME);
        $formatter->setLenient(false);
        return $formatter;
    }
795317
public function generate()
    {
        $code = array();

        if ($this->namespace !== null) {
            $code[] = $this->getIndentation() . 'namespace ' . $this->namespace;
            $code[] = '{';
            $code[] = null;

            // Temporarily add one more level of indentation.
            $this->addIndentationLevel(1);
        }

        $code = array_merge($code, $this->renderUsesLines());

        $indentation = $this->getIndentation();

        $doc = $this->generateDocumentation();
        if ($doc !== null) {
            $code[] = $doc;
        }

        $code[] = $indentation . 'trait ' . $this->name;
        $code[] = $indentation . '{';

        // Class uses.
        $traitElements = $this->generateTraitUsesLines();

        // Class properties.
        $traitElements = array_merge($traitElements, $this->generatePropertiesLines());

        // Class methods.
        $traitElements = array_merge($traitElements, $this->generateMethodsLines());

        if (count($traitElements) > 0) {
            $code[] = null;
            $code = array_merge($code, $traitElements);
            // Remove last empty line.
            array_pop($code);
        }

        $code[] = $indentation . '}';

        if ($this->namespace !== null) {
            // Set back the indentation.
            $this->addIndentationLevel(-1);

            $code[] = $this->getIndentation() . '}';
        }

        return implode($this->getLineFeed(), $code);
    }
1026891
public function formatListDetails(): string
    {
        ob_start();
        FunctionsPrintFacts::printMediaLinks($this->tree(), '1 OBJE @' . $this->xref() . '@', 1);

        return ob_get_clean();
    }
1003228
public function getContentType()
    {
        $mime = 'text/calendar; charset=utf-8';
        if (isset($this->objectData['component']) && $this->objectData['component']) {
            $mime .= '; component='.$this->objectData['component'];
        }

        return $mime;
    }
989584
function createSubComponent() {
    $output = null;
    foreach( $this->components as $component ) {
      if( '' >= $component->getConfig( 'language'))
        $component->setConfig( 'language',  $this->getConfig( 'language' ));
      $component->setConfig( 'allowEmpty',  $this->getConfig( 'allowEmpty' ));
      $component->setConfig( 'nl',          $this->getConfig( 'nl' ));
      $component->setConfig( 'unique_id',   $this->getConfig( 'unique_id' ));
      $component->setConfig( 'format',      $this->getConfig( 'format' ));
      $output .= $component->createComponent( $this->xcaldecl );
    }
    return $output;
  }