Output webspace page templates.

@param Webspace $webspace
166957
private function outputWebspacePageTemplates(Webspace $webspace)
    {
        $this->output->writeln('Page Templates:');

        $structures = $this->structureManager->getStructures();

        $checkedTemplates = [];

        foreach ($webspace->getDefaultTemplates() as $template) {
            $checkedTemplates[] = $template;
        }

        foreach ($structures as $structure) {
            $template = $structure->getKey();

            if (!$structure->getInternal() && !in_array($template, $checkedTemplates)) {
                $this->validatePageTemplate('page', $structure->getKey());
            }
        }
    }
1031181
private function upgradeWebspace(Webspace $webspace)
    {
        $sessionManager = $this->container->get('sulu.phpcr.session');
        $node = $sessionManager->getContentNode($webspace->getKey());

        foreach ($webspace->getAllLocalizations() as $localization) {
            $locale = $localization->getLocale();
            $propertyName = $this->getPropertyName(self::SHADOW_ON_PROPERTY, $locale);

            $this->upgradeNode($node, $propertyName, $locale);
        }
    }
792073
public function output_html($data, $query='') {
        global $OUTPUT;

        $default = $this->get_defaultsetting();
        $context = (object) [
            'size' => $this->size,
            'id' => $this->get_id(),
            'name' => $this->get_full_name(),
            'value' => $data,
            'forceltr' => $this->get_force_ltr(),
        ];
        $element = $OUTPUT->render_from_template('core_admin/setting_configtext', $context);

        return format_admin_setting($this, $this->visiblename, $element, $this->description, true, '', $default, $query);
    }
1355210
public function generateSite()
    {

        $template = new TemplateImpl($this->backendContainer);
        $pageStrategy = $this->backendContainer->getCurrentPageStrategyInstance();


        $cacheControl = $this->backendContainer->getCacheControlInstance();
        if ($this->config->isDebugMode()) {
            $cacheControl->disableCache();
            $template->setTwigDebug(true);
        }


        $currentPage = $pageStrategy->getCurrentPage();
        $template->setTemplateFromConfig($currentPage->getTemplate(), "_main");

        $ajaxServer = $this->backendContainer->getAJAXServerInstance();
        $id = null;
        if (($id = $this->GETValueOfIndexIfSetElseDefault('ajax')) !== null) {
            $template->onlyInitialize();
            $ajaxServer->registerHandlersFromConfig();
        }

        //Decide output mode
        if ($id !== null) {
            echo json_encode($ajaxServer->handleFromFunctionString($id, $this->GETValueOfIndexIfSetElseDefault('token')), $this->config->isDebugMode()?JSON_PRETTY_PRINT:0);

        } else if (!$cacheControl->setUpCache()) {
            echo $template->render();
        }

    }
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);
    }
629828
private function dumpWebspace(Webspace $webspace)
    {
        foreach ($webspace->getAllLocalizations() as $localization) {
            $this->output->writeln(sprintf(' - %s (%s)', $webspace->getKey(), $localization->getLocale()));
            $this->dumpPortalInformations(
                $this->webspaceManager->findPortalInformationsByWebspaceKeyAndLocale(
                    $webspace->getKey(),
                    $localization->getLocale(),
                    $this->environment
                )
            );
        }
    }
1086589
protected function addThemeNamespaceHints($namespace)
    {
        $theme = Theme::getCurrent();
        
        $hints   = array_reverse($this->hints[$namespace]);
        $hints[] = Theme::path('resources/views/vendor/'.$namespace);
        
        if (class_exists(\Caffeinated\Modules\ModulesServiceProvider::class)) {
            $hints[] = Theme::path('resources/views/modules/'.$namespace);
        }
        
        $this->hints[$namespace] = array_reverse($hints);
    }
417587
public function output_html($data, $query='') {
        global $OUTPUT;

        // The order matters very much because of the implied numeric keys.
        $days = array('sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday');
        $context = (object) [
            'name' => $this->get_full_name(),
            'id' => $this->get_id(),
            'days' => array_map(function($index) use ($days, $data) {
                return [
                    'index' => $index,
                    'label' => get_string($days[$index], 'calendar'),
                    'checked' => in_array($index, $data)
                ];
            }, array_keys($days))
        ];

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

        return format_admin_setting($this, $this->visiblename, $element, $this->description, false, '', NULL, $query);

    }
9028
public function output_html($data, $query='') {
        global $OUTPUT;
        $context = new stdClass();
        $context->title = $this->visiblename;
        $context->description = $this->description;
        $context->descriptionformatted = highlight($query, markdown_to_html($this->description));
        return $OUTPUT->render_from_template('core_admin/setting_heading', $context);
    }
1119617
function performOutput( $dom )
    {
        $this->XMLSchema = eZXMLSchema::instance();
        $this->NestingLevel = 0;
        $this->Output = '';
        $sectionLevel = -1;

        $this->createLinksArray( $dom );

        $this->outputTag( $dom->documentElement, $sectionLevel );

        return $this->Output;
    }
1178808
public function output_html($data, $query='') {
        global $CFG, $OUTPUT, $DB;

        // display strings
        $txt = get_strings(array('authenticationplugins', 'users', 'administration',
            'settings', 'edit', 'name', 'enable', 'disable',
            'up', 'down', 'none', 'users'));
        $txt->updown = "$txt->up/$txt->down";
        $txt->uninstall = get_string('uninstallplugin', 'core_admin');
        $txt->testsettings = get_string('testsettings', 'core_auth');

        $authsavailable = core_component::get_plugin_list('auth');
        get_enabled_auth_plugins(true); // fix the list of enabled auths
        if (empty($CFG->auth)) {
            $authsenabled = array();
        } else {
            $authsenabled = explode(',', $CFG->auth);
        }

        // construct the display array, with enabled auth plugins at the top, in order
        $displayauths = array();
        $registrationauths = array();
        $registrationauths[''] = $txt->disable;
        $authplugins = array();
        foreach ($authsenabled as $auth) {
            $authplugin = get_auth_plugin($auth);
            $authplugins[$auth] = $authplugin;
            /// Get the auth title (from core or own auth lang files)
            $authtitle = $authplugin->get_title();
            /// Apply titles
            $displayauths[$auth] = $authtitle;
            if ($authplugin->can_signup()) {
                $registrationauths[$auth] = $authtitle;
            }
        }

        foreach ($authsavailable as $auth => $dir) {
            if (array_key_exists($auth, $displayauths)) {
                continue; //already in the list
            }
            $authplugin = get_auth_plugin($auth);
            $authplugins[$auth] = $authplugin;
            /// Get the auth title (from core or own auth lang files)
            $authtitle = $authplugin->get_title();
            /// Apply titles
            $displayauths[$auth] = $authtitle;
            if ($authplugin->can_signup()) {
                $registrationauths[$auth] = $authtitle;
            }
        }

        $return = $OUTPUT->heading(get_string('actauthhdr', 'auth'), 3, 'main');
        $return .= $OUTPUT->box_start('generalbox authsui');

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

        //add always enabled plugins first
        $displayname = $displayauths['manual'];
        $settings = "<a href=\"settings.php?section=authsettingmanual\">{$txt->settings}</a>";
        $usercount = $DB->count_records('user', array('auth'=>'manual', 'deleted'=>0));
        $table->data[] = array($displayname, $usercount, '', '', $settings, '', '');
        $displayname = $displayauths['nologin'];
        $usercount = $DB->count_records('user', array('auth'=>'nologin', 'deleted'=>0));
        $table->data[] = array($displayname, $usercount, '', '', '', '', '');


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

            $usercount = $DB->count_records('user', array('auth'=>$auth, 'deleted'=>0));

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

            // settings link
            if (file_exists($CFG->dirroot.'/auth/'.$auth.'/settings.php')) {
                $settings = "<a href=\"settings.php?section=authsetting$auth\">{$txt->settings}</a>";
            } else if (file_exists($CFG->dirroot.'/auth/'.$auth.'/config.html')) {
                $settings = "<a href=\"auth_config.php?auth=$auth\">{$txt->settings}</a>";
            } else {
                $settings = '';
            }

            // Uninstall link.
            $uninstall = '';
            if ($uninstallurl = core_plugin_manager::instance()->get_uninstall_url('auth_'.$auth, 'manage')) {
                $uninstall = html_writer::link($uninstallurl, $txt->uninstall);
            }

            $test = '';
            if (!empty($authplugins[$auth]) and method_exists($authplugins[$auth], 'test_settings')) {
                $testurl = new moodle_url('/auth/test_settings.php', array('auth'=>$auth, 'sesskey'=>sesskey()));
                $test = html_writer::link($testurl, $txt->testsettings);
            }

            // Add a row to the table.
            $row = new html_table_row(array($displayname, $usercount, $hideshow, $updown, $settings, $test, $uninstall));
            if ($class) {
                $row->attributes['class'] = $class;
            }
            $table->data[] = $row;
        }
        $return .= html_writer::table($table);
        $return .= get_string('configauthenticationplugins', 'admin').'<br />'.get_string('tablenosave', 'filters');
        $return .= $OUTPUT->box_end();
        return highlight($query, $return);
    }
146081
public function output_html($data, $query='') {
        global $OUTPUT;

        $context = new stdClass();
        $context->title = $this->visiblename;
        $context->description = $this->description;

        return $OUTPUT->render_from_template('core_admin/setting_description', $context);
    }
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);
    }
1007798
public function output_html($data, $query='') {
        global $CFG, $OUTPUT, $DB;

        // display strings
        $stradministration = get_string('administration');
        $stredit = get_string('edit');
        $strservice = get_string('externalservice', 'webservice');
        $strdelete = get_string('delete');
        $strplugin = get_string('plugin', 'admin');
        $stradd = get_string('add');
        $strfunctions = get_string('functions', 'webservice');
        $strusers = get_string('users');
        $strserviceusers = get_string('serviceusers', 'webservice');

        $esurl = "$CFG->wwwroot/$CFG->admin/webservice/service.php";
        $efurl = "$CFG->wwwroot/$CFG->admin/webservice/service_functions.php";
        $euurl = "$CFG->wwwroot/$CFG->admin/webservice/service_users.php";

        // built in services
         $services = $DB->get_records_select('external_services', 'component IS NOT NULL', null, 'name');
         $return = "";
         if (!empty($services)) {
            $return .= $OUTPUT->heading(get_string('servicesbuiltin', 'webservice'), 3, 'main');



            $table = new html_table();
            $table->head  = array($strservice, $strplugin, $strfunctions, $strusers, $stredit);
            $table->colclasses = array('leftalign service', 'leftalign plugin', 'centeralign functions', 'centeralign users', 'centeralign ');
            $table->id = 'builtinservices';
            $table->attributes['class'] = 'admintable externalservices generaltable';
            $table->data  = array();

            // iterate through auth plugins and add to the display table
            foreach ($services as $service) {
                $name = $service->name;

                // hide/show link
                if ($service->enabled) {
                    $displayname = "<span>$name</span>";
                } else {
                    $displayname = "<span class=\"dimmed_text\">$name</span>";
                }

                $plugin = $service->component;

                $functions = "<a href=\"$efurl?id=$service->id\">$strfunctions</a>";

                if ($service->restrictedusers) {
                    $users = "<a href=\"$euurl?id=$service->id\">$strserviceusers</a>";
                } else {
                    $users = get_string('allusers', 'webservice');
                }

                $edit = "<a href=\"$esurl?id=$service->id\">$stredit</a>";

                // add a row to the table
                $table->data[] = array($displayname, $plugin, $functions, $users, $edit);
            }
            $return .= html_writer::table($table);
        }

        // Custom services
        $return .= $OUTPUT->heading(get_string('servicescustom', 'webservice'), 3, 'main');
        $services = $DB->get_records_select('external_services', 'component IS NULL', null, 'name');

        $table = new html_table();
        $table->head  = array($strservice, $strdelete, $strfunctions, $strusers, $stredit);
        $table->colclasses = array('leftalign service', 'leftalign plugin', 'centeralign functions', 'centeralign users', 'centeralign ');
        $table->id = 'customservices';
        $table->attributes['class'] = 'admintable externalservices generaltable';
        $table->data  = array();

        // iterate through auth plugins and add to the display table
        foreach ($services as $service) {
            $name = $service->name;

            // hide/show link
            if ($service->enabled) {
                $displayname = "<span>$name</span>";
            } else {
                $displayname = "<span class=\"dimmed_text\">$name</span>";
            }

            // delete link
            $delete = "<a href=\"$esurl?action=delete&amp;sesskey=".sesskey()."&amp;id=$service->id\">$strdelete</a>";

            $functions = "<a href=\"$efurl?id=$service->id\">$strfunctions</a>";

            if ($service->restrictedusers) {
                $users = "<a href=\"$euurl?id=$service->id\">$strserviceusers</a>";
            } else {
                $users = get_string('allusers', 'webservice');
            }

            $edit = "<a href=\"$esurl?id=$service->id\">$stredit</a>";

            // add a row to the table
            $table->data[] = array($displayname, $delete, $functions, $users, $edit);
        }
        // add new custom service option
        $return .= html_writer::table($table);

        $return .= '<br />';
        // add a token to the table
        $return .= "<a href=\"$esurl?id=0\">$stradd</a>";

        return highlight($query, $return);
    }
1163285
public function add_template_directory($path, $namespace = null, $prepend = false) {
		$template_directory = [
			'directory' => $path,
			'namespace' => $namespace
		];

		if ($prepend) {
			array_unshift($this->template_directories, $template_directory);
		} else {
			array_push($this->template_directories, $template_directory);
		}
	}
819344
public function output_html($data, $query='') {
        $result = parent::output_html($data, $query);

        $data = trim($data);
        if ($data) {
            $decoded = json_decode($data, true);
            // Note: it is not very nice to abuse these file classes, but anyway...
            if (is_array($decoded)) {
                $valid = '<span class="pathok">&#x2714;</span>';
            } else {
                $valid = '<span class="patherror">&#x2718;</span>';
            }
            $result = str_replace('</textarea>', '</textarea>'.$valid, $result);
        }

        return $result;
    }
1271892
public function render_footer_template() {
		$output = null;
		if ( ! empty( $this->footer ) ) {
			$output .= '<script type="text/html" id="' . esc_attr( $this->id() ) . '-footer-tmpl">';
			$output .= $this->footer->render();
			$output .= '</script>';
		}

		return $output;
	}