Exemple #1
0
 /**
  * Executes index action
  *
  * @param sfWebRequest $request A request object
  */
 public function executeIndex(sfWebRequest $request)
 {
     $themeObjects = $this->searcher->getThemes();
     $this->validThemeObjects = $themeObjects['valid'];
     $this->invalidDirNames = $themeObjects['invalid']['invalid'];
     $this->invalidMainCss = $themeObjects['invalid']['maincss'];
     $this->config->removeUsedThemeName(array_merge($this->invalidDirNames, $this->invalidMainCss), $this->validThemeObjects);
     $this->usedThemeName = $this->config->getUsedThemeName();
     if (null === $this->usedThemeName) {
         $this->existsUsedTheme = true;
     } else {
         $this->existsUsedTheme = $this->searcher->existsAssetsByThemeName($this->config->getUsedThemeName());
     }
     $this->form = new opThemeActivationForm(array(), array('themes' => $this->validThemeObjects));
     if ($request->isMethod(sfWebRequest::POST)) {
         $this->form->bind($this->request->getParameter('theme_activation'));
         if ($this->form->isValid()) {
             $this->getUser()->setFlash('notice', 'Saved.');
             $this->form->save();
         } else {
             $this->getUser()->setFlash('error', $this->form->getErrorSchema()->getMessage());
         }
         $this->redirect('opSkinThemePlugin/index');
     }
 }
Exemple #2
0
 /**
  * Executes index action
  *
  * @param sfWebRequest $request A request object
  */
 public function executeIndex(sfWebRequest $request)
 {
     $themeSearcher = new opThemeAssetSearcher();
     $this->themeName = $request->getParameterHolder()->get('theme_name');
     if (null === $this->themeName) {
         $this->forward404('Request parameter id does not exist.');
     }
     $this->isExistsTheme = $themeSearcher->isAvailableTheme($this->themeName);
     $this->emptyThemeName = $this->themeName === null;
 }
 public static function enableSkinByTheme($themeName)
 {
     $themeSearcher = new opThemeAssetSearcher();
     $isSmt = sfContext::getInstance()->getRequest()->isSmartphone();
     $assetsType = array('css', 'js');
     foreach ($assetsType as $type) {
         $filePaths = $themeSearcher->findAssetsPathByThemeNameAndType($themeName, $type, $isSmt);
         if (false !== $filePaths) {
             self::includeCssOrJs($filePaths, $type, $isSmt);
         }
     }
 }