Generate extra HTML output to facilitate the dynamic duplication logic
@param int $intCount
@return string
323756
protected function getDynamicHtml($intCount = 0)
    {
        $strReturn = "";

        if ($this->__dynamic && ! empty($this->__dynamicLabel)) {
            $arrFields = array();
            // Generate an array of field id's
            foreach ($this->__fields as $field) {
                switch (get_class($field)) {
                    case "ValidFormBuilder\\MultiField":
                        /* @var $subField Element */
                        foreach ($field->getFields() as $subField) {
                            // Skip the hidden dynamic counter fields.
                            if ((get_class($subField) == "ValidFormBuilder\\Hidden") && $subField->isDynamicCounter()) {
                                continue;
                            }

                            if (!empty($field->getName())) {
                                $arrFields[$subField->getId()] = $subField->getName();
                            }
                        }

                        break;
                    default:
                        // Skip the hidden dynamic counter fields.
                        if ((get_class($field) == "ValidFormBuilder\\Hidden") && $field->isDynamicCounter()) {
                            continue;
                        }

                        if (!empty($field->getName())) {
                            $arrFields[$field->getId()] = $field->getName();
                        }

                        break;
                }
            }

            //*** Store the active area's checkbox in the dynamic fields array as well
            $areaName = ($intCount == 0) ? $this->getName() : $this->getName() . "_" . $intCount;
            if ($this->__active) {
                $arrFields[$areaName] = $areaName;
            }

            $strReturn .= "<div class=\"vf__dynamic\"{$this->getDynamicButtonMeta()}>";
            $strReturn .= "<a href=\"#\" data-target-id=\"" . implode("|", array_keys(array_filter($arrFields)))
                . "\" data-target-name=\"" . implode("|", array_values(array_filter($arrFields)))
                . "\"{$this->__getDynamicLabelMetaString()}>{$this->__dynamicLabel}</a>";
            $strReturn .= "</div>";
        }

        return $strReturn;
    }
384314
public function render(array $changeCounts)
    {
        $this->templateVariableContainer->add('newCountRatio', $changeCounts['new'] / $changeCounts['total'] * 100);
        $this->templateVariableContainer->add('changedCountRatio', $changeCounts['changed'] / $changeCounts['total'] * 100);
        $this->templateVariableContainer->add('removedCountRatio', $changeCounts['removed'] / $changeCounts['total'] * 100);
        $content = $this->renderChildren();
        $this->templateVariableContainer->remove('newCountRatio');
        $this->templateVariableContainer->remove('changedCountRatio');
        $this->templateVariableContainer->remove('removedCountRatio');

        return $content;
    }
132390
private function getOutput()
    {
        $output = "# Todo list\n\n";

        // Make menu
        $columns = 12;

        $captions = implode('|', array_fill(0, $columns, ' '));
        $subcaptions = implode('|', array_fill(0, $columns, ':---:'));

        $output .= "|$captions|\n";
        $output .= "|$subcaptions|\n";

        $menu = [];
        foreach (array_keys($this->output) as $language) {
            $menu[] = "[$language](#$language)";
        }

        $rows = array_chunk($menu, $columns);
        array_map(function ($row) use (&$output) {
            $row = implode(' | ', $row);
            $output .= $row."\n";
        }, $rows);

        $output .= "\n\n";

        // Make items
        foreach ($this->output as $language => $values) {
            $output .= "#### {$language}:\n";
            $output .= implode(PHP_EOL, $values);
            $output .= "\n\n[ [to top](#todo-list) ]\n\n";
        }

        return $output;
    }
666303
public function getSimple(bool $isCount = false): \Assurrussa\GridView\Helpers\GridViewResult
    {
        $gridViewResult = $this->_getGridView($isCount);
        $gridViewResult->data = $this->pagination->getSimple($this->page, $this->limit, $isCount);
        $gridViewResult->pagination = $this->_getPaginationRender();
        $gridViewResult->simple = true;

        return $gridViewResult;
    }
322693
public function __toHtml($submitted = false, $blnSimpleLayout = false, $blnLabel = true, $blnDisplayErrors = true, $intCount = 0)
    {
        return $this->toHtml($submitted, $blnSimpleLayout, $blnLabel, $blnDisplayErrors);
    }
828711
public function output_html($data, $query='') {
        global $CFG, $USER, $OUTPUT;

        // Get strings that are used
        $strshow = get_string('on', 'repository');
        $strhide = get_string('off', 'repository');
        $strdelete = get_string('disabled', 'repository');

        $actionchoicesforexisting = array(
            'show' => $strshow,
            'hide' => $strhide,
            'delete' => $strdelete
        );

        $actionchoicesfornew = array(
            'newon' => $strshow,
            'newoff' => $strhide,
            'delete' => $strdelete
        );

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

        // Set strings that are used multiple times
        $settingsstr = get_string('settings');
        $disablestr = get_string('disable');

        // Table to list plug-ins
        $table = new html_table();
        $table->head = array(get_string('name'), get_string('isactive', 'repository'), get_string('order'), $settingsstr);
        $table->align = array('left', 'center', 'center', 'center', 'center');
        $table->data = array();

        // Get list of used plug-ins
        $repositorytypes = repository::get_types();
        if (!empty($repositorytypes)) {
            // Array to store plugins being used
            $alreadyplugins = array();
            $totalrepositorytypes = count($repositorytypes);
            $updowncount = 1;
            foreach ($repositorytypes as $i) {
                $settings = '';
                $typename = $i->get_typename();
                // Display edit link only if you can config the type or if it has multiple instances (e.g. has instance config)
                $typeoptionnames = repository::static_function($typename, 'get_type_option_names');
                $instanceoptionnames = repository::static_function($typename, 'get_instance_option_names');

                if (!empty($typeoptionnames) || !empty($instanceoptionnames)) {
                    // Calculate number of instances in order to display them for the Moodle administrator
                    if (!empty($instanceoptionnames)) {
                        $params = array();
                        $params['context'] = array(context_system::instance());
                        $params['onlyvisible'] = false;
                        $params['type'] = $typename;
                        $admininstancenumber = count(repository::static_function($typename, 'get_instances', $params));
                        // site instances
                        $admininstancenumbertext = get_string('instancesforsite', 'repository', $admininstancenumber);
                        $params['context'] = array();
                        $instances = repository::static_function($typename, 'get_instances', $params);
                        $courseinstances = array();
                        $userinstances = array();

                        foreach ($instances as $instance) {
                            $repocontext = context::instance_by_id($instance->instance->contextid);
                            if ($repocontext->contextlevel == CONTEXT_COURSE) {
                                $courseinstances[] = $instance;
                            } else if ($repocontext->contextlevel == CONTEXT_USER) {
                                $userinstances[] = $instance;
                            }
                        }
                        // course instances
                        $instancenumber = count($courseinstances);
                        $courseinstancenumbertext = get_string('instancesforcourses', 'repository', $instancenumber);

                        // user private instances
                        $instancenumber =  count($userinstances);
                        $userinstancenumbertext = get_string('instancesforusers', 'repository', $instancenumber);
                    } else {
                        $admininstancenumbertext = "";
                        $courseinstancenumbertext = "";
                        $userinstancenumbertext = "";
                    }

                    $settings .= '<a href="' . $this->baseurl . '&amp;action=edit&amp;repos=' . $typename . '">' . $settingsstr .'</a>';

                    $settings .= $OUTPUT->container_start('mdl-left');
                    $settings .= '<br/>';
                    $settings .= $admininstancenumbertext;
                    $settings .= '<br/>';
                    $settings .= $courseinstancenumbertext;
                    $settings .= '<br/>';
                    $settings .= $userinstancenumbertext;
                    $settings .= $OUTPUT->container_end();
                }
                // Get the current visibility
                if ($i->get_visible()) {
                    $currentaction = 'show';
                } else {
                    $currentaction = 'hide';
                }

                $select = new single_select($this->repository_action_url($typename, 'repos'), 'action', $actionchoicesforexisting, $currentaction, null, 'applyto' . basename($typename));

                // Display up/down link
                $updown = '';
                // Should be done with CSS instead.
                $spacer = $OUTPUT->spacer(array('height' => 15, 'width' => 15, 'class' => 'smallicon'));

                if ($updowncount > 1) {
                    $updown .= "<a href=\"$this->baseurl&amp;action=moveup&amp;repos=".$typename."\">";
                    $updown .= $OUTPUT->pix_icon('t/up', get_string('moveup')) . '</a>&nbsp;';
                }
                else {
                    $updown .= $spacer;
                }
                if ($updowncount < $totalrepositorytypes) {
                    $updown .= "<a href=\"$this->baseurl&amp;action=movedown&amp;repos=".$typename."\">";
                    $updown .= $OUTPUT->pix_icon('t/down', get_string('movedown')) . '</a>&nbsp;';
                }
                else {
                    $updown .= $spacer;
                }

                $updowncount++;

                $table->data[] = array($i->get_readablename(), $OUTPUT->render($select), $updown, $settings);

                if (!in_array($typename, $alreadyplugins)) {
                    $alreadyplugins[] = $typename;
                }
            }
        }

        // Get all the plugins that exist on disk
        $plugins = core_component::get_plugin_list('repository');
        if (!empty($plugins)) {
            foreach ($plugins as $plugin => $dir) {
                // Check that it has not already been listed
                if (!in_array($plugin, $alreadyplugins)) {
                    $select = new single_select($this->repository_action_url($plugin, 'repos'), 'action', $actionchoicesfornew, 'delete', null, 'applyto' . basename($plugin));
                    $table->data[] = array(get_string('pluginname', 'repository_'.$plugin), $OUTPUT->render($select), '', '');
                }
            }
        }

        $return .= html_writer::table($table);
        $return .= $OUTPUT->box_end();
        return highlight($query, $return);
    }
855170
public function extract($colorCount = 1)
    {
        if (!$this->isInitialized()) {
            $this->initialize();
        }

        return self::mergeColors($this->sortedColors, $colorCount, 100 / $colorCount);
    }
192913
public function getHtml(): string
  {
    $this->prepareOverviewTable();

    if (!empty($this->templateData))
    {
      $this->setAttrData('slat-name', $this->submitName);

      // If required add template row to this louver control. This row will be used by JS for adding dynamically
      // additional rows to the louver control.
      $this->templateData[$this->templateKey] = 0;
      $row                                    = $this->rowFactory->createRow($this, $this->templateData);
      $row->addClass('slat_template');
      $row->setAttrStyle('visibility: collapse');
      $row->prepare($this->submitName);
    }

    $ret = $this->prefix;

    $ret .= Html::generateTag('table', $this->attributes);

    // Generate HTML code for the column classes.
    $ret .= '<colgroup>';
    $ret .= $this->rowFactory->getHtmlColumnGroup();
    $ret .= '</colgroup>';

    $ret .= Html::generateTag('thead', ['class' => OverviewTable::$class]);
    $ret .= $this->getHtmlHeader();
    $ret .= '</thead>';

    if ($this->footerControl)
    {
      $ret .= Html::generateTag('tfoot', ['class' => OverviewTable::$class]);
      $ret .= '<tr>';
      $ret .= Html::generateTag('td', ['colspan' => $this->rowFactory->getNumberOfColumns()]);
      $ret .= $this->footerControl->getHtml();
      $ret .= '</td>';
      $ret .= '<td class="error"></td>';
      $ret .= '</tr>';
      $ret .= '</tfoot>';
    }

    $ret .= Html::generateTag('tbody', ['class' => OverviewTable::$class]);
    $ret .= $this->getHtmlBody();
    $ret .= '</tbody>';

    $ret .= '</table>';

    $ret .= $this->postfix;

    $this->rowFactory->generateResponsiveCss($this->getAttribute('id'));

    return $ret;
  }
990792
public function getOuterHtml()
    {
        $outer_html = '';

        if ($this->xml_mode && $this->xml_print_pi) {
            $outer_html .= '<?xml version="'.$this->document->xmlVersion.'" encoding="'.$this->document->xmlEncoding.'"?>';
            $outer_html .= "\n\n";
        }

        foreach ($this->nodes as $node) {
            if (isset($this->document)) {
                if ($this->xml_mode) {
                    $outer_html .= $this->document->saveXML($node);
                } else {
                    $outer_html .= $this->document->saveHTML($node);
                }
            }
        }

        $outer_html = $this->handleHtmlResult($outer_html);

        return $outer_html;
    }
1186569
public function generateURLSegment($increment = 0)
    {
        $increment = (int) $increment;
        $filter = URLSegmentFilter::create();

        // Setting this to on. Because of the UI flow, it would be quite a lot of work
        // to support turning this off. (ie. the add by title flow would not work).
        // If this becomes a problem we can approach it then.
        // @see https://github.com/silverstripe/silverstripe-blog/issues/376
        $filter->setAllowMultibyte(true);

        $this->URLSegment = $filter->filter($this->Title);

        if ($increment > 0) {
            $this->URLSegment .= '-' . $increment;
        }

        if ($this->getDuplicatesByField('URLSegment')->count() > 0) {
            $this->generateURLSegment($increment + 1);
        }

        return $this->URLSegment;
    }
780325
private function _getGridView(bool $isCount = false): \Assurrussa\GridView\Helpers\GridViewResult
    {
        $this->_fetch();

        $gridViewResult = new \Assurrussa\GridView\Helpers\GridViewResult();
        $gridViewResult->id = $this->getId();
        $gridViewResult->ajax = $this->ajax;
        $gridViewResult->formAction = $this->getFormAction();
        $gridViewResult->requestParams = $this->requestParams;
        $gridViewResult->headers = $this->columns->toArray();
        $gridViewResult->buttonCreate = $this->buttons->getButtonCreate();
        $gridViewResult->buttonExport = $this->buttons->getButtonExport();
        $gridViewResult->buttonCustoms = $this->buttons->render();
        $gridViewResult->inputCustoms = $this->inputs->render();
        $gridViewResult->filter = $this->_request->toArray();
        $gridViewResult->page = $this->page;
        $gridViewResult->orderBy = $this->orderBy;
        $gridViewResult->search = $this->search;
        $gridViewResult->limit = $this->limit;
        $gridViewResult->sortName = $this->sortName;
        $gridViewResult->counts = $this->counts;
        $gridViewResult->searchInput = $this->searchInput;

        return $gridViewResult;
    }
1373182
private function _generateBlockId($blockCount)
    {
        return base64_encode(self::BLOCK_ID_PREFIX.str_pad($blockCount, self::BLOCK_ID_PADDING, '0', STR_PAD_LEFT));
    }
199297
function tpl_keys_rowcount($attrib)
    {
        if (!$attrib['id'])
            $attrib['id'] = 'rcmcountdisplay';

        $this->rc->output->add_gui_object('countdisplay', $attrib['id']);

        return html::span($attrib, $this->get_rowcount_text());
    }
1085121
public function writeInHTMLOutput()
  {
    $image = $this->applyFilters();

    if ($this->extension == self::IMAGE_TYPE_JPG) {
      ob_start();
      imagejpeg($image, null, $this->jpgQuality);
      $contents = ob_get_contents();
      ob_end_clean();

      $base64 = "data:image/jpeg;base64," . base64_encode($contents);
      echo "<img src=$base64 />";
    } else if ($this->extension == self::IMAGE_TYPE_PNG) {
      ob_start();
      imagepng($image, null, $this->pngCompression);
      $contents = ob_get_contents();
      ob_end_clean();

      $base64 = "data:image/png;base64," . base64_encode($contents);
      echo "<img src=$base64 />";
    } else {
      throw new \Exception('Impossible de générer l\'image : extension non supportée');
    }
  }
883188
public function getTotalsRowHTML()
    {
        $output = [];
        foreach ($this->columns as $name => $column) {
            // if no totals plan, then show dash, but keep column formatting
            if (!isset($this->totals_plan[$name])) {
                $output[] = $column->getTag('foot', '-');
                continue;
            }

            // if totals plan is set as array, then show formatted value
            if (is_array($this->totals_plan[$name])) {
                // todo - format
                $field = $this->model->getElement($name);
                $output[] = $column->getTotalsCellHTML($field, $this->totals[$name]);
                continue;
            }

            // otherwise just show it, for example, "Totals:" cell
            $output[] = $column->getTag('foot', $this->totals_plan[$name]);
        }

        return implode('', $output);
    }
347420
public function iterNextPage($count = 3)
    {
        if ($this->getPage() == 1 && $this->getPagesCount() >= $count * 2) {
            $count *= 2;
        }
        $pages = [];
        foreach (range(1, $count) as $i) {
            $page = $this->getPage() + $i;
            if ($page <= $this->getPagesCount()) {
                $pages[] = $page;
            }
        }

        return $pages;
    }
328992
private function content(Post $post, int $count): string
    {
        $out = '';

        if (!$this->posts->isContent()) {
            return $out;
        }

        $content = $post->content(
            $this->posts->args['excerpt']['more_text'],
            '',
            $this->posts->args['excerpt']['paginate']
        );

        if (!$content) {
            return $out;
        }

        $out .= '<div class="entry-content" itemprop="articleBody">';
        $out .= $content;
        $out .= '</div><!-- .entry-content -->';

        return $out;
    }