1
|
|
|
<?php |
2
|
|
|
namespace Ajax\semantic\html\modules; |
3
|
|
|
|
4
|
|
|
use Ajax\semantic\html\base\HtmlSemDoubleElement; |
5
|
|
|
use Ajax\JsUtils; |
6
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* Ajax\semantic\html\modules$HtmlSlider |
9
|
|
|
* This class is part of phpMv-ui |
10
|
|
|
* @author jcheron <[email protected]> |
11
|
|
|
* @version 1.0.0 |
12
|
|
|
* @since 2.3.0 |
13
|
|
|
* @see https://fomantic-ui.com/modules/slider.html |
14
|
|
|
* |
15
|
|
|
*/ |
16
|
|
|
class HtmlSlider extends HtmlSemDoubleElement { |
17
|
|
|
|
18
|
|
|
protected $_paramParts=array(); |
19
|
|
|
public function __construct($identifier, $content='') { |
20
|
|
|
parent::__construct($identifier, 'div','ui slider'); |
21
|
|
|
} |
22
|
|
|
|
23
|
|
|
public function setLabeled(){ |
24
|
|
|
$this->addClass('labeled'); |
25
|
|
|
} |
26
|
|
|
|
27
|
|
|
public function setTicked(){ |
28
|
|
|
if(!$this->propertyContains('class', 'labeled')){ |
29
|
|
|
$this->addClass('labeled'); |
30
|
|
|
} |
31
|
|
|
$this->addClass('ticked'); |
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
public function setLabels($labels){ |
35
|
|
|
$this->_params['interpretLabel']=$labels; |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* $values is an associative array with keys (min,max,start,end,step,smooth) |
40
|
|
|
* @param array $values |
41
|
|
|
*/ |
42
|
|
|
public function asRange($values=NULL){ |
43
|
|
|
$this->addClass('range'); |
44
|
|
|
if(\is_array($values)){ |
45
|
|
|
$this->_params=\array_merge($this->_params,$values); |
46
|
|
|
} |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* $values is an associative array with keys (min,max,start,step,smooth) |
51
|
|
|
* @param array $values |
52
|
|
|
*/ |
53
|
|
|
public function setValues($values=NULL){ |
54
|
|
|
if(\is_array($values)){ |
55
|
|
|
$this->_params=\array_merge($this->_params,$values); |
56
|
|
|
} |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
public function setReversed($value=true){ |
60
|
|
|
if($value){ |
61
|
|
|
$this->addClass('reversed'); |
62
|
|
|
} |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
public function setVertical($value=true){ |
66
|
|
|
if($value){ |
67
|
|
|
$this->addClass('vertical'); |
68
|
|
|
} |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
/* |
72
|
|
|
* (non-PHPdoc) |
73
|
|
|
* @see BaseHtml::run() |
74
|
|
|
*/ |
75
|
|
|
public function run(JsUtils $js) { |
76
|
|
|
if(isset($this->_bsComponent)===false){ |
77
|
|
|
$this->_bsComponent=$js->semantic()->slider('#'.$this->identifier,$this->_params,$this->_paramParts); |
|
|
|
|
78
|
|
|
} |
79
|
|
|
$this->addEventsOnRun($js); |
80
|
|
|
return $this->_bsComponent; |
81
|
|
|
} |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
|
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.