1
|
|
|
<?php |
2
|
|
|
namespace Ajax\semantic\html\base; |
3
|
|
|
|
4
|
|
|
use Ajax\JsUtils; |
5
|
|
|
/** |
6
|
|
|
* Sem class for navigation elements : Breadcrumbs and Pagination |
7
|
|
|
* @author jc |
8
|
|
|
* @version 1.001 |
9
|
|
|
*/ |
10
|
|
|
abstract class HtmlSemNavElement extends HtmlSemCollection { |
11
|
|
|
/** |
12
|
|
|
* @var string the root site |
13
|
|
|
*/ |
14
|
|
|
protected $root; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* @var String the html attribute which contains the elements url. default : data-ajax |
18
|
|
|
*/ |
19
|
|
|
protected $attr; |
20
|
|
|
|
21
|
|
|
protected $_contentSeparator=""; |
22
|
|
|
|
23
|
|
|
|
24
|
|
|
public function __construct($identifier,$tagName,$baseClass){ |
25
|
|
|
parent::__construct($identifier,$tagName,$baseClass); |
26
|
|
|
$this->root=""; |
27
|
|
|
$this->attr="data-ajax"; |
28
|
|
|
} |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* Associate an ajax get to the elements, displayed in $targetSelector |
32
|
|
|
* $attr member is used to build each element url |
33
|
|
|
* @param string $targetSelector the target of the get |
34
|
|
|
* @param string $attr the html attribute used to build the elements url |
|
|
|
|
35
|
|
|
* @return HtmlNavElement |
36
|
|
|
*/ |
37
|
|
|
public function autoGetOnClick($targetSelector){ |
38
|
|
|
return $this->getOnClick($this->root, $targetSelector,array("attr"=>$this->attr)); |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
public function contentAsString(){ |
42
|
|
|
return implode($this->_contentSeparator, $this->content); |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* Generate the jquery script to set the elements to the HtmlNavElement |
47
|
|
|
* @param JsUtils $jsUtils |
48
|
|
|
*/ |
49
|
|
|
public function jsSetContent(JsUtils $jsUtils){ |
50
|
|
|
$jsUtils->html("#".$this->identifier,str_replace("\"","'", $this->contentAsString()),true); |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
public function getRoot() { |
54
|
|
|
return $this->root; |
55
|
|
|
} |
56
|
|
|
public function setRoot($root) { |
57
|
|
|
$this->root = $root; |
58
|
|
|
return $this; |
59
|
|
|
} |
60
|
|
|
public function getAttr() { |
61
|
|
|
return $this->attr; |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* Define the html attribute for each element url in ajax |
66
|
|
|
* @param string $attr html attribute |
67
|
|
|
* @return HtmlNavElement |
68
|
|
|
*/ |
69
|
|
|
public function setAttr($attr) { |
70
|
|
|
$this->attr = $attr; |
71
|
|
|
return $this; |
72
|
|
|
} |
73
|
|
|
|
74
|
|
View Code Duplication |
public function __call($method, $args) { |
|
|
|
|
75
|
|
|
if(isset($this->$method) && is_callable($this->$method)) { |
76
|
|
|
return call_user_func_array( |
77
|
|
|
$this->$method, |
78
|
|
|
$args |
79
|
|
|
); |
80
|
|
|
} |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
public abstract function fromDispatcher($dispatcher,$startIndex=0); |
|
|
|
|
84
|
|
|
|
85
|
|
|
|
86
|
|
|
public function setContentSeparator($contentSeparator) { |
87
|
|
|
$this->_contentSeparator=$contentSeparator; |
88
|
|
|
return $this; |
89
|
|
|
} |
90
|
|
|
|
91
|
|
|
|
92
|
|
|
} |
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italy
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was removed, but the annotation was not.