| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | namespace Ajax\semantic\html\modules; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  | use Ajax\semantic\html\base\HtmlSemDoubleElement; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  | use Ajax\semantic\html\elements\HtmlHeader; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  | use Ajax\JsUtils; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  | use Ajax\common\html\HtmlSingleElement; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  | class HtmlDimmer extends HtmlSemDoubleElement { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  | 	private $_container; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  | 	private $_params=array (); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  | 	private $_inverted; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  | 	public function __construct($identifier, $content=NULL) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  | 		parent::__construct($identifier, "div", "ui dimmer"); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  | 		$this->setContent($content); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  | 		$this->_inverted=false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  | 	public function setContent($content) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  | 		$this->content=new HtmlSemDoubleElement("content-" . $this->identifier, "div", "content", new HtmlSemDoubleElement("", "div", "center", $content)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  | 		return $this; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  | 	public function asIcon($icon, $title, $subHeader=NULL) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  | 		$header=new HtmlHeader("header-" . $this->identifier); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  | 		$header->asIcon($icon, $title, $subHeader); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  | 		if ($this->_inverted === false) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  | 			$header->setInverted(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  | 		return $this->setContent($header); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  | 	public function asPage() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  | 		return $this->addToProperty("class", "page"); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  | 	public function setInverted() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  | 		parent::setInverted(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  | 		$this->_inverted=true; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  | 		return $this; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  | 	} | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 43 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 44 |  |  | 	public function run(JsUtils $js) { | 
            
                                                                        
                            
            
                                    
            
            
                | 45 |  |  | 		if ($this->_container instanceof HtmlSingleElement) | 
            
                                                                        
                            
            
                                    
            
            
                | 46 |  |  | 			$this->_bsComponent=$js->semantic()->dimmer("#" . $this->_container->getIdentifier(), $this->_params); | 
            
                                                                        
                            
            
                                    
            
            
                | 47 |  |  | 		return parent::run($js); | 
            
                                                                        
                            
            
                                    
            
            
                | 48 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  | 	public function jsShow() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  | 		if (isset($this->_container) === true) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  | 			return '$("#.' . $this->_container->getIdentifier() . ').dimmer("show");'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  | 	public function setBlurring() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  | 		return $this->addToProperty("class", "blurring"); | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 57 |  |  | 	} | 
            
                                                        
            
                                    
            
            
                | 58 |  |  | } |