本文整理汇总了PHP中Gpf_Rpc_Form类的典型用法代码示例。如果您正苦于以下问题:PHP Gpf_Rpc_Form类的具体用法?PHP Gpf_Rpc_Form怎么用?PHP Gpf_Rpc_Form使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Gpf_Rpc_Form类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: load
/**
* @anonym
* @service custom_separator read
* @param Gpf_Rpc_Params $params
* @return Gpf_Rpc_Form
*/
public function load(Gpf_Rpc_Params $params) {
$form = new Gpf_Rpc_Form($params);
$form->addField(self::FIELD_NUMBER, Gpf_Settings::get(self::FIELD_NUMBER));
$form->addField(self::SECRET_WORD, Gpf_Settings::get(self::SECRET_WORD));
$form->addField(self::ALLOW_TEST_SALES, Gpf_Settings::get(self::ALLOW_TEST_SALES));
return $form;
}
示例2: saveRolePrivileges
/**
* Save role privileges
*
* @service role write
* @param Gpf_Rpc_Params $params
* @return Gpf_Rpc_Form
*/
public function saveRolePrivileges(Gpf_Rpc_Params $params)
{
$form = new Gpf_Rpc_Form($params);
$role = new Gpf_Db_Role();
$role->setId($form->getFieldValue('roleid'));
$role->load();
if (!strlen($role->getAccountId())) {
$form->setErrorMessage($this->_('It is not possible to changes privileges for default role %s', $role->getName()));
return $form;
}
//delete all privileges for selected role
Gpf_Db_Table_RolePrivileges::getInstance()->deleteAllPrivileges($role->getId());
//insert all privileges again to database
$objects = new Gpf_Data_RecordSet();
$objects->loadFromArray($form->getFieldValue('objects'));
foreach ($objects as $record) {
$rights = explode(',', $record->get('privileges'));
foreach ($rights as $right) {
$privilege = new Gpf_Db_RolePrivilege();
$privilege->setObject($record->get('object'));
$privilege->setRoleId($role->getId());
$privilege->setPrivilege($right);
$privilege->insert();
}
}
$form->setInfoMessage($this->_('Changes saved'));
return $form;
}
示例3: save
/**
* @service mail_template write
* @param $fields
* @return Gpf_Rpc_Form
*/
public function save(Gpf_Rpc_Params $params)
{
$form = new Gpf_Rpc_Form($params);
try {
$mailTemplate = $this->loadMailTemplate($form->getFieldValue('templateid'));
} catch (Gpf_Exception $e) {
$form->setErrorMessage($this->_('Failed to load mail template with error: %s', $e->getMessage()));
return $form;
}
try {
$className = $mailTemplate->get(Gpf_Db_Table_MailTemplates::CLASS_NAME);
$objTemplate = new $className();
$templateVariables = new Gpf_Data_RecordSet();
$templateVariables->setHeader(array('id', 'value'));
foreach ($objTemplate->getTemplateVariables() as $code => $name) {
$record = $templateVariables->createRecord();
$record->set('id', $code);
$record->set('value', $form->getFieldValue('var_' . $code));
$templateVariables->add($record);
}
$objTemplate->setCachedVariableValues($templateVariables);
$objTemplate->addRecipient($form->getFieldValue('recipient'));
$objTemplate->sendNow();
} catch (Gpf_Exception $e) {
$form->setErrorMessage($this->_('Failed to send test mail with error: %s', $e->getMessage()));
return $form;
}
$form->setInfoMessage($this->_('Test mail was successfully queued'));
return $form;
}
示例4: execute
protected function execute(Gpf_Rpc_Params $params)
{
$form = new Gpf_Rpc_Form($params);
$hostname = $form->getFieldValue(self::FTP_HOSTNAME);
if (substr($hostname, 0, 6) == 'ftp://') {
$hostname = substr($hostname, 6);
}
$username = $form->getFieldValue(self::FTP_USERNAME);
$password = $form->getFieldValue(self::FTP_PASSWORD);
if ($password == '*****') {
$password = Gpf_Settings::get(Gpf_Settings_Gpf::FTP_PASSWORD);
}
$directory = $form->getFieldValue(self::FTP_DIRECTORY);
$checkResult = $this->checkFtpConnectionSetAndOk($hostname, $directory, $username, $password);
if ($checkResult !== true) {
$form->setErrorMessage($checkResult);
return $form;
}
$this->writeFtpInfo($hostname, $directory, $username, $password);
try {
$task = new Gpf_Install_UpdateApplicationFilesTask($this->distributionFileName);
$task->run();
} catch (Gpf_Tasks_LongTaskInterrupt $e) {
$this->setResponseType($form, self::PART_DONE_TYPE);
$form->setInfoMessage($e->getMessage());
return $form;
} catch (Exception $e) {
$form->setErrorMessage($this->_('Error during files update (%s)', $e->getMessage()));
return $form;
}
$form->setInfoMessage($this->_('Files updated'));
$this->setNextStep($form);
return $form;
}
示例5: execute
protected function execute(Gpf_Rpc_Params $params)
{
$form = new Gpf_Rpc_Form($params);
$updateFile = $this->getNextUpdateFile();
if ($updateFile !== null) {
try {
Gpf_Install_CreateDatabaseTask::setStorageEngine($this->createDatabase());
$updateFile->execute();
} catch (Exception $e) {
$form->setErrorMessage($e->getMessage());
return $form;
}
$this->setResponseType($form, self::PART_DONE_TYPE);
$form->setInfoMessage($this->_('Updated to version %s-%s', $updateFile->getApplication(), $updateFile->getVersion()));
return $form;
}
$task = $this->getUpdateAccountTask();
try {
$task->run();
} catch (Gpf_Tasks_LongTaskInterrupt $e) {
$this->setResponseType($form, self::PART_DONE_TYPE);
$form->setInfoMessage($e->getMessage());
return $form;
} catch (Exception $e) {
$form->setErrorMessage($this->_('Error during application update (%s)', $e->getMessage()));
return $form;
}
$this->setNextStep($form);
return $form;
}
示例6: save
/**
* @service language write
* @return Gpf_Rpc_Form
*/
public function save(Gpf_Rpc_Params $params)
{
$form = new Gpf_Rpc_Form($params);
$result = parent::save($params);
Gpf_Lang_CsvLanguage::rebuildLanguageCache($form->getFieldValue('Id'));
return $result;
}
示例7: load
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));
}
示例8: load
/**
* @service banner read
* @param $bannerId
* @return Gpf_Rpc_Form
*/
public function load(Gpf_Rpc_Params $params) {
$form = new Gpf_Rpc_Form($params);
$bannerFactory = new Pap_Common_Banner_Factory();
$site = $bannerFactory->getBanner($form->getFieldValue(Gpf_View_FormService::ID));
$form->addField('htAccessCode', $site->getHtaccessCode());
return $form;
}
示例9: download
/**
* Download file from server
*
* @param Gpf_Rpc_Params $params
* @service db_file read
*/
public function download(Gpf_Rpc_Params $params)
{
try {
$form = new Gpf_Rpc_Form($params);
if (!strlen($form->getFieldValue('fileid'))) {
throw new Gpf_Exception("No fileid specified");
}
$this->file = new Gpf_Db_File();
$this->file->set('fileid', $form->getFieldValue("fileid"));
$this->file->load();
try {
if ($form->getFieldValue('attachment') == Gpf::YES) {
$this->isAttachment = true;
} else {
$this->isAttachment = false;
}
} catch (Exception $e) {
$this->isAttachment = false;
}
} catch (Gpf_DbEngine_NoRow $e) {
throw new Exception($this->_("File does not exist"));
} catch (Exception $e) {
throw new Exception($e->getMessage());
}
return $this;
}
示例10: downloadCsvLanguage
/**
* Download cached csv language file
*
* @service language export
* @param Gpf_Rpc_Params $params
*/
public function downloadCsvLanguage(Gpf_Rpc_Params $params)
{
$form = new Gpf_Rpc_Form($params);
$download = new Gpf_File_Download_FileSystem(Gpf_Lang_CsvLanguage::getAccountCsvFileName($form->getFieldValue('code')));
$download->setAttachment(true);
return $download;
}
示例11: getDescription
/**
*
* @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;
}
示例12: loadSettingsEmailNotifications
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));
}
示例13: save
/**
* @service cronjob write
* @param $fields
*/
public function save(Gpf_Rpc_Params $params) {
$form = new Gpf_Rpc_Form($params);
Gpf_Settings::set(Gpf_Settings_Gpf::CRON_RUN_INTERVAL, $form->getFieldValue(Gpf_Settings_Gpf::CRON_RUN_INTERVAL));
$form->setInfoMessage($this->_("Cron runtime saved"));
return $form;
}
示例14: currencyLoad
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;
}
示例15: exportCodes
/**
* @service coupon export
* @param bannerid
* @return Gpf_Rpc_Serializable
*/
public function exportCodes(Gpf_Rpc_Params $params) {
$form = new Gpf_Rpc_Form($params);
$coupon = new Pap_Features_Coupon_Coupon();
$coupon->setId($form->getFieldValue('bannerid'));
$select = $coupon->getCodes(Gpf_Session::getAuthUser()->getPapUserId());
$csvGenerator = new Gpf_Csv_GeneratorResponse('codes.csv', null, $select->getAllRows());
return $csvGenerator->generateFile();
}