Function to render class

@param Application $renderer Renderer object
@param string $saveHandler Save controller name
@return string HTML string
358383
public function view($renderer, $saveHandler = 'save')
    {
        // TODO: Context rewriting if in one chain!
        $fieldView = $this->viewField($renderer);
        return $renderer->view($this->defaultView)
            ->set($this->cssClass, 'cssClass')
            ->set($this->value(), 'value')
            ->set(url_build(preg_replace('/(_\d+)/', '', $renderer->id()), $saveHandler), 'action')
            ->set($this->entity, 'entity')
            ->set($this->param, 'param')
            ->set($this->dbObject->id, 'objectId')
            ->set($renderer->id(), 'applicationId')
            ->set($fieldView, 'fieldView')
            ->output();
    }
1342524
public function render(): string
   {
       try {
           $output = "";
           foreach ($this->observer as $value) {
               $output .= $value->render();
           }
           return $output;
       } catch (Throwable $e) {
           throw new ViewException(
               "Can't render " . static::class . " " . $e->getMessage()
           );
       }
   }
1261157
public function render(ResultsRenderer $renderer)
    {
        $output = '';
        if (count($bannedFunctions = $this->result->getBannedFunctions())) {
            $output .= sprintf(
                "  %s\n%s\n",
                $renderer->style(
                    "Some functions were used which should not be used in this exercise",
                    ['bold', 'underline', 'yellow']
                ),
                implode("\n", array_map(function (array $call) {
                    return sprintf('    %s on line %s', $call['function'], $call['line']);
                }, $bannedFunctions))
            );
        }

        if (count($missingFunctions = $this->result->getMissingFunctions())) {
            $output .= sprintf(
                "  %s\n%s\n",
                $renderer->style(
                    "Some function requirements were missing. You should use the functions",
                    ['bold', 'underline', 'yellow']
                ),
                implode("\n", array_map(function ($function) {
                    return sprintf('    %s', $function);
                }, $missingFunctions))
            );
        }

        return $output;
    }
1269940
public function getViewRenderer(): ViewRenderer
    {
        if ($this->viewRenderer === null) {
            $collector = $this->getCollector();
            $routes = $collector->getViews();
            $resolver = $collector->getViewEngineResolver();
            $templateHandlers = $collector->getTemplateStreamHandlers();
            if (!$templateHandlers->has('callback')) {
                $templateHandlers->add('callback', CallbackTemplateHandler::class);
            }
            $this->viewRenderer = new ViewRenderer($routes, new ViewEngine());
            $resolver->copyEngines($this->viewRenderer->getEngineResolver());
            $this->viewRenderer->handle('error.{error}', function ($error) {
                return TemplateStream::url('callback', '\Opis\Colibri\Rendering\Template::error' . $error, 'php');
            }, -100)->where('error', '401|403|404|405|500|503');
            $this->viewRenderer->handle('alerts', function () {
                return TemplateStream::url('callback', '\Opis\Colibri\Rendering\Template::alerts', 'php');
            }, -100);
        }

        return $this->viewRenderer;
    }
629005
public function render(Renderer $renderer) {
    if (!$this->isDirectory() && is_null($this->getContent())) {
      $content = '';
      if ($header_template = $this->getHeaderTemplate()) {
        $content .= $renderer->render($header_template, $this->getVars()) . "\n";
      }
      $content .= $renderer->render($this->getTemplate(), $this->getVars());
      $this->content($content);
    }
  }
25851
function Renderer(options = {}) {
    if (!(this instanceof Renderer)) {
        return new Renderer(options);
    }
    var o = (this.options = Object.assign({}, defaults, options));

    // custom handlebars instance
    this.handlebars = handlebars.create();

    // register global helpers/partials
    if (o.helpers) this.helper(o.helpers);
    if (o.partials) this.partial(o.partials);

    // enabling caching (via lru-cache)
    if (o.cache) {
        this.cache = new Cache({ max: 100 });
    }
}
1195088
public function html(PhpRenderer $renderer = null) {
        $view = new View();
        $view->setResponse(new Response());
        $resolver = new TemplateMapResolver();

        if($renderer === null) {
            $renderer = new PhpRenderer();
            $resolver->add($this->getTemplate(), $this->getDefaultTemplatePath($this->getTemplate()));
            $renderer->setResolver($resolver);
        } else {
            $renderer->resolver()->attach($resolver);
        }

        $view->getEventManager()->attach(new PhpRendererStrategy($renderer));

        $view->render($this);

        return $view->getResponse()->getContent();
    }
870808
public function render(AbstractRenderer $renderer = null, $active = null)
    {
        if (is_null($renderer)) {
            $renderer = $this->getRenderer();
        }

        return $renderer->render($this->getRelations(), $active);
    }
1034300
public function export_for_template(\renderer_base $renderer) {
        global $PAGE;

        // Prepare the data we are going to send to the template.
        $data = new \stdClass();
        $data->conversations = [];

        // Don't do anything if there are no messages.
        foreach ($this->conversations as $conversation) {
            $messages = $this->messages[$conversation->id] ?? [];

            if (empty($messages)) {
                continue;
            }

            $viewallmessageslink = new \moodle_url('/message/index.php', ['convid' => $conversation->id]);

            $group = new \stdClass();
            $group->id = $conversation->groupid;
            $group->picture = $conversation->picture;
            $group->hidepicture = $conversation->hidepicture;
            $group->courseid = $conversation->courseid;
            $grouppictureurl = $renderer->image_url('g/g1')->out(false); // Default image.
            if ($url = get_group_picture_url($group, $group->courseid, false, true)) {
                $grouppictureurl = $url->out(false);
            }

            $coursecontext = \context_course::instance($conversation->courseid);

            $conversationformatted = new \stdClass();
            $conversationformatted->groupname = format_string($conversation->name, true, ['context' => $coursecontext]);
            $conversationformatted->grouppictureurl = $grouppictureurl;
            $conversationformatted->coursename = format_string($conversation->coursename, true, ['context' => $coursecontext]);
            $conversationformatted->numberofunreadmessages = count($messages);
            $conversationformatted->messages = [];
            $conversationformatted->viewallmessageslink = \html_writer::link($viewallmessageslink,
                get_string('emaildigestviewallmessages', 'message_email'));

            // We only display the last 3 messages.
            $messages = array_slice($messages, -3, 3, true);
            foreach ($messages as $message) {
                $user = new \stdClass();
                username_load_fields_from_object($user, $message);
                $user->picture = $message->picture;
                $user->imagealt = $message->imagealt;
                $user->email = $message->email;
                $user->id = $message->useridfrom;

                $userpicture = new \user_picture($user);
                $userpicture->includetoken = true;
                $userpictureurl = $userpicture->get_url($PAGE)->out(false);

                $messageformatted = new \stdClass();
                $messageformatted->userpictureurl = $userpictureurl;
                $messageformatted->userfullname = fullname($user);
                $messageformatted->message = message_format_message_text($message);

                // Check if the message was sent today.
                $istoday = userdate($message->timecreated, 'Y-m-d') == userdate(time(), 'Y-m-d');
                if ($istoday) {
                    $timesent = userdate($message->timecreated, get_string('strftimetime24', 'langconfig'));
                } else {
                    $timesent = userdate($message->timecreated, get_string('strftimedatefullshort', 'langconfig'));
                }

                $messageformatted->timesent = $timesent;

                $conversationformatted->messages[] = $messageformatted;
            }

            $data->conversations[] = $conversationformatted;
        }

        return $data;
    }
781812
protected function parseActionUrl($url, $action = null, $renderer = null)
    {
        unset($action);

        if ($renderer === null) {
            $renderer = $this->getActionRenderer();
        }

        if ($url instanceof Translation) {
            $url = (string)$url;
        }

        $url = trim($url);

        if (empty($url) && !is_numeric($url)) {
            return '#';
        }

        if ($renderer === null) {
            /** @todo Shame! Force `{{ id }}` to use "obj_id" GET parameter… */
            $objId = filter_input(INPUT_GET, 'obj_id', FILTER_SANITIZE_STRING);
            if ($objId) {
                $url = preg_replace('~\{\{\s*(obj_)?id\s*\}\}~', $objId, $url);
            }

            /** @todo Shame! Force `{{ type }}` to use "obj_type" GET parameter… */
            $objType = filter_input(INPUT_GET, 'obj_type', FILTER_SANITIZE_STRING);
            if ($objType) {
                $url = preg_replace('~\{\{\s*(obj_)?type\s*\}\}~', $objType, $url);
            }

            if ($url && strpos($url, ':') === false && !in_array($url[0], [ '/', '#', '?' ])) {
                $url = $this->adminUrl().$url;
            }

            return $url;
        } elseif ($renderer instanceof ViewableInterface) {
            $url = $renderer->renderTemplate($url);

            if ($url && strpos($url, ':') === false && !in_array($url[0], [ '/', '#', '?' ])) {
                $url = $this->adminUrl().$url;
            }
        }

        return $url;
    }
853413
public function render($renderer)
    {
        static $lastpicbottom, $lastpicpage, $lastpicleft, $lastpicright;

        // Check for a pagebreak first
        if ($renderer->checkPageBreakPDF($this->height + 5)) {
            $this->y = $renderer->GetY();
        }

        $curx = $renderer->GetX();

        // Get the current positions
        if ($this->x === ReportBaseElement::CURRENT_POSITION) {
            $this->x = $renderer->GetX();
        } else {
            // For static position add margin
            $this->x = $renderer->addMarginX($this->x);
            $renderer->SetX($curx);
        }
        if ($this->y === ReportBaseElement::CURRENT_POSITION) {
            //-- first check for a collision with the last picture
            if (isset($lastpicbottom)) {
                if (($renderer->PageNo() == $lastpicpage) && ($lastpicbottom >= $renderer->GetY()) && ($this->x >= $lastpicleft) && ($this->x <= $lastpicright)
                ) {
                    $renderer->SetY($lastpicbottom + 5);
                }
            }
            $this->y = $renderer->GetY();
        } else {
            $renderer->SetY($this->y);
        }
        if ($renderer->getRTL()) {
            $renderer->Image(
                $this->file,
                $renderer->getPageWidth() - $this->x,
                $this->y,
                $this->width,
                $this->height,
                '',
                '',
                $this->line,
                false,
                72,
                $this->align
            );
        } else {
            $renderer->Image(
                $this->file,
                $this->x,
                $this->y,
                $this->width,
                $this->height,
                '',
                '',
                $this->line,
                false,
                72,
                $this->align
            );
        }
        $lastpicpage           = $renderer->PageNo();
        $renderer->lastpicpage = $renderer->getPage();
        $lastpicleft           = $this->x;
        $lastpicright          = $this->x + $this->width;
        $lastpicbottom         = $this->y + $this->height;
        // Setup for the next line
        if ($this->line === 'N') {
            $renderer->SetY($lastpicbottom);
        }
    }
366327
public function renderFootnote($renderer)
    {
        if ($renderer->getCurrentStyle() != $this->styleName) {
            $renderer->setCurrentStyle($this->styleName);
        }

        $temptext = str_replace('#PAGENUM#', (string) $renderer->pageNo(), $this->text);
        // underline «title» part of Source item
        $temptext = str_replace([
            '«',
            '»',
        ], [
            '<u>',
            '</u>',
        ], $temptext);
        echo "\n<div><a name=\"footnote", $this->num, '"></a>';
        $renderer->write($this->num . '. ' . $temptext);
        echo '</div>';

        $renderer->setXy(0, $renderer->getY() + $this->getFootnoteHeight($renderer));
    }
207921
public function render(Render $renderer)
	{
		$checkboxes = [];

		// Render all the boxes
		foreach ($this->getContents() as $checkbox)
		{
			$checkboxes[] = $renderer->render($checkbox);
		}

		return implode('', $checkboxes);
	}
42094
public function setSaveHandler($saveHandler = null)
    {
        $this->setOriginalSaveHandler($saveHandler);
        if (!$saveHandler instanceof AbstractProxy &&
            !$saveHandler instanceof NativeSessionHandler &&
            !$saveHandler instanceof \SessionHandlerInterface &&
            null !== $saveHandler) {
            throw new \InvalidArgumentException('Must be instance of AbstractProxy or NativeSessionHandler; implement \SessionHandlerInterface; or be null.');
        }

        // Wrap $saveHandler in proxy and prevent double wrapping of proxy
        if (!$saveHandler instanceof AbstractProxy && $saveHandler instanceof \SessionHandlerInterface) {
            $saveHandler = new SessionHandlerProxy($saveHandler);
        } elseif (!$saveHandler instanceof AbstractProxy) {
            $saveHandler = version_compare(phpversion(), '5.4.0', '>=') ?
                new SessionHandlerProxy(new \SessionHandler()) : new NativeProxy();
        }
        $this->saveHandler = $saveHandler;

        if ($this->saveHandler instanceof \SessionHandlerInterface) {
            if (version_compare(phpversion(), '5.4.0', '>=')) {
                session_set_save_handler($this->saveHandler, false);
            } else {
                session_set_save_handler(
                    array($this->saveHandler, 'open'),
                    array($this->saveHandler, 'close'),
                    array($this->saveHandler, 'read'),
                    array($this->saveHandler, 'write'),
                    array($this->saveHandler, 'destroy'),
                    array($this->saveHandler, 'gc')
                );
            }
        }
    }
257845
public function withSaveHandler(SessionHandlerInterface $save_handler): SessionMiddleware
    {
        return new SessionMiddleware(
            $save_handler,
            $this->name,
            $this->save_path,
            $this->cache_limiter,
            $this->cache_expire,
            $this->cookie_params
        );
    }
1135238
public function render(array $arguments = [], $renderer = null) {
        if(empty($this->itemsToDisplay)) {
            return $this->button->render($arguments);
        }

        return $this->baseRender($arguments, $renderer);
    }
1182121
public function render(array $arguments = [], $renderer = null) {
        if($renderer === null) {
            if(static::$defaultRenderer === null) {
                throw new Exception('No Default Renderer Exists for Class ' . get_class());
            } else {
                if(is_callable(static::$defaultRenderer)) {
                    $callable = static::$defaultRenderer;
                    static::$defaultRenderer = $callable();
                }
                $renderer = static::$defaultRenderer;
            }
        } else {
            if(is_callable($renderer)) {
                $renderer = $renderer();
            }
        }

        return $renderer->render($this, $arguments);
    }