1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Ajax\semantic\html\base; |
4
|
|
|
|
5
|
|
|
use Ajax\common\html\HtmlDoubleElement; |
6
|
|
|
use Ajax\JsUtils; |
7
|
|
|
use Ajax\semantic\html\content\InternalPopup; |
8
|
|
|
use Phalcon\Mvc\View; |
9
|
|
|
use Ajax\semantic\html\base\traits\BaseTrait; |
10
|
|
|
|
11
|
|
|
/** |
12
|
|
|
* Base class for Semantic double elements |
13
|
|
|
* @author jc |
14
|
|
|
* @version 1.001 |
15
|
|
|
*/ |
16
|
|
|
class HtmlSemDoubleElement extends HtmlDoubleElement { |
17
|
|
|
use BaseTrait; |
18
|
|
|
protected $_popup=NULL; |
19
|
|
|
|
20
|
|
|
public function __construct($identifier, $tagName="p",$baseClass="ui") { |
21
|
|
|
parent::__construct($identifier, $tagName); |
22
|
|
|
$this->_baseClass=$baseClass; |
23
|
|
|
$this->setClass($baseClass); |
24
|
|
|
} |
25
|
|
|
|
26
|
|
|
public function setPopupAttributes($variation=NULL,$popupEvent=NULL){ |
27
|
|
|
if(isset($this->_popup)) |
28
|
|
|
$this->_popup->setAttributes($variation,$popupEvent); |
29
|
|
|
} |
30
|
|
|
|
31
|
|
|
public function addPopup($title="",$content="",$variation=NULL,$params=array()){ |
32
|
|
|
$this->_popup=new InternalPopup($this,$title,$content,$variation,$params); |
33
|
|
|
return $this; |
34
|
|
|
} |
35
|
|
|
|
36
|
|
|
public function addPopupHtml($html="",$variation=NULL,$params=array()){ |
37
|
|
|
$this->_popup=new InternalPopup($this); |
38
|
|
|
$this->_popup->setHtml($html); |
39
|
|
|
$this->_popup->setAttributes($variation,$params); |
40
|
|
|
return $this; |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
public function compile(JsUtils $js=NULL, View $view=NULL){ |
44
|
|
|
if(isset($this->_popup)) |
45
|
|
|
$this->_popup->compile(); |
46
|
|
|
return parent::compile($js,$view); |
47
|
|
|
} |
48
|
|
|
public function run(JsUtils $js){ |
49
|
|
|
parent::run($js); |
50
|
|
|
if(isset($this->_popup)){ |
51
|
|
|
$this->_popup->run($js); |
52
|
|
|
//$this->addEventsOnRun($js); |
|
|
|
|
53
|
|
|
//return $this->_bsComponent; |
|
|
|
|
54
|
|
|
} |
55
|
|
|
} |
56
|
|
|
/* |
|
|
|
|
57
|
|
|
public function __call($name, $arguments){ |
58
|
|
|
$type=\substr($name, 0,3); |
59
|
|
|
$name=\strtolower(\substr($name, 3)); |
60
|
|
|
$names=\array_merge($this->_variations,$this->_states); |
61
|
|
|
$argument=@$arguments[0]; |
62
|
|
|
if(\array_search($name, $names)!==FALSE){ |
63
|
|
|
switch ($type){ |
64
|
|
|
case "set": |
65
|
|
|
if($argument===false){ |
66
|
|
|
$this->removePropertyValue("class", $name); |
67
|
|
|
}else { |
68
|
|
|
$this->setProperty("class", $this->_baseClass." ".$name); |
69
|
|
|
} |
70
|
|
|
break; |
71
|
|
|
case "add": |
72
|
|
|
$this->addToPropertyCtrl("class", $name,array($name)); |
73
|
|
|
break; |
74
|
|
|
default: |
75
|
|
|
throw new \Exception("Méthode ".$type.$name." inexistante."); |
76
|
|
|
} |
77
|
|
|
}else{ |
78
|
|
|
throw new \Exception("Propriété ".$name." inexistante."); |
79
|
|
|
} |
80
|
|
|
return $this; |
81
|
|
|
} |
82
|
|
|
*/ |
83
|
|
|
} |
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.