mirror of
https://github.com/e107inc/e107.git
synced 2025-08-03 21:27:25 +02:00
'progressbar' field type added to custom fields handler. progressbar() now accepts values like '8/10'
This commit is contained in:
@@ -14,7 +14,7 @@
|
|||||||
private $_fieldTypes = array(
|
private $_fieldTypes = array(
|
||||||
'number', 'email', 'url', 'password', 'text', 'tags', 'textarea',
|
'number', 'email', 'url', 'password', 'text', 'tags', 'textarea',
|
||||||
'bbarea', 'image', 'file', 'icon', 'datestamp', 'checkboxes', 'dropdown', 'radio',
|
'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);
|
return ($raw) ? 'https://www.youtube.com/watch?v='.str_replace(".youtube", '', $value) : $tp->toVideo($value);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
case "image":
|
case "image":
|
||||||
return ($raw) ? $tp->thumbUrl($value) : $tp->toImage($value);
|
return ($raw) ? $tp->thumbUrl($value) : $tp->toImage($value);
|
||||||
break;
|
break;
|
||||||
@@ -192,6 +194,10 @@
|
|||||||
return ($raw) ? $value : e107::getUserClass()->getName($value);
|
return ($raw) ? $value : e107::getUserClass()->getName($value);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case "progressbar":
|
||||||
|
return ($raw) ? $value.'%' : e107::getForm()->progressBar($key,$value,$this->_config[$key]);
|
||||||
|
break;
|
||||||
|
|
||||||
case "textarea":
|
case "textarea":
|
||||||
case "bbarea":
|
case "bbarea":
|
||||||
return $tp->toHtml($value, true);
|
return $tp->toHtml($value, true);
|
||||||
|
@@ -1869,7 +1869,7 @@ class e_form
|
|||||||
/**
|
/**
|
||||||
* Render a bootStrap ProgressBar.
|
* Render a bootStrap ProgressBar.
|
||||||
* @param string $name
|
* @param string $name
|
||||||
* @param number $value
|
* @param number|string $value
|
||||||
* @param array $options
|
* @param array $options
|
||||||
* @example Use
|
* @example Use
|
||||||
*/
|
*/
|
||||||
@@ -1891,11 +1891,28 @@ class e_form
|
|||||||
|
|
||||||
$striped = (vartrue($options['btn-label'])) ? ' progress-striped active' : '';
|
$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}' >
|
$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."'>";
|
<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>
|
$text .= "</div>
|
||||||
</div>";
|
</div>";
|
||||||
|
|
||||||
@@ -5323,6 +5340,7 @@ class e_form
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'text':
|
case 'text':
|
||||||
|
case 'progressbar':
|
||||||
|
|
||||||
$maxlength = vartrue($parms['maxlength'], 255);
|
$maxlength = vartrue($parms['maxlength'], 255);
|
||||||
unset($parms['maxlength']);
|
unset($parms['maxlength']);
|
||||||
|
Reference in New Issue
Block a user