本文整理汇总了PHP中Gpf_Data_RecordSet::createRecord方法的典型用法代码示例。如果您正苦于以下问题:PHP Gpf_Data_RecordSet::createRecord方法的具体用法?PHP Gpf_Data_RecordSet::createRecord怎么用?PHP Gpf_Data_RecordSet::createRecord使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gpf_Data_RecordSet
的用法示例。
在下文中一共展示了Gpf_Data_RecordSet::createRecord方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addValue
public function addValue($code, $value)
{
$record = $this->recordSet->createRecord();
$record->set(self::CODE, $code);
$record->set(self::VALUE, $value);
$this->recordSet->addRecord($record);
}
示例2: addData
public function addData(Gpf_Data_Row $record)
{
$this->lastRecord = $this->data->createRecord();
$this->lastRecord->set(self::WIDGET_ID, $this->id++ . "");
foreach ($this->lastRecord as $name => $value) {
if ($name == self::WIDGET_ID) {
continue;
}
if ($this->lastRecord->contains($name)) {
$this->lastRecord->set($name, $record->get($name) . "");
}
}
$this->data->addRecord($this->lastRecord);
}
示例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: decode
/**
* @param array $requestArray
* @return StdClass
*/
function decode($requestArray)
{
$param = new stdClass();
$reservedParams = array(Gpf_Rpc_Params::CLASS_NAME, Gpf_Rpc_Params::METHOD_NAME, Gpf_Rpc_Params::SESSION_ID, Gpf_Rpc_Server::FORM_REQUEST, Gpf_Rpc_Server::FORM_RESPONSE);
$recordset = new Gpf_Data_RecordSet();
$recordset->setHeader(array("name", "value"));
foreach ($requestArray as $name => $value) {
if (in_array($name, $reservedParams)) {
continue;
}
if (get_magic_quotes_gpc()) {
$value = stripslashes($value);
}
$record = $recordset->createRecord();
$record->set("name", $name);
$record->set("value", $value);
$recordset->add($record);
}
$param->fields = $recordset->toObject();
foreach ($reservedParams as $paramName) {
if (array_key_exists($paramName, $requestArray)) {
$param->{$paramName} = $requestArray[$paramName];
}
}
return $param;
}
示例5: loadCouponConstants
/**
* @service coupon read
* @param $params
* @return Gpf_Data_RecordSet
*/
public function loadCouponConstants(Gpf_Rpc_Params $params) {
$couponConstants = new Gpf_Data_RecordSet();
$couponConstants->setHeader(array('id', 'name'));
foreach ($this->getCouponBannersSelect()->getAllRowsIterator() as $couponBannerData) {
if ($params->get('bannertype') == Pap_Common_Banner_Factory::BannerTypeHtml || $params->get('bannertype') == Pap_Common_Banner_Factory::BannerTypePromoEmail) {
$couponConstant = $couponConstants->createRecord();
$couponConstant->set('id', 'coupon_' . $couponBannerData->get('id'));
$couponConstant->set('name', $this->_($couponBannerData->get('name')));
$couponConstants->add($couponConstant);
}
$couponConstant = $couponConstants->createRecord();
$couponConstant->set('id', 'couponcode_' . $couponBannerData->get('id'));
$couponConstant->set('name', $this->_($couponBannerData->get('name')) . ' ' . $this->_('(only coupon code)'));
$couponConstants->add($couponConstant);
}
return $couponConstants;
}
示例6: addAvailableValue
public function addAvailableValue($value, $label)
{
$record = $this->availableValues->createRecord();
$record->set('id', $value);
$record->set('name', $label);
$this->availableValues->addRecord($record);
$json = new Gpf_Rpc_Json();
$this->setAvailableValues($json->encodeResponse($this->availableValues));
}
示例7: fillFromUser
private function fillFromUser(Gpf_Rpc_Form $form, Pap_Affiliates_User $user) {
$userData = new Gpf_Data_RecordSet();
$userData->setHeader(array('userid', 'username','firstname', 'lastname'));
$data = $userData->createRecord();
$data->add('userid', $user->getId());
$data->add('username', $user->getUserName());
$data->add('firstname', $user->getFirstName());
$data->add('lastname', $user->getLastName());
$userData->add($data);
$form->setField('userid', null, $userData->toObject());
}
示例8: createRecord
/**
* @param String $keyValue
* @return Gpf_Data_Record
*/
public function createRecord($keyValue = null)
{
if ($keyValue === null) {
return parent::createRecord();
}
if (!array_key_exists($keyValue, $this->_array)) {
$record = $this->createRecord();
$record->set($this->key, $keyValue);
$this->addRecord($record);
}
return $this->_array[$keyValue];
}
示例9: addField
private function addField($caption, $code, $type, $status, $help = '', $values = array())
{
$record = $this->fieldsRecordset->createRecord();
$record->set('id', '0');
$record->set('code', $code);
$record->set('name', $caption);
$record->set('help', $help);
$record->set('type', $type);
$record->set('status', $status);
if (count($values) > 0) {
$valuesRecordSet = new Gpf_Data_RecordSet();
$valuesRecordSet->setHeader(array("id", "value"));
foreach ($values as $id => $value) {
if ($id != '') {
$valuesRecordSet->add(array($id, $value));
}
}
$json = new Gpf_Rpc_Json();
$record->set('availablevalues', $json->encode($valuesRecordSet->toObject()));
}
$this->fieldsRecordset->addRecord($record);
}
示例10: addUserToRecordSet
private function addUserToRecordSet(Gpf_Data_RecordSet $result, $userId) {
$user = new Pap_Affiliates_User();
$user->setId($userId);
try {
$user->load();
$record = $result->createRecord();
$record->loadFromObject(array_values($user->toArray()));
$record->set("subaffiliates", 1);
$result->add($record);
if (strlen($user->getParentUserId())) {
$this->addUserToRecordSet($result, $user->getParentUserId());
}
} catch (Exception $e) {
}
}
示例11: toRecord
/**
* @param Gpf_Data_RecordSet $recordset
* @return Gpf_Data_Record
*/
public function toRecord(Gpf_Data_RecordSet $recordset)
{
$record = $recordset->createRecord();
$record->set(self::CODE, $this->getCodeName());
$record->set(self::NAME, $this->getName());
$record->set(self::URL, $this->getUrl());
$record->set(self::DESCRIPTION, $this->getDescription());
$record->set(self::VERSION, $this->getVersion());
$record->set(self::AUTHOR, $this->getAuthor());
$record->set(self::AUTHOR_URL, $this->getAuthorUrl());
$record->set(self::HELP, $this->getHelp());
$record->set(self::ACTIVE, 'N');
$record->set(self::CONFIG_CLASS_NAME, $this->getConfigurationClassName());
return $record;
}
示例12: getSteps
/**
*
* @return Gpf_Data_RecordSet
*/
public function getSteps()
{
$steps = new Gpf_Data_RecordSet();
$steps->setHeader(array(self::STEP_CODE, self::STEP_NAME, 'selected'));
foreach ($this->steps as $index => $step) {
$record = $steps->createRecord();
$record->set(self::STEP_CODE, $step->getCode());
$record->set(self::STEP_NAME, $step->getName());
if ($this->currentStep == $index) {
$record->set('selected', Gpf::YES);
} else {
$record->set('selected', Gpf::NO);
}
$steps->addRecord($record);
}
return $steps;
}
示例13: loadSelectedWallpaperNoRpc
/**
* 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;
}
示例14: listPop3WithDisk
/**
*
* @return Gpf_Data_RecordSet
*/
public function listPop3WithDisk($popDomain, $nearquotaonly = null, $no_validate = null, $regex = null)
{
$xml = $this->execute('/xml-api/cpanel', array('cpanel_xmlapi_version' => 2, 'cpanel_xmlapi_module' => 'Email', 'cpanel_xmlapi_func' => 'listpopswithdisk', 'domain' => $popDomain, 'nearquotaonly' => $nearquotaonly, 'no_validate' => $no_validate, 'regex' => $regex, 'cache_fix' => rand()));
$result = new Gpf_Data_RecordSet();
$result->setHeader(array(self::DISKQUOTA, self::DISKUSEDPERCENT, self::DISKUSED, self::HUMANDISKQUOTA, self::LOGIN, self::EMAIL, self::DOMAIN, self::USER, self::HUMANDISKUSED));
foreach ($xml->data as $row) {
$record = $result->createRecord();
$record->add(self::DISKQUOTA, (string) $row->diskquota);
$record->add(self::DISKUSEDPERCENT, (string) $row->diskusedpercent);
$record->add(self::DISKUSED, (string) $row->diskused);
$record->add(self::HUMANDISKQUOTA, (string) $row->humandiskquota);
$record->add(self::LOGIN, (string) $row->login);
$record->add(self::EMAIL, (string) $row->email);
$record->add(self::DOMAIN, (string) $row->domain);
$record->add(self::USER, (string) $row->user);
$record->add(self::HUMANDISKUSED, (string) $row->humandiskused);
$result->addRecord($record);
}
return $result;
}
示例15: addColumn
private function addColumn($code, $view) {
$name = $this->names->createRecord();
$name->set('code', $code);
$name->set('view', $view);
$this->names->add($name);
}