forked from lh/OpenEyes
/
Slider.php
55 lines (50 loc) · 1.75 KB
/
Slider.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
/**
* OpenEyes
*
* (C) Moorfields Eye Hospital NHS Foundation Trust, 2008-2011
* (C) OpenEyes Foundation, 2011-2013
* This file is part of OpenEyes.
* OpenEyes is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
* OpenEyes is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
* You should have received a copy of the GNU General Public License along with OpenEyes in a file titled COPYING. If not, see <http://www.gnu.org/licenses/>.
*
* @package OpenEyes
* @link http://www.openeyes.org.uk
* @author OpenEyes <info@openeyes.org.uk>
* @copyright Copyright (c) 2008-2011, Moorfields Eye Hospital NHS Foundation Trust
* @copyright Copyright (c) 2011-2013, OpenEyes Foundation
* @license http://www.gnu.org/licenses/gpl-3.0.html The GNU General Public License V3.0
*/
class Slider extends BaseFieldWidget
{
public $min;
public $max;
public $step;
public $force_dp = false;
public $prefix_positive = false;
public $remap_values = false;
public $null;
public $value_display;
public $append = '';
public $width;
public $painScale;
public function init()
{
parent::init();
if ($this->null) {
$this->max += 1;
if ($this->value === null) {
$this->value = 0;
$this->value_display = 'NR';
} else {
$this->value_display = $this->value++;
}
} else {
$this->value_display = $this->value;
}
if ($this->width && !preg_match('/[^0-9]/', $this->width)) {
$this->width .= 'px';
}
}
}