Render css progress bar

@param $percent1
@param int $percent2
@param int $offset
@return string
331527
protected function renderProgressBar($percent1, $percent2 = 0, $offset = 0)
    {
        $percent1 = round(max(1, $percent1));
        $offset = round(max(0, $offset));
        $offset = round(min(99, $offset));

        $output = '<div class="progress">';
        $output .= '<div class="progress-bar">';
        $output .= '<div class="progress-bar1" style="width: ' . $percent1 . '%; margin-left: ' . $offset . '%;"></div>';

        if ($percent2 > 0) {
            $percent2 = round(max(1, $percent2));
            if ($percent1 + $percent2 + $offset > 100) {
                // preventing line break in css progress bar if widths and margins are bigger than 100%
                $percent2 = 100 - $percent1 - $offset;
                $percent2 = max(0, $percent2);
            }
            $output .= '<div class="progress-bar2" style="width: ' . $percent2 . '%"></div>';
        }

        $output .= '</div>';
        $output .= '</div>';
        return $output;
    }
497193
protected function _progressBar()
    {
        if ($this->_current > $this->_total) {
            return;
        }

        $percent = $this->_current / $this->_total;
        $nb = $percent * $this->_size;

        $b = str_repeat($this->_chars['bar'], floor($nb));
        $i = '';

        if ($nb < $this->_size) {
            $i = str_pad($this->_chars['indicator'], $this->_size - strlen($b));
        }

        $p = floor($percent * 100);

        $string = Text::insert($this->_format, compact('p', 'b', 'i'));

        $this->write("\r" . $string, $this->_color);
    }
117888
public function addProgressTrackingEvent($url, $offset)
    {
        // create Tracking
        $trackingDomElement = $this->linearCreativeDomElement->ownerDocument->createElement('Tracking');
        $this->getTrackingEventsDomElement()->appendChild($trackingDomElement);

        // add event attribute
        $trackingDomElement->setAttribute('event', self::EVENT_TYPE_PROGRESS);

        // add offset attribute
        if (is_numeric($offset)) {
            $offset = $this->secondsToString($offset);
        }
        $trackingDomElement->setAttribute('offset', $offset);

        // create cdata
        $cdata = $this->linearCreativeDomElement->ownerDocument->createCDATASection($url);
        $trackingDomElement->appendChild($cdata);

        return $this;
    }
688910
public function createReflection($percent, $reflection, $white, $border, $borderColor)
    {
        return new Plugins\Reflection($percent, $reflection, $white, $border, $borderColor);
    }
556601
protected function bootstrapProgressBar(ProgressBarInterface $progressBar) {

        $span = static::coreHTMLElement("span", $progressBar->getValue() . "%", ["class" => "sr-only"]);

        $attributes = [];

        $attributes["class"]         = ["progress-bar", ProgressBarRenderer::renderType($progressBar)];
        $attributes["class"][]       = ProgressBarRenderer::renderStriped($progressBar);
        $attributes["class"][]       = ProgressBarRenderer::renderAnimated($progressBar);
        $attributes["style"]         = ProgressBarRenderer::renderStyle($progressBar);
        $attributes["role"]          = "progressbar";
        $attributes["aria-valuenow"] = $progressBar->getValue();
        $attributes["aria-valuemin"] = $progressBar->getMin();
        $attributes["aria-valuemax"] = $progressBar->getMax() . "%";

        $innerHTML = ProgressBarRenderer::renderContent($progressBar, $span);

        $div = static::coreHTMLElement("div", $innerHTML, $attributes);

        return static::coreHTMLElement("div", $div, ["class" => "progress"]);
    }
55828
protected function render() : string
    {
        $html = '<div class="progress">';

        foreach ($this->values as $k => $value) {
            $styles = $this->styles($value);
            if (strlen($styles) > 0) {
                $styles = 'style="' . trim($styles) . '"';
            }

            $html .= '<div class="progress-bar' . $this->classes($this->bg_colors[$k]) . '" role="progressbar" ' .
                $styles . ' aria-valuenow="' . $value . '" aria-valuemin="0" aria-valuemax="100"></div>';
        }

        $html .= '</div>';

        return $html;
    }
903686
function percentPx(parentWd, WD, noNeg) {
        var wd = WD || 0; // ensure it is number  // null --> 0

        if (wd >= 1 || wd == 0) return wd;else if (wd <= -1) return noNeg ? 0 : wd;else if (typeof parentWd != 'number') return null;else if (wd >= 0.9999) // 100%
          return parentWd;else if (wd >= 0) return wd * parentWd;else {
          if (noNeg) return 0;
          if (wd > -0.9999) return wd * parentWd;else return -parentWd; // -100%
        }
      }
124717
protected function renderProgressbar()
    {
        /** @var \Tx_Phpunit_ViewHelpers_ProgressBarViewHelper $progressBarViewHelper */
        $progressBarViewHelper = GeneralUtility::makeInstance(\Tx_Phpunit_ViewHelpers_ProgressBarViewHelper::class);
        $progressBarViewHelper->injectOutputService($this->outputService);
        $progressBarViewHelper->render();
    }
946695
public static String percentageBar(double percentage) {
        final char  dot   = '.';
        final char  mark  = '#';
        final int   slots = 40;

        StringBuilder bar = new StringBuilder(replicate(String.valueOf(dot), slots));
        int numSlots = (int) (slots * percentage / 100.0);
        for (int k = 0; k < numSlots; ++k) bar.setCharAt(k, mark);

        return String.format("[%s] %3.0f%%", bar, percentage);
    }
498941
public function progress_bar(array $items) {
        foreach ($items as &$item) {
            $text = $item['text'];
            unset($item['text']);
            if (array_key_exists('link', $item)) {
                $link = $item['link'];
                unset($item['link']);
                $item = html_writer::link($link, $text, $item);
            } else {
                $item = html_writer::tag('span', $text, $item);
            }
        }
        return html_writer::tag('div', join(get_separator(), $items), array('class' => 'backup_progress clearfix'));
    }
1318619
public static function percentage($number1 = false, $number2 = false, $decimals = 2) {

        if($number1 && $number2) {

            return self::round(($number1 / $number2) * 100, $decimals);
        }

        return false;
    }
719417
public function scale($percent)
    {
        $this->mode = 'percentualScale';
        $this->targetSize = [$percent, null];
        $this->arguments = [];

        return $this->process();
    }
91769
public function percToProgressbarClass($perc, $translatedThreshold = null)
    {
        if ($translatedThreshold === null) {
            $translatedThreshold = $this->getTranslatedThreshold();
        }
        if ($perc >= 100) {
            $percClass = 'progress-bar-success';
        } elseif ($perc >= $translatedThreshold) {
            $percClass = 'progress-bar-info';
        } elseif ($perc > 0) {
            $percClass = 'progress-bar-warning';
        } else {
            $percClass = 'progress-bar-danger';
        }
        if ($perc > 0 && $perc < 10) {
            $percClass .= ' progress-bar-minwidth1';
        } elseif ($perc >= 10 && $perc < 100) {
            $percClass .= ' progress-bar-minwidth2';
        }

        return $percClass;
    }
207970
public function lighten($percent)
    {
        $color = $this->toHsl();
        $lightness = $this->clamp(($color->lightness() + $percent) / 100);
        return $color->lightness($lightness * 100)->back($this);
    }
940528
private function renderDiff($lines1, $lines2)
    {
        if (!is_array($lines1)) {
            $lines1 = explode("\n", $lines1);
        }
        if (!is_array($lines2)) {
            $lines2 = explode("\n", $lines2);
        }
        foreach ($lines1 as $i => $line) {
            $lines1[$i] = rtrim($line, "\r\n");
        }
        foreach ($lines2 as $i => $line) {
            $lines2[$i] = rtrim($line, "\r\n");
        }

        $renderer = new DiffRendererHtmlInline();
        $diff = new \Diff($lines1, $lines2);

        return $diff->render($renderer);
    }
747407
public function brighten($percent)
    {
        $percent *= -1;
        $color = $this->toRgb();
        $color->red(max(0, min(255, $color->red() - round(255 * ($percent / 100)))));
        $color->green(max(0, min(255, $color->green() - round(255 * ($percent / 100)))));
        $color->blue(max(0, min(255, $color->blue() - round(255 * ($percent / 100)))));
        return $color->back($this);
    }
940402
public function renderTemplate($offset='') {
		$randstr = \Asgard\Common\Tools::randstr(10);
		$jq = $this->renderNew('{{'.$randstr.'}}');
		$jq = addcslashes((string)$jq, "'");
		$jq = str_replace("\r\n", "\n", $jq);
		$jq = str_replace("\n", "\\\n", $jq);
		$jq = str_replace('{{'.$randstr.'}}', $offset, $jq);
		return $jq;
	}