Completed
Push — master ( 3ad5ef...acbd35 )
by Jean-Christophe
03:30
created

HtmlSticky::setFixed()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 5
nc 2
nop 1
1
<?php
2
3
namespace Ajax\semantic\html\modules;
4
5
use Ajax\semantic\html\base\HtmlSemDoubleElement;
6
use Ajax\JsUtils;
7
8
class HtmlSticky extends HtmlSemDoubleElement {
9
10
	public function __construct($identifier,$context=NULL,$content=NULL) {
11
		parent::__construct($identifier, "div", "ui sticky", $content);
12
		if(isset($content))
13
			$this->setContext($context);
14
	}
15
16
	public function setContext($context){
17
		$this->_params["context"]=$context;
18
		return $this;
19
	}
20
21
	public function setFixed($value=NULL){
22
		$fixed="fixed";
23
		if(isset($value))
24
			$fixed.=" ".$value;
25
		return $this->addToProperty("class",$fixed);
26
	}
27
28
	public function setBound($value=NULL){
29
		$bound="bound";
30
		if(isset($value))
31
			$bound.=" ".$value;
32
			return $this->addToProperty("class",$bound);
33
	}
34
35
	/**
36
	 * {@inheritDoc}
37
	 * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::run()
38
	 */
39
	public function run(JsUtils $js){
40
		parent::run($js);
41
		return $js->semantic()->sticky("#".$this->identifier,$this->_params);
42
	}
43
44
	public function setOffset($offset=0){
45
		$this->_params["offset"]=$offset;
46
		return $this;
47
	}
48
49
50
51
	public function setDebug($verbose=NULL){
52
		$this->_params["debug"]=true;
53
		if(isset($verbose))
54
			$this->_params["verbose"]=true;
55
		return $this;
56
	}
57
}