setField() public method

public setField ( $name, $value, $values = null, $error = "" )
Example #1
0
 public function load(Gpf_Rpc_Form $form) {
     $form->setField(self::MAX_COMMISSIONS_PER_REFERRAL_NUMBER,
 	$this->getCommissionsAttributeWithDefaultValue($form->getFieldValue('Id'), self::MAX_COMMISSIONS_PER_REFERRAL_NUMBER, -1));
     
 	$form->setField(self::MAX_COMMISSIONS_PER_REFERRAL_PERIOD,
 	$this->getCommissionsAttributeWithDefaultValue($form->getFieldValue('Id'), self::MAX_COMMISSIONS_PER_REFERRAL_PERIOD, -1));
 }
Example #2
0
 /**
  *
  * @return Gpf_Rpc_Form
  */
 public function getDescription()
 {
     $data = new Gpf_Rpc_Form();
     $data->setField(self::VERSION, Gpf_Application::getInstance()->getVersion());
     $data->setField(self::SCENARION_NAME, $this->name);
     return $data;
 }
Example #3
0
 public function loadAccountSettings(Gpf_Rpc_Form $form) {
     $form->setField(Pap_Settings::RECAPTCHA_PRIVATE_KEY, Gpf_Settings::get(Pap_Settings::RECAPTCHA_PRIVATE_KEY));
     $form->setField(Pap_Settings::RECAPTCHA_PUBLIC_KEY, Gpf_Settings::get(Pap_Settings::RECAPTCHA_PUBLIC_KEY));
     $form->setField(Pap_Settings::RECAPTCHA_ENABLED, Gpf_Settings::get(Pap_Settings::RECAPTCHA_ACCOUNT_ENABLED));
     $form->setField(Pap_Settings::RECAPTCHA_THEME, Gpf_Settings::get(Pap_Settings::RECAPTCHA_ACCOUNT_THEME));
     return $form;
 }
Example #4
0
    public function loadSettingsEmailNotifications(Gpf_Rpc_Form $form) {
        $form->setField(Pap_Features_SplitCommissions_Definition::NOTIFICATION_ON_SALE_SUMMARY,
        Gpf_Settings::get(Pap_Features_SplitCommissions_Definition::NOTIFICATION_ON_SALE_SUMMARY));

        $form->setField(Pap_Features_SplitCommissions_Definition::NOTIFICATION_ON_SALE_SUMMARY_STATUS,
        Gpf_Settings::get(Pap_Features_SplitCommissions_Definition::NOTIFICATION_ON_SALE_SUMMARY_STATUS));   
    }
 public function setField($name, $value)
 {
     if (is_scalar($value) || $value instanceof Gpf_Rpc_Serializable) {
         $this->fields->setField($name, $value);
     } else {
         throw new Gpf_Exception("Not supported value");
     }
 }
Example #6
0
 /**
  * stores width x height to the size field.
  *
  * @param Gpf_Rpc_Form $form
  * @param String $sizeFieldName
  */
 public function encodeSize(Gpf_Rpc_Form $form, $sizeFieldName) {
     if($form->getFieldValue($sizeFieldName) == Pap_Db_Banner::SIZE_PREDEFINED) {
         $form->setField($sizeFieldName, $form->getFieldValue($sizeFieldName).$form->getFieldValue('size_predefined'));
     }
     if($form->getFieldValue($sizeFieldName) == Pap_Db_Banner::SIZE_OWN) {
         $form->setField($sizeFieldName, $form->getFieldValue($sizeFieldName).$form->getFieldValue('size_width').'x'.$form->getFieldValue('size_height'));
     }
 }
Example #7
0
 public function currencyLoad(Gpf_Rpc_Form $form) {
     try {
         $form->setField('multiple_currencies', Gpf_Settings::get(Pap_Settings::MULTIPLE_CURRENCIES));
     } catch (Gpf_Exception $e) {
         $form->setField('multiple_currencies', 'N');
     }
     return Gpf_Plugins_Engine::PROCESS_CONTINUE;
 }
 /**
  * @anonym 
  * @param Gpf_Rpc_Params $params
  * @service
  * @return Gpf_Rpc_Form
  */
 public function load(Gpf_Rpc_Params $params)
 {
     $form = new Gpf_Rpc_Form($params);
     $form->setField(self::LICENSE_AGREE_NAME, '');
     $form->setField(self::LICENSE_ID_NAME, '');
     $form->setField(self::VERSION_NAME, Gpf_Application::getInstance()->getVersion());
     return $form;
 }
Example #9
0
 public function load(Gpf_Rpc_Form $form) {
     try {
         $form->setField(SaleFilter_Definition::NAME_MINIMUM_TOTALCOST,
         $this->createCampaignAttribute()->getSetting(SaleFilter_Definition::NAME_MINIMUM_TOTALCOST, $form->getFieldValue('Id')));
         $form->setField(SaleFilter_Definition::NAME_MAXIMUM_TOTALCOST,
         $this->createCampaignAttribute()->getSetting(SaleFilter_Definition::NAME_MAXIMUM_TOTALCOST, $form->getFieldValue('Id')));
     } catch (Gpf_DbEngine_NoRowException $e) {
     }
 }
 /**
  * special handling
  *
  * @service password_constraints read
  * @param $fields
  * @return Gpf_Rpc_Form
  */
 public function load(Gpf_Rpc_Params $params)
 {
     $form = new Gpf_Rpc_Form($params);
     $form->setField('minLength', Gpf_Settings::get(Gpf_Settings_Gpf::PASSWORD_MIN_LENGTH));
     $form->setField('maxLength', Gpf_Settings::get(Gpf_Settings_Gpf::PASSWORD_MAX_LENGTH));
     $form->setField('azChars', Gpf_Settings::get(Gpf_Settings_Gpf::PASSWORD_LETTERS));
     $form->setField('digitsChars', Gpf_Settings::get(Gpf_Settings_Gpf::PASSWORD_DIGITS));
     $form->setField('specialChars', Gpf_Settings::get(Gpf_Settings_Gpf::PASSWORD_SPECIAL));
     return $form;
 }
	/**
     * @service invoice_format read
     * @param $fields
     */
    public function load(Gpf_Rpc_Params $params) {
        $form = new Gpf_Rpc_Form($params);

        $form->setField(Pap_Settings::GENERATE_INVOICES, Gpf_Settings::get(Pap_Settings::GENERATE_INVOICES));
        $form->setField(Pap_Settings::INVOICE_BCC_RECIPIENT, Gpf_Settings::get(Pap_Settings::INVOICE_BCC_RECIPIENT));

        $form->setField("payoutInvoice",
        	Gpf_Settings::get(Pap_Settings::PAYOUT_INVOICE));
        return $form;
    }
 /**
  * @service regional_settings read
  * @param $fields
  */
 public function load(Gpf_Rpc_Params $params)
 {
     $form = new Gpf_Rpc_Form($params);
     $form->setField(Gpf_Settings_Gpf::REGIONAL_SETTINGS_IS_DEFAULT, Gpf_Settings::get(Gpf_Settings_Gpf::REGIONAL_SETTINGS_IS_DEFAULT));
     $form->setField(Gpf_Settings_Gpf::REGIONAL_SETTINGS_DATE_FORMAT, Gpf_Settings::get(Gpf_Settings_Gpf::REGIONAL_SETTINGS_DATE_FORMAT));
     $form->setField(Gpf_Settings_Gpf::REGIONAL_SETTINGS_TIME_FORMAT, Gpf_Settings::get(Gpf_Settings_Gpf::REGIONAL_SETTINGS_TIME_FORMAT));
     $form->setField(Gpf_Settings_Gpf::REGIONAL_SETTINGS_THOUSANDS_SEPARATOR, Gpf_Settings::get(Gpf_Settings_Gpf::REGIONAL_SETTINGS_THOUSANDS_SEPARATOR));
     $form->setField(Gpf_Settings_Gpf::REGIONAL_SETTINGS_DECIMAL_SEPARATOR, Gpf_Settings::get(Gpf_Settings_Gpf::REGIONAL_SETTINGS_DECIMAL_SEPARATOR));
     return $form;
 }
	/**
	 * @service affiliate_signup_setting read
	 * @param $fields
	 */
	public function load(Gpf_Rpc_Params $params) {
		$form = new Gpf_Rpc_Form($params);
		$form->setField(Pap_Settings::POST_SIGNUP_TYPE_SETTING_NAME, Gpf_Settings::get(Pap_Settings::POST_SIGNUP_TYPE_SETTING_NAME));

		$form->setField(Pap_Settings::POST_SIGNUP_URL_SETTING_NAME, Gpf_Settings::get(Pap_Settings::POST_SIGNUP_URL_SETTING_NAME));

		$form->setField(Pap_Settings::SIGNUP_TERMS_SETTING_NAME, Gpf_Settings::get(Pap_Settings::SIGNUP_TERMS_SETTING_NAME));

		$form->setField(Pap_Settings::FORCE_TERMS_ACCEPTANCE_SETTING_NAME, Gpf_Settings::get(Pap_Settings::FORCE_TERMS_ACCEPTANCE_SETTING_NAME));

		$form->setField(Pap_Settings::INCLUDE_PAYOUT_OPTIONS, Gpf_Settings::get(Pap_Settings::INCLUDE_PAYOUT_OPTIONS));

		$form->setField(Pap_Settings::PAYOUT_OPTIONS, Gpf_Settings::get(Pap_Settings::PAYOUT_OPTIONS));

		$form->setField(Pap_Settings::FORCE_PAYOUT_OPTION, Gpf_Settings::get(Pap_Settings::FORCE_PAYOUT_OPTION));

		$form->setField('assignAffiliateTo', Gpf_Settings::get(Pap_Settings::ASSIGN_NON_REFERRED_AFFILIATE_TO));

		//		$form->setField(self::OPTIONAL_PAYOUT_FIELDS,
		//		Gpf_Settings::get(self::OPTIONAL_PAYOUT_FIELDS));

		$form->setField(Pap_Settings::AFFILIATE_APPROVAL, Gpf_Settings::get(Pap_Settings::AFFILIATE_APPROVAL));

		Gpf_Plugins_Engine::extensionPoint('PostAffiliate.AffiliateSignupForm.load', $form);

		return $form;
	}
	/**
	 * @service general_setting read
	 * @param $fields
	 */
	public function load(Gpf_Rpc_Params $params) {
		$form = new Gpf_Rpc_Form($params);

        $form->setField("payoutOptions",
        	Gpf_Settings::get(
        		Pap_Settings::PAYOUTS_PAYOUT_OPTIONS_SETTING_NAME));

        $form->setField("minimumPayout",
        	Gpf_Settings::get(Pap_Settings::PAYOUTS_MINIMUM_PAYOUT_SETTING_NAME));

		return $form;
	}
 /**
  * @service cronjob read
  * 
  * @param Gpf_Rpc_Params $params
  * @return Gpf_Rpc_Data
  */
 public function load(Gpf_Rpc_Params $params) {
     $form = new Gpf_Rpc_Form($params);
     
     $runner = new Gpf_Tasks_Runner();
     if (!$runner->isRunningOK()) {
         $form->setField('warningMessage', $this->_('Cron job is not running'));
     }
     $form->setField('lastRunTime', $runner->getLastRunTime());
     $form->setField('cronCommand', $this->getCronCommand());
     $form->setField(Gpf_Settings_Gpf::CRON_RUN_INTERVAL, Gpf_Settings::get(Gpf_Settings_Gpf::CRON_RUN_INTERVAL));
     return $form;
 }
    /**
     * @service logging_setting read
     * @param $fields
     */
    public function load(Gpf_Rpc_Params $params) {
        $form = new Gpf_Rpc_Form($params);

        $form->setField(Gpf_Settings_Gpf::LOG_LEVEL_SETTING_NAME, Gpf_Settings::get(Gpf_Settings_Gpf::LOG_LEVEL_SETTING_NAME));
       	$form->setField(Pap_Settings::DEBUG_TYPES, Gpf_Settings::get(Pap_Settings::DEBUG_TYPES));
        $form->setField(Pap_Settings::AUTO_DELETE_EVENTS, Gpf_Settings::get(Pap_Settings::AUTO_DELETE_EVENTS));
        $form->setField(Pap_Settings::AUTO_DELETE_EVENTS_RECORDS_NUM, Gpf_Settings::get(Pap_Settings::AUTO_DELETE_EVENTS_RECORDS_NUM));

        $form->setField(Pap_Settings::AUTO_DELETE_LOGINSHISTORY, Gpf_Settings::get(Pap_Settings::AUTO_DELETE_LOGINSHISTORY));

       	return $form;
    }
 /**
  *
  * @service proxy_setting read
  * @param $fields
  * @return Gpf_Rpc_Form
  */
 public function load(Gpf_Rpc_Params $params)
 {
     $form = new Gpf_Rpc_Form($params);
     try {
         $form->setField('server', Gpf_Settings::get(Gpf_Settings_Gpf::PROXY_SERVER_SETTING_NAME));
         $form->setField('port', Gpf_Settings::get(Gpf_Settings_Gpf::PROXY_PORT_SETTING_NAME));
         $form->setField('user', Gpf_Settings::get(Gpf_Settings_Gpf::PROXY_USER_SETTING_NAME));
         $form->setField('password', Gpf_Settings::get(Gpf_Settings_Gpf::PROXY_PASSWORD_SETTING_NAME));
     } catch (Gpf_Exception $e) {
         $form->setErrorMessage($this->_('Failed to load proxy server settings.'));
     }
     return $form;
 }
    /**
     * @service fraud_protection read
     * @param $fields
     */
    public function load(Gpf_Rpc_Params $params) {
        $form = new Gpf_Rpc_Form($params);

        $form->setField(Pap_Settings::BANNEDIPS_CLICKS_FROM_IFRAME,
        Gpf_Settings::get(Pap_Settings::BANNEDIPS_CLICKS_FROM_IFRAME));

        
        $form->setField(Pap_Settings::BANNEDIPS_CLICKS,
        Gpf_Settings::get(Pap_Settings::BANNEDIPS_CLICKS));

        $form->setField(Pap_Settings::BANNEDIPS_CLICKS_ACTION,
        Gpf_Settings::get(Pap_Settings::BANNEDIPS_CLICKS_ACTION));

        $form->setField(Pap_Settings::BANNEDIPS_LIST_CLICKS,
        Gpf_Settings::get(Pap_Settings::BANNEDIPS_LIST_CLICKS));

        $form->setField(Pap_Settings::REPEATING_BANNER_CLICKS,
        Gpf_Settings::get(Pap_Settings::REPEATING_BANNER_CLICKS));

        $form->setField(Pap_Settings::REPEATING_CLICKS_SETTING_NAME,
        Gpf_Settings::get(Pap_Settings::REPEATING_CLICKS_SETTING_NAME));

        $form->setField(Pap_Settings::REPEATING_CLICKS_SECONDS_SETTING_NAME,
        Gpf_Settings::get(Pap_Settings::REPEATING_CLICKS_SECONDS_SETTING_NAME));

        $form->setField(Pap_Settings::REPEATING_CLICKS_ACTION_SETTING_NAME,
        Gpf_Settings::get(Pap_Settings::REPEATING_CLICKS_ACTION_SETTING_NAME));

        Gpf_Plugins_Engine::extensionPoint('FraudProtectionClicksForm.load', $form);

        return $form;
    }
 /**
  * @anonym 
  * @param Gpf_Rpc_Params $params
  * @service
  * @return Gpf_Rpc_Form
  */
 public function load(Gpf_Rpc_Params $params)
 {
     $form = new Gpf_Rpc_Form($params);
     try {
         $db = $this->createDatabase();
         $db->connect();
         $form->setField(self::DB_HOSTNAME, $db->getHostname());
         $form->setField(self::DB_USERNAME, $db->getUsername());
         $form->setField(self::DB_PASSWORD, '*****');
         $form->setField(self::DB_NAME, $db->getDbname());
     } catch (Exception $e) {
     }
     return $form;
 }
Example #20
0
 /**
  * Upload file to server
  *
  * @service db_file write
  * @param Gpf_Rpc_Params $params
  * @return Gpf_Rpc_Form
  */
 public function upload(Gpf_Rpc_Params $params)
 {
     $form = new Gpf_Rpc_Form($params);
     try {
         $this->uploadFile();
         $file = $this->saveUploadedFile();
         $form->setField("fileid", $file->get('fileid'));
         $form->setField("filename", $file->get('filename'));
         $form->setField("filetype", $file->get('filetype'));
         $form->setField("filesize", $file->get('filesize'));
     } catch (Exception $e) {
         $form->setErrorMessage($e->getMessage());
     }
     return $form;
 }
 /**
  * @anonym 
  * @param Gpf_Rpc_Params $params
  * @service
  * @return Gpf_Rpc_Form
  */
 public function load(Gpf_Rpc_Params $params)
 {
     $form = new Gpf_Rpc_Form($params);
     $username = Gpf_Settings::get(Gpf_Settings_Gpf::FTP_USERNAME);
     $password = Gpf_Settings::get(Gpf_Settings_Gpf::FTP_PASSWORD);
     $hostname = Gpf_Settings::get(Gpf_Settings_Gpf::FTP_HOSTNAME);
     $directory = Gpf_Settings::get(Gpf_Settings_Gpf::FTP_DIRECTORY);
     if ($this->checkFtpConnectionSetAndOk($hostname, $directory, $username, $password) === true) {
         $form->setField(self::FTP_USERNAME, $username);
         $form->setField(self::FTP_PASSWORD, '*****');
         $form->setField(self::FTP_HOSTNAME, $hostname);
         $form->setField(self::FTP_DIRECTORY, $directory);
     }
     return $form;
 }
    /**
     * @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;
    }
 /**
  * @service transaction write
  */
 public function importCSV(Gpf_Rpc_Params $params){
     $form = new Gpf_Rpc_Form($params);
     $importTask = new Pap_Merchants_Transaction_TransactionsImportTask($form, 'Pap_Merchants_Transaction_TransactionsImportTask');
     try {
         $importTask->run();
         $form->setField(self::SUCCESS, Gpf::YES);
     } catch (Gpf_Tasks_LongTaskInterrupt $e) {
         $form->setField(self::SUCCESS, Gpf::NO);
         $form->setInfoMessage($e->getMessage());
     } catch (Exception $e) {
         $importTask->forceFinishTask();
         $form->setField(self::SUCCESS, Gpf::YES);
         $form->setErrorMessage($this->_('Error during Import') . ' (' . $e->getMessage() . ') ');
     }
     return $form;
 }
    /**
     * @service banner read
     */
    public function getBannerPreview(Gpf_Rpc_Params $params) {
        $form = new Gpf_Rpc_Form($params);

        $id = $form->getFieldValue('bannerId');
        $type = $form->getFieldValue('rtype');
        $actualSize = $form->getFieldValue('actualSize');
        try {
            $bannerObj = $this->bannerFactory->getBannerObject($id, $type);
        } catch (Pap_Common_Banner_NotFound $e) {
            $form->setField('bannerPreview', 'Unknown banner type');
            return $form;
        }
        $bannerObj->setViewInActualSize($actualSize);
        $form->setField('bannerPreview', $bannerObj->getPreview(new Pap_Common_User()));
        return $form;
    }
	/**
	 * @service commission read
	 * @param $fields
	 */
	public function loadSignupBonus(Gpf_Rpc_Params $params) {
		$form = new Gpf_Rpc_Form($params);

		$form->setField(Pap_Settings::SIGNUP_BONUS,
		Gpf_Settings::get(Pap_Settings::SIGNUP_BONUS));
		return $form;
	}
 /**
  *
  * @param Gpf_Rpc_Params $params
  * @service
  * @anonym
  */
 public function load(Gpf_Rpc_Params $params)
 {
     $form = new Gpf_Rpc_Form($params);
     $currentLanguage = Gpf_Session::getAuthUser()->getLanguage();
     $form->setField(self::SELECT_LANGUAGE, $currentLanguage, Gpf_Lang_Languages::getInstance()->getActiveLanguagesNoRpc()->toObject());
     return $form;
 }
    /**
     * @service tracking_mod_rewrite write
     * @param $fields
     */
    public function save(Gpf_Rpc_Params $params) {
        $form = new Gpf_Rpc_Form($params);

        $prefix = $form->getFieldValue(Pap_Settings::MOD_REWRITE_PREFIX_SETTING_NAME);
        $separator = $form->getFieldValue(Pap_Settings::MOD_REWRITE_SEPARATOR_SETTING_NAME);
        $suffix = $form->getFieldValue(Pap_Settings::MOD_REWRITE_SUFIX_SETTING_NAME);
        $htaccessCode = $this->generateHtaccessCode($prefix, $separator, $suffix);

        if($separator == '') {
        	$form->setErrorMessage("Separator cannot be empty!");
        	return $form;
        }

        Gpf_Settings::set(Pap_Settings::MOD_REWRITE_PREFIX_SETTING_NAME, $prefix);
        Gpf_Settings::set(Pap_Settings::MOD_REWRITE_SEPARATOR_SETTING_NAME, $separator);
        Gpf_Settings::set(Pap_Settings::MOD_REWRITE_SUFIX_SETTING_NAME, $suffix);

        $form->setField("htaccess_code", $htaccessCode);

        $form->setInfoMessage($this->_("Changes saved"));

        Pap_Db_Table_CachedBanners::clearCachedBanners();

        return $form;
    }
 /**
  * Upload file to server
  *
  * @param Gpf_Rpc_Params $params
  * @service db_file write
  * @return Gpf_Rpc_Form
  */
 public function upload(Gpf_Rpc_Params $params)
 {
     $form = new Gpf_Rpc_Form($params);
     try {
         $this->uploadFile();
         $uploadedFile = $this->saveUploadedFile();
         $form->setField('filename', $this->name);
         $form->setField('filetype', $this->type);
         $form->setField('filesize', $this->size);
         $form->setField('fileurl', $uploadedFile);
         $form->setInfoMessage($this->_("File was successfully uploaded"));
     } catch (Exception $e) {
         $form->setErrorMessage($e->getMessage());
     }
     return $form;
 }
    /**
     * @service url_setting read
     * @param $fields
     */
    public function load(Gpf_Rpc_Params $params) {
        $form = new Gpf_Rpc_Form($params);

        $form->setField(Pap_Settings::MAIN_SITE_URL,
            Gpf_Settings::get(Pap_Settings::MAIN_SITE_URL));

        return $form;
    }
    /**
     * Load format for edit
     *
     * @service banner_format_setting read
     * @param $fields
     */
    public function load(Gpf_Rpc_Params $params) {
        $form = new Gpf_Rpc_Form($params);

        $form->setField("format", $this->loadFormatFromName($form->getFieldValue("Id")));


        return $form;
    }