| <?php |
|
|
| |
| |
| |
| |
| |
| |
|
|
| namespace Piwik\View; |
|
|
| use Exception; |
| use Piwik\View; |
|
|
| |
| |
| |
| |
| |
| |
| |
| class UIControl extends \Piwik\View |
| { |
| |
| |
| |
| |
| |
| public const TEMPLATE = ''; |
|
|
| |
| |
| |
| |
| |
| |
| |
| public $cssIdentifier = null; |
|
|
| |
| |
| |
| |
| |
| |
| |
| public $jsClass = null; |
|
|
| |
| |
| |
| |
| |
| public $jsNamespace = 'piwik/UI'; |
|
|
| |
| |
| |
| |
| |
| public $cssClass = ""; |
|
|
| |
| |
| |
| |
| |
| public $htmlAttributes = array(); |
|
|
| |
| |
| |
| |
| |
| private $innerView = null; |
|
|
| public function __construct() |
| { |
| $this->innerView = new View(static::TEMPLATE); |
|
|
| parent::__construct("@CoreHome\_uiControl"); |
| } |
|
|
| |
| |
| |
| public function __set($key, $val) |
| { |
| $this->innerView->__set($key, $val); |
| } |
|
|
| |
| |
| |
| public function &__get($key) |
| { |
| return $this->innerView->__get($key); |
| } |
|
|
| public function __isset($key) |
| { |
| return isset($this->innerView->templateVars[$key]); |
| } |
|
|
| |
| |
| |
| |
| |
| |
| public function render() |
| { |
| if ($this->cssIdentifier === null) { |
| throw new Exception("All UIControls must set a cssIdentifier property"); |
| } |
|
|
| if ($this->jsClass === null) { |
| throw new Exception("All UIControls must set a jsClass property"); |
| } |
|
|
| return parent::render(); |
| } |
|
|
| |
| |
| |
| public function getTemplateVars($override = array()) |
| { |
| $this->templateVars['implView'] = $this->innerView; |
| $this->templateVars['cssIdentifier'] = $this->cssIdentifier; |
| $this->templateVars['cssClass'] = $this->cssClass; |
| $this->templateVars['jsClass'] = $this->jsClass; |
| $this->templateVars['htmlAttributes'] = $this->htmlAttributes; |
| $this->templateVars['jsNamespace'] = $this->jsNamespace; |
| $this->templateVars['implOverride'] = $override; |
|
|
| $innerTemplateVars = $this->innerView->getTemplateVars($override); |
|
|
| $this->templateVars['clientSideProperties'] = array(); |
| foreach ($this->getClientSideProperties() as $name) { |
| $this->templateVars['clientSideProperties'][$name] = $innerTemplateVars[$name]; |
| } |
|
|
| $this->templateVars['clientSideParameters'] = array(); |
| foreach ($this->getClientSideParameters() as $name) { |
| $this->templateVars['clientSideParameters'][$name] = $innerTemplateVars[$name]; |
| } |
|
|
| return parent::getTemplateVars($override); |
| } |
|
|
| |
| |
| |
| |
| |
| |
| |
| public function getClientSideProperties() |
| { |
| return array(); |
| } |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| public function getClientSideParameters() |
| { |
| return array(); |
| } |
| } |
|
|