|
3 | 3 |
|
4 | 4 | use Ajax\service\JArray;
|
5 | 5 | use Ajax\common\html\traits\NavElementTrait;
|
6 |
| -use Ajax\bootstrap\html\base\HtmlNavElement; |
| 6 | + |
7 | 7 | /**
|
8 | 8 | * Sem class for navigation elements : Breadcrumbs and Pagination
|
| 9 | + * |
9 | 10 | * @author jc
|
10 | 11 | * @version 1.001
|
11 | 12 | */
|
12 | 13 | abstract class HtmlSemNavElement extends HtmlSemCollection {
|
13 | 14 | use NavElementTrait;
|
| 15 | + |
14 | 16 | /**
|
| 17 | + * |
15 | 18 | * @var string the root site
|
16 | 19 | */
|
17 | 20 | protected $root;
|
18 | 21 |
|
19 | 22 | /**
|
| 23 | + * |
20 | 24 | * @var String the html attribute which contains the elements url. default : data-ajax
|
21 | 25 | */
|
22 | 26 | protected $attr;
|
23 | 27 |
|
24 | 28 | /**
|
| 29 | + * |
25 | 30 | * @var string|array
|
26 | 31 | */
|
27 |
| - protected $_contentSeparator=""; |
28 |
| - |
| 32 | + protected $_contentSeparator = ""; |
29 | 33 |
|
30 |
| - public function __construct($identifier,$tagName,$baseClass){ |
31 |
| - parent::__construct($identifier,$tagName,$baseClass); |
32 |
| - $this->root=""; |
33 |
| - $this->attr="data-ajax"; |
| 34 | + public function __construct($identifier, $tagName, $baseClass) { |
| 35 | + parent::__construct($identifier, $tagName, $baseClass); |
| 36 | + $this->root = ""; |
| 37 | + $this->attr = "data-ajax"; |
34 | 38 | }
|
35 | 39 |
|
36 | 40 | /**
|
37 | 41 | * Associate an ajax get to the elements, displayed in $targetSelector
|
38 |
| - * @param string $targetSelector the target of the get |
| 42 | + * |
| 43 | + * @param string $targetSelector |
| 44 | + * the target of the get |
39 | 45 | * @return HtmlSemNavElement
|
40 | 46 | */
|
41 |
| - public function autoGetOnClick($targetSelector){ |
42 |
| - return $this->getOnClick($this->root, $targetSelector,array("attr"=>$this->attr)); |
| 47 | + public function autoGetOnClick($targetSelector) { |
| 48 | + return $this->getOnClick($this->root, $targetSelector, array( |
| 49 | + "attr" => $this->attr |
| 50 | + )); |
43 | 51 | }
|
44 | 52 |
|
45 |
| - public function contentAsString(){ |
| 53 | + public function contentAsString() { |
46 | 54 | return JArray::implode($this->_contentSeparator, $this->content);
|
47 | 55 | }
|
48 | 56 |
|
49 |
| - public function setContentDivider($divider,$index=NULL) { |
50 |
| - $divider="<div class='divider'> {$divider} </div>"; |
| 57 | + public function setContentDivider($divider, $index = NULL) { |
| 58 | + $divider = "<div class='divider'> {$divider} </div>"; |
51 | 59 | return $this->setDivider($divider, $index);
|
52 | 60 | }
|
53 | 61 |
|
54 |
| - public function setIconContentDivider($iconContentDivider,$index=NULL) { |
55 |
| - $contentDivider="<i class='".$iconContentDivider." icon divider'></i>"; |
| 62 | + public function setIconContentDivider($iconContentDivider, $index = NULL) { |
| 63 | + $contentDivider = "<i class='" . $iconContentDivider . " icon divider'></i>"; |
56 | 64 | return $this->setDivider($contentDivider, $index);
|
57 | 65 | }
|
58 | 66 |
|
59 |
| - protected function setDivider($divider,$index){ |
60 |
| - if(isset($index)){ |
61 |
| - if(!\is_array($this->_contentSeparator)) |
62 |
| - $this->_contentSeparator=array_fill (0, $this->count()-1,$this->_contentSeparator); |
63 |
| - $this->_contentSeparator[$index]=$divider; |
64 |
| - }else{ |
65 |
| - $this->_contentSeparator=$divider; |
| 67 | + protected function setDivider($divider, $index) { |
| 68 | + if (isset($index)) { |
| 69 | + if (! \is_array($this->_contentSeparator)) |
| 70 | + $this->_contentSeparator = array_fill(0, $this->count() - 1, $this->_contentSeparator); |
| 71 | + $this->_contentSeparator[$index] = $divider; |
| 72 | + } else { |
| 73 | + $this->_contentSeparator = $divider; |
66 | 74 | }
|
67 | 75 | return $this;
|
68 | 76 | }
|
69 | 77 |
|
70 |
| - protected function getContentDivider($index){ |
71 |
| - if(\is_array($this->_contentSeparator)){ |
| 78 | + protected function getContentDivider($index) { |
| 79 | + if (\is_array($this->_contentSeparator)) { |
72 | 80 | return @$this->_contentSeparator[$index];
|
73 | 81 | }
|
74 | 82 | return $this->_contentSeparator;
|
75 | 83 | }
|
76 |
| - |
77 |
| - |
78 | 84 | }
|
0 commit comments