mirror of
https://github.com/e107inc/e107.git
synced 2025-04-13 17:12:07 +02:00
'progressbar' field type added to custom fields handler. progressbar() now accepts values like '8/10'
This commit is contained in:
parent
dfb8435d58
commit
39ef6aecab
@ -14,7 +14,7 @@
|
||||
private $_fieldTypes = array(
|
||||
'number', 'email', 'url', 'password', 'text', 'tags', 'textarea',
|
||||
'bbarea', 'image', 'file', 'icon', 'datestamp', 'checkboxes', 'dropdown', 'radio',
|
||||
'userclass', 'user', 'boolean', 'checkbox', 'hidden', 'lanlist', 'language', 'country', 'video'
|
||||
'userclass', 'user', 'boolean', 'checkbox', 'hidden', 'lanlist', 'language', 'country', 'video', 'progressbar'
|
||||
|
||||
);
|
||||
|
||||
@ -150,6 +150,8 @@
|
||||
return ($raw) ? 'https://www.youtube.com/watch?v='.str_replace(".youtube", '', $value) : $tp->toVideo($value);
|
||||
break;
|
||||
|
||||
|
||||
|
||||
case "image":
|
||||
return ($raw) ? $tp->thumbUrl($value) : $tp->toImage($value);
|
||||
break;
|
||||
@ -192,6 +194,10 @@
|
||||
return ($raw) ? $value : e107::getUserClass()->getName($value);
|
||||
break;
|
||||
|
||||
case "progressbar":
|
||||
return ($raw) ? $value.'%' : e107::getForm()->progressBar($key,$value,$this->_config[$key]);
|
||||
break;
|
||||
|
||||
case "textarea":
|
||||
case "bbarea":
|
||||
return $tp->toHtml($value, true);
|
||||
|
@ -1869,7 +1869,7 @@ class e_form
|
||||
/**
|
||||
* Render a bootStrap ProgressBar.
|
||||
* @param string $name
|
||||
* @param number $value
|
||||
* @param number|string $value
|
||||
* @param array $options
|
||||
* @example Use
|
||||
*/
|
||||
@ -1891,11 +1891,28 @@ class e_form
|
||||
|
||||
$striped = (vartrue($options['btn-label'])) ? ' progress-striped active' : '';
|
||||
|
||||
$percVal = number_format($value,0).'%';
|
||||
if(strpos($value,'/')!==false)
|
||||
{
|
||||
$label = $value;
|
||||
list($score,$denom) = explode('/',$value);
|
||||
|
||||
$multiplier = 100 / (int) $denom;
|
||||
|
||||
$value = (int) $score * (int) $multiplier;
|
||||
$percVal = number_format($value,0).'%';
|
||||
}
|
||||
else
|
||||
{
|
||||
$percVal = number_format($value,0).'%';
|
||||
$label = $percVal;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
$text = "<div class='progress ".$class."{$striped}' >
|
||||
<div id='".$target."' class='progress-bar bar' role='progressbar' aria-valuenow='".intval($value)."' aria-valuemin='0' aria-valuemax='100' style='min-width: 2em;width: ".$percVal."'>";
|
||||
$text .= $percVal;
|
||||
$text .= $label;
|
||||
$text .= "</div>
|
||||
</div>";
|
||||
|
||||
@ -5323,6 +5340,7 @@ class e_form
|
||||
break;
|
||||
|
||||
case 'text':
|
||||
case 'progressbar':
|
||||
|
||||
$maxlength = vartrue($parms['maxlength'], 255);
|
||||
unset($parms['maxlength']);
|
||||
|
Loading…
x
Reference in New Issue
Block a user