本文整理匯總了PHP中Gpf_Rpc_Form::fill方法的典型用法代碼示例。如果您正苦於以下問題:PHP Gpf_Rpc_Form::fill方法的具體用法?PHP Gpf_Rpc_Form::fill怎麽用?PHP Gpf_Rpc_Form::fill使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Gpf_Rpc_Form
的用法示例。
在下文中一共展示了Gpf_Rpc_Form::fill方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: generateCoupon
protected function generateCoupon($code) {
$coupon = new Pap_Db_Coupon();
$this->form->fill($coupon);
$coupon->setBannerID($this->form->getFieldValue(Pap_Features_Coupon_CreateCoupons::BANNER_ID));
$coupon->setStatus(Pap_Common_Constants::STATUS_APPROVED);
$coupon->setCode($code);
$coupon->setUserID($this->affiliateID);
$coupon->setUseCount(0);
$this->insertCoupon($coupon);
}
示例2: save
/**
* @service grid_view write
*
* @param $Id
* @param $gridcode
* @param $name
* @param $rowsperpage
* @param $columns
*/
public function save(Gpf_Rpc_Params $params) {
$form = new Gpf_Rpc_Form($params);
$viewId = $form->getFieldValue('Id');
$view = $this->getView($viewId);
try {
$form->fill($view);
$this->saveView($view, $form);
} catch (Exception $e) {
$form->setErrorMessage($this->_("Error while saving ") . $form->getFieldValue('name') . " (" . $e->getMessage() . ")");
}
return $form;
}
示例3: save
/**
* @service email_setting write
* @param $fields
* @return Gpf_Rpc_Form
*/
public function save(Gpf_Rpc_Params $params)
{
$form = new Gpf_Rpc_Form($params);
$dbRow = new Gpf_Db_MailAccount();
try {
$dbRow->setAsDefault(true);
$dbRow->loadFromData(array(Gpf_Db_Table_MailAccounts::IS_DEFAULT));
} catch (Gpf_DbEngine_NoRowException $e) {
$dbRow->setAccountName($this->_("Default Mail Account"));
$dbRow->setAsDefault(true);
}
$form->fill($dbRow);
$dbRow->save();
$form->setInfoMessage($this->_("Email settings saved"));
return $form;
}
示例4: add
/**
* @service filter write
* @param $fields
*/
public function add(Gpf_Rpc_Params $params) {
$form = new Gpf_Rpc_Form($params);
$filter = new Gpf_Db_Filter();
$form->fill($filter);
$filter->setUserId(Gpf_Session::getAuthUser()->getUserId());
try {
$filter->insert();
$this->saveFilterPresets($form, $filter->getPrimaryKeyValue());
} catch (Exception $e) {
$form->setErrorMessage($e->getMessage());
return $form;
}
$form->load($filter);
$form->setField('Id', $filter->get('filterid'));
$form->setInfoMessage($this->_("Filter added"));
return $form;
}
示例5: add
/**
* Create new language
*
* @service language add
* @return Gpf_Rpc_Form
*/
public function add(Gpf_Rpc_Params $params)
{
$form = new Gpf_Rpc_Form($params);
$lang = new Gpf_Db_Language();
$lang->setCode($form->getFieldValue(Gpf_Db_Table_Languages::CODE));
$lang->setAccountId(Gpf_Application::getInstance()->getAccountId());
$lang->setId($lang->generateId());
try {
//Load should fail, otherwise it is error - language already exists
$lang->load();
$form->setErrorMessage($this->_('Language code %s is already used in your installation', $form->getFieldValue(Gpf_Db_Table_Languages::CODE)));
return $form;
} catch (Exception $e) {
}
try {
//Load language from default csv file
$fileNameDefault = Gpf_Paths::getInstance()->getLanguageInstallDirectory() . Gpf_Application::getInstance()->getCode() . '_' . Gpf_Lang_CsvHandler::DEFAULT_LANGUAGE . '.csv';
$file = new Gpf_Io_Csv_Reader($fileNameDefault, ';', '"', array('source', 'translation', 'type', 'module', 'status', 'customer'));
$csvLanguage = new Gpf_Lang_CsvLanguage();
$csvLanguage->loadFromCsvFile($file);
$form->fill($lang);
$lang->setAccountId(Gpf_Application::getInstance()->getAccountId());
$lang->setId($lang->generateId());
$lang->setActive(true);
$lang->setTranslatedPercentage(0);
$lang->insert();
//update metadata
$csvLanguage->copyMetadataFromDbLanguage($lang);
foreach ($csvLanguage->getTranslations() as $translation) {
$translation->setStatus(Gpf_Lang_Parser_Translation::STATUS_NOT_TRANSLATED);
}
//export cache
$csvLanguage->exportAccountCache();
} catch (Exception $e) {
$form->setErrorMessage($this->_('Failed to create new language: %s', $e->getMessage()));
return $form;
}
$form->setInfoMessage($this->_('New language with code %s created', $form->getFieldValue(Gpf_Db_Table_Languages::CODE)));
return $form;
}
示例6: add
/**
*
* @service user_comm_group add
* @param $fields
*/
public function add(Gpf_Rpc_Params $params) {
$form = new Gpf_Rpc_Form($params);
$dbRow = $this->createDbRowObject();
$this->setDefaultDbRowObjectValues($dbRow);
$form->fill($dbRow);
$dbRow->set(Pap_Db_Table_UserInCommissionGroup::STATUS, self::DEFAULT_STATUS);
$dbRow->set(Pap_Db_Table_UserInCommissionGroup::NOTE, self::DEFAULT_NOTE);
$dbRow->set(Pap_Db_Table_UserInCommissionGroup::DATE_ADDED, Gpf_Common_DateUtils::now());
try {
$dbRow->save();
} catch (Exception $e) {
$form->setErrorMessage($e->getMessage());
return $form;
}
$form->load($dbRow);
$form->setField("Id", $dbRow->getPrimaryKeyValue());
$form->setInfoMessage($this->getDbRowObjectName().$this->_(" added"));
return $form;
}
示例7: add
/**
*
* @service user_in_commission_group add
* @param $fields
* @return Gpf_Rpc_Form
*/
public function add(Gpf_Rpc_Params $params) {
$form = new Gpf_Rpc_Form($params);
$dbRow = $this->createDbRowObject();
$this->setDefaultDbRowObjectValues($dbRow);
$form->fill($dbRow);
$dbRow->setDateAdded(Gpf_Common_DateUtils::getDateTime(time()));
$dbRow->removeUserFromCampaignGroups($form->getFieldValue('campaignid'));
try {
$dbRow->save();
} catch (Exception $e) {
$form->setErrorMessage($e->getMessage());
return $form;
}
$form->load($dbRow);
$form->setField("Id", $dbRow->getPrimaryKeyValue());
$form->setInfoMessage($this->_("%s was successfully added", $this->getDbRowObjectName()));
return $form;
}
示例8: fillAdd
protected function fillAdd(Gpf_Rpc_Form $form, Gpf_DbEngine_RowBase $dbRow) {
$form->fill($dbRow);
}
示例9: save
/**
* @service grid_view write
*
* @param $Id
* @param $gridcode
* @param $name
* @param $rowsperpage
* @param $columns
*/
public function save(Gpf_Rpc_Params $params) {
$form = new Gpf_Rpc_Form($params);
$viewId = $form->getFieldValue('Id');
if ($viewId == self::DEFAULT_VIEW_ID) {
$form->setErrorMessage($this->_("Default view can not be modified"));
return $form;
}
$view = $this->getView($viewId);
try {
$form->fill($view);
if (($view->getName() == $this->_(self::DEFAULT_VIEW_NAME))) {
throw new Gpf_Exception($this->_("View name must be unique"));
}
$this->saveView($view, $form);
} catch (Exception $e) {
$form->setErrorMessage($this->_("Error while saving view ") . $form->getFieldValue('name') . " (" . $e->getMessage() . ")");
}
return $form;
}
示例10: save
/**
* @service currency write
* @param $fields
*/
public function save(Gpf_Rpc_Params $params) {
$form = new Gpf_Rpc_Form($params);
$dbRow = $this->createDbRowObject();
$dbRow->setIsDefault(Gpf_Db_Currency::DEFAULT_CURRENCY_VALUE);
try {
$dbRow->loadFromData();
} catch (Gpf_DbEngine_NoRowException $e) {
$dbRow->setAccountId(Gpf_Session::getAuthUser()->getAccountId());
}
$oldDbRow = clone $dbRow;
$form->fill($dbRow);
foreach ($oldDbRow as $name => $oldValue) {
if ($dbRow->get($name) != $oldValue) {
$form->addField('changed', 'Y');
break;
}
}
try {
$dbRow->save();
Gpf_Plugins_Engine::extensionPoint('PostAffiliate.CurrencyForm.save', $form);
} catch (Exception $e) {
$form->setErrorMessage($e->getMessage());
return $form;
}
$form->load($dbRow);
$form->setInfoMessage($this->getDbRowObjectName().$this->_(" saved"));
return $form;
}
示例11: saveCapping
/**
* Saves capping settings for this campaign
*
* @service campaign write
* @param $fields
*/
public function saveCapping(Gpf_Rpc_Params $params) {
$form = new Gpf_Rpc_Form($params);
$campaign = new Pap_Common_Campaign();
$campaign->set('campaignid', $form->getFieldValue("Id"));
try {
$campaign->load();
} catch (Gpf_DbEngine_NoRow $e) {
$form->setErrorMessage($this->_("Campaign does not exist"));
return $form;
}
$form->fill($campaign);
$this->checkBeforeSave($campaign, $form);
try {
$campaign->save();
} catch (Exception $e) {
$form->setErrorMessage($e->getMessage());
return $form;
}
$form->load($campaign);
$form->setInfoMessage($this->_("Campaign capping saved"));
return $form;
}
示例12: processMultiTier
/**
*
* @param $form
* @return Gpf_Rpc_Form
*/
protected function processMultiTier(Gpf_Rpc_Form $form) {
$transaction = new Pap_Common_Transaction();
$form->fill($transaction);
$this->addMultiTierTransaction($form->getFieldValue(Pap_Db_Table_Transactions::TOTAL_COST),
$form->getFieldValue(Pap_Db_Table_Transactions::CAMPAIGN_ID),
$form->getFieldValue(Pap_Db_Table_Transactions::USER_ID),
$form->getFieldValue(Pap_Db_Table_Transactions::COMMISSIONTYPEID),
$form->getFieldValue(Pap_Db_Table_Transactions::R_STATUS),
$transaction);
$form->setInfoMessage($this->_('Transaction was successfully added'));
return $form;
}