Render the add index sub form.
@throws Exception
@throws common_exception_BadRequest
@return void
162186
public function addPropertyIndex()
    {
        if(!$this->isXmlHttpRequest()){
            throw new common_exception_BadRequest('wrong request mode');
        }
        if(!$this->hasRequestParameter('uri')){
            throw new Exception("wrong request Parameter");
        }
        $uri = $this->getRequestParameter('uri');

        $clazz = $this->getCurrentClass();

        $index = 1;
        if($this->hasRequestParameter('index')){
            $index = $this->getRequestParameter('index');
        }

        $propertyIndex = 1;
        if($this->hasRequestParameter('propertyIndex')){
            $propertyIndex = $this->getRequestParameter('propertyIndex');
        }

        //create and attach the new index property to the property
        $property = $this->getProperty(tao_helpers_Uri::decode($uri));
        $class = $this->getClass("http://www.tao.lu/Ontologies/TAO.rdf#Index");

        //get property range to select a default tokenizer
        /** @var core_kernel_classes_Class $range */
        $range = $property->getRange();
        //range is empty select item content
        $tokenizer = null;
        if (is_null($range)) {
            $tokenizer = $this->getResource('http://www.tao.lu/Ontologies/TAO.rdf#RawValueTokenizer');
        } else {
            $tokenizer = $range->getUri() === OntologyRdfs::RDFS_LITERAL
                ? $this->getResource('http://www.tao.lu/Ontologies/TAO.rdf#RawValueTokenizer')
                : $this->getResource('http://www.tao.lu/Ontologies/TAO.rdf#LabelTokenizer');
        }

        $indexClass = $this->getClass('http://www.tao.lu/Ontologies/TAO.rdf#Index');
        $i = 0;
        $indexIdentifierBackup = preg_replace('/[^a-z_0-9]/','_',strtolower($property->getLabel()));
        $indexIdentifierBackup = ltrim(trim($indexIdentifierBackup, '_'),'0..9');
        $indexIdentifier = $indexIdentifierBackup;
        do{
            if($i !== 0){
                $indexIdentifier = $indexIdentifierBackup.'_'.$i;
            }
            $resources = $indexClass->searchInstances(array(OntologyIndex::PROPERTY_INDEX_IDENTIFIER => $indexIdentifier), array('like' => false));
            $count = count($resources);
            $i++;
        }while($count !== 0);

        $indexProperty = $class->createInstanceWithProperties(array(
                OntologyRdfs::RDFS_LABEL => preg_replace('/_/',' ',ucfirst($indexIdentifier)),
                OntologyIndex::PROPERTY_INDEX_IDENTIFIER => $indexIdentifier,
                OntologyIndex::PROPERTY_INDEX_TOKENIZER => $tokenizer,
                OntologyIndex::PROPERTY_INDEX_FUZZY_MATCHING => GenerisRdf::GENERIS_TRUE,
                OntologyIndex::PROPERTY_DEFAULT_SEARCH  => GenerisRdf::GENERIS_FALSE,
            ));

        $property->setPropertyValue($this->getProperty(OntologyIndex::PROPERTY_INDEX), $indexProperty);

        //generate form
        $indexFormContainer = new tao_actions_form_IndexProperty(new OntologyIndex($indexProperty), $propertyIndex.$index);
        $myForm = $indexFormContainer->getForm();
        $form = trim(preg_replace('/\s+/', ' ', $myForm->renderElements()));
        $this->returnJson(array('form' => $form));
    }
2997
public function render()
    {
        switch ($this->type) {
            case "file":
                if (!is_readable($this->template)) {
                    throw new \Exception("Could not find template file: " . $this->template);
                }

                extract($this->templateData);
                include $this->template;

                break;

            case "callback":
                if (!isset($this->template["callback"]) || !is_callable($this->template["callback"])) {
                    throw new \Exception("View missing callback.");
                }

                echo call_user_func($this->template["callback"]);

                break;

            case "string":
                echo $this->template;

                break;

            default:
                throw new \Exception("Not a valid template type: " . $this->type);
        }
    }
662627
protected function processSubmit(FormInterface $form, Request $request): void
    {
        // Restored request should only render the form, not immediately submit it.
        if ($request->hasFlag(Request::RESTORED)) {
            return;
        }

        $form->handleRequest($request);
        if (!$form->isSubmitted()) {
            throw new BadRequestException('The form was not submitted.');
        }

        $data = $form->getData();
        if ($form->isValid()) {
            $this->onSuccess($data, $this);
        } else {
            $this->onError($data, $this);
        }
        $this->onSubmit($data, $this);
    }
607625
public function add_sub_page() {

		$this->screen_hook_suffix = add_submenu_page(
			$this->struct['args']['parent'],
			$this->struct['args']['page_title'],
			$this->struct['args']['menu_title'],
			$this->struct['args']['capability'],
			$this->slug,
			array( $this, 'create_page' )
		);

	}
586424
public function AddForm() {
        $sng=singleton('Snippet');
        $fields=$sng->getCMSFields();
        $validator=$sng->getCMSValidator();
        
        $actions=new FieldList(
                                FormAction::create('doAdd', _t('CodeBank.CREATE', '_Create'))->addExtraClass('ss-ui-action-constructive')->setAttribute('data-icon', 'accept')->setUseButtonTag(true)
                            );
        
        $form=CMSForm::create($this, 'AddForm', $fields, $actions)->setHTMLID('Form_AddForm');
        $form->setValidator($validator);
        $form->disableDefaultAction();
        $form->addExtraClass('cms-add-form cms-edit-form');
        $form->setResponseNegotiator($this->getResponseNegotiator());
        $form->setTemplate($this->getTemplatesWithSuffix('_EditForm'));
        $form->addExtraClass('center '.$this->BaseCSSClasses());
        $form->setAttribute('data-pjax-fragment', 'CurrentForm');
        
        
        //Handle Language id in url
        if($this->request->getVar('LanguageID')) {
            $langField=$form->Fields()->dataFieldByName('LanguageID');
            if($langField && $langField->Value()=='') {
                $langField->setValue(intval(str_replace('language-', '', $this->request->getVar('LanguageID'))));
            }
        }
        
        
        //Handle folder id in url (or post)
        if($this->request->getVar('FolderID')) {
            $folder=SnippetFolder::get()->byID(intval($this->request->getVar('FolderID')));
            if(!empty($folder) && $folder!==false && $folder->ID!=0) {
                $langField=$form->Fields()->dataFieldByName('LanguageID')->setValue($folder->ParentID);
                $form->Fields()->replaceField('LanguageID', $langField->performReadonlyTransformation());
                $form->Fields()->push(new HiddenField('FolderID', 'FolderID', $folder->ID));
            }
        }else if($this->request->postVar('FolderID')) {
            $folder=SnippetFolder::get()->byID(intval($this->request->postVar('FolderID')));
            if(!empty($folder) && $folder!==false && $folder->ID!=0) {
                $langField=$form->Fields()->dataFieldByName('LanguageID')->setValue($folder->ParentID);
                $form->Fields()->replaceField('LanguageID', $langField->performReadonlyTransformation());
                $form->Fields()->push(new HiddenField('FolderID', 'FolderID', $folder->ID));
            }
        }
        
        
        $this->extend('updateAddForm', $form);
        
        
        //Display message telling user to run dev/build because the version numbers are out of sync
        if(CB_VERSION!='@@VERSION@@' && CodeBankConfig::CurrentConfig()->Version!=CB_VERSION.' '.CB_BUILD_DATE) {
            $form->insertBefore(new LiteralField('<p class="message error">'._t('CodeBank.UPDATE_NEEDED', '_A database upgrade is required please run {startlink}dev/build{endlink}.', array('startlink'=>'<a href="dev/build?flush=all">', 'endlink'=>'</a>')).'</p>'), 'LanguageID');
        }else if($this->hasOldTables()) {
            $form->insertBefore(new LiteralField('<p class="message warning">'._t('CodeBank.MIGRATION_AVAILABLE', '_It appears you are upgrading from Code Bank 2.2.x, your old data can be migrated {startlink}click here to begin{endlink}, though it is recommended you backup your database first.', array('startlink'=>'<a href="dev/tasks/CodeBankLegacyMigrate">', 'endlink'=>'</a>')).'</p>'), 'LanguageID');
        }
        
        $form->Actions()->push(new LiteralField('CodeBankVersion', '<p class="codeBankVersion">Code Bank: '.$this->getVersion().'</p>'));
        
        
        Requirements::javascript(CB_DIR.'/javascript/CodeBank.EditForm.js');
        
        return $form;
    }
977912
public function load() {

        if (!$this->hasRequestParameter('uri')) {
            throw new common_exception_MissingParameter('uri', __METHOD__);
        }
        if (!$this->hasRequestParameter('stylesheetUri')) {
            throw new common_exception_MissingParameter('stylesheetUri', __METHOD__);
        }
        if (!$this->hasRequestParameter('lang')) {
            throw new common_exception_MissingParameter('lang', __METHOD__);
        }
        
        $item = new \core_kernel_classes_Resource($this->getRequestParameter('uri'));
        $lang = $this->getRequestParameter('lang');
        $styleSheet = $this->getRequestParameter('stylesheetUri');
        if (!\tao_helpers_File::securityCheck($styleSheet, true)) {
            throw new \common_exception_Error('invalid stylesheet path "'.$styleSheet.'"');
        }



        $cssArray = CssHelper::loadCssFile($item, $lang, $styleSheet);
        echo json_encode($cssArray);
    }
1173197
public function render()
    {
        $myConfig = \OxidEsales\Eshop\Core\Registry::getConfig();

        parent::render();

        $this->_aViewData['edit'] = $oArticle = oxNew(\OxidEsales\Eshop\Application\Model\Article::class);

        $soxId = $this->getEditObjectId();
        if (isset($soxId) && $soxId != "-1") {
            $oDB = $this->getDatabase();

            // load object
            $this->updateArticle($oArticle, $soxId);

            $sShopID = $myConfig->getShopID();

            $sSelect = $this->formOrderAmountQuery($soxId);
            $this->_aViewData["totalordercnt"] = $iTotalOrderCnt = (float) $oDB->getOne($sSelect);

            $sSelect = $this->formSoldOutAmountQuery($soxId);
            $this->_aViewData["soldcnt"] = $iSoldCnt = (float) $oDB->getOne($sSelect);

            $sSelect = $this->formCanceledAmountQuery($soxId);
            $this->_aViewData["canceledcnt"] = $iCanceledCnt = (float) $oDB->getOne($sSelect);

            // not yet processed
            $this->_aViewData["leftordercnt"] = $iTotalOrderCnt - $iSoldCnt - $iCanceledCnt;

            // position in top ten
            $sSelect = "select oxartid,sum(oxamount) as cnt from oxorderarticles " .
                       "where oxordershopid = '{$sShopID}' group by oxartid order by cnt desc";

            $rs = $oDB->select($sSelect);
            $iTopPos = 0;
            $iPos = 0;
            if ($rs != false && $rs->count() > 0) {
                while (!$rs->EOF) {
                    $iPos++;
                    if ($rs->fields[0] == $soxId) {
                        $iTopPos = $iPos;
                    }
                    $rs->fetchRow();
                }
            }

            $this->_aViewData["postopten"] = $iTopPos;
            $this->_aViewData["toptentotal"] = $iPos;
        }

        $this->_aViewData["afolder"] = $myConfig->getConfigParam('aProductfolder');
        $this->_aViewData["aSubclass"] = $myConfig->getConfigParam('aArticleClasses');

        return "article_overview.tpl";
    }
431850
public function ListAll()
	{
		if (!$this->ModelName)
		{
			throw new Exception("ModelName must be defined in " . get_class($this) . "::ListAll");
		}

		// capture output instead of rendering if specified
		if ($this->CaptureOutputMode)
		{
			$this->DebugOutput = $this->RenderEngine->fetch("View" . $this->ModelName .  "ListAll.tpl");
		}
		else
		{
			$this->RenderEngine->display("View" . $this->ModelName .  "ListAll.tpl");
		}
		//$this->_ListAll(null, Request::Get("page",1), Request::Get("limit",20));
	}
95864
public function render() {
        $request     = Request::me();
        $namespace   = $this->module->getViewNamespace();
        $appUri      = $request->getApplicationBaseUri();
        $nestedTiles = $this->nestedTiles;
        foreach ($nestedTiles as $tile) {
            $tile->setParent($this);
        }
        $properties  = $this->getMergedProperties();

        if (!defined($namespace.'APP')) {
            define($namespace.'APP', strLeft($appUri, -1));
        }
        if (!defined($namespace.'MODULE')) {
            $moduleUri = $appUri.$this->module->getPrefix();
            define($namespace.'MODULE', strLeft($moduleUri, -1));
        }

        $properties['request' ] = $request;
        $properties['response'] = Response::me();
        $properties['session' ] = $request->isSession() ? $request->getSession() : null;
        $properties['form'    ] = $request->getAttribute(ACTION_FORM_KEY);
        $properties['page'    ] = Page::me();

        if ($this->isPushModelSupport()) {
            $pageValues = Page::me()->values();
            $properties = \array_merge($properties, $pageValues);
        }

        $tileHint = false;
        if (Application::isAdminIP()) {
            $rootDir  = $this->di('config')['app.dir.root'];
            $file     = $this->fileName;
            $file     = strRightFrom($file, $rootDir.DIRECTORY_SEPARATOR, 1, false, $file);
            $file     = 'file="'.str_replace('\\', '/', $file).'"';
            $tile     = $this->name==self::GENERIC_NAME ? '':'tile="'.$this->name.'" ';
            $tileHint = $tile.$file;
            echo ($this->parent ? NL:'').'<!-- #begin: '.$tileHint.' -->'.NL;
        }

        includeFile($this->fileName, $nestedTiles + $properties);

        if ($tileHint) {
            echo NL.'<!-- #end: '.$tileHint.' -->'.NL;
        }
        return $this;
    }
1158746
public function render()
    {
        $currentNode = $this->getCurrentNode();
        $currentSiteNode = $this->getCurrentSiteNode();
        $fusionRuntime = $this->getFusionRuntime($currentSiteNode);

        $dimensions = $currentNode->getContext()->getDimensions();
        if (array_key_exists('language', $dimensions) && $dimensions['language'] !== []) {
            $currentLocale = new Locale($dimensions['language'][0]);
            $this->i18nService->getConfiguration()->setCurrentLocale($currentLocale);
            $this->i18nService->getConfiguration()->setFallbackRule(['strict' => false, 'order' => array_reverse($dimensions['language'])]);
        }

        $fusionRuntime->pushContextArray([
            'node' => $currentNode,
            'documentNode' => $this->getClosestDocumentNode($currentNode) ?: $currentNode,
            'site' => $currentSiteNode,
            'editPreviewMode' => isset($this->variables['editPreviewMode']) ? $this->variables['editPreviewMode'] : null
        ]);
        try {
            $output = $fusionRuntime->render($this->fusionPath);
            $output = $this->mergeHttpResponseFromOutput($output, $fusionRuntime);
        } catch (RuntimeException $exception) {
            throw $exception->getPrevious();
        }
        $fusionRuntime->popContext();

        return $output;
    }
672470
public function index()
    {
        $action = $this->Crud->action();
        $action->config('scaffold.fields_blacklist', ['created', 'modified']);
        $this->Crud->execute();
    }
81145
public function render()
    {
        // set response headers
        @Common::stripHeader('Pragma');
        @Common::stripHeader('Expires');
        @Common::sendHeader('Content-Type: text/html; charset=UTF-8');
        @Common::sendHeader('Cache-Control: must-revalidate');
        @Common::sendHeader('X-Frame-Options: deny');

        $error = htmlspecialchars($this->error, ENT_QUOTES, 'UTF-8');
        $messages = htmlspecialchars(serialize($this->feedbackMessages), ENT_QUOTES, 'UTF-8');
        $tokenAuth = $this->tokenAuth;
        $httpsFail = (int) $this->httpsFail;

        // use a heredoc instead of an external file
        echo <<<END_OF_TEMPLATE
<!DOCTYPE html>
<html>
 <head>
  <meta name="robots" content="noindex,nofollow">
  <meta charset="utf-8">
  <title></title>
 </head>
 <body>
  <form name="myform" method="post" action="?module=CoreUpdater&amp;action=oneClickResults">
   <input type="hidden" name="token_auth" value="$tokenAuth" />
   <input type="hidden" name="error" value="$error" />
   <input type="hidden" name="messages" value="$messages" />
   <input type="hidden" name="httpsFail" value="$httpsFail" />
   <noscript>
    <button type="submit">Continue</button>
   </noscript>
  </form>
  <script type="text/javascript">
   document.myform.submit();
  </script>
 </body>
</html>
END_OF_TEMPLATE;
    }
330486
public function render()
    {
        $reg = $this->registry;
        ?>
        <div class="wrap">
            <h1><?php echo $reg['page_title']; ?></h1>
            <form action="options.php" method="post">
                <?php settings_errors($reg['option_name']) ?>
                <?php settings_fields($reg['option_name']); ?>
                <?php do_settings_sections($reg['option_name']); ?>
                <?php submit_button(); ?>
            </form>
        </div>
        <?php
    }
1128140
public function render($request, Exception $e)
    {
        if (str_is('api.*', $request->getHost())) {
            /** @TODO Really ugly hack to always return JSON for api */
            $request->headers->set('x-requested-with', 'XMLHttpRequest');
        }
        return parent::render($request, $e);
    }
247508
protected function definition_sub() {
        $mform = $this->_form;

        $plugindefaults = get_config('workshopeval_best');
        $current = $this->_customdata['current'];

        $options = array();
        for ($i = 9; $i >= 1; $i = $i-2) {
            $options[$i] = get_string('comparisonlevel' . $i, 'workshopeval_best');
        }
        $mform->addElement('select', 'comparison', get_string('comparison', 'workshopeval_best'), $options);
        $mform->addHelpButton('comparison', 'comparison', 'workshopeval_best');
        $mform->setDefault('comparison', $plugindefaults->comparison);

        $this->set_data($current);
    }
1002330
def render_has_many_form(form_builder, parent, &block)
      index = parent && form_builder.send(:parent_child_index, parent)
      template.concat template.capture { yield(form_builder, index) }
      template.concat has_many_actions(form_builder, "".html_safe)
    end
625073
public function indexAction()
    {
        if ($this->getRequest()->isAjax()) {
            try {
                $this->loadLayout(null, false, false);
                $this->getLayout()->getUpdate()->setCacheId(null);
                $this->getLayout()->getUpdate()->addHandle(strtolower($this->getFullActionName()) . '_AJAX');
            } catch (Exception $e) {
                Mage::logException($e);
                $this->getResponse()->setHeader('Content-Type', 'application/json');
                $this->getResponse()->setBody(Zend_Json::encode(['error' => true, 'message' => $e->getMessage()]));
            }
        }

        $this->loadLayout();
        $this->renderLayout();
    }