Completed
Push — master ( 0ba4b1...2affe6 )
by Jean-Christophe
03:09
created

HtmlSemDoubleElement::addIcon()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 12
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 12
rs 9.4285
cc 3
eloc 9
nc 4
nop 3
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);
0 ignored issues
show
Unused Code Comprehensibility introduced by
86% of this comment could be valid code. Did you maybe forget this after debugging?

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.

Loading history...
53
			//return $this->_bsComponent;
0 ignored issues
show
Unused Code Comprehensibility introduced by
67% of this comment could be valid code. Did you maybe forget this after debugging?

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.

Loading history...
54
		}
55
	}
56
/*
0 ignored issues
show
Unused Code Comprehensibility introduced by
67% of this comment could be valid code. Did you maybe forget this after debugging?

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.

Loading history...
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
}