public function render(FrontendController $frontendController, CmsView $view)
 {
     $siteTitle = '<h2>' . $frontendController->getCmsPage()->getTitle() . '</h2>';
     return $this->renderEditable($frontendController, $siteTitle);
 }
Exemple #2
0
    /**
     * @param FrontendController $frontendController
     * @param $html
     *
     * @return null|string
     */
    protected function renderEditable(FrontendController $frontendController, $html)
    {
        $pageModel = new PageModel($frontendController->getDB());
        // @TODO dont know if it works 2014-02-03 pam else comment in and delete line after again
        //$cmsPage = $pageModel->getPageByID($frontendController->getCmsPage()->getID());
        $cmsPage = $frontendController->getCmsPage();
        // @TODO Move the $this->hidden compare earlier in the code, before the rendering begins or is over to save resources
        if ($pageModel->hasUserWriteAccess($cmsPage, $frontendController->getAuth()) === false) {
            return $this->hidden === false ? $html : null;
        }
        $modIDStr = 'mod-' . $this->ID . '-' . $frontendController->getCmsPage()->getID();
        $layerClass = 'element';
        $sortableClass = null;
        $hiddenClass = null;
        if ($this instanceof LayoutElement) {
            $layerClass = 'element-layout';
        }
        if ($this instanceof CmsElementSortable) {
            $sortableClass = 'element-sortable ';
        }
        if ($this->hidden === true) {
            $hiddenClass = 'element-hidden ';
        }
        $editableHtml = '<div id="' . $modIDStr . '" class="element-editable ' . $hiddenClass . $sortableClass . str_replace('_', '-', $this->identifier) . ' clearfix">
			<div id="' . $modIDStr . '-content" class="' . $layerClass . ' edit-area clearfix">
				' . $html . '
				<div class="edit-area-btn-group">
					<!--<a class="edit-area-btn edit-area-btn-info ui-button ui-widget ui-state-default ui-corner-all ui-button-icon-only" href="javascript:alert(\'Element type: ' . $this->identifier . '\');"><span class="ui-button-icon-primary ui-icon ui-icon-info"></span><span class="ui-button-text">Element Info</span></a>-->
					' . ($this->parentElement instanceof CmsElementSortable ? '<a class="edit-area-btn edit-area-btn-history ui-button ui-widget ui-state-default ui-corner-all ui-button-icon-only ui-move" title="move" role="button"><span class="ui-button-icon-primary ui-icon ui-icon-arrow-4"></span><span class="ui-button-text">move</span></a>' : null) . '
					' . ($this instanceof TextElement ? '<a class="edit-area-btn edit-area-btn-edit ui-button ui-widget ui-state-default ui-corner-all ui-button-icon-only" title="edit content" role="button"><span class="ui-button-icon-primary ui-icon ui-icon-pencil"></span><span class="ui-button-text">edit</span></a> ' : null) . '
					' . ($this->hasConfig($frontendController) ? '<a class="edit-area-btn edit-area-btn-settings ui-button ui-widget ui-state-default ui-corner-all ui-button-icon-only" href="/backend/element/' . $this->ID . '-' . $frontendController->getCmsPage()->getID() . '/ajax-settingsbox" role="button" title="Module settings: ' . $modIDStr . ' (' . $this->identifier . ')"><span class="ui-button-icon-primary ui-icon ui-icon-gear"></span><span class="ui-button-text">Settings</span></a> ' : null) . '
					<a class="edit-area-btn edit-area-btn-history ui-button ui-widget ui-state-default ui-corner-all ui-button-icon-only" href="/backend/element/' . $this->ID . '-' . $frontendController->getCmsPage()->getID() . '/ajax-revision-control" role="button" title="Revision control: ' . $modIDStr . ' (' . $this->identifier . ')"><span class="ui-button-icon-primary ui-icon ui-icon-clock"></span><span class="ui-button-text">Revision control</span></a>';
        if ($this->pageID == $frontendController->getCmsPage()->getID()) {
            $editableHtml .= '<a class="edit-area-btn edit-area-btn-delete ui-button ui-widget ui-state-default ui-corner-all ui-button-icon-only" title="delete" role="button"><span class="ui-button-icon-primary ui-icon ui-icon-trash"></span><span class="ui-button-text">delete</span></a>';
        } else {
            $editableHtml .= $this->hidden === false ? '<a class="edit-area-btn edit-area-btn-hide ui-button ui-widget ui-state-default ui-corner-all ui-button-icon-only" title="hide" role="button"><span class="ui-button-icon-primary ui-icon ui-icon-closethick"></span><span class="ui-button-text">hide</span></a>' : '<a class="edit-area-btn edit-area-btn-reveal ui-button ui-widget ui-state-default ui-corner-all ui-button-icon-only" title="show" role="button"><span class="ui-button-icon-primary ui-icon ui-icon-closethick"></span><span class="ui-button-text">show</span></a>';
        }
        $editableHtml .= '</div>
			</div>
		</div>';
        return $editableHtml;
    }