public function executeEmulateList(\core\HttpRequest $request)
 {
     $moduleName = $request->getData('emulateModule');
     $itemsName = $request->getData('emulateListItems');
     $emulatedController = $this->_emulateController();
     $methodName = 'list' . ucfirst($itemsName);
     if (!method_exists($emulatedController, $methodName)) {
         throw new \RuntimeException('Unknown list items "' . $itemsName . '" on module "' . $moduleName . '"');
     }
     $items = $emulatedController->{$methodName}();
     $this->responseContent()->setData($items);
 }
 public function executeLoadTpl(\core\HttpRequest $request)
 {
     $index = $request->getData('index');
     $tplDirPath = __DIR__ . '/../../../tpl/frontend';
     $tplPath = realpath($tplDirPath . '/' . $index . '.html');
     if (strpos($tplPath, realpath($tplDirPath) . '/') !== 0) {
         throw new \RuntimeException('Accessing template "' . $tplPath . '" is not allowed');
     }
     if (!file_exists($tplPath)) {
         throw new \RuntimeException('Template "' . $tplPath . '" doesn\'t exist');
     }
     $content = file_get_contents($tplPath);
     $partials = $this->_loadPartials($content, dirname($tplPath));
     $this->responseContent()->setData(array('tpl' => $content, 'partials' => $partials));
 }