set() public méthode

public set ( $id, $value )
 private function fillResultRecord(Gpf_Data_Record $record, Gpf_Data_Record $row) {
     foreach ($this->dataColumns as $columnId => $column) {
         try {
             $record->set($columnId, $row->get($column->getName()));
         } catch (Gpf_Exception $e) {
             $record->set($columnId, '');
         }
     }
     return $record;
 }
 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);
 }
 private function addFilteredByHeader(Gpf_Data_Record $record)
 {
     $newRecord = new Gpf_Data_Record($this->header);
     foreach ($this->header as $column) {
         $newRecord->set($column, $record->get($column));
     }
     $this->encode($newRecord->toObject());
 }
Exemple #4
0
 public function getCountryCode(Gpf_Data_Record $context) {
     if ($context->get(Pap_Db_Table_RawImpressions::IP) == '127.0.0.1') {
         $context->set(Pap_Db_Table_Impressions::COUNTRYCODE, '');
         return;
     }
     if (in_array($context->get(Pap_Db_Table_RawImpressions::IP), self::$recognizedIPs)) {
         $context->set(Pap_Db_Table_Impressions::COUNTRYCODE, self::$recognizedIPs[array_search($context->get(Pap_Db_Table_RawImpressions::IP), self::$recognizedIPs)]);
         return;
     }
     try {
         $location = new GeoIp_Location();
         $location->setIpString($context->get(Pap_Db_Table_RawImpressions::IP));
         $location->load();
         $context->set(Pap_Db_Table_Impressions::COUNTRYCODE, $location->getCountryCode());
     } catch (Exception $e) {
     }
     self::$recognizedIPs[$context->get(Pap_Db_Table_RawImpressions::IP)] = $context->get(Pap_Db_Table_Impressions::COUNTRYCODE);
 }
    /**
     * @service payout_history export
     * @return Gpf_Rpc_Serializable
     */
    public function getIIFFile(Gpf_Rpc_Params $params) {
        $this->initParamsForCSVFile($params);

        $views = $params->get("columns");
        $header = array();
        for ($i = 2; $i < count($views); $i++) {
            if ($views[$i][0] === self::ACTIONS) {
                continue;
            }
            $header[] = $views[$i][0];
        }
        if (!in_array('payouthistoryid', $header)) {
            $header[] = 'payouthistoryid';
        }
        if (!in_array('amount', $header)) {
            $header[] = 'amount';
        }
        if (!in_array('merchantnote', $header)) {
            $header[] = 'merchantnote';
        }
        if (!in_array('affiliatenote', $header)) {
            $header[] = 'affiliatenote';
        }

        $viewResult = new Gpf_Data_RecordSet();
        $viewResult->setHeader($header);

        $payoutHistoryIds = array();

        $result = $this->getResultForCSV();

        if ($result->getSize() > 0) {
            foreach ($result as $record) {
               $row = new Gpf_Data_Record($header);
               foreach ($header as $column) {
                  $row->set($column, $record->get($column));
               }
               $row = $this->addAffiliateInfo($row);
               $viewResult->addRecord($row);
               $payoutHistoryIds[] = $row->get('payouthistoryid');
            }
        }

        if ($this->_fileName != null) {
            $fileName = $this->_fileName.".iif";
        } else {
            $fileName = "grid.iif";
        }

        $affiliates = $this->getUsersFromPayouts($payoutHistoryIds);

        $iifGenerator = new QuickBooks_GeneratorResponse($fileName, $viewResult, $affiliates);
        return $iifGenerator->generateFile();
    }
 /**
  * Returns row data for grid
  *
  * @service language read
  *
  * @param $filters
  * @param $limit
  * @param $offset
  * @param $sort_col
  * @param $sort_asc
  * @param Gpf_Data_RecordSet $columns
  * @return Gpf_Rpc_Serializable
  */
 public function getRows(Gpf_Rpc_Params $params)
 {
     $this->_params = $params;
     $this->_sortColumn = $params->get('sort_col');
     $this->_sortAsc = $params->get('sort_asc');
     $this->_requiredColumns = new Gpf_Data_IndexedRecordSet('id');
     $this->_requiredColumns->loadFromArray($params->get('columns'));
     $response = new Gpf_Rpc_Object();
     $recordHeader = new Gpf_Data_RecordHeader();
     $result = new Gpf_Data_RecordSet();
     foreach ($this->getAllViewColumns() as $column) {
         $result->addColumn($column->get('id'));
         $recordHeader->add($column->get('id'));
     }
     $result->addColumn('id');
     $recordHeader->add('id');
     $languagesIterator = new Gpf_Io_DirectoryIterator(Gpf_Paths::getInstance()->getLanguageInstallDirectory(), 'csv', false);
     $languagesCount = 0;
     foreach ($languagesIterator as $fullName => $file) {
         if (preg_match('/^' . Gpf_Application::getInstance()->getCode() . '_(.+)\\.csv$/', $file, $matches)) {
             $file = new Gpf_Io_Csv_Reader($fullName, ';', '"', array('source', 'translation', 'type', 'module', 'status', 'customer'));
             $language = new Gpf_Lang_CsvLanguage();
             $language->loadFromCsvFile($file, true);
             $languagesCount++;
             $record = new Gpf_Data_Record($recordHeader);
             $record->set('id', $fullName);
             $record->set(Gpf_Db_Table_Languages::CODE, $language->getMetaValue(Gpf_Lang_CsvLanguage::LANG_CODE));
             $record->set(Gpf_Db_Table_Languages::NAME, $language->getMetaValue(Gpf_Lang_CsvLanguage::LANG_NAME));
             $record->set(Gpf_Db_Table_Languages::ENGLISH_NAME, $language->getMetaValue(Gpf_Lang_CsvLanguage::LANG_ENG_NAME));
             $record->set(Gpf_Db_Table_Languages::TRANSLATED_PERCENTAGE, $language->getMetaValue(Gpf_Lang_CsvLanguage::LANG_TRANSLATION_PERCENTAGE));
             $record->set(Gpf_Db_Table_Languages::AUTHOR, $language->getMetaValue(Gpf_Lang_CsvLanguage::LANG_AUTHOR));
             $record->set(Gpf_Db_Table_Languages::VERSION, $language->getMetaValue(Gpf_Lang_CsvLanguage::LANG_VERSION));
             $result->addRecord($record);
         }
     }
     $response->rows = $result->toObject();
     $response->count = $languagesCount;
     return $response;
 }
Exemple #7
0
 private function addValueToRecord(Gpf_Data_Record $record, $name)
 {
     $record->set($name, $this->configFile->getSetting($name));
 }