Esempio n. 1
0
 /**
  * Given an Object implementing Piwik_iView interface, we either:
  * - echo the output of the rendering if fetch = false
  * - returns the output of the rendering if fetch = true
  *
  * @param Piwik_ViewDataTable $view
  * @param bool $fetch
  * @return string|void
  */
 protected function renderView(Piwik_ViewDataTable $view, $fetch = false)
 {
     Piwik_PostEvent('Controller.renderView', $this, array('view' => $view, 'controllerName' => $view->getCurrentControllerName(), 'controllerAction' => $view->getCurrentControllerAction(), 'apiMethodToRequestDataTable' => $view->getApiMethodToRequestDataTable(), 'controllerActionCalledWhenRequestSubTable' => $view->getControllerActionCalledWhenRequestSubTable()));
     $standardColumnNameToTranslation = array_map('Piwik_Translate', $this->standardColumnNameToTranslation);
     $view->setColumnsTranslations($standardColumnNameToTranslation);
     $view->main();
     $rendered = $view->getView()->render();
     if ($fetch) {
         return $rendered;
     }
     echo $rendered;
 }
Esempio n. 2
0
	/**
	 * Given an Object implementing Piwik_iView interface, we either:
	 * - echo the output of the rendering if fetch = false
	 * - returns the output of the rendering if fetch = true
	 *
	 * @param Piwik_ViewDataTable $view
	 * @param bool $fetch
	 * @return string|void
	 */
	protected function renderView( Piwik_ViewDataTable $view, $fetch = false)
	{
		Piwik_PostEvent(	'Controller.renderView', 
							$this, 
							array(	'view' => $view,
									'controllerName' => $view->getCurrentControllerName(),
									'controllerAction' => $view->getCurrentControllerAction(),
									'apiMethodToRequestDataTable' => $view->getApiMethodToRequestDataTable(),
									'controllerActionCalledWhenRequestSubTable' => $view->getControllerActionCalledWhenRequestSubTable(),
							)
				);

		$view->main();
		$rendered = $view->getView()->render();
		if($fetch)
		{
			return $rendered;
		}
		echo $rendered;
	}