innerView = new View(static::TEMPLATE);
parent::__construct("@CoreHome\_uiControl");
}
/**
* Sets a variable. See {@link View::__set()}.
*/
public function __set($key, $val)
{
$this->innerView->__set($key, $val);
}
/**
* Gets a view variable. See {@link View::__get()}.
*/
public function &__get($key)
{
return $this->innerView->__get($key);
}
public function __isset($key)
{
return isset($this->innerView->templateVars[$key]);
}
/**
* Renders the control view within a containing
that is used by the UIControl JavaScript
* class.
*
* @return string
*/
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();
}
/**
* See {@link View::getTemplateVars()}.
*/
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);
}
/**
* Returns the array of property names whose values are passed to the UIControl JavaScript class.
*
* Should be overriden by descendants.
*
* @return array
*/
public function getClientSideProperties()
{
return array();
}
/**
* Returns an array of property names whose values are passed to the UIControl JavaScript class.
* These values differ from those in {@link $clientSideProperties} in that they are meant to passed as
* request parameters when the JavaScript code makes an AJAX request.
*
* Should be overriden by descendants.
*
* @return array
*/
public function getClientSideParameters()
{
return array();
}
}