本文整理汇总了PHP中Gpf_Data_RecordSet::loadFromArray方法的典型用法代码示例。如果您正苦于以下问题:PHP Gpf_Data_RecordSet::loadFromArray方法的具体用法?PHP Gpf_Data_RecordSet::loadFromArray怎么用?PHP Gpf_Data_RecordSet::loadFromArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gpf_Data_RecordSet
的用法示例。
在下文中一共展示了Gpf_Data_RecordSet::loadFromArray方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: saveFieldsRpc
protected function saveFieldsRpc(Gpf_Rpc_Params $params) {
$action = new Gpf_Rpc_Action($params);
$action->setErrorMessage($this->_('Failed to save %s field(s) in %s(s)', '%s', $this->getDbRowObjectName()));
$action->setInfoMessage($this->_('%s field(s) in %s(s) successfully saved', '%s', $this->getDbRowObjectName()));
$fields = new Gpf_Data_RecordSet();
$fields->loadFromArray($action->getParam("fields"));
foreach ($fields as $field) {
$dbRow = $this->createDbRowObject();
$dbRow->setPrimaryKeyValue($field->get(Gpf_Db_Table_FormFields::ID));
$dbRow->load();
$dbRow->setName($field->get(Gpf_Db_Table_FormFields::NAME));
$dbRow->setStatus($field->get(Gpf_Db_Table_FormFields::STATUS));
$dbRow->setType($field->get(Gpf_Db_Table_FormFields::TYPE));
if ($field->get(Gpf_Db_Table_FormFields::AVAILABLEVALUES) != null) {
$dbRow->setAvailableValues($field->get(Gpf_Db_Table_FormFields::AVAILABLEVALUES));
}
$dbRow->save();
$action->addOk();
}
return $action;
}
示例3: saveFields
/**
* @service channel write
*
* @param $fields
* @return Gpf_Rpc_Action
*/
public function saveFields(Gpf_Rpc_Params $params) {
$action = new Gpf_Rpc_Action($params);
$action->setErrorMessage($this->_('Failed to save %s field(s)'));
$action->setInfoMessage($this->_('%s field(s) successfully saved'));
$fields = new Gpf_Data_RecordSet();
$fields->loadFromArray($action->getParam("fields"));
$channels = Pap_Db_Table_Channels::getUserChannels(Gpf_Session::getAuthUser()->getPapUserId());
foreach ($fields as $field) {
$isUnique = true;
foreach ($channels as $channel) {
if ($field->get('value') == $channel->get(Pap_Db_Table_Channels::VALUE)) {
$isUnique = false;
break;
}
}
if ($isUnique) {
$this->saveField($field);
} else {
$action->setErrorMessage($this->_("Failed to save %s field(s). Data with value '".$field->get('value').
"' already exist. Data must be unique."));
$action->addError();
return $action;
}
}
$action->addOk();
return $action;
}
示例4: saveFields
/**
* @service commission_group write
*
* @param $fields
* @return Gpf_Rpc_Action
*/
public function saveFields(Gpf_Rpc_Params $params) {
$action = new Gpf_Rpc_Action($params);
$action->setErrorMessage($this->_('Failed to save %s field(s) in %s(s)', '%s', $this->_('commission group')));
$action->setInfoMessage($this->_('%s field(s) in %s(s) successfully saved', '%s', $this->_('commission group')));
$userId = $action->getParam('id');
$fields = new Gpf_Data_RecordSet();
$fields->loadFromArray($action->getParam("fields"));
foreach ($fields as $field) {
$this->saveCommissionGroup($field->get('id'), $userId, $field->get("value"));
$action->addOk();
}
return $action;
}
示例5: saveFields
/**
* @service affiliate_tracking_code write_own
* @param $ids
* @return Gpf_Rpc_Action
*/
public function saveFields(Gpf_Rpc_Params $params) {
$action = new Gpf_Rpc_Action($params);
$action->setErrorMessage($this->_('Failed to save %s field(s) in %s(s)', '%s', $this->getDbRowObjectName()));
$action->setInfoMessage($this->_('%s field(s) in %s(s) successfully saved', '%s', $this->getDbRowObjectName()));
$fields = new Gpf_Data_RecordSet();
$fields->loadFromArray($action->getParam("fields"));
foreach ($fields as $field) {
$dbRow = $this->loadAffTrackingCode($field);
$dbRow->setStatus(Pap_Common_Constants::STATUS_PENDING);
$dbRow->set($field->get("name"), $field->get("value"));
$dbRow->save();
$action->addOk();
}
return $action;
}
示例6: saveGadgets
/**
* @service gadget write
* @return Gpf_Rpc_Action
*/
public function saveGadgets(Gpf_Rpc_Params $params)
{
$action = new Gpf_Rpc_Action($params);
$action->setInfoMessage($this->_('Gadgets saved'));
$gadgets = new Gpf_Data_RecordSet();
$gadgets->loadFromArray($action->getParam('gadgets'));
foreach ($gadgets as $gadgetRecord) {
$gadget = new Gpf_Db_Gadget();
$gadget->setPrimaryKeyValue($gadgetRecord->get("gadgetid"));
try {
$gadget->load();
} catch (Gpf_Db_NoRowException $e) {
}
$gadget->fillFromRecord($gadgetRecord);
$gadget->set('accountuserid', Gpf_Session::getAuthUser()->getAccountUserId());
$gadget->save();
}
$action->addOk();
return $action;
}
示例7: saveFields
/**
* @service
*
* @param $fields
* @return Gpf_Rpc_Action
*/
public function saveFields(Gpf_Rpc_Params $params) {
$action = new Gpf_Rpc_Action($params);
$action->setErrorMessage($this->_('Failed to save %s field(s) in %s(s)', '%s', $this->getDbRowObjectName()));
$action->setInfoMessage($this->_('%s field(s) in %s(s) successfully saved', '%s', $this->getDbRowObjectName()));
$fields = new Gpf_Data_RecordSet();
$fields->loadFromArray($action->getParam("fields"));
foreach ($fields as $field) {
$dbRow = $this->createDbRowObject();
$dbRow->setPrimaryKeyValue($field->get('id'));
$dbRow->load();
$dbRow->set($field->get("name"), $field->get("value"));
$dbRow->save();
$action->addOk();
}
return $action;
}
示例8: saveView
protected function saveView(Gpf_Db_View $view, Gpf_Rpc_Form $form) {
$view->set('accountuserid', $this->getUserId());
$view->set('viewtype', $form->getFieldValue('gridcode'));
$view->save();
$view->load();
$viewId = $view->get(Gpf_Db_Table_Views::ID);
$viewColumns = Gpf_Db_Table_ViewColumns::getInstance();
$viewColumns->deleteAll($viewId);
$rorder = 0;
$columns = new Gpf_Data_RecordSet();
$columns->loadFromArray($form->getFieldValue('columns'));
foreach ($columns as $column) {
$viewColumn = new Gpf_Db_ViewColumn();
$viewColumn->set('viewid', $viewId);
$viewColumn->set('name', $column->get('id'));
$viewColumn->set('sorted', $column->get('sorted'));
$viewColumn->set('width', $column->get('width'));
$viewColumn->set('rorder', $rorder++);
$viewColumn->save();
}
$form->setInfoMessage($this->_('View %s saved',$form->getFieldValue('name')));
$form->setField('Id',$view->getId());
$activeViewsTable = Gpf_Db_Table_ActiveViews::getInstance();
$activeViewsTable->saveActiveView($view->get("viewtype"), $viewId);
}
示例9: saveFilterPresets
private function saveFilterPresets(Gpf_Rpc_Form $form, $filterId) {
$filterConditionsTable = Gpf_Db_Table_FilterConditions::getInstance();
$filterConditionsTable->deleteAll($filterId);
$presets = new Gpf_Data_RecordSet();
$presets->loadFromArray($form->getFieldValue("presets"));
foreach ($presets as $preset) {
$filterCondition = new Gpf_Db_FilterCondition();
$filterCondition->setFilterId($filterId);
$filterCondition->fillFromRecord($preset);
$filterCondition->save();
}
}
示例10: saveFields
/**
* @service campaign write
*
* @param $fields
* @return Gpf_Rpc_Action
*/
public function saveFields(Gpf_Rpc_Params $params) {
$action = new Gpf_Rpc_Action($params);
$fields = new Gpf_Data_RecordSet();
$fields->loadFromArray($action->getParam("fields"));
$action->setErrorMessage($this->_('Failed to save %s field(s) in %s(s)', '%s', $this->getDbRowObjectName()));
$action->setInfoMessage($this->_('%s field(s) in %s(s) successfully saved', '%s', $this->getDbRowObjectName()));
foreach ($fields as $field) {
$dbRow = $this->createDbRowObject();
$dbRow->setPrimaryKeyValue($field->get('id'));
$dbRow->load();
if ($dbRow->getIsDefault() && $field->get("name") == "rstatus" && $field->get("value") != Pap_Db_Campaign::CAMPAIGN_STATUS_ACTIVE) {
$action->setErrorMessage($this->_('You cannot deactivate default campaign'));
$action->addError();
continue;
}
$dbRow->set($field->get("name"), $field->get("value"));
$dbRow->save();
$action->addOk();
}
return $action;
}
示例11: saveQuickLaunch
/**
* @service quicklaunch write
* @return Gpf_Rpc_Action
*/
public function saveQuickLaunch(Gpf_Rpc_Params $params)
{
$items = new Gpf_Data_RecordSet();
$items->loadFromArray($params->get('items'));
$quickLaunchSetting = "";
foreach ($items as $item) {
$quickLaunchSetting .= $item->get(self::SCREEN_CODE) . ",";
}
$quickLaunchSetting = rtrim($quickLaunchSetting, ",");
Gpf_Db_Table_UserAttributes::setSetting(Gpf_Settings_Gpf::QUICK_LAUNCH_SETTING_NAME, $quickLaunchSetting);
$action = new Gpf_Rpc_Action(new Gpf_Rpc_Params());
$action->setInfoMessage($this->_('Quick Launch saved'));
$action->addOk();
return $action;
}
示例12: saveFields
/**
* @service language write
* @return Gpf_Rpc_Action
*/
public function saveFields(Gpf_Rpc_Params $params)
{
$action = new Gpf_Rpc_Action($params);
$action->setErrorMessage($this->_('Failed to save %s field(s)'));
$action->setInfoMessage($this->_('%s field(s) successfully saved'));
$language = new Gpf_Db_Language();
$language->setId($action->getParam(Gpf_Db_Table_Languages::ID));
$language->load();
$csvFile = new Gpf_Io_Csv_Reader(Gpf_Lang_CsvLanguage::getAccountCsvFileName($language->getCode()));
$csvLanguage = new Gpf_Lang_CsvLanguage();
$csvLanguage->loadFromCsvFile($csvFile);
$fields = new Gpf_Data_RecordSet();
$fields->loadFromArray($action->getParam("fields"));
foreach ($fields as $field) {
$translation = new Gpf_Lang_Parser_Translation();
$translation->setSourceMessage($field->get('id'));
if ($csvLanguage->existTranslation($translation)) {
$existingTranslation = $csvLanguage->getTranslation($translation);
if ($existingTranslation->getStatus() == Gpf_Lang_Parser_Translation::STATUS_NOT_TRANSLATED) {
$existingTranslation->setStatus(Gpf_Lang_Parser_Translation::STATUS_TRANSLATED);
$csvLanguage->incrementTranslatedCount();
}
$existingTranslation->set($field->get("name"), $this->sourceCodeSpecialChars($field->get("value")));
}
$action->addOk();
}
$csvLanguage->exportAccountCache();
$language->setTranslatedPercentage($csvLanguage->getTranslationPercentage());
$language->save();
return $action;
}
示例13: saveFields
/**
* @service banner write
* @param Gpf_Rpc_Params $params
*/
public function saveFields(Gpf_Rpc_Params $params) {
$result = parent::saveFields($params);
$action = new Gpf_Rpc_Action($params);
$fields = new Gpf_Data_RecordSet();
$fields->loadFromArray($action->getParam("fields"));
$field = $fields->get(0);
$bannerInRotator = new Pap_Db_BannerInRotator();
$bannerInRotator->setId($field->get('id'));
$bannerInRotator->load();
try {
$this->removeRotatorFromCache($bannerInRotator->getParentBannerId());
} catch (Gpf_Exception $e) {}
return $result;
}
示例14: saveFields
/**
* @service direct_link write
*
* @param $fields
*/
public function saveFields(Gpf_Rpc_Params $params) {
$retval = parent::saveFields($params);
Pap_Tracking_DirectLinksBase::getInstance()->regenerateDirectLinksFile();
$fields = new Gpf_Data_RecordSet();
$fields->loadFromArray($params->get("fields"));
$changedUrls = array();
foreach ($fields as $field) {
$changedUrls[] = $field->get('id');
}
$this->sendNotificationEmail($changedUrls);
return $retval;
}