<?php 


class vstContenedor{
	
	public $_titulo;
	public $_elementos;
	
	public function __construct($titulo){
		$this->_titulo = $titulo;
	}
	
	
	public function render(){
		
		$contenido = '';
		
		foreach ($this->_elementos as $elemento){
				
			
			if(is_object($elemento)){
				$contenido .= $elemento->render();
			}else{
				$contenido .= $elemento;
			}
				
				
				
		}
		
		
		$html = '<div data-widget-fullscreenbutton="false" data-widget-deletebutton="false" data-widget-togglebutton="false" data-widget-colorbutton="false" id="wid-id-1" class="jarviswidget jarviswidget-color-blue jarviswidget-sortable" style="" role="widget">
				<!-- widget options:
					usage: <div class="jarviswidget" id="wid-id-0" data-widget-editbutton="false">
					
					data-widget-colorbutton="false"	
					data-widget-editbutton="false"
					data-widget-togglebutton="false"
					data-widget-deletebutton="false"
					data-widget-fullscreenbutton="false"
					data-widget-custombutton="false"
					data-widget-collapsed="false" 
					data-widget-sortable="false"
					
				-->
				<header role="heading">
					<h2><strong>'.$this->_titulo.'</strong></h2>				
					
				<span class="jarviswidget-loader"><i class="fa fa-refresh fa-spin"></i></span></header>

				<!-- widget div-->
				<div role="content">
					
					<!-- widget edit box -->
					<div class="jarviswidget-editbox">
						<!-- This area used as dropdown edit box -->
						<input type="text" class="form-control">
						<span class="note"><i class="fa fa-check text-success"></i> Change title to update and save instantly!</span>
							
					</div>
					<!-- end widget edit box -->
					
					<!-- widget content -->
					<div class="widget-body">
						
						'.$contenido.'						
						
					</div>
					<!-- end widget content -->
					
				</div>
				<!-- end widget div -->
				
			</div>';
		
		return $html;
	}
	public function __toString(){
		return $this->render();
	}
	public function addElement(&$elemento){
		$this->_elementos[] = $elemento;
	}
	
	
}