Generates the HTML for the setting

@global moodle_page $PAGE
@global core_renderer $OUTPUT
@param string $data
@param string $query
515037
public function output_html($data, $query = '') {
        global $PAGE, $OUTPUT;

        $icon = new pix_icon('i/loading', get_string('loading', 'admin'), 'moodle', ['class' => 'loadingicon']);
        $context = (object) [
            'id' => $this->get_id(),
            'name' => $this->get_full_name(),
            'value' => $data,
            'icon' => $icon->export_for_template($OUTPUT),
            'haspreviewconfig' => !empty($this->previewconfig),
            'forceltr' => $this->get_force_ltr()
        ];

        $element = $OUTPUT->render_from_template('core_admin/setting_configcolourpicker', $context);
        $PAGE->requires->js_init_call('M.util.init_colour_picker', array($this->get_id(), $this->previewconfig));

        return format_admin_setting($this, $this->visiblename, $element, $this->description, true, '',
            $this->get_defaultsetting(), $query);
    }
700542
public function output_html($data, $query='') {
        global $OUTPUT;

        if (!$this->load_choices() or empty($this->choices)) {
            return '';
        }

        $default = $this->get_defaultsetting();
        if (is_null($default)) {
            $default = array();
        }
        if (is_null($data)) {
            $data = array();
        }

        $context = (object) [
            'id' => $this->get_id(),
            'name' => $this->get_full_name(),
            'size' => min(10, count($this->choices))
        ];

        $defaults = [];
        $options = [];
        $template = 'core_admin/setting_configmultiselect';

        if (!empty($this->optgroups)) {
            $optgroups = [];
            foreach ($this->optgroups as $label => $choices) {
                $optgroup = array('label' => $label, 'options' => []);
                foreach ($choices as $value => $name) {
                    if (in_array($value, $default)) {
                        $defaults[] = $name;
                    }
                    $optgroup['options'][] = [
                        'value' => $value,
                        'name' => $name,
                        'selected' => in_array($value, $data)
                    ];
                    unset($this->choices[$value]);
                }
                $optgroups[] = $optgroup;
            }
            $context->optgroups = $optgroups;
            $template = 'core_admin/setting_configmultiselect_optgroup';
        }

        foreach ($this->choices as $value => $name) {
            if (in_array($value, $default)) {
                $defaults[] = $name;
            }
            $options[] = [
                'value' => $value,
                'name' => $name,
                'selected' => in_array($value, $data)
            ];
        }
        $context->options = $options;

        if (is_null($default)) {
            $defaultinfo = NULL;
        } if (!empty($defaults)) {
            $defaultinfo = implode(', ', $defaults);
        } else {
            $defaultinfo = get_string('none');
        }

        $element = $OUTPUT->render_from_template($template, $context);

        return format_admin_setting($this, $this->visiblename, $element, $this->description, true, '', $defaultinfo, $query);
    }
908841
public function toRender($title, $crud, $data)
    {
        $view       = $this->di->get("view");
        $pageRender = $this->di->get("pageRender");
        $view->add($crud, $data);
        $tempfix = "";
        $pageRender->renderPage($tempfix, ["title" => $title]);
    }
970703
public function output_html($data, $query='') {
        global $OUTPUT;

        $context = (object) [
            'name' => $this->get_full_name(),
            'emoticons' => [],
            'forceltr' => true,
        ];

        $i = 0;
        foreach ($data as $field => $value) {

            // When $i == 0: text.
            // When $i == 1: imagename.
            // When $i == 2: imagecomponent.
            // When $i == 3: altidentifier.
            // When $i == 4: altcomponent.
            $fields[$i] = (object) [
                'field' => $field,
                'value' => $value,
                'index' => $i
            ];
            $i++;

            if ($i > 4) {
                $icon = null;
                if (!empty($fields[1]->value)) {
                    if (get_string_manager()->string_exists($fields[3]->value, $fields[4]->value)) {
                        $alt = get_string($fields[3]->value, $fields[4]->value);
                    } else {
                        $alt = $fields[0]->value;
                    }
                    $icon = new pix_emoticon($fields[1]->value, $alt, $fields[2]->value);
                }
                $context->emoticons[] = [
                    'fields' => $fields,
                    'icon' => $icon ? $icon->export_for_template($OUTPUT) : null
                ];
                $fields = [];
                $i = 0;
            }
        }

        $context->reseturl = new moodle_url('/admin/resetemoticons.php');
        $element = $OUTPUT->render_from_template('core_admin/setting_emoticons', $context);
        return format_admin_setting($this, $this->visiblename, $element, $this->description, false, '', NULL, $query);
    }
415620
public function output_html($data, $query='') {
        $editor = editors_get_preferred_editor(FORMAT_HTML);
        $editor->set_text($data);
        $editor->use_editor($this->get_id(), array('noclean'=>true));
        return parent::output_html($data, $query);
    }
438941
public function renderPage($view, $layout = null)
    {
        $event = new PageMenuContextualEvent($view);

        //Set currentView and dispatch victoire.on_render_page event with this currentView
        $pageRenderEvent = new PageRenderEvent($view);
        $this->eventDispatcher->dispatch('victoire.on_render_page', $pageRenderEvent);
        $this->currentViewHelper->setCurrentView($view);

        //Build WidgetMap
        $this->widgetMapBuilder->build($view, true);

        //Populate widgets with their data
        $this->widgetDataWarmer->warm($this->entityManager, $view);

        //Dispatch contextual event regarding page type
        if (in_array($view->getType(), ['business_page', 'virtual_business_page'])) {
            //Dispatch also an event with the Business entity name
            $eventName = 'victoire_core.page_menu.contextual';
            if (!$view->getId()) {
                $eventName = 'victoire_core.business_template_menu.contextual';
                $event = new PageMenuContextualEvent($view->getTemplate());
            }
            $this->eventDispatcher->dispatch($eventName, $event);
            $type = $view->getBusinessEntityId();
        } else {
            $type = $view->getType();
        }

        $eventName = 'victoire_core.'.$type.'_menu.contextual';
        $this->eventDispatcher->dispatch($eventName, $event);

        if (null === $layout) {
            //Determine which layout to use
            $layout = $this->guessBestLayoutForView($view);
        }
        $globalConfig = $this->entityManager->getRepository(GlobalConfig::class)->findLast() ?: new GlobalConfig();

        //Create the response
        $response = $this->container->get('templating')->renderResponse('VictoireCoreBundle:Layout:'.$layout.'.html.twig', [
            'globalConfig'                    => $globalConfig,
            'victoire_i18n_available_locales' => $this->availableLocales,
            'victoire_twig_responsive'        => $this->twigResponsive,
            'view'                            => $view,
        ]);

        return $response;
    }
1153891
public function render($tabname, $page, $perpage, $cat, $recurse, $showhidden,
            $showquestiontext, $tagids = []) {
        ob_start();
        $this->display($tabname, $page, $perpage, $cat, $recurse, $showhidden, $showquestiontext, $tagids);
        $out = ob_get_contents();
        ob_end_clean();
        return $out;
    }
197306
public static function output($message, $data = null)
    {
        if (static::$mode == "html") {
            static::html($message, $data);
        } else {
            static::text($message, $data);
        }
    }
918426
public function output_html($data, $query='') {
        global $OUTPUT;

        $context = (object) [
            'expressions' => [],
            'name' => $this->get_full_name()
        ];

        if (empty($data)) {
            $looplimit = 1;
        } else {
            $looplimit = (count($data)/2)+1;
        }

        for ($i=0; $i<$looplimit; $i++) {

            $expressionname = 'expression'.$i;

            if (!empty($data[$expressionname])){
                $expression = $data[$expressionname];
            } else {
                $expression = '';
            }

            $valuename = 'value'.$i;

            if (!empty($data[$valuename])){
                $value = $data[$valuename];
            } else {
                $value= '';
            }

            $context->expressions[] = [
                'index' => $i,
                'expression' => $expression,
                'value' => $value
            ];
        }

        $element = $OUTPUT->render_from_template('core_admin/setting_devicedetectregex', $context);

        return format_admin_setting($this, $this->visiblename, $element, $this->description, false, '', null, $query);
    }
597700
public function output_html($data, $query = '') {
        global $CFG, $OUTPUT, $DB, $PAGE;

        $context = (object) [
            'manageurl' => new moodle_url($this->get_manage_url(), [
                    'type' => $this->get_plugin_type(),
                    'sesskey' => sesskey(),
                ]),
            'infocolumnname' => $this->get_info_column_name(),
            'plugins' => [],
        ];

        $pluginmanager = core_plugin_manager::instance();
        $allplugins = $pluginmanager->get_plugins_of_type($this->get_plugin_type());
        $enabled = $pluginmanager->get_enabled_plugins($this->get_plugin_type());
        $plugins = array_merge($enabled, $allplugins);
        foreach ($plugins as $key => $plugin) {
            $pluginlink = new moodle_url($context->manageurl, ['plugin' => $key]);

            $pluginkey = (object) [
                'plugin' => $plugin->displayname,
                'enabled' => $plugin->is_enabled(),
                'togglelink' => '',
                'moveuplink' => '',
                'movedownlink' => '',
                'settingslink' => $plugin->get_settings_url(),
                'uninstalllink' => '',
                'info' => '',
            ];

            // Enable/Disable link.
            $togglelink = new moodle_url($pluginlink);
            if ($plugin->is_enabled()) {
                $toggletarget = false;
                $togglelink->param('action', 'disable');

                if (count($context->plugins)) {
                    // This is not the first plugin.
                    $pluginkey->moveuplink = new moodle_url($pluginlink, ['action' => 'up']);
                }

                if (count($enabled) > count($context->plugins) + 1) {
                    // This is not the last plugin.
                    $pluginkey->movedownlink = new moodle_url($pluginlink, ['action' => 'down']);
                }

                $pluginkey->info = $this->get_info_column($plugin);
            } else {
                $toggletarget = true;
                $togglelink->param('action', 'enable');
            }

            $pluginkey->toggletarget = $toggletarget;
            $pluginkey->togglelink = $togglelink;

            $frankenstyle = $plugin->type . '_' . $plugin->name;
            if ($uninstalllink = core_plugin_manager::instance()->get_uninstall_url($frankenstyle, 'manage')) {
                // This plugin supports uninstallation.
                $pluginkey->uninstalllink = $uninstalllink;
            }

            if (!empty($this->get_info_column_name())) {
                // This plugintype has an info column.
                $pluginkey->info = $this->get_info_column($plugin);
            }

            $context->plugins[] = $pluginkey;
        }

        $str = $OUTPUT->render_from_template('core_admin/setting_manage_plugins', $context);
        return highlight($query, $str);
    }
823544
public function output_html($data, $query='') {
        global $CFG, $OUTPUT;

        // display strings
        $txt = get_strings(array('administration', 'settings', 'edit', 'name', 'enable', 'disable',
            'up', 'down', 'none'));
        $struninstall = get_string('uninstallplugin', 'core_admin');

        $txt->updown = "$txt->up/$txt->down";

        $editors_available = editors_get_available();
        $active_editors = explode(',', $CFG->texteditors);

        $active_editors = array_reverse($active_editors);
        foreach ($active_editors as $key=>$editor) {
            if (empty($editors_available[$editor])) {
                unset($active_editors[$key]);
            } else {
                $name = $editors_available[$editor];
                unset($editors_available[$editor]);
                $editors_available[$editor] = $name;
            }
        }
        if (empty($active_editors)) {
        //$active_editors = array('textarea');
        }
        $editors_available = array_reverse($editors_available, true);
        $return = $OUTPUT->heading(get_string('acteditorshhdr', 'editor'), 3, 'main', true);
        $return .= $OUTPUT->box_start('generalbox editorsui');

        $table = new html_table();
        $table->head  = array($txt->name, $txt->enable, $txt->updown, $txt->settings, $struninstall);
        $table->colclasses = array('leftalign', 'centeralign', 'centeralign', 'centeralign', 'centeralign');
        $table->id = 'editormanagement';
        $table->attributes['class'] = 'admintable generaltable';
        $table->data  = array();

        // iterate through auth plugins and add to the display table
        $updowncount = 1;
        $editorcount = count($active_editors);
        $url = "editors.php?sesskey=" . sesskey();
        foreach ($editors_available as $editor => $name) {
        // hide/show link
            $class = '';
            if (in_array($editor, $active_editors)) {
                $hideshow = "<a href=\"$url&amp;action=disable&amp;editor=$editor\">";
                $hideshow .= $OUTPUT->pix_icon('t/hide', get_string('disable')) . '</a>';
                $enabled = true;
                $displayname = $name;
            }
            else {
                $hideshow = "<a href=\"$url&amp;action=enable&amp;editor=$editor\">";
                $hideshow .= $OUTPUT->pix_icon('t/show', get_string('enable')) . '</a>';
                $enabled = false;
                $displayname = $name;
                $class = 'dimmed_text';
            }

            // up/down link (only if auth is enabled)
            $updown = '';
            if ($enabled) {
                if ($updowncount > 1) {
                    $updown .= "<a href=\"$url&amp;action=up&amp;editor=$editor\">";
                    $updown .= $OUTPUT->pix_icon('t/up', get_string('moveup')) . '</a>&nbsp;';
                }
                else {
                    $updown .= $OUTPUT->spacer() . '&nbsp;';
                }
                if ($updowncount < $editorcount) {
                    $updown .= "<a href=\"$url&amp;action=down&amp;editor=$editor\">";
                    $updown .= $OUTPUT->pix_icon('t/down', get_string('movedown')) . '</a>&nbsp;';
                }
                else {
                    $updown .= $OUTPUT->spacer() . '&nbsp;';
                }
                ++ $updowncount;
            }

            // settings link
            if (file_exists($CFG->dirroot.'/lib/editor/'.$editor.'/settings.php')) {
                $eurl = new moodle_url('/admin/settings.php', array('section'=>'editorsettings'.$editor));
                $settings = "<a href='$eurl'>{$txt->settings}</a>";
            } else {
                $settings = '';
            }

            $uninstall = '';
            if ($uninstallurl = core_plugin_manager::instance()->get_uninstall_url('editor_'.$editor, 'manage')) {
                $uninstall = html_writer::link($uninstallurl, $struninstall);
            }

            // Add a row to the table.
            $row = new html_table_row(array($displayname, $hideshow, $updown, $settings, $uninstall));
            if ($class) {
                $row->attributes['class'] = $class;
            }
            $table->data[] = $row;
        }
        $return .= html_writer::table($table);
        $return .= get_string('configeditorplugins', 'editor').'<br />'.get_string('tablenosave', 'admin');
        $return .= $OUTPUT->box_end();
        return highlight($query, $return);
    }
602013
public function output_html($data, $query='') {
        global $CFG, $OUTPUT, $PAGE;
        require_once("$CFG->libdir/editorlib.php");
        require_once(__DIR__.'/lib.php');
        $tinymce = new tinymce_texteditor();
        $pluginmanager = core_plugin_manager::instance();

        // display strings
        $strbuttons = get_string('availablebuttons', 'editor_tinymce');
        $strdisable = get_string('disable');
        $strenable = get_string('enable');
        $strname = get_string('name');
        $strsettings = get_string('settings');
        $struninstall = get_string('uninstallplugin', 'core_admin');
        $strversion = get_string('version');

        $subplugins = core_component::get_plugin_list('tinymce');

        $return = $OUTPUT->heading(get_string('subplugintype_tinymce_plural', 'editor_tinymce'), 3, 'main', true);
        $return .= $OUTPUT->box_start('generalbox tinymcesubplugins');

        $table = new html_table();
        $table->head  = array($strname, $strbuttons, $strversion, $strenable, $strsettings, $struninstall);
        $table->align = array('left', 'left', 'center', 'center', 'center', 'center');
        $table->data  = array();
        $table->attributes['class'] = 'admintable generaltable';

        // Iterate through subplugins.
        foreach ($subplugins as $name => $dir) {
            $namestr = get_string('pluginname', 'tinymce_'.$name);
            $version = get_config('tinymce_'.$name, 'version');
            if ($version === false) {
                $version = '';
            }
            $plugin = $tinymce->get_plugin($name);
            $plugininfo = $pluginmanager->get_plugin_info('tinymce_'.$name);

            // Add hide/show link.
            $class = '';
            if (!$version) {
                $hideshow = '';
                $displayname = html_writer::tag('span', $name, array('class'=>'error'));
            } else if ($plugininfo->is_enabled()) {
                $url = new moodle_url('/lib/editor/tinymce/subplugins.php', array('sesskey'=>sesskey(), 'return'=>'settings', 'disable'=>$name));
                $hideshow = $OUTPUT->pix_icon('t/hide', $strdisable);
                $hideshow = html_writer::link($url, $hideshow);
                $displayname = $namestr;
            } else {
                $url = new moodle_url('/lib/editor/tinymce/subplugins.php', array('sesskey'=>sesskey(), 'return'=>'settings', 'enable'=>$name));
                $hideshow = $OUTPUT->pix_icon('t/show', $strenable);
                $hideshow = html_writer::link($url, $hideshow);
                $displayname = $namestr;
                $class = 'dimmed_text';
            }

            if ($PAGE->theme->resolve_image_location('icon', 'tinymce_' . $name, false)) {
                $icon = $OUTPUT->pix_icon('icon', '', 'tinymce_' . $name, array('class' => 'icon pluginicon'));
            } else {
                $icon = $OUTPUT->pix_icon('spacer', '', 'moodle', array('class' => 'icon pluginicon noicon'));
            }
            $displayname  = $icon . ' ' . $displayname;

            // Add available buttons.
            $buttons = implode(', ', $plugin->get_buttons());
            $buttons = html_writer::tag('span', $buttons, array('class'=>'tinymcebuttons'));

            // Add settings link.
            if (!$version) {
                $settings = '';
            } else if ($url = $plugininfo->get_settings_url()) {
                $settings = html_writer::link($url, $strsettings);
            } else {
                $settings = '';
            }

            // Add uninstall info.
            $uninstall = '';
            if ($uninstallurl = core_plugin_manager::instance()->get_uninstall_url('tinymce_' . $name, 'manage')) {
                $uninstall = html_writer::link($uninstallurl, $struninstall);
            }

            // Add a row to the table.
            $row = new html_table_row(array($displayname, $buttons, $version, $hideshow, $settings, $uninstall));
            if ($class) {
                $row->attributes['class'] = $class;
            }
            $table->data[] = $row;
        }
        $return .= html_writer::table($table);
        $return .= html_writer::tag('p', get_string('tablenosave', 'admin'));
        $return .= $OUTPUT->box_end();
        return highlight($query, $return);
    }
950247
protected function render($template, $data = null)
    {
        $twigView = $this->container->view;

        // By making page data a Twig Global, we can access page data in block elements
        // which are loaded by a Twig function
        $twigEnvironment = $twigView->getEnvironment();
        $twigEnvironment->addGlobal('page', $data);
        $twigEnvironment->addGlobal('alert', $this->alert);

        return $twigView->render($this->response, $template);
    }
318239
public function output_html($data, $query='') {
        global $CFG, $OUTPUT;

        // display strings
        $stradministration = get_string('administration');
        $strsettings = get_string('settings');
        $stredit = get_string('edit');
        $strprotocol = get_string('protocol', 'webservice');
        $strenable = get_string('enable');
        $strdisable = get_string('disable');
        $strversion = get_string('version');

        $protocols_available = core_component::get_plugin_list('webservice');
        $active_protocols = empty($CFG->webserviceprotocols) ? array() : explode(',', $CFG->webserviceprotocols);
        ksort($protocols_available);

        foreach ($active_protocols as $key=>$protocol) {
            if (empty($protocols_available[$protocol])) {
                unset($active_protocols[$key]);
            }
        }

        $return = $OUTPUT->heading(get_string('actwebserviceshhdr', 'webservice'), 3, 'main');
        $return .= $OUTPUT->box_start('generalbox webservicesui');

        $table = new html_table();
        $table->head  = array($strprotocol, $strversion, $strenable, $strsettings);
        $table->colclasses = array('leftalign', 'centeralign', 'centeralign', 'centeralign', 'centeralign');
        $table->id = 'webserviceprotocols';
        $table->attributes['class'] = 'admintable generaltable';
        $table->data  = array();

        // iterate through auth plugins and add to the display table
        $url = "$CFG->wwwroot/$CFG->admin/webservice/protocols.php?sesskey=" . sesskey();
        foreach ($protocols_available as $protocol => $location) {
            $name = get_string('pluginname', 'webservice_'.$protocol);

            $plugin = new stdClass();
            if (file_exists($CFG->dirroot.'/webservice/'.$protocol.'/version.php')) {
                include($CFG->dirroot.'/webservice/'.$protocol.'/version.php');
            }
            $version = isset($plugin->version) ? $plugin->version : '';

            // hide/show link
            if (in_array($protocol, $active_protocols)) {
                $hideshow = "<a href=\"$url&amp;action=disable&amp;webservice=$protocol\">";
                $hideshow .= $OUTPUT->pix_icon('t/hide', $strdisable) . '</a>';
                $displayname = "<span>$name</span>";
            } else {
                $hideshow = "<a href=\"$url&amp;action=enable&amp;webservice=$protocol\">";
                $hideshow .= $OUTPUT->pix_icon('t/show', $strenable) . '</a>';
                $displayname = "<span class=\"dimmed_text\">$name</span>";
            }

            // settings link
            if (file_exists($CFG->dirroot.'/webservice/'.$protocol.'/settings.php')) {
                $settings = "<a href=\"settings.php?section=webservicesetting$protocol\">$strsettings</a>";
            } else {
                $settings = '';
            }

            // add a row to the table
            $table->data[] = array($displayname, $version, $hideshow, $settings);
        }
        $return .= html_writer::table($table);
        $return .= get_string('configwebserviceplugins', 'webservice');
        $return .= $OUTPUT->box_end();

        return highlight($query, $return);
    }
507647
public function renderPage($data, $status = 200)
    {
        $data["stylesheets"] = ["css/style.css"];

        // Add common header, navbar and footer
        //$this->view->add("default1/header", [], "header");
        //$this->view->add("default1/navbar", [], "navbar");
        //$this->view->add("default1/footer", [], "footer");

        // Add layout, render it, add to response and send.
        $this->view->add("default1/layout", $data, "layout");
        $body = $this->view->renderBuffered("layout");
        $this->response->setBody($body)
                       ->send($status);
        exit;
    }
336918
public function outputView(array $data, $view = null)
    {
        $this->getContext()->getOutput()->outputView($data, $view);
    }
565137
public function output_html($data, $query='') {
        global $CFG, $OUTPUT;
        require_once($CFG->libdir . '/licenselib.php');
        $url = "licenses.php?sesskey=" . sesskey();

        // display strings
        $txt = get_strings(array('administration', 'settings', 'name', 'enable', 'disable', 'none'));
        $licenses = license_manager::get_licenses();

        $return = $OUTPUT->heading(get_string('availablelicenses', 'admin'), 3, 'main', true);

        $return .= $OUTPUT->box_start('generalbox editorsui');

        $table = new html_table();
        $table->head  = array($txt->name, $txt->enable);
        $table->colclasses = array('leftalign', 'centeralign');
        $table->id = 'availablelicenses';
        $table->attributes['class'] = 'admintable generaltable';
        $table->data  = array();

        foreach ($licenses as $value) {
            $displayname = html_writer::link($value->source, get_string($value->shortname, 'license'), array('target'=>'_blank'));

            if ($value->enabled == 1) {
                $hideshow = html_writer::link($url.'&action=disable&license='.$value->shortname,
                    $OUTPUT->pix_icon('t/hide', get_string('disable')));
            } else {
                $hideshow = html_writer::link($url.'&action=enable&license='.$value->shortname,
                    $OUTPUT->pix_icon('t/show', get_string('enable')));
            }

            if ($value->shortname == $CFG->sitedefaultlicense) {
                $displayname .= ' '.$OUTPUT->pix_icon('t/locked', get_string('default'));
                $hideshow = '';
            }

            $enabled = true;

            $table->data[] =array($displayname, $hideshow);
        }
        $return .= html_writer::table($table);
        $return .= $OUTPUT->box_end();
        return highlight($query, $return);
    }