function getRenderedLayout($layout, $tag, $topic) { //Get layout Markup and its tokens $layoutMarkup = $this->getLayoutSource($layout); // Get layout HTML content (default:layout_default.ctp) $matches = $this->getMatchElements($layoutMarkup); // Get matching elements $layoutTokens = $this->getLayoutModuleTokens($matches); // return arrays of token values App::import("Controller", "Modules"); $Modules = new ModulesController(); $Modules->constructClasses(); $dataModuleResult = $Modules->getModules($layoutTokens); //Get Modules content App::import("Controller", "Datarows"); $Datarows = new DatarowsController(); $Datarows->constructClasses(); $Content = $Datarows->getDatarows($layoutTokens, $tag, $topic); //Get final layout Markup $layoutMarkup = $this->getlayoutMarkup($layoutMarkup, $layoutTokens, $dataModuleResult, $Content, $matches, $topic); return $layoutMarkup; }
function _renderJSON($module, $tag, $topic = "", $options = array()) { //create an output array $json = array(); //include Modules App::import("Controller", "Modules"); $Modules = new ModulesController(); $Modules->constructClasses(); //get modules $modules = $module == "all" ? $this->Module->find('list') : array($module); //traverse foreach ($modules as $module) { $name = $Modules->getModuleAlias($module); $json[$name] = array(); $json = $Modules->getModuleJSON($module, $tag, $this->Topic->getTopicName($topic), $json, $options); } $this->set("json", $json); $this->layout = "json"; $this->render('index'); }