public function __construct($name, array $dataHeader) { $this->id = 0; $this->name = $name; $this->data = new Gpf_Data_RecordSet(); $this->data->setHeader(array_merge(array(self::WIDGET_ID), $dataHeader)); }
/** * * @return Gpf_Data_RecordSet */ public function getSettingsNoRpc() { $this->recordSet = new Gpf_Data_RecordSet(); $this->recordSet->setHeader(new Gpf_Data_RecordHeader(array(self::CODE, self::VALUE))); $this->loadSetting(); return $this->recordSet; }
public function __construct() { $this->_db = $this->createDatabase(); $this->_selectBuilder = new Gpf_SqlBuilder_SelectBuilder(); $this->filters = new Gpf_Rpc_FilterCollection(); $this->_columns = new Gpf_View_Columns(); $this->_requiredColumns = new Gpf_Data_IndexedRecordSet('id'); $this->_requiredColumns->setHeader(array('id')); $this->initColumns(); $this->_fileName = null; if (!array_key_exists(self::KEY_COLUMN_ID, $this->dataColumns)) { throw new Gpf_Exception("Key column not defined in " . get_class($this) . ". Use setKeyDataColumn() function to set key data column"); } }
private function initSavedCookies() { if ($this->savedCookies != null) { return; } $this->savedCookies = new Gpf_Data_RecordSet(); $this->savedCookies->setHeader(array('name', 'value', 'expire', 'overwrite')); }
/** * @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; }
/** * @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; }
/** * @service campaign read * @return Gpf_Data_RecordSet */ public function getActionTypes(Gpf_Rpc_Params $params) { $actionTypesHeader = array(Pap_Db_Table_CommissionTypes::TYPE, Pap_Db_Table_CommissionTypes::NAME, Pap_Db_Table_CommissionTypes::ID, 'campaignName'); $data = new Gpf_Rpc_Data($params); $filters = $data->getFilters(); $statsParams = new Pap_Stats_Params(); $statsParams->setCampaignId($filters->getFilterValue('campaignid')); $statsParams->setBannerId($filters->getFilterValue('bannerid')); $transactionTypeStats = new Pap_Stats_TransactionTypeStats($statsParams); $transactionTypes = $transactionTypeStats->getTypes(); $actionTypesRecordSet = new Gpf_Data_RecordSet(); $actionTypesRecordSet->setHeader($actionTypesHeader); $this->initActionCampaignNames(); foreach ($transactionTypes as $transactionType) { if ($transactionType->getType() != Pap_Common_Constants::TYPE_SALE && $transactionType->getType() !=Pap_Common_Constants::TYPE_ACTION && $transactionType->getType() != Pap_Common_Constants::TYPE_RECURRING) { continue; } $actionTypesRecordSet->add(new Gpf_Data_Record($actionTypesHeader, array($transactionType->getType(), $transactionType->getName(), $transactionType->getCommissionTypeId(), $this->getActionCampaignName($transactionType->getCommissionTypeId())))); } return $actionTypesRecordSet; }
/** * * @service transaction write * @return Gpf_Data_RecordSet */ public function getColumnNames() { $this->names = new Gpf_Data_RecordSet(); $this->names->setHeader(new Gpf_Data_RecordHeader(array('code', 'view'))); $this->addColumn(Pap_Db_Table_Transactions::TRANSACTION_ID, $this->_("ID")); $this->addColumn(Pap_Db_Table_Transactions::ACCOUNT_ID, $this->_("Account ID")); $this->addColumn(Pap_Db_Table_Transactions::USER_ID, $this->_("User ID")); $this->addColumn(Pap_Db_Table_Transactions::BANNER_ID, $this->_("Banner ID")); $this->addColumn(Pap_Db_Table_Transactions::PARRENT_BANNER_ID, $this->_("Parent Banner ID")); $this->addColumn(Pap_Db_Table_Transactions::CAMPAIGN_ID, $this->_("Campaign ID")); $this->addColumn(Pap_Db_Table_Transactions::COUNTRY_CODE, $this->_("Country Code")); $this->addColumn(Pap_Db_Table_Transactions::PARRENT_TRANSACTION_ID, $this->_("Parent Transaction")); $this->addColumn(Pap_Db_Table_Transactions::R_STATUS, $this->_("Status")); $this->addColumn(Pap_Db_Table_Transactions::R_TYPE, $this->_("Type")); $this->addColumn(Pap_Db_Table_Transactions::DATE_INSERTED, $this->_("Date inserted")); $this->addColumn(Pap_Db_Table_Transactions::DATE_APPROVED, $this->_("Date approved")); $this->addColumn(Pap_Db_Table_Transactions::PAYOUT_STATUS, $this->_("Payout status")); $this->addColumn(Pap_Db_Table_Transactions::REFERER_URL, $this->_("Referrer URL")); $this->addColumn(Pap_Db_Table_Transactions::IP, $this->_("IP")); $this->addColumn(Pap_Db_Table_Transactions::BROWSER, $this->_("Browser")); $this->addColumn(Pap_Db_Table_Transactions::COMMISSION, $this->_("Commission")); $this->addColumn(Pap_Db_Table_Transactions::RECURRING_COMM_ID, $this->_("Recurring Commission ID")); $this->addColumn(Pap_Db_Table_Transactions::CLICK_COUNT, $this->_("Click Count")); $this->addColumn(Pap_Db_Table_Transactions::TRACK_METHOD, $this->_("Tracking Method")); $this->addColumn(Pap_Db_Table_Transactions::ORDER_ID, $this->_("Order ID")); $this->addColumn(Pap_Db_Table_Transactions::PRODUCT_ID, $this->_("Product ID")); $this->addColumn(Pap_Db_Table_Transactions::TOTAL_COST, $this->_("Total cost")); $this->addColumn(Pap_Db_Table_Transactions::FIXED_COST, $this->_("Fixed cost")); $this->addColumn(Pap_Db_Table_Transactions::DATA1, $this->_("Extra data 1")); $this->addColumn(Pap_Db_Table_Transactions::DATA2, $this->_("Extra data 2")); $this->addColumn(Pap_Db_Table_Transactions::DATA3, $this->_("Extra data 3")); $this->addColumn(Pap_Db_Table_Transactions::DATA4, $this->_("Extra data 4")); $this->addColumn(Pap_Db_Table_Transactions::DATA5, $this->_("Extra data 5")); $this->addColumn(Pap_Db_Table_Transactions::ORIGINAL_CURRENCY_ID, $this->_("Original currency ID")); $this->addColumn(Pap_Db_Table_Transactions::ORIGINAL_CURRENCY_VALUE, $this->_("Original currency value")); $this->addColumn(Pap_Db_Table_Transactions::ORIGINAL_CURRENCY_RATE, $this->_("Original currency rate")); $this->addColumn(Pap_Db_Table_Transactions::COMMISSIONTYPEID, $this->_("Commission type ID")); $this->addColumn(Pap_Db_Table_Transactions::MERCHANTNOTE, $this->_("Merchant note")); $this->addColumn(Pap_Db_Table_Transactions::SYSTEMNOTE, $this->_("System note")); $this->addColumn(Pap_Db_Table_Transactions::COUPON_ID, $this->_("Coupon ID")); $this->addColumn(Pap_Db_Table_Transactions::VISITOR_ID, $this->_("Visitor ID")); $this->addColumn(Pap_Db_Table_Transactions::SALE_ID, $this->_("Sale ID")); $this->addColumn(Pap_Db_Table_Transactions::SPLIT, $this->_("Split")); $this->addColumn(Pap_Db_Table_Transactions::LOGGROUPID, $this->_("Log group ID")); return $this->names; }
/** * Returns parent affiliates plus current affiliate * * @service affiliate_tree read * @param $itemId * @return Gpf_Data_RecordSet */ public function loadParents(Gpf_Rpc_Params $params) { $result = new Gpf_Data_RecordSet(); $user = new Pap_Affiliates_User(); $result->setHeader(array_keys($user->toArray())); $result->addColumn("subaffiliates", 1); $this->addUserToRecordSet($result, $params->get('itemId')); return $result; }
/** * * @return Gpf_Data_RecordSet */ private function getAvailableLanguages() { $languages = new Gpf_Data_RecordSet(); $languages->setHeader(array('id', 'name')); foreach (new Gpf_Lang_InstallLanguages() as $language) { $languages->add(array($language->getCode(), $language->getExtendedName())); } return $languages; }
/** * @service banner_format_setting read * @return Gpf_Data_RecordSet */ public function loadWrapperNames(Gpf_Rpc_Params $params) { $row = new Pap_Db_BannerWrapper(); $collection = $row->loadCollection(); $result = new Gpf_Data_RecordSet(); $result->setHeader(array('id', 'name')); foreach ($collection as $row){ $result->add(array($row->getId(), $row->getName())); } return $result; }
/** * returns data for chart * * @service trend_stats read * @param $fields * @return Gpf_Rpc_Chart */ public function loadDataTypes(Gpf_Rpc_Params $params) { $this->initCampaignId($params); $this->initDataTypes(); $recordSet = new Gpf_Data_RecordSet(); $recordSet->setHeader(array("id", "value")); foreach ($this->dataTypes as $dataType) { $recordSet->add(array($dataType->getId(), $dataType->getName())); } return $recordSet; }
/** * @service * @anonym * * @param $gridcode */ public function getActiveView(Gpf_Rpc_Params $params) { $view = new Gpf_Data_RecordSet(); $view->setHeader(array("id")); try { $view->add(array($this->getActiveViewId($params->get('gridcode')))); } catch (Exception $e) { $view->add(array("default")); } return $view; }
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()); }
/** * Load list of template variables for custom template * * @service mail_template read * @param Gpf_Rpc_Params $params */ public function getTemplateVariables(Gpf_Rpc_Params $params) { $recordSet = new Gpf_Data_RecordSet(); $recordSet->setHeader(array('code', 'name')); //TODO - treba prerobit cez extension point ... v pap newsletter feature budu premenne definovane cez Pap_Mail_UserMail $objTemplate = new Pap_Mail_UserMail(); foreach ($objTemplate->getTemplateVariables() as $code => $name) { $recordSet->add(array($code, $name)); } return $recordSet; }
/** * Load list of template variables for custom template * * @service mail_template read * @param Gpf_Rpc_Params $params */ public function getTemplateVariables(Gpf_Rpc_Params $params) { $recordSet = new Gpf_Data_RecordSet(); $recordSet->setHeader(array('code', 'name')); $objTemplate = new Pap_Mail_UserMail(); foreach ($objTemplate->getTemplateVariables() as $code => $name) { $recordSet->add(array($code, $name)); } return $recordSet; }
/** * Load list of template variables for template specified in input parameter templateId * * @service mail_template read * @param Gpf_Rpc_Params $params */ public function getTemplateVariables(Gpf_Rpc_Params $params) { $dbRow = $this->loadMailTemplate($params->get("templateId")); $recordSet = new Gpf_Data_RecordSet(); $recordSet->setHeader(array('code', 'name')); $className = $dbRow->get(Gpf_Db_Table_MailTemplates::CLASS_NAME); $objTemplate = new $className(); foreach ($objTemplate->getTemplateVariables() as $code => $name) { $recordSet->add(array($code, $name)); } return $recordSet; }
public function getAllIconsNoRpc() { $response = new Gpf_Data_RecordSet(); $response->setHeader(array("iconName", "smallIcon", "middleIcon", "bigIcon")); foreach ($this->icons as $iconName => $imageFile) { try { $response->add(array($iconName, $this->getImageUrl($imageFile, "small"), $this->getImageUrl($imageFile, "middle"), $this->getImageUrl($imageFile, "big"))); } catch (Exception $e) { //TODO: add default image ! } } return $response; }
/** * Gets template names for template name suggestion oracle * * @service template read * @param $search */ public function getTemplateNames(Gpf_Rpc_Params $params) { $searchString = $params->get('search'); $this->loadTemplates(); $result = new Gpf_Data_RecordSet(); $result->setHeader(array('id', 'name')); foreach ($this->templates as $templateName) { if ($searchString == "" || strstr($templateName, $searchString) !== false) { $result->add(array($templateName, $templateName . '.tpl')); } } return $result; }
/** * Proxy request from server to Addons web server and return list of Integration methods * @service integration_methods read * @param Gpf_Rpc_Params $params * @return Gpf_Data_RecordSet */ private function getIntegrationMethodsList(Gpf_Rpc_Params $params) { $proxyRequest = new Gpf_Rpc_Request('Aw_Db_Table_Integrations', 'getIntegrationsList'); $this->sendRequest($proxyRequest, $params); $recordSet = new Gpf_Data_RecordSet(); $recordSet->loadFromObject($proxyRequest->getResponseObject()->toObject()); $header = $recordSet->getHeader()->getIds(); $header[0] = "id"; $recordSet->setHeader($header); $this->processIntegrations($recordSet); return $recordSet; }
protected function loadItems($itemId) { $result = new Gpf_Data_RecordSet(); $result->setHeader(array('itemId', 'subItemsCount', 'name', 'info', 'type')); if (Gpf_Io_File::isFileExists($itemId)) { $file = new Gpf_Io_File($itemId); if ($file->isDirectory()) { $this->loadSubfilesFiles($itemId, $result, true); $this->loadSubfilesFiles($itemId, $result); return $result; } $result->add(array($itemId, 0, $file->getName(), $file->getSize(), self::TYPE_FILE)); } return $result; }
/** * Load list of template variables for custom template * * @service mail_template read * @param Gpf_Rpc_Params $params */ public function getTemplateVariables(Gpf_Rpc_Params $params) { $recordSet = new Gpf_Data_RecordSet(); $recordSet->setHeader(array('code', 'name')); $objTemplate = new Pap_Mail_AffiliateUserMail(); foreach ($objTemplate->getTemplateVariables() as $code => $name) { if($code == 'password' || $code == 'parent_password'){ continue; } $recordSet->add(array($code, $name)); } return $recordSet; }
/** * @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; }
/** * * @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; }
protected function afterExecute(Gpf_Data_RecordSet $inputResult) { $outPutResult = new Gpf_Data_RecordSet(); $outPutResult->setHeader(array(parent::KEY_COLUMN_ID, 'number', 'rule')); foreach ($inputResult as $row) { $rule = new Pap_Features_PerformanceRewards_Rule_Transaction(); $rule->fillFromRecord($row); $rule->setCommissionGroupId($row->get('commissiongroup')); try { $outPutResult->add(array($row->get(parent::KEY_COLUMN_ID), $row->get('number'), $rule->getString())); } catch (Pap_Features_PerformanceRewards_UnknownRuleException $e) { $outPutResult->add(array($row->get(parent::KEY_COLUMN_ID), $row->get('number'), $this->_('Unknown rule (%s) - probably created with some feature or plugin - this rule will not be applied.', $rule->getAction()))); } } return $outPutResult; }
private function addCommissions(Gpf_Data_RecordSet $rs ) { $cTable = Pap_Db_Table_Commissions::getInstance(); $rsCommissions = $cTable->getAllCommissionsInCampaign('', ''); $rs->addColumn('commissions', 'N'); $newRs = new Gpf_Data_RecordSet(); $newRs->setHeader($rs->getHeader()); foreach ($rs as $record) { if($cTable->findCampaignInCommExistsRecords($record->get("id"), $rsCommissions)) { $record->set('commissions', $this->getCommissionsDescription($record->get("id"), $rsCommissions)); $newRs->addRecord($record); } } return $newRs; }
protected function afterExecute(Gpf_Data_RecordSet $inputResult) { $outputResult = new Gpf_Data_RecordSet(); $outputResult->setHeader($inputResult->getHeader()); $tree = new Pap_Features_BannersCategories_Tree(false); foreach ($inputResult as $record) { if ($record->get('code')=='0' || $record->get('selected')=='N') { continue; } $newRecord = new Gpf_Data_Record($inputResult->getHeader()); $newRecord->add('name', $this->_localize($tree->getBreadcrumb($record->get('id'), ' > '))); $newRecord->add('id', $record->get('id')); $outputResult->add($newRecord); } return $outputResult; }
/** * * @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; }
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); }
protected function afterExecute(Gpf_Data_RecordSet $inputResult) { $outputResult = new Gpf_Data_RecordSet(); $outputResult->setHeader($inputResult->getHeader()); $tree = new Pap_Features_BannersCategories_Tree(false); foreach ($inputResult as $record) { if ($record->get('code')=='0') { $this->_count--; continue; } $newRecord = new Gpf_Data_Record($inputResult->getHeader()); $newRecord->add('name', $record->get('name')); $newRecord->add('id', $record->get('id')); $newRecord->add('state', $record->get('state')); $newRecord->add('depth', $record->get('depth')); $outputResult->add($newRecord); } return $outputResult; }