예제 #1
0
    public function indexAction()
    {
        $moduleMapper = new \Modules\Admin\Mappers\Module();
        $pageMapper = new \Modules\Page\Mappers\Page();
        $this->getLayout()->getAdminHmenu()->add($this->getTranslator()->trans('systemSettings'), array('action' => 'index'));
        if ($this->getRequest()->isPost()) {
            $this->getConfig()->set('multilingual_acp', $this->getRequest()->getPost('multilingualAcp'));
            $this->getConfig()->set('content_language', $this->getRequest()->getPost('contentLanguage'));
            $this->getConfig()->set('description', $this->getRequest()->getPost('description'));
            $this->getConfig()->set('page_title', $this->getRequest()->getPost('pageTitle'));
            $this->getConfig()->set('start_page', $this->getRequest()->getPost('startPage'));
            $this->getConfig()->set('mod_rewrite', (int) $this->getRequest()->getPost('modRewrite'));
            $this->getConfig()->set('standardMail', $this->getRequest()->getPost('standardMail'));
            $this->getConfig()->set('timezone', $this->getRequest()->getPost('timezone'));
            $this->getConfig()->set('locale', $this->getRequest()->getPost('locale'));
            if ($this->getRequest()->getPost('navbarFixed') === '1') {
                $this->getConfig()->set('admin_layout_top_nav', 'navbar-fixed-top');
            }
            if ($this->getRequest()->getPost('navbarFixed') === '0') {
                $this->getConfig()->set('admin_layout_top_nav', '');
            }
            if ((int) $this->getRequest()->getPost('modRewrite')) {
                $htaccess = <<<'HTACCESS'
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase %1$s/
    RewriteRule ^index\.php$ - [L]
    RewriteCond %%{REQUEST_FILENAME} !-f
    RewriteCond %%{REQUEST_FILENAME} !-d
    RewriteRule . %1$s/index.php [L]
</IfModule>
HTACCESS;
                file_put_contents(APPLICATION_PATH . '/../.htaccess', sprintf($htaccess, REWRITE_BASE));
            } elseif (file_exists(APPLICATION_PATH . '/../.htaccess')) {
                file_put_contents(APPLICATION_PATH . '/../.htaccess', '');
            }
            $this->addMessage('saveSuccess');
        }
        $this->getView()->set('languages', $this->getTranslator()->getLocaleList());
        $this->getView()->set('multilingualAcp', $this->getConfig()->get('multilingual_acp'));
        $this->getView()->set('contentLanguage', $this->getConfig()->get('content_language'));
        $this->getView()->set('description', $this->getConfig()->get('description'));
        $this->getView()->set('pageTitle', $this->getConfig()->get('page_title'));
        $this->getView()->set('startPage', $this->getConfig()->get('start_page'));
        $this->getView()->set('modRewrite', $this->getConfig()->get('mod_rewrite'));
        $this->getView()->set('standardMail', $this->getConfig()->get('standardMail'));
        $this->getView()->set('timezones', \DateTimeZone::listIdentifiers());
        $this->getView()->set('timezone', $this->getConfig()->get('timezone'));
        $this->getView()->set('locale', $this->getConfig()->get('locale'));
        $this->getView()->set('modules', $moduleMapper->getModules());
        $this->getView()->set('pages', $pageMapper->getPageList());
        $this->getView()->set('navbarFixed', $this->getConfig()->get('admin_layout_top_nav'));
    }
예제 #2
0
 /**
  * Gets the menu items as html-string.
  *
  * @param \Modules\Admin\Models\MenuItem $item
  * @param array $options
  * @return string
  */
 protected function recGetItems($item, $locale, $options = array())
 {
     $menuMapper = new \Modules\Admin\Mappers\Menu();
     $pageMapper = new \Modules\Page\Mappers\Page();
     $subItems = $menuMapper->getMenuItemsByParent($item->getMenuId(), $item->getId());
     $html = '';
     if (in_array($item->getType(), array(1, 2, 3))) {
         $html = '<li>';
     }
     if ($item->getType() == 1) {
         $html .= '<a href="' . $item->getHref() . '">' . $item->getTitle() . '</a>';
     } elseif ($item->getType() == 2) {
         $page = $pageMapper->getPageByIdLocale($item->getSiteId(), $locale);
         $html .= '<a href="' . $this->layout->getUrl($page->getPerma()) . '">' . $item->getTitle() . '</a>';
     } elseif ($item->getType() == 3) {
         $html .= '<a href="' . $this->layout->getUrl(array('module' => $item->getModuleKey(), 'action' => 'index', 'controller' => 'index')) . '">' . $item->getTitle() . '</a>';
     }
     if (!empty($subItems)) {
         if (isset($options['class_ul'])) {
             $html .= '<ul class="' . $options['class_ul'] . '">';
         } else {
             $html .= '<ul class="list-unstyled ilch_menu_ul">';
         }
         foreach ($subItems as $subItem) {
             $html .= $this->recGetItems($subItem, $locale, $options);
         }
         $html .= '</ul>';
     }
     if (in_array($item->getType(), array(1, 2, 3))) {
         $html .= '</li>';
     }
     return $html;
 }