Ejemplo n.º 1
0
 public function settings()
 {
     $dto = $this->themeService->findThemeByKey(OW::getConfig()->getValue('base', 'selectedTheme'));
     if ($dto === null) {
         throw new LogicException("Can't find theme `" . OW::getConfig()->getValue('base', 'selectedTheme') . "`");
     }
     $assignArray = (array) json_decode($dto->getDescription());
     $assignArray['iconUrl'] = $this->themeService->getStaticUrl($dto->getKey()) . BOL_ThemeService::ICON_FILE;
     $assignArray['name'] = $dto->getKey();
     $assignArray['title'] = $dto->getTitle();
     $this->assign('themeInfo', $assignArray);
     $this->assign('resetUrl', OW::getRouter()->urlFor(__CLASS__, 'reset'));
     $controls = $this->themeService->findThemeControls($dto->getId());
     if (empty($controls)) {
         $this->assign('noControls', true);
     } else {
         $form = new ThemeEditForm($controls);
         $this->assign('inputArray', $form->getFormElements());
         $this->addForm($form);
         if (OW::getRequest()->isPost()) {
             if ($form->isValid($_POST)) {
                 $this->themeService->saveThemeControls($dto->getId(), $form->getValues());
                 $this->themeService->updateCustomCssFile($dto->getId());
                 $this->redirect();
             }
         }
     }
     $this->menu->getElement('settings')->setActive(true);
 }