Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/core/View
diff options
context:
space:
mode:
authordiosmosis <benakamoorthi@fastmail.fm>2014-02-08 16:17:31 +0400
committerdiosmosis <benakamoorthi@fastmail.fm>2014-02-08 16:17:53 +0400
commit8ef3981f6437f25e182d046527fb68cf8c21bbb4 (patch)
treefdb94d21b7450a2d827d031cefbdcb3e92b7404f /core/View
parenta31b6532fdc54f96f571c067a9ff5711bfbd6099 (diff)
Fix infinite recursion issue w/ {% render %}-ing UIControl instances, move dashboard settings HTML rendering to new UIControl object, and slight improvement to error message in screenshot capture script.
Diffstat (limited to 'core/View')
-rw-r--r--core/View/UIControl.php60
1 files changed, 39 insertions, 21 deletions
diff --git a/core/View/UIControl.php b/core/View/UIControl.php
index 39994aa828..0590fe2552 100644
--- a/core/View/UIControl.php
+++ b/core/View/UIControl.php
@@ -72,22 +72,42 @@ class UIControl extends \Piwik\View
public $cssClass = "";
/**
- * Whether we are currently rendering the containing div or not.
+ * The inner view that renders the actual control content.
+ *
+ * @var View
*/
- private $renderingContainer = false;
+ private $innerView = null;
/**
* Constructor.
*/
public function __construct()
{
- parent::__construct(static::TEMPLATE);
+ $this->innerView = new View(static::TEMPLATE);
+
+ parent::__construct("@CoreHome\_uiControl");
$this->clientSideProperties = array();
$this->clientSideParameters = array();
}
/**
+ * 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);
+ }
+
+ /**
* Renders the control view within a containing <div> that is used by the UIControl JavaScript
* class.
*
@@ -103,24 +123,22 @@ class UIControl extends \Piwik\View
throw new Exception("All UIControls must set a jsClass property");
}
- if ($this->renderingContainer) {
- return parent::render();
- } else {
- $this->renderingContainer = true;
-
- $surroundingDivView = new View("@CoreHome\_uiControl");
- $surroundingDivView->clientSideProperties = $this->clientSideProperties;
- $surroundingDivView->clientSideParameters = $this->clientSideParameters;
- $surroundingDivView->implView = $this;
- $surroundingDivView->cssIdentifier = $this->cssIdentifier;
- $surroundingDivView->cssClass = $this->cssClass;
- $surroundingDivView->jsClass = $this->jsClass;
-
- $result = $surroundingDivView->render();
-
- $this->renderingContainer = false;
+ $this->getTemplateVars();
+ return parent::render();
+ }
- return $result;
- }
+ /**
+ * See {@link View::getTemplateVars()}.
+ */
+ public function getTemplateVars($override = array())
+ {
+ $this->templateVars['implView'] = $this->innerView;
+ $this->templateVars['clientSideProperties'] = $this->clientSideProperties;
+ $this->templateVars['clientSideParameters'] = $this->clientSideParameters;
+ $this->templateVars['cssIdentifier'] = $this->cssIdentifier;
+ $this->templateVars['cssClass'] = $this->cssClass;
+ $this->templateVars['jsClass'] = $this->jsClass;
+
+ return parent::getTemplateVars($override);
}
} \ No newline at end of file