/** * @param $template * @param $locale * @param $variables * @param $dataSource */ public function render($template, $locale, $variables, $dataSource = null) { $this->view->assign('inEditMode', $this->block->inEditMode()); $this->view->assign('refreshBlock', $this->block->inEditMode() && $this->request->isXmlHttpRequest()); $this->view->assign('locale', $locale); $this->view->assign('dataSource', $dataSource); $this->view->assign('config', $variables); if (!empty($template)) { $this->view->setTemplate($template); } else { $this->view->setTemplate("string:"); } }
/** * */ private function setEditMode() { $value = $this->request->gp('value'); if (empty($value)) { $value = $this->block->inEditMode() ? 0 : 1; } if ($this->block->setEditMode($value)) { $this->response->sendAsJson(array('success' => true)); } $this->response->sendAsJson(array('success' => false)); }
/** * */ protected function setEditMode() { $value = $this->request->gp('value'); if (empty($value)) { $value = $this->block->inEditMode() ? 0 : 1; } if ($this->block->setEditMode($value)) { $this->response->sendAsJson(['success' => true]); } $this->response->sendAsJson(['success' => false]); }
/** * @return mixed */ public function adminPanelInit() { if ($this->user->isAdmin() === false) { return; } $cmd = $this->request->gp('cmd', false); if ($cmd !== false) { if (method_exists($this, $cmd)) { return $this->{$cmd}(); } } $this->view->addHeadData('<script type="text/javascript">var menu_id=\'' . $this->route->getCurrentMenuItem()->id . '\';var menu_translation_id=\'' . $this->route->getCurrentMenuItemTranslation()->id . '\';var base_path=\'' . $this->route->getSiteBaseURI() . '\';var menu_path=\'' . $this->route->getMenuPath() . '\';</script>'); $this->view->assign('inEditMode', $this->block->inEditMode()); $this->view->render('AdminPanel'); }
/** * @param $xml * @return array|string */ private function contentChildViews($xml) { $childsHtml = array(); foreach ($xml->children() as $child) { $contentId = $this->getContentId($child); $blocks = $this->getDataFromBlocksByContentId($contentId); // In Editmode we want to render all views to insert content if (empty($blocks) && $this->getXMLAttr($child, 'hideEmpty') !== false && $this->block->inEditMode() === false) { continue; } // result returns an array $result = $this->contentChildViews($child); $addContent = $this->getXMLAttr($child, 'add') ?: 'afterContent'; if (!isset($childsHtml[$addContent])) { $childsHtml[$addContent] = ''; } if (count($result) > 0) { $blockhtml = (isset($result['beforeContent']) ? $result['beforeContent'] : '') . $this->core->evalString($blocks) . (isset($result['afterContent']) ? $result['afterContent'] : ''); if (($this->getXMLAttr($child, 'hideEmpty') === null || $this->getXMLAttr($child, 'hideEmpty') === true) && $this->block->inEditMode() === false && trim($blockhtml) == '') { $childsHtml[$addContent] .= isset($childsHtml[$addContent]) ? $childsHtml[$addContent] : ''; } else { $childsHtml[$addContent] .= (isset($childsHtml[$addContent]) ? $childsHtml[$addContent] : '') . $this->blockController->createEditViewContentDIV($child, $blockhtml); } } else { $blockhtml = $this->core->evalString($blocks); if (($this->getXMLAttr($child, 'hideEmpty') === null || $this->getXMLAttr($child, 'hideEmpty') === true) && $this->block->inEditMode() === false && trim($blockhtml) == '') { $childsHtml[$addContent] .= ''; } else { $childsHtml[$addContent] .= $this->blockController->createEditViewContentDIV($child, $blockhtml); } } } return $childsHtml; }
/** * @param $xml * @return array|string */ protected function contentChildViews($xml) { $childsHtml = []; foreach ($xml->children() as $child) { $contentId = $this->getContentId($child); $blocks = $this->getDataFromBlocksByContentId($contentId); // In Editmode we want to render all views to insert content if (empty($blocks) && $this->getXmlAttr($child, 'hideEmpty') !== false && empty($placeholder) && $this->block->inEditMode() === false) { continue; } if (empty($blocks) && !empty($placeholder) && $this->block->inEditMode() === false) { $blocks = $this->blockController->createEditViewElement($child, $placeholder); } // result returns an array $result = $this->contentChildViews($child); $addContent = $this->getXmlAttr($child, 'add') ?: 'afterContent'; if (!isset($childsHtml[$addContent])) { $childsHtml[$addContent] = ''; } if (count($result) > 0) { $blockhtml = (isset($result['beforeContent']) ? $result['beforeContent'] : '') . $this->core->includeScript($blocks) . (isset($result['afterContent']) ? $result['afterContent'] : ''); if (trim($blockhtml) === '') { $childsHtml[$addContent] .= isset($childsHtml[$addContent]) ? $childsHtml[$addContent] : ''; } else { $childsHtml[$addContent] .= (isset($childsHtml[$addContent]) ? $childsHtml[$addContent] : '') . $this->blockController->createEditViewElement($child, $blockhtml); } } else { $blockhtml = $this->core->includeScript($blocks); if (trim($blockhtml) === '') { $childsHtml[$addContent] .= ''; } else { $childsHtml[$addContent] .= $this->blockController->createEditViewElement($child, $blockhtml); } } } return $childsHtml; }