creates formatted output for calendar component property repeat

@author Kjell-Inge Gustafsson <ical@kigkonsult.se>
@since 0.9.7 - 2006-11-20
@return string
494484
function createRepeat() {
    $cnt = count( $this->repeat );
    if( 0 >= $cnt )
      return;
    $attributes = $this->_createParams( $this->repeat['params'] );
    return $this->_createElement( 'REPEAT', $attributes, $this->repeat['value'] );
  }
129602
public function getFormattedDateRangeDate() {

    // Load session instance date range date values.
    $timestamp = $this->get('timestamp')->value;
    $year_start = date('Y', $timestamp);
    $month_day_start = date('M j', $timestamp);
    $timestamp_to = $this->get('timestamp_to')->value;
    $year_to = date('Y', $timestamp_to);
    $month_day_to = date('M j', $timestamp_to);

    // Format date range to eliminate repeated values.
    if ($year_start == $year_to) {
      if (date('M', $timestamp) == date('M', $timestamp_to)) {
        if ($month_day_start == $month_day_to) {
          // M j, Y.
          $formatted_date = "$month_day_start, $year_start";
        }
        else {
          // M j - j, Y.
          $day_to = date('j', $timestamp_to);
          $formatted_date =  "$month_day_start - $day_to, $year_start";
        }
      }
      else {
        // M j - M j, Y.
        $formatted_date =  "$month_day_start - $month_day_to, $year_start";
      }
    }
    else {
      // M j, Y - M j, Y.
      $formatted_date = $month_day_start . ", $year_start - " . $month_day_to . ", $year_to";
    }

    return $formatted_date;
  }
97402
public function format() {

        /*         * Add the mandatary props* */
        if (!is_null($this->locale)) {
            $result[self::LOCALE_KEY] = $this->locale;
        }

        if (!is_null($this->sender)) {
            $result[self::SENDER_KEY] = $this->sender;
        }

        if (!is_null($this->senderEmail)) {
            $result[self::SENDEREMAIL_KEY] = $this->senderEmail;
        }
        if (!is_null($this->subject)) {
            $result[self::SUBJECT_KEY] = $this->subject;
        }
        if (!is_null($this->contactsListID)) {
            $result[self::CONTACTLISTID_KEY] = $this->contactsListID;
        }
        /*         * Add the optional props if any* */
        if (!is_null($this->optionalProperties)) {
            $result = array_merge($result, $this->optionalProperties);
        }


        return $result;
    }
1160658
public function xmlOutput() {
        $o = '';
        $o.= '        <FIELD NAME="' . $this->name . '"';
        $o.= ' TYPE="' . $this->getXMLDBTypeName($this->type) . '"';
        if ($this->length) {
            $o.= ' LENGTH="' . $this->length . '"';
        }
        if ($this->notnull) {
            $notnull = 'true';
        } else {
            $notnull = 'false';
        }
        $o.= ' NOTNULL="' . $notnull . '"';
        if (!$this->sequence && $this->default !== null) {
            $o.= ' DEFAULT="' . $this->default . '"';
        }
        if ($this->sequence) {
            $sequence = 'true';
        } else {
            $sequence = 'false';
        }
        $o.= ' SEQUENCE="' . $sequence . '"';
        if ($this->decimals !== null) {
            $o.= ' DECIMALS="' . $this->decimals . '"';
        }
        if ($this->comment) {
            $o.= ' COMMENT="' . htmlspecialchars($this->comment) . '"';
        }
        $o.= '/>' . "\n";

        return $o;
    }
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;
    }
580662
public function getOutput() {
    	$this->lines = array();
    
		$this->addLine('BEGIN:VCALENDAR');
		$this->addLine('VERSION:2.0');
    	
		if( is_null($this->prodid) ) {
			$this->addLine("PRODID:" . '-//'.$this->host.'//NONSGML v1.0//EN');
		} 
		elseif( !is_null($this->prodid) ) {
			$this->addLine("PRODID:" . $this->prodid);
		}
		
    	$upcomingEvents = $this->calendar->UpcomingEvents($this->limit); /* @var $upcomingEvents DataObjectSet */
    	foreach($upcomingEvents as $dateTime) { /* @var $event CalendarDateTime */
    		$this->addDateTime($dateTime);
    	}
    	
		$this->addLine('END:VCALENDAR');
		
		return implode("\r\n", $this->lines);
    }
76439
public function format()
    {
        if ($this->groupEvent) {
            // ugly fix for misunderstanding of this...
            $this->version = 2;
        }

        $result = [
            'Url' => $this->url,
            'EventType' => $this->eventType,
            'IsBackup'  => $this->isBackup,
            'Status'    => $this->status,
            'Version'   => $this->version
        ];

        if($this->apikeyId){
            $result['APIKeyID'] = $this->apikeyId;
        }

        return $result;
    }
631881
protected static function _calendartranslation()
	{
		static $jsscript = 0;

		if ($jsscript == 0)
		{
			$return = 'Calendar._DN = new Array ("' . Lang::txt('SUNDAY', true) . '", "' . Lang::txt('MONDAY', true) . '", "'
				. Lang::txt('TUESDAY', true) . '", "' . Lang::txt('WEDNESDAY', true) . '", "' . Lang::txt('THURSDAY', true) . '", "'
				. Lang::txt('FRIDAY', true) . '", "' . Lang::txt('SATURDAY', true) . '", "' . Lang::txt('SUNDAY', true) . '");'
				. ' Calendar._SDN = new Array ("' . Lang::txt('SUN', true) . '", "' . Lang::txt('MON', true) . '", "' . Lang::txt('TUE', true) . '", "'
				. Lang::txt('WED', true) . '", "' . Lang::txt('THU', true) . '", "' . Lang::txt('FRI', true) . '", "' . Lang::txt('SAT', true) . '", "'
				. Lang::txt('SUN', true) . '");' . ' Calendar._FD = 0;' . ' Calendar._MN = new Array ("' . Lang::txt('JANUARY', true) . '", "'
				. Lang::txt('FEBRUARY', true) . '", "' . Lang::txt('MARCH', true) . '", "' . Lang::txt('APRIL', true) . '", "' . Lang::txt('MAY', true)
				. '", "' . Lang::txt('JUNE', true) . '", "' . Lang::txt('JULY', true) . '", "' . Lang::txt('AUGUST', true) . '", "'
				. Lang::txt('SEPTEMBER', true) . '", "' . Lang::txt('OCTOBER', true) . '", "' . Lang::txt('NOVEMBER', true) . '", "'
				. Lang::txt('DECEMBER', true) . '");' . ' Calendar._SMN = new Array ("' . Lang::txt('JANUARY_SHORT', true) . '", "'
				. Lang::txt('FEBRUARY_SHORT', true) . '", "' . Lang::txt('MARCH_SHORT', true) . '", "' . Lang::txt('APRIL_SHORT', true) . '", "'
				. Lang::txt('MAY_SHORT', true) . '", "' . Lang::txt('JUNE_SHORT', true) . '", "' . Lang::txt('JULY_SHORT', true) . '", "'
				. Lang::txt('AUGUST_SHORT', true) . '", "' . Lang::txt('SEPTEMBER_SHORT', true) . '", "' . Lang::txt('OCTOBER_SHORT', true) . '", "'
				. Lang::txt('NOVEMBER_SHORT', true) . '", "' . Lang::txt('DECEMBER_SHORT', true) . '");'
				. ' Calendar._TT = {};Calendar._TT["INFO"] = "' . Lang::txt('JLIB_HTML_BEHAVIOR_ABOUT_THE_CALENDAR', true) . '";'
				. ' Calendar._TT["ABOUT"] =
 "DHTML Date/Time Selector\n" +
 "(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" +
"For latest version visit: http://www.dynarch.com/projects/calendar/\n" +
"Distributed under GNU LGPL.  See http://gnu.org/licenses/lgpl.html for details." +
"\n\n" +
"' . Lang::txt('JLIB_HTML_BEHAVIOR_DATE_SELECTION', false, false) . '" +
"' . Lang::txt('JLIB_HTML_BEHAVIOR_YEAR_SELECT', false, false) . '" +
"' . Lang::txt('JLIB_HTML_BEHAVIOR_MONTH_SELECT', false, false) . '" +
"' . Lang::txt('JLIB_HTML_BEHAVIOR_HOLD_MOUSE', false, false)
				. '";
Calendar._TT["ABOUT_TIME"] = "\n\n" +
"Time selection:\n" +
"- Click on any of the time parts to increase it\n" +
"- or Shift-click to decrease it\n" +
"- or click and drag for faster selection.";

		Calendar._TT["PREV_YEAR"] = "' . Lang::txt('JLIB_HTML_BEHAVIOR_PREV_YEAR_HOLD_FOR_MENU', true) . '";' . ' Calendar._TT["PREV_MONTH"] = "'
				. Lang::txt('JLIB_HTML_BEHAVIOR_PREV_MONTH_HOLD_FOR_MENU', true) . '";' . ' Calendar._TT["GO_TODAY"] = "'
				. Lang::txt('JLIB_HTML_BEHAVIOR_GO_TODAY', true) . '";' . ' Calendar._TT["NEXT_MONTH"] = "'
				. Lang::txt('JLIB_HTML_BEHAVIOR_NEXT_MONTH_HOLD_FOR_MENU', true) . '";' . ' Calendar._TT["NEXT_YEAR"] = "'
				. Lang::txt('JLIB_HTML_BEHAVIOR_NEXT_YEAR_HOLD_FOR_MENU', true) . '";' . ' Calendar._TT["SEL_DATE"] = "'
				. Lang::txt('JLIB_HTML_BEHAVIOR_SELECT_DATE', true) . '";' . ' Calendar._TT["DRAG_TO_MOVE"] = "'
				. Lang::txt('JLIB_HTML_BEHAVIOR_DRAG_TO_MOVE', true) . '";' . ' Calendar._TT["PART_TODAY"] = "'
				. Lang::txt('JLIB_HTML_BEHAVIOR_TODAY', true) . '";' . ' Calendar._TT["DAY_FIRST"] = "'
				. Lang::txt('JLIB_HTML_BEHAVIOR_DISPLAY_S_FIRST', true) . '";' . ' Calendar._TT["WEEKEND"] = "0,6";' . ' Calendar._TT["CLOSE"] = "'
				. Lang::txt('JLIB_HTML_BEHAVIOR_CLOSE', true) . '";' . ' Calendar._TT["TODAY"] = "' . Lang::txt('JLIB_HTML_BEHAVIOR_TODAY', true)
				. '";' . ' Calendar._TT["TIME_PART"] = "' . Lang::txt('JLIB_HTML_BEHAVIOR_SHIFT_CLICK_OR_DRAG_TO_CHANGE_VALUE', true) . '";'
				. ' Calendar._TT["DEF_DATE_FORMAT"] = "%Y-%m-%d";' . ' Calendar._TT["TT_DATE_FORMAT"] = "'
				. Lang::txt('JLIB_HTML_BEHAVIOR_TT_DATE_FORMAT', true) . '";' . ' Calendar._TT["WK"] = "' . Lang::txt('JLIB_HTML_BEHAVIOR_WK', true) . '";'
				. ' Calendar._TT["TIME"] = "' . Lang::txt('JLIB_HTML_BEHAVIOR_TIME', true) . '";';
			$jsscript = 1;
			return $return;
		}
		else
		{
			return false;
		}
	}
1272441
public function jsRender()
    {
        $pre = '';

        if ($this->preventDefault) {
            $this->fx_args = ['event'];
            $pre .= "\n".$this->indent.'  event.preventDefault();';
        }

        if ($this->stopPropagation) {
            $this->fx_args = ['event'];
            $pre .= "\n".$this->indent.'  event.stopPropagation();';
        }

        $output = 'function('.implode(',', $this->fx_args).') {';
        $output .= $pre;
        foreach ($this->fx_statements as $statement) {
            if (!$statement) {
                // null passed
                continue;
            }

            if ($statement instanceof jsChain && !$statement->_chain) {
                // chain contains no statements, so probably is useless
                continue;
            }

            if ($statement instanceof jsExpressionable) {
                $statement = $statement->jsRender();
            } else {
                throw new Exception(['Incorrect statement for jsFunction.', 'statement' => $statement]);
            }

            $output .= "\n".$this->indent.'  '.$statement.';';
        }

        $output .= "\n".$this->indent.'}';

        return $output;
    }
1094288
function createSequence() {
    $cnt = count( $this->sequence );
    if( 0 >= $cnt )
      return;
    $attributes = $this->_createParams( $this->sequence['params'] );
    return $this->_createElement( 'SEQUENCE', $attributes, $this->sequence['value'] );
  }
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;
  }
1091193
protected function getInternalFormatter()
    {
        $formatter = $this->getCustomFormatter(DBDate::ISO_LOCALE, DBDate::ISO_DATE);
        $formatter->setLenient(false);
        return $formatter;
    }
681968
public function getFormatter()
    {
        if ($this->formatter !== null) {
            return $this->formatter;
        }

        if (class_exists('PHPUnit_Runner_Version', false)) {
            if ($this->type === "summary") {
                $this->formatter = new SummaryPHPUnitResultFormatter5($this->parent);
            } elseif ($this->type === "clover") {
                $this->formatter = new CloverPHPUnitResultFormatter5($this->parent);
            } elseif ($this->type === "xml") {
                $this->formatter = new XMLPHPUnitResultFormatter5($this->parent);
            } elseif ($this->type === "plain") {
                $this->formatter = new PlainPHPUnitResultFormatter5($this->parent);
            } elseif ($this->type === "crap4j") {
                $this->formatter = new Crap4JPHPUnitResultFormatter5($this->parent);
            } else {
                throw new BuildException("Formatter '" . $this->type . "' not implemented");
            }
        } elseif (\version_compare('6', \PHPUnit\Runner\Version::id(), '>=')
            && \version_compare('7', \PHPUnit\Runner\Version::id(), '<')
        ) {
            if ($this->type === "summary") {
                $this->formatter = new SummaryPHPUnitResultFormatter6($this->parent);
            } elseif ($this->type === "clover") {
                $this->formatter = new CloverPHPUnitResultFormatter6($this->parent);
            } elseif ($this->type === "xml") {
                $this->formatter = new XMLPHPUnitResultFormatter6($this->parent);
            } elseif ($this->type === "plain") {
                $this->formatter = new PlainPHPUnitResultFormatter6($this->parent);
            } elseif ($this->type === "crap4j") {
                $this->formatter = new Crap4JPHPUnitResultFormatter6($this->parent);
            } else {
                throw new BuildException("Formatter '" . $this->type . "' not implemented");
            }
        } else {
            if ($this->type === "summary") {
                $this->formatter = new SummaryPHPUnitResultFormatter7($this->parent);
            } elseif ($this->type === "clover") {
                $this->formatter = new CloverPHPUnitResultFormatter7($this->parent);
            } elseif ($this->type === "xml") {
                $this->formatter = new XMLPHPUnitResultFormatter7($this->parent);
            } elseif ($this->type === "plain") {
                $this->formatter = new PlainPHPUnitResultFormatter7($this->parent);
            } elseif ($this->type === "crap4j") {
                $this->formatter = new Crap4JPHPUnitResultFormatter7($this->parent);
            } else {
                throw new BuildException("Formatter '" . $this->type . "' not implemented");
            }
        }

        return $this->formatter;
    }
820507
public function scheduled_at_formatted()
    {
        return ucfirst($this->dates->make($this->wrappedObject->scheduled_at)->format($this->incidentDateFormat()));
    }
522842
private function repeatTagEndHandler(): void
    {
        $this->process_repeats--;
        if ($this->process_repeats > 0) {
            return;
        }

        // Check if there is anything to repeat
        if (count($this->repeats) > 0) {
            // No need to load them if not used...

            $lineoffset = 0;
            foreach ($this->repeats_stack as $rep) {
                $lineoffset += $rep[1];
            }
            //-- read the xml from the file
            $lines = file($this->report);
            while (strpos($lines[$lineoffset + $this->repeat_bytes], '<RepeatTag') === false) {
                $lineoffset--;
            }
            $lineoffset++;
            $reportxml = "<tempdoc>\n";
            $line_nr   = $lineoffset + $this->repeat_bytes;
            // RepeatTag Level counter
            $count = 1;
            while (0 < $count) {
                if (strstr($lines[$line_nr], '<RepeatTag') !== false) {
                    $count++;
                } elseif (strstr($lines[$line_nr], '</RepeatTag') !== false) {
                    $count--;
                }
                if (0 < $count) {
                    $reportxml .= $lines[$line_nr];
                }
                $line_nr++;
            }
            // No need to drag this
            unset($lines);
            $reportxml .= "</tempdoc>\n";
            // Save original values
            $this->parser_stack[] = $this->parser;
            $oldgedrec            = $this->gedrec;
            foreach ($this->repeats as $gedrec) {
                $this->gedrec  = $gedrec;
                $repeat_parser = xml_parser_create();
                $this->parser  = $repeat_parser;
                xml_parser_set_option($repeat_parser, XML_OPTION_CASE_FOLDING, false);

                xml_set_element_handler(
                    $repeat_parser,
                    function ($parser, string $name, array $attrs): void {
                        $this->startElement($parser, $name, $attrs);
                    },
                    function ($parser, string $name): void {
                        $this->endElement($parser, $name);
                    }
                );

                xml_set_character_data_handler(
                    $repeat_parser,
                    function ($parser, string $data): void {
                        $this->characterData($parser, $data);
                    }
                );

                if (!xml_parse($repeat_parser, $reportxml, true)) {
                    throw new DomainException(sprintf(
                        'RepeatTagEHandler XML error: %s at line %d',
                        xml_error_string(xml_get_error_code($repeat_parser)),
                        xml_get_current_line_number($repeat_parser)
                    ));
                }
                xml_parser_free($repeat_parser);
            }
            // Restore original values
            $this->gedrec = $oldgedrec;
            $this->parser = array_pop($this->parser_stack);
        }
        [$this->repeats, $this->repeat_bytes] = array_pop($this->repeats_stack);
    }
47998
public function renderCreateColumns()
    {
        $columns = $this->getTableColumns();

        if (!$columns) {
            return '';
        }

        $source = '';

        foreach ($columns as $column) {
            $attributes = [$this->serializeArrayToAttributes($column->getName())];
            $type       = $column->getType()->getName();

            switch ($type) {
                case Type::INTEGER:
                    $method = 'integer';
                    break;
                case Type::SMALLINT:
                    $method = 'smallInteger';
                    break;
                case Type::BIGINT:
                    $method = 'bigInteger';
                    break;
                case Type::STRING:
                    $attributes[] = $column->getLength();
                    $method       = 'string';
                    break;
                case Type::GUID:
                case Type::TEXT:
                    $method = 'text';
                    break;
                case Type::FLOAT:
                    $method = 'float';
                    break;
                case Type::DECIMAL:
                    $attributes[] = $column->getPrecision();
                    $attributes[] = $column->getScale();
                    $method       = 'decimal';
                    break;
                case Type::BOOLEAN:
                    $method = 'boolean';
                    break;
                case Type::DATETIME:
                case Type::DATETIMETZ:
                    $method = 'dateTime';
                    break;
                case Type::DATE:
                    $method = 'date';
                    break;
                case Type::TIME:
                    $method = 'time';
                    break;
                case Type::BINARY:
                case Type::BLOB:
                    $method = 'binary';
                    break;
                case Type::JSON_ARRAY:
                    $method = 'json';
                    break;
                default:
                    throw new DbExporterException('Not supported database column type' . $type);
                    break;
            }

            $source .= '$table->' . $method . '(' . implode(', ', $attributes) . ')';
            if ($column->getUnsigned()) {
                $source .= "\n" . '      ->unsigned()';
            }
            if (!$column->getNotnull()) {
                $source .= "\n" . '      ->nullable()';
            }
            if ($column->getDefault() || $column->getDefault() === null && !$column->getNotnull()) {
                $source .= "\n" . '      ->default(' . var_export($column->getDefault(), true) . ')';
            }
            $source .= ';' . "\n";
        }

        return trim($source);
    }
676980
public function toString()
    {
        $translator = call_user_func([$this->dateClass, 'getTranslator']);

        $parts = [];

        $format = !$this->startDate->isStartOfDay() || $this->endDate && !$this->endDate->isStartOfDay()
            ? 'Y-m-d H:i:s'
            : 'Y-m-d';

        if ($this->recurrences !== null) {
            $parts[] = $this->translate('period_recurrences', [], $this->recurrences, $translator);
        }

        $parts[] = $this->translate('period_interval', [':interval' => $this->dateInterval->forHumans([
            'join' => true,
        ])], null, $translator);

        $parts[] = $this->translate('period_start_date', [':date' => $this->startDate->rawFormat($format)], null, $translator);

        if ($this->endDate !== null) {
            $parts[] = $this->translate('period_end_date', [':date' => $this->endDate->rawFormat($format)], null, $translator);
        }

        $result = implode(' ', $parts);

        return mb_strtoupper(mb_substr($result, 0, 1)).mb_substr($result, 1);
    }