Render and optionally output a vcal string.
@param bool $output Whether to output the calendar data directly (the default).
@return string The complete rendered vlal
434958
public function render($output = true)
    {
        //Add header
        $ics = 'BEGIN:VCALENDAR
METHOD:PUBLISH
VERSION:2.0
X-WR-CALNAME:' . $this->calendarName . '
PRODID:-//hacksw/handcal//NONSGML v1.0//EN';

        //Add events
        foreach ($this->events as $event) {
            $ics .= '
BEGIN:VEVENT
UID:' . $event['uid'] . '
DTSTAMP:' . gmdate('Ymd') . 'T' . gmdate('His') . 'Z
DTSTART:' . $event['start'] . '
DTEND:' . $event['end'] . '
SUMMARY:' . str_replace("\n", "\\n", $event['summary']) . '
DESCRIPTION:' . str_replace("\n", "\\n", $event['description']) . '
URL;VALUE=URI:' . $event['url'] . '
END:VEVENT';
        }

        //Add footer
        $ics .= '
END:VCALENDAR';

        if ($output) {
            //Output
            $filename = $this->calendarName;
            //Filename needs quoting if it contains spaces
            if (strpos($filename, ' ') !== false) {
                $filename = '"'.$filename.'"';
            }
            header('Content-type: text/calendar; charset=utf-8');
            header('Content-Disposition: inline; filename=' . $filename . '.ics');
            echo $ics;
        }
        return $ics;
    }
1017002
protected function get_other_values(renderer_base $output) {
        $timestamp = $this->calendar->time;

        $cache = $this->related['cache'];
        $url = new moodle_url('/calendar/view.php', [
            'view' => 'upcoming',
            'time' => $timestamp,
            'course' => $this->calendar->course->id,
        ]);
        $this->url = $url;
        $return['isloggedin'] = isloggedin();
        $return['events'] = array_map(function($event) use ($cache, $output, $url) {
            $context = $cache->get_context($event);
            $course = $cache->get_course($event);
            $moduleinstance = $cache->get_module_instance($event);
            $exporter = new calendar_event_exporter($event, [
                'context' => $context,
                'course' => $course,
                'moduleinstance' => $moduleinstance,
                'daylink' => $url,
                'type' => $this->related['type'],
                'today' => $this->calendar->time,
            ]);

            $data = $exporter->export($output);

            // We need to override default formatted time because it differs from day view.
            // Formatted time for upcoming view adds a link to the day view.
            $legacyevent = container::get_event_mapper()->from_event_to_legacy_event($event);
            $data->formattedtime = calendar_format_event_time($legacyevent, time(), null);

            return $data;
        }, $this->related['events']);

        if ($context = $this->get_default_add_context()) {
            $return['defaulteventcontext'] = $context->id;
        }
        $return['filter_selector'] = $this->get_course_filter_selector($output);
        $return['courseid'] = $this->calendar->courseid;

        if ($this->calendar->categoryid) {
            $return['categoryid'] = $this->calendar->categoryid;
        }

        return $return;
    }
847364
public function display ($file, $output = TRUE)
	{

		// If there is no template directory set then try and use default root/templates directory

		if (!$this->templateDir)
		{
			$this->templateDir	= ABS_ROOT . 'templates' . DIRECTORY_SEPARATOR;
		}

		// Load template

		$template	= $this->loadTemplateFile ($file);

		// Replace variables

		if ($this->replaceVars)
		{
			$rendered	= $this->replaceVars ($template);
		} else {
			$rendered	 = $template;
		}

		// Output

		if ($output)
		{
			echo $rendered;
		}

		// Return template

		return $rendered;

	}
444715
protected function injectDebugBar($output)
    {
        if (!($debugBarConfig = Lb::app()->getConfigByName('debugbar'))) {
            return $output;
        }
        if (empty($debugBarConfig['enabled'])) {
            return $output;
        }
        if (empty($debugBarConfig['baseUrl'])) {
            return $output;
        }
        if (empty($debugBarConfig['basePath'])) {
            return $output;
        }

        /**
         * @var StandardDebugBar $debugBar
         */
        $debugBar = DebugBar::getInstance();
        $debugBarRenderer = $debugBar->getJavascriptRenderer($debugBarConfig['baseUrl'], $debugBarConfig['basePath']);
        $debugBarComponent = $debugBarRenderer->renderHead() . $debugBarRenderer->render();
        $replace = <<<EOF
{$debugBarComponent}
</body>
EOF;
        return str_replace('</body>', $replace, $output);
    }
214838
public function export_for_template(renderer_base $output) {
        global $CFG;

        require_once($CFG->libdir . '/externallib.php');

        $syscontext = context_system::instance();

        $context = new stdClass();
        $context->text = external_format_string($this->text, $syscontext->id);
        $context->url = $this->url ? $this->url->out() : null;
        $context->title = external_format_string($this->title, $syscontext->id);
        $context->sort = $this->sort;
        $context->children = array();
        if (preg_match("/^#+$/", $this->text)) {
            $context->divider = true;
        }
        $context->haschildren = !empty($this->children) && (count($this->children) > 0);
        foreach ($this->children as $child) {
            $child = $child->export_for_template($output);
            array_push($context->children, $child);
        }

        return $context;
    }
91892
public function read($output = false)
    {
        if ($output) {
            $handle = $this->open();
            if ($handle) {
                while (!feof($handle)) {
                    echo fgets($handle, 4096);
                    // Process buffer here..
                }
                fclose($handle);
            }
        } else {
            return file_get_contents($this->getAbsolutePath());
        }
    }
530868
public static function outputStyles($output = '')
    {
        self::lookIfProcessFiles('style', 'header');

        $template = self::$templates['style'];
        $styles = self::$data['style']['header'];

        foreach ($styles as $value) {
            $output .= sprintf(
                $template,
                $value['url']
            );
        }

        self::$data['style']['header'] = [];

        return ! empty($output) ? $output : false;
    }
19443
public function render( $print = true )
	{
		if( $this->args['render'] === false )return;

		$field = $this->getField();

		$class  = 'glsr-field';
		$class .= $this->args['errors'] ? ' glsr-has-error' : '';

		$renderedString = '%s';

		if( ( isset( $field->args['required'] ) && $field->args['required'] )
			|| ( isset( $field->args['attributes']['required'] ) || in_array( 'required', $field->args['attributes'] )) ) {
			$class .= ' glsr-required';
		}

		if( $field->args['type'] !== 'hidden' ) {
			$renderedString = sprintf( '<div class="%s">%%s</div>', $class );
		}

		$rendered = sprintf( $renderedString,
			$this->args['before'] .
			$field->generateLabel() .
			$field->render() .
			$this->args['after'] .
			$this->args['errors']
		);

		$rendered = apply_filters( 'castor/rendered/field', $rendered, $field->args['type'] );

		if( !!$print && $print !== 'return' ) {
			echo $rendered;
		}

		return $rendered;
	}
1028252
function display( $result )
    {
        $cli = eZCLI::instance();
        $col = 60;
        $start = $result['start'];
        $end = $result['end'];
        $final = $result['result'];
        $prime = $result['prime'];
        $repeatCount = $result['repeat_count'];
        $normalized = $result['normalized'];
        $cli->output( $cli->stylize( 'symbol', $result['name'] ) . " " . $cli->stylize( 'mark', "($repeatCount times)" ) );
        if ( isset( $final['memory'] ) )
        {
            $text = $cli->stylize( 'bold', "Memory" ) . ": " . $cli->stylize( 'emphasize', $final['memory'] ) . " bytes";
            if ( isset( $prime['memory'] ) )
                $text .= " (Priming: " . $cli->stylize( 'mark', $prime['memory'] ) . " bytes)";
            if ( $this->MaxMap !== false )
            {
                if ( $this->MaxMap['memory'] > $final['memory'] )
                {
                    $factor = $this->MaxMap['memory'] / $final['memory'];
                    $text .= " " . number_format( $factor, 1 ) . "x less";
                }
                else
                {
                    $factor = $final['memory'] / $this->MaxMap['memory'];
                    $text .= " " . number_format( $factor, 1 ) . "x more";
                }
            }
            $cli->output( $text );
        }
        $text = "Time:   " . $cli->stylize( 'emphasize', number_format( $final['time'], 3 ) ) . " seconds (" . $cli->stylize( 'emphasize', number_format( $normalized['time'], 3 ) ) . ")";
        if ( $this->MaxMap !== false )
        {
            if ( $this->MaxMap['time'] > $normalized['time'] )
            {
                $factor = $this->MaxMap['time'] / $normalized['time'];
                $text .= " " . number_format( $factor, 1 ) . "x less";
            }
            else
            {
                $factor = $normalized['time'] / $this->MaxMap['time'];
                $text .= " " . number_format( $factor, 1 ) . "x more";
            }
        }
        $cli->output( $text );

        if ( $this->MaxMap == false )
        {
            $this->MaxMap = array();
            $this->MaxMap['time'] = $normalized['time'];
            $this->MaxMap['memory'] = $final['memory'];
        }
        else
        {
            if ( isset( $final['memory'] ) and
                 $this->MaxMap['memory'] < $final['memory'] )
                $this->MaxMap['memory'] = $final['memory'];
            if ( $this->MaxMap['time'] < $normalized['time'] )
                $this->MaxMap['time'] = $normalized['time'];
        }

//         $cli->output( $result['name'] . "\033[" . $col . "G", false );
//         if ( $result['status'] )
//         {
//             $cli->output( $cli->stylize( 'success', "[Success]" ) );
//         }
//         else
//         {
//             $cli->output( $cli->stylize( 'error', "[Failure]" ) );
//             foreach ( $result['messages'] as $message )
//             {
//                 $cli->output( "  * ", false );
//                 if ( $message['assert'] )
//                 {
//                     $cli->output( '#' . $message['assert_number'] . ' ', false );
//                     $cli->output( '' . $message['assert'] . ': ', false );
//                 }
//                 $cli->output( $message['text'], false );
//                 $cli->output();
//             }
//         }
    }
607340
protected function _printLogo(&$output)
        {

            $output->writeLn('');
            $output->writeLn('');
            $output->writeLn('');
            $output->writeLn('<sw>          _           _                       _           </sw>');
            $output->writeLn('<sw>         | |         | |                     | |          </sw>');
            $output->writeLn('<sw>      ___| | __ _ ___| |____      _____  _ __| | _____    </sw>');
            $output->writeLn('<sw>     / __| |/ _` / __| \'_ \ \ /\ / / _ \| \'__| |/ / __|   </sw>');
            $output->writeLn('<sw>     \__ \ | (_| \__ \ | | \ V  V / (_) | |  |   <\__ \   </sw>');
            $output->writeLn('<sw>     |___/_|\__,_|___/_| |_|\_/\_/ \___/|_|  |_|\_\___/   </sw>');
            $output->writeLn('<fg=white>                                        web development   </fg=white>');
            $output->writeLn('');
            $output->writeLn('');
            $output->writeLn('                    [ <info>Cronjob Manager</info> ]');
            $output->writeLn('');
            $output->writeLn('');


        }
446264
public function processOutput($output)
	{
		$output=$this->transform($output);
		if($this->purifyOutput)
		{
			$purifier=new CHtmlPurifier;
			$output=$purifier->purify($output);
		}
		parent::processOutput($output);
	}
340624
private function handleOutput(string $output): self
    {
        $this->output .= $output;

        if (!self::inTest()) {
            echo $output;
        }

        return $this;
    }
200977
public function display_render( $pre_output, $field, $display ) {
		if ( ! empty( $pre_output ) ) {
			return $pre_output;
		}

		$return = '';

		// If repeatable
		if ( $display->field->args( 'repeatable' ) ) {
			$rows = array();

			// And has a repeatable value
			if ( is_array( $display->field->value ) ) {

				// Then loop and output.
				foreach ( $display->field->value as $val ) {
					$rows[] = $this->_display_render( $display->field, $val );
				}
			}

			if ( ! empty( $rows ) ) {

				$return .= '<ul class="cmb2-' . str_replace( '_', '-', $display->field->type() ) . '"><li>';
				foreach ( (array) $rows as $row ) {
					$return .= sprintf( '<li>%s</a>', $row );
				}
				$return .= '</ul>';

			} else {
				$return .= '&mdash;';
			}

		} else {
			$return .= $this->_display_render( $display->field, $display->field->value );
		}

		return $return ? $return : $pre_output;
	}
422870
public function display($return = false) {
        global $PAGE;

        // Get the list of requested users.
        $search = optional_param($this->name . '_searchtext', '', PARAM_RAW);
        if (optional_param($this->name . '_clearbutton', false, PARAM_BOOL)) {
            $search = '';
        }
        $groupedusers = $this->find_users($search);

        // Output the select.
        $name = $this->name;
        $multiselect = '';
        if ($this->multiselect) {
            $name .= '[]';
            $multiselect = 'multiple="multiple" ';
        }
        $output = '<div class="userselector" id="' . $this->name . '_wrapper">' . "\n" .
                '<select name="' . $name . '" id="' . $this->name . '" ' .
                $multiselect . 'size="' . $this->rows . '" class="form-control no-overflow">' . "\n";

        // Populate the select.
        $output .= $this->output_options($groupedusers, $search);

        // Output the search controls.
        $output .= "</select>\n<div class=\"form-inline\">\n";
        $output .= '<input type="text" name="' . $this->name . '_searchtext" id="' .
                $this->name . '_searchtext" size="15" value="' . s($search) . '" class="form-control"/>';
        $output .= '<input type="submit" name="' . $this->name . '_searchbutton" id="' .
                $this->name . '_searchbutton" value="' . $this->search_button_caption() . '" class="btn btn-secondary"/>';
        $output .= '<input type="submit" name="' . $this->name . '_clearbutton" id="' .
                $this->name . '_clearbutton" value="' . get_string('clear') . '" class="btn btn-secondary"/>';

        // And the search options.
        $optionsoutput = false;
        if (!user_selector_base::$searchoptionsoutput) {
            $output .= print_collapsible_region_start('', 'userselector_options',
                get_string('searchoptions'), 'userselector_optionscollapsed', true, true);
            $output .= $this->option_checkbox('preserveselected', $this->preserveselected,
                get_string('userselectorpreserveselected'));
            $output .= $this->option_checkbox('autoselectunique', $this->autoselectunique,
                get_string('userselectorautoselectunique'));
            $output .= $this->option_checkbox('searchanywhere', $this->searchanywhere,
                get_string('userselectorsearchanywhere'));
            $output .= print_collapsible_region_end(true);

            $PAGE->requires->js_init_call('M.core_user.init_user_selector_options_tracker', array(), false, self::$jsmodule);
            user_selector_base::$searchoptionsoutput = true;
        }
        $output .= "</div>\n</div>\n\n";

        // Initialise the ajax functionality.
        $output .= $this->initialise_javascript($search);

        // Return or output it.
        if ($return) {
            return $output;
        } else {
            echo $output;
        }
    }
571363
public function export_for_template(\renderer_base $output) {
        $listofgroups = [];
        $groupids = json_decode($this->value);
        foreach ($groupids as $id) {
            $listofgroups[] = format_string($this->coursegroups[$id]->name, true, ['context' => $this->context]);
        }

        if (!empty($listofgroups)) {
            $this->displayvalue = implode($listofgroups, ', ');
        } else {
            $this->displayvalue = get_string('groupsnone');
        }
        return parent::export_for_template($output);
    }
957464
public function export_for_template(renderer_base $output) {
        ob_start();
        $this->display();
        $formhtml = ob_get_contents();
        ob_end_clean();
        $context = [
            'formhtml' => $formhtml
        ];
        return $context;
    }
162408
public function export_for_template(\renderer_base $output) {
        return array(
            'message'       => clean_text($this->message),
            'extraclasses'  => implode(' ', $this->extraclasses),
            'announce'      => $this->announce,
            'closebutton'   => $this->closebutton,
            'issuccess'         => $this->messagetype === 'success',
            'isinfo'            => $this->messagetype === 'info',
            'iswarning'         => $this->messagetype === 'warning',
            'iserror'           => $this->messagetype === 'error',
        );
    }