/**
     * @service theme write
     *
     * @return Gpf_Rpc_Action
     */
    public function save(Gpf_Rpc_Params $params) {
        $form = new Gpf_Rpc_Form($params);
        $newThemeId = str_replace(' ', '_', $form->getFieldValue('name'));
        $srcTheme = new Gpf_Desktop_Theme($form->getFieldValue('Id')
        , $form->getFieldValue('panelName'));
        $srcPath = $srcTheme->getThemePath();
        $targetPath = new Gpf_Io_File($srcPath->getParent().$newThemeId);
        try{
            $targetPath->mkdir();
            $srcPath->recursiveCopy($targetPath);

            $newTheme = new Gpf_Desktop_Theme($newThemeId
            , $form->getFieldValue('panelName'));
            $newTheme->load();
            $newTheme->setName($form->getFieldValue('name'));
            $newTheme->setAuthor($form->getFieldValue('author'));
            $newTheme->setUrl($form->getFieldValue('url'));
            $newTheme->setDescription($form->getFieldValue('description'));
            $newTheme->setBuiltIn(false);
            $newTheme->save();
        }catch(Gpf_Exception $ex){
            $form->setErrorMessage($ex->getMessage());
        }
        $form->setField('themeId', $newThemeId);
        return $form;
    }
    protected function loadSetting() {
        parent::loadSetting();

        $this->addSetting(Pap_Settings::AFF_NOTIFICATION_ON_NEW_SALE_ENABLED_SETTING_NAME);

        $this->addSetting(Pap_Settings::AFF_NOTIFICATION_ON_SUBAFF_SIGNUP_ENABLED_SETTING_NAME);
        $this->addSetting(Pap_Settings::AFF_NOTIFICATION_ON_SUBAFF_SALE_ENABLED_SETTING_NAME);

    	$this->addSetting(Pap_Settings::SUPPORT_DIRECT_LINKING);
        $this->addSetting(Pap_Settings::MAIN_SITE_URL);

        $this->addSetting(Pap_Settings::TEXT_BANNER_FORMAT_SETTING_NAME);
        $this->addSetting(Pap_Settings::IMAGE_BANNER_FORMAT_SETTING_NAME);
        $this->addSetting(Pap_Settings::FLASH_BANNER_FORMAT_SETTING_NAME);

        $this->addSetting(Pap_Settings::BRANDING_TEXT_POST_AFFILIATE_PRO);
        $this->addSetting(Gpf_Settings_Gpf::BRANDING_QUALITY_UNIT);
        $this->addSetting(Pap_Settings::BRANDING_KNOWLEDGEBASE_LINK);
        $this->addSetting(Pap_Settings::BRANDING_POST_AFFILIATE_PRO_HELP_LINK);
        $this->addSetting(Pap_Settings::BRANDING_TUTORIAL_VIDEOS_ENABLED);
        $this->addSetting(Pap_Settings::SETTING_LINKING_METHOD);
        
        Gpf_Plugins_Engine::extensionPoint('PostAffiliate.ApplicationSettings.loadSetting', $this);
        
        $this->addValue(Pap_Settings::PARAM_NAME_USER_ID, Pap_Tracking_Request::getAffiliateClickParamName());
        $this->addValue(Pap_Settings::PARAM_NAME_BANNER_ID, Pap_Tracking_Request::getBannerClickParamName());
        
        $currentTheme = new Gpf_Desktop_Theme();
        $this->addValue("desktopMode", $currentTheme->getDesktopMode());

        //TODO - IIF Export Format - easy solution for adding other export button than CSV, if needed other formats need to refactor (find out if plugin is active)
        $this->addValue("quickBooksPluginActive", $this->isPluginActive('QuickBooks'));


       	try {
       	    $defaultCurrency = Gpf_Db_Currency::getDefaultCurrency();
       	    $this->addValue("currency_symbol", $defaultCurrency->getSymbol());
       	    $this->addValue("currency_precision", $defaultCurrency->getPrecision());
       	    $this->addValue("currency_wheredisplay", $defaultCurrency->getWhereDisplay());
       	} catch(Gpf_Exception $e) {
       	    $this->addValue("currency_symbol", "Unknown");
       	    $this->addValue("currency_precision", 2);
       	    $this->addValue("currency_wheredisplay", 1);
       	}
    }    
Пример #3
0
 /**
  * Get recordset of all selected wallpaper
  *
  * @param Gpf_Rpc_Params $params
  * @return Gpf_Data_RecordSet
  */
 public function loadSelectedWallpaperNoRpc()
 {
     $response = new Gpf_Data_RecordSet();
     $response->addColumn(self::WALLPAPER_TYPE);
     $response->addColumn(self::WALLPAPER_POSITION);
     $response->addColumn(self::BACKGROUND_COLOR);
     $response->addColumn("fileId");
     $response->addColumn("url");
     $record = $response->createRecord();
     try {
         Gpf_Db_Table_UserAttributes::getInstance()->loadAttributes(Gpf_Session::getAuthUser()->getAccountUserId());
         $wallpaperType = Gpf_Db_Table_UserAttributes::getInstance()->getAttributeWithDefaultValue(self::WALLPAPER_TYPE, self::TYPE_THEME);
         $theme = new Gpf_Desktop_Theme();
         $wallpaperId = Gpf_Db_Table_UserAttributes::getInstance()->getAttributeWithDefaultValue(self::WALLPAPER, $theme->getDefaultWallpaper());
         $position = Gpf_Db_Table_UserAttributes::getInstance()->getAttributeWithDefaultValue(self::WALLPAPER_POSITION, $theme->getDefaultWallpaperPosition());
         $color = Gpf_Db_Table_UserAttributes::getInstance()->getAttributeWithDefaultValue(self::BACKGROUND_COLOR, $theme->getDefaultBackgroundColor());
         $record->set(self::WALLPAPER_POSITION, $position);
         $record->set(self::BACKGROUND_COLOR, $color);
         $record->set(self::WALLPAPER_TYPE, $wallpaperType);
         if ($wallpaperType == self::TYPE_THEME) {
             $record->set("url", Gpf_Paths::getInstance()->getResourceUrl($wallpaperId, Gpf_Paths::IMAGE_DIR . Gpf_Paths::WALLPAPER_DIR));
         } else {
             if ($wallpaperType == self::TYPE_CUSTOM) {
                 $wallpaper = new Gpf_Db_Wallpaper();
                 $wallpaper->setPrimaryKeyValue($wallpaperId);
                 $wallpaper->load();
                 $record->set("fileId", $wallpaper->getFileId());
                 $record->set("url", $wallpaper->getUrl());
             }
         }
     } catch (Gpf_Exception $e) {
         $theme = new Gpf_Desktop_Theme();
         $record->set(self::WALLPAPER_POSITION, "S");
         $record->set(self::BACKGROUND_COLOR, "#000000");
         $record->set(self::WALLPAPER_TYPE, self::TYPE_NONE);
         $record->set("fileId", null);
         $record->set("url", "");
     }
     $response->addRecord($record);
     return $response;
 }
Пример #4
0
 private function canDisableTheme($panelName)
 {
     $iterator = new Gpf_Io_DirectoryIterator(Gpf_Paths::getInstance()->getTopTemplatePath() . $panelName, '', false, true);
     $enabledCount = 0;
     foreach ($iterator as $fullName => $themeId) {
         if ($themeId == rtrim(Gpf_Paths::DEFAULT_THEME, '/')) {
             continue;
         }
         try {
             $theme = new Gpf_Desktop_Theme($themeId, $panelName);
             if ($theme->isEnabled()) {
                 $enabledCount++;
                 if ($enabledCount == 2) {
                     return true;
                 }
             }
         } catch (Gpf_Exception $e) {
             Gpf_Log::error($e->getMessage());
         }
     }
     return false;
 }
Пример #5
0
 public function isThemeValid($theme)
 {
     if (strpos($theme, '_') === 0) {
         return false;
     }
     $themePath = Gpf_Paths::getInstance()->getTopTemplatePath() . $this->getPanelName() . '/' . $theme . '/';
     if (!Gpf_Io_File::isFileExists($themePath) || !Gpf_Io_File::isFileExists($themePath . Gpf_Desktop_Theme::CONFIG_FILE_NAME)) {
         return false;
     }
     $themeObj = new Gpf_Desktop_Theme($theme, $this->getPanelName());
     return $themeObj->isEnabled();
 }