Generate HTML output for specific dynamic count

@param boolean $submitted
@param boolean $blnSimpleLayout
@param boolean $blnLabel
@param boolean $blnDisplayErrors
@param integer $intCount
@return string
322693
public function __toHtml($submitted = false, $blnSimpleLayout = false, $blnLabel = true, $blnDisplayErrors = true, $intCount = 0)
    {
        return $this->toHtml($submitted, $blnSimpleLayout, $blnLabel, $blnDisplayErrors);
    }
415392
static public function count($countable, $count, $message = null, $propertyPath = null)
        {
            if ($count !== count($countable)) {
                $message = $message ?: sprintf(
                    'List does not contain exactly "%d" elements.',
                    static::stringify($countable),
                    static::stringify($count)
                );

                throw static::createException($countable, $message, static::INVALID_COUNT, $propertyPath, array('count' => $count));
            }
        }
894372
public function field(array &$submitted, array $options = array())
    {
        $this->options = $options;
        $this->submitted = &$submitted;

        $this->validateField();
        $this->validateTitle();
        $this->validateWeight();
        $this->validateTranslation();
        $this->validateTypeField();
        $this->validateWidgetField();

        $this->unsetSubmitted('update');

        return $this->getResult();
    }
995013
public function __toHtml($submitted = false, $blnSimpleLayout = false, $blnLabel = true, $blnDisplayErrors = true, $intCount = 0)
    {
        $blnError = ($submitted && ! $this->__validator->validate($intCount) && $blnDisplayErrors) ? true : false;

        if (! $blnSimpleLayout) {
            // *** We asume that all dynamic fields greater than 0 are never required.
            if ($this->__validator->getRequired()) {
                $this->setMeta("class", "vf__required");
            } else {
                $this->setMeta("class", "vf__optional");
            }

            // *** Set custom meta.
            if ($blnError) {
                $this->setMeta("class", "vf__error");
            }

            if (! $blnLabel) {
                $this->setMeta("class", "vf__nolabel");
            }

            // Call this right before __getMetaString();
            $this->setConditionalMeta();

            $strOutput = "<div{$this->__getMetaString()}>\n";

            if ($blnError) {
                $strOutput .= "<p class=\"vf__error\">{$this->__validator->getError($intCount)}</p>";
            }

            if ($blnLabel) {
                $strLabel = (! empty($this->__requiredstyle) && $this->__validator->getRequired()) ? sprintf($this->__requiredstyle, $this->__label) : $this->__label;
                if (! empty($this->__label)) {
                    $strOutput .= "<label{$this->__getLabelMetaString()}>{$strLabel}</label>\n";
                }
            }
        } else {
            if ($blnError) {
                $this->setMeta("class", "vf__error");
            }

            $this->setMeta("class", "vf__multifielditem");

            // Call this right before __getMetaString();
            $this->setConditionalMeta();

            $strOutput = "<div{$this->__getMetaString()}\">\n";
        }

        $strOutput .= "<fieldset{$this->__getFieldMetaString()}>\n";

        foreach ($this->__fields as $objField) {
            switch (get_class($objField)) {
                case "ValidFormBuilder\\GroupField":
                    $strOutput .= $objField->toHtmlInternal($this->__getValue($submitted, $intCount), $submitted, $intCount);

                    break;
            }
        }

        $strOutput .= "</fieldset>\n";

        if (! empty($this->__tip)) {
            $strOutput .= "<small class=\"vf__tip\"{$this->__getTipMetaString()}>{$this->__tip}</small>\n";
        }

        $strOutput .= "</div>\n";

        return $strOutput;
    }
309026
private function renderElements(
        FieldsetInterface $elements, $formClass, $output, $submitElements, $offset = 2
    ) {
        foreach ($elements as $element) {
            if ($element instanceof FieldsetInterface) {
                list($output, $submitElements) = $this->renderElements(
                    $element, $formClass, $output, $submitElements
                );
            } elseif ($element instanceof Submit
                || $element instanceof Button
            ) {
                $submitElements[] = $element;
            } elseif (
                $element instanceof Csrf || $element instanceof Hidden
            ) {
                $output .= $this->getView()->formElement($element);
            } elseif ($element instanceof Checkbox) {
                $viewModel = new ViewModel();
                $viewModel->setVariable('element', $element);
                $viewModel->setVariable('offset', $offset);
                $viewModel->setTemplate(
                    'travello-view-helper/widget/bootstrap-form-checkbox'
                );

                $output .= $this->getView()->render($viewModel);
            } else {
                if ($element instanceof File) {
                    $element->setAttributes(
                        ['class' => 'form-control-static']
                    );
                } else {
                    $element->setAttributes(['class' => 'form-control']);
                }

                if ($formClass == 'form-inline') {
                    $element->setLabelAttributes(
                        ['class' => 'control-label']
                    );

                    $template = 'bootstrap-form-group-inline';
                } else {
                    $element->setLabelAttributes(
                        ['class' => 'col-sm-' . $offset . ' control-label']
                    );

                    $template = 'bootstrap-form-group';
                }

                $viewModel = new ViewModel();
                $viewModel->setVariable('element', $element);
                $viewModel->setVariable('offset', $offset);
                $viewModel->setTemplate(
                    'travello-view-helper/widget/' . $template
                );

                $output .= $this->getView()->render($viewModel);
            }
        }

        return [$output, $submitElements];
    }
858638
public function outputProfiling($blnPrintOutput = true)
    {
        $strPath = isset($_SERVER['REQUEST_URI']) ?
            $_SERVER['REQUEST_URI'] :
            $_SERVER['PHP_SELF'];

        $strOut = '<div class="qDbProfile">';
        if ($this->blnEnableProfiling) {
            $strOut .= sprintf('<form method="post" id="frmDbProfile%s" action="%s/profile.php"><div>',
                $this->intDatabaseIndex, QCUBED_PHP_URL);
            $strOut .= sprintf('<input type="hidden" name="strProfileData" value="%s" />',
                base64_encode(serialize($this->strProfileArray)));
            $strOut .= sprintf('<input type="hidden" name="intDatabaseIndex" value="%s" />', $this->intDatabaseIndex);
            $strOut .= sprintf('<input type="hidden" name="strReferrer" value="%s" /></div></form>',
                htmlentities($strPath));

            $intCount = round(count($this->strProfileArray));
            if ($intCount == 0) {
                $strQueryString = 'No queries';
            } else {
                if ($intCount == 1) {
                    $strQueryString = '1 query';
                } else {
                    $strQueryString = $intCount . ' queries';
                }
            }

            $strOut .= sprintf('<b>PROFILING INFORMATION FOR DATABASE CONNECTION #%s</b>: %s performed.  Please <a href="#" onclick="var frmDbProfile = document.getElementById(\'frmDbProfile%s\'); frmDbProfile.target = \'_blank\'; frmDbProfile.submit(); return false;">click here to view profiling detail</a><br />',
                $this->intDatabaseIndex, $strQueryString, $this->intDatabaseIndex);
        } else {
            $strOut .= '<form></form><b>Profiling was not enabled for this database connection (#' . $this->intDatabaseIndex . ').</b>  To enable, ensure that ENABLE_PROFILING is set to TRUE.';
        }
        $strOut .= '</div>';

        $strOut .= '<script>$j(function() {$j(".qDbProfile").draggable();});</script>';    // make it draggable so you can move it out of the way if needed.

        if ($blnPrintOutput) {
            print ($strOut);
            return null;
        } else {
            return $strOut;
        }
    }
477955
public function getDynamicCount($blnParentIsDynamic = false)
    {
        $intReturn = 0;

        if (($this->__dynamic || $blnParentIsDynamic) && is_object($this->__dynamiccounter)) {
            $intReturn = $this->__dynamiccounter->getValidator()->getValue();
        }

        return (int) $intReturn;
    }
500858
protected final function add_response($count, $label = null, $required = false) {
        if ($label === null) {
            $label = get_string('response', 'lesson');
        }
        $this->_form->addElement('editor', 'response_editor['.$count.']', $label,
                 array('rows' => '4', 'columns' => '80'),
                 array('noclean' => true, 'maxfiles' => EDITOR_UNLIMITED_FILES, 'maxbytes' => $this->_customdata['maxbytes']));
        $this->_form->setType('response_editor['.$count.']', PARAM_RAW);
        $this->_form->setDefault('response_editor['.$count.']', array('text' => '', 'format' => FORMAT_HTML));

        if ($required) {
            $this->_form->addRule('response_editor['.$count.']', get_string('required'), 'required', null, 'client');
        }
    }
878787
public function beforeFormDisplay ($form, $isNew)
    {
        if ($this->useTabbedForms || $form instanceof \Gems_Form_TableForm) {
            //If needed, add a row of link buttons to the bottom of the form
            if ($links = $this->createMenuLinks($isNew ? $this->menuCreateIncludeLevel : $this->menuEditIncludeLevel)) {
                $linkContainer = \MUtil_Html::create()->div(array('class' => 'element-container-labelless'));
                $linkContainer[] = $links;

                $element = $form->createElement('html', 'formLinks');
                $element->setValue($linkContainer);
                $element->setOrder(999);
                if ($form instanceof \Gems_TabForm)  {
                    $form->resetContext();
                }
                $form->addElement($element);
                $form->addDisplayGroup(array('formLinks'), 'form_buttons');
            }
        } else {
            if (\MUtil_Bootstrap::enabled() !== true) {
                $table = new \MUtil_Html_TableElement(array('class' => 'formTable'));
                $table->setAsFormLayout($form, true, true);
                $table['tbody'][0][0]->class = 'label';  // Is only one row with formLayout, so all in output fields get class.

                if ($links = $this->createMenuLinks($isNew ? $this->menuCreateIncludeLevel : $this->menuEditIncludeLevel)) {
                    $table->tf(); // Add empty cell, no label
                    $linksCell = $table->tf($links);
                }
            } elseif ($links = $this->createMenuLinks($isNew ? $this->menuCreateIncludeLevel : $this->menuEditIncludeLevel)) {
                $element = $form->createElement('html', 'menuLinks');
                $element->setValue($links);
                $element->setOrder(999);
                $form->addElement($element);
            }
        }

        return $form;
    }
1272626
public function getHtmlOutput(\Zend_View_Abstract $view)
    {
        $seq = $this->getHtmlSequence();

        $seq->h2($this->_('Checks'));

        $ul = $seq->ul();
        $ul->li($this->_('Executes respondent change event for all active respondents.'));

        $seq->pInfo($this->_(
                'Run this code when the respondent change event was changed or e.g. when a new "default" track was created.'
                ));

        return $seq;
    }
197331
private static function renderBootstrapMultiselectPlugin($count) {

        $html = '<script type="text/javascript">';
        $html .= '$(document).ready(function() {';
        $html .= "$('#parent_id').multiselect(";
        $html .= "{";

        $html .= "nonSelectedText: 'Select a category',";
        $html .= 'enableHTML: false,';
        $html .= "maxHeight: 200,";

        if ($count > 10) {
            $html .= "enableFiltering: true,";
            $html .= "enableCaseInsensitiveFiltering: false,";
            $html .= "enableFullValueFiltering: false,";
            $html .= "filterBehavior: 'text',";
            $html .= "filterPlaceholder: 'Search...',";
        }

        $html .= "buttonClass: 'btn btn-default'";

        $html .= "}";
        $html .= ");";
        $html .= '});';
        $html .= '</script>';

        return $html;
}
1161115
function listInboundRuleTriggers($count = 100, $offset = 0) {
		$query = array();

		$query["count"] = $count;
		$query["offset"] = $offset;

		return new DynamicResponseModel($this->processRestRequest('GET', '/triggers/inboundrules', $query));
	}
782447
public function render(ElementInterface $element): string
    {
        if (! $element instanceof LabelAwareInterface) {
            throw new InvalidClassException(
                sprintf(
                    'The given element "%s" does not implement "%s"',
                    $element->name(),
                    LabelAwareInterface::class
                )
            );
        }

        if ($element->label() === '') {
            return '';
        }

        $attributes = $element->labelAttributes();
        if (! isset($attributes['for'])) {
            $attributes['for'] = $element->id();
        }

        return sprintf(
            '<label %s>%s</label>',
            $this->attributesToString($attributes),
            $element->label()
        );
    }
955896
protected void renderInputTagEnd(ResponseWriter rw, SelectBooleanCheckbox selectBooleanCheckbox)
			throws IOException {
		rw.endElement("input");
		String caption = selectBooleanCheckbox.getCaption();
		if (null != caption) {
			if (selectBooleanCheckbox.isEscape()) {
				rw.writeText(" " + caption, null);
			} else {
				rw.append(" " + caption);
			}
		}
		rw.endElement("label");
		rw.endElement("div");
	}
288974
public function renderForm( $legend = null, $submitButton = 'Submit', array $attributes = array() )
    {
        if ( static::VerticalGroupPattern !== $this->_blockPattern )
        {
            $attributes['class'] = static::addValue( Option::get( $attributes, 'class', array() ), 'form' . $this->_formType );
        }

        $_html = Convert::kvpToString( $attributes );

        if ( !empty( $legend ) )
        {
            $legend = static::wrap( 'legend', $legend );
        }

        $_submit = null;

        if ( !empty( $submitButton ) )
        {
            $_submit = $this->button(
                'submit',
                array(
                    'text' => ( true === $submitButton ? 'Submit' : $submitButton ),
                )
            );
        }

        $_html = <<<HTML
<form {$_html}>
	{$legend}
	{$this->_contents}
	<div class="form-actions">
	{$_submit}
	</div>
	{$this->_csrf}
</form>
HTML;

        $this->_contents = null;

        return $_html;
    }
584371
public function outputFileCount(int $count): void
    {
        if (OutputInterface::VERBOSITY_NORMAL === $this->io->getVerbosity()) {
            $this->progressBar = $this->io->createProgressBar($count);
            $this->progressBar->start();
        } elseif ($this->io->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE) {
            $this->progressBar = new ProgressBar(new NullOutput());
        }
    }
778384
protected String renderRadio(FacesContext facesContext,
                               UIInput uiComponent,
                               String value,
                               boolean disabled,
                               boolean checked,
                               boolean renderId,
                               Integer itemNum)
            throws IOException
    {
        String clientId = uiComponent.getClientId(facesContext);

        String itemId = (itemNum == null)? null : clientId + 
                facesContext.getNamingContainerSeparatorChar() + itemNum;

        ResponseWriter writer = facesContext.getResponseWriter();

        writer.startElement(HTML.INPUT_ELEM, uiComponent);

        if (itemId != null)
        {
            writer.writeAttribute(HTML.ID_ATTR, itemId, null);
        }
        else if (renderId)
        {
            writer.writeAttribute(HTML.ID_ATTR, clientId, null);
        }
        writer.writeAttribute(HTML.TYPE_ATTR, HTML.INPUT_TYPE_RADIO, null);
        writer.writeAttribute(HTML.NAME_ATTR, clientId, null);

        if (disabled)
        {
            writer.writeAttribute(HTML.DISABLED_ATTR, HTML.DISABLED_ATTR, null);
        }

        if (checked)
        {
            writer.writeAttribute(HTML.CHECKED_ATTR, HTML.CHECKED_ATTR, null);
        }

        if (value != null)
        {
            writer.writeAttribute(HTML.VALUE_ATTR, value, null);
        }
        else
        {
            writer.writeAttribute(HTML.VALUE_ATTR, "", null);
        }
        
        Map<String, List<ClientBehavior>> behaviors = null;
        if (uiComponent instanceof ClientBehaviorHolder)
        {
            behaviors = ((ClientBehaviorHolder) uiComponent).getClientBehaviors();
            
            long commonPropertiesMarked = 0L;
            if (isCommonPropertiesOptimizationEnabled(facesContext))
            {
                commonPropertiesMarked = CommonPropertyUtils.getCommonPropertiesMarked(uiComponent);
            }
            if (behaviors.isEmpty() && isCommonPropertiesOptimizationEnabled(facesContext))
            {
                CommonPropertyUtils.renderChangeEventProperty(writer, 
                        commonPropertiesMarked, uiComponent);
                CommonPropertyUtils.renderEventProperties(writer, 
                        commonPropertiesMarked, uiComponent);
                CommonPropertyUtils.renderFieldEventPropertiesWithoutOnchange(writer, 
                        commonPropertiesMarked, uiComponent);
            }
            else
            {
                HtmlRendererUtils.renderBehaviorizedOnchangeEventHandler(facesContext, writer, uiComponent, behaviors);
                if (isCommonEventsOptimizationEnabled(facesContext))
                {
                    Long commonEventsMarked = CommonEventUtils.getCommonEventsMarked(uiComponent);
                    CommonEventUtils.renderBehaviorizedEventHandlers(facesContext, writer, 
                            commonPropertiesMarked, commonEventsMarked, uiComponent, behaviors);
                    CommonEventUtils.renderBehaviorizedFieldEventHandlersWithoutOnchange(
                        facesContext, writer, commonPropertiesMarked, commonEventsMarked, uiComponent, behaviors);
                }
                else
                {
                    HtmlRendererUtils.renderBehaviorizedEventHandlers(facesContext, writer, uiComponent, behaviors);
                    HtmlRendererUtils.renderBehaviorizedFieldEventHandlersWithoutOnchange(
                            facesContext, writer, uiComponent, behaviors);
                }
            }
            HtmlRendererUtils.renderHTMLAttributes(writer, uiComponent, 
                    HTML.INPUT_PASSTHROUGH_ATTRIBUTES_WITHOUT_DISABLED_AND_STYLE_AND_EVENTS);
        }
        else
        {
            HtmlRendererUtils.renderHTMLAttributes(writer, uiComponent, 
                    HTML.INPUT_PASSTHROUGH_ATTRIBUTES_WITHOUT_DISABLED_AND_STYLE);
        }

        if (isDisabled(facesContext, uiComponent))
        {
            writer.writeAttribute(org.apache.myfaces.shared.renderkit.html.HTML.DISABLED_ATTR, Boolean.TRUE, null);
        }

        writer.endElement(HTML.INPUT_ELEM);

        return itemId;
    }