Inheritance: extends Gpf_Data_RecordSet
 /**
  * @param string $name
  * @return Gpf_Data_Record
  */
 private function get($name)
 {
     if ($this->attributes == null) {
         throw new Gpf_Exception("Attributes not loaded");
     }
     return $this->attributes->getRecord($name);
 }
Example #2
0
 public function generateRightRefidIntoRecordSet(Gpf_Data_IndexedRecordSet $recordSet) {
     $usernameRecord = $recordSet->getRecord('username');
     $usernameRecord->get('value');
     $r1 = $recordSet->createRecord();
     $r1->set('name', 'refid');
     $r1->set('value', substr(md5($usernameRecord->get('value')), 0, Gpf_Settings::get(self::SETTING_REFID_MIN_LENGTH)));
     $recordSet->addRecord($r1);
 }
Example #3
0
 public function getField($name) {
    	try {
    	    $record = $this->fields->getRecord($name);
    	    return $record->get(self::FIELD_VALUE);
    	} catch(Exception $e) {
    	    return '';
    	}
 }
Example #4
0
    /**
     * @return Gpf_Data_RecordSet
     */
    public function getResult() {
        $result = new Gpf_Data_IndexedRecordSet('id');

        $result->setHeader(Gpf_View_Column::getMetaResultArray());
        foreach ($this->_columns as $column) {
            if($column->isInHeader()) {
                $result->add($column->getResultArray());
            }
        }
        return $result;
    }
 /**
  * Compute active languages recordset from install directory language files
  *
  * @return Gpf_Data_IndexedRecordSet
  */
 public function getActiveLanguagesNoRpc()
 {
     $result = new Gpf_Data_IndexedRecordSet('code');
     $result->setHeader(array(Gpf_Db_Table_Languages::CODE, Gpf_Db_Table_Languages::NAME, Gpf_Db_Table_Languages::ENGLISH_NAME, Gpf_Db_Table_Languages::IS_DEFAULT));
     $langCacheDirectory = Gpf_Paths::getInstance()->getInstallDirectoryPath() . Gpf_Paths::CACHE_DIRECTORY . Gpf_Lang_Dictionary::LANGUAGE_DIRECTORY;
     foreach (new Gpf_Io_DirectoryIterator($langCacheDirectory) as $file) {
         if (preg_match('!^' . Gpf_Application::getInstance()->getCode() . '_(.+)\\.s\\.php$!', $file, $matches)) {
             $language = $this->loadLanguage($matches[1]);
             $result->add(array($matches[1], $language->getName(), $language->getEnglishName(), Gpf::NO));
         }
     }
     return $result;
 }
Example #6
0
 public function loadFromObject(stdClass $object)
 {
     if ($object->success == Gpf::YES) {
         $this->setInfoMessage($object->message);
     } else {
         $this->setErrorMessage($object->message);
     }
     $this->fields = new Gpf_Data_IndexedRecordSet(self::FIELD_NAME);
     $this->fields->loadFromObject($object->fields);
 }
 /**
  * @return Gpf_Data_IndexedRecordSet
  */
 public function fillViewColumns(Gpf_Data_IndexedRecordSet $allColumns, $viewid)
 {
     $viewColumns = new Gpf_Data_RecordSet();
     $selectBuilder = new Gpf_SqlBuilder_SelectBuilder();
     $selectBuilder->select->add('name', 'name');
     $selectBuilder->select->add('sorted', 'sorted');
     $selectBuilder->select->add('width', 'width');
     $selectBuilder->from->add(self::getName());
     $selectBuilder->where->add('viewid', '=', $viewid);
     $selectBuilder->orderBy->add('rorder');
     $viewColumns->load($selectBuilder);
     foreach ($viewColumns as $viewColumn) {
         try {
             $column = $allColumns->getRecord($viewColumn->get('name'));
             $column->set('sorted', $viewColumn->get('sorted'));
             $column->set('width', $viewColumn->get('width'));
             $column->set('visible', Gpf::YES);
         } catch (Exception $e) {
         }
     }
     return $allColumns;
 }
Example #8
0
 /**
  * returns recordset with setting values for given setting names (array) and given account
  *
  * @param  settingNamesArray array
  * @param  accountId
  * @return Gpf_Data_RecordSet
  */
 public function getSettings($settingNames, $accountId)
 {
     if (!is_array($settingNames) || count($settingNames) <= 0) {
         throw new Gpf_Exception("getSettings(): parameter settingNames is empty or not an array!");
     }
     $result = new Gpf_Data_IndexedRecordSet('name');
     $selectBuilder = new Gpf_SqlBuilder_SelectBuilder();
     $selectBuilder->select->add('name', 'name');
     $selectBuilder->select->add('value', 'value');
     $selectBuilder->from->add(self::getName());
     $selectBuilder->where->add("accountid", "=", $accountId);
     $names = "";
     foreach ($settingNames as $name) {
         $names .= ($names != "" ? "," : '') . "'" . $name . "'";
     }
     $names = "(" . $names . ")";
     $selectBuilder->where->add("name", 'in', $settingNames);
     $result->load($selectBuilder);
     return $result;
 }
 public function setFields(Gpf_Data_IndexedRecordSet $fields)
 {
     $this->fields->loadFieldsFromArray($fields->toArray());
 }
 /**
  * @return Gpf_Data_IndexedRecordSet
  */
 public function getIndexedRecordSet($key)
 {
     $response = new Gpf_Data_IndexedRecordSet($key);
     $response->loadFromObject($this->getStdResponse());
     return $response;
 }
 private function addPlugins()
 {
     $plugins = new Gpf_Data_IndexedRecordSet('name');
     $plugins->setHeader(array('name'));
     foreach (Gpf_Plugins_Engine::getInstance()->getConfiguration()->getActivePlugins() as $pluginCode) {
         $plugins->add(array($pluginCode));
     }
     Gpf_Rpc_CachedResponse::addById($plugins, self::PLUGINS);
 }
 /**
  * @return Gpf_Rpc_Params
  */
 protected function createSignupParams() {
     $fields = new Gpf_Data_IndexedRecordSet('name');
     $fields->setHeader(new Gpf_Data_RecordHeader(array('name', 'value')));
     $this->fillSignupParams($fields);
     
     $params = new Gpf_Rpc_Params();
     $params->add('fields', $fields->toObject());
     
     return $params;
 }
	/**
	 * @param $params
	 * @return Gpf_Data_IndexedRecordSet
	 */
	protected function getRowFromSpecialTypes($commTypeValue) {
		$commTypes = new Gpf_Data_IndexedRecordSet(Pap_Db_Table_CommissionTypes::ID);
		$commTypes->setHeader($this->createHeaderArray());
		$this->addSpecialTypes($commTypes);
		$this->translateCommTypes($commTypes);
		$commType = $commTypes->toShalowRecordSet();
		try {
			$commType->addRecord($commTypes->getRecord($commTypeValue));
		} catch (Gpf_Data_RecordSetNoRowException $e) {
		}
		return $commType;
	}
 private function loadRequiredColumnsFromArray($columnsArray) {
     $indexedRecordset = new Gpf_Data_IndexedRecordSet('id');
     $indexedRecordset->loadFromArray($columnsArray);
     foreach ($indexedRecordset as $record) {
         try {
             $visible = $record->get('visible');
         } catch (Gpf_Exception $e) {
             $visible = Gpf::YES;
         }
         if ($visible == Gpf::YES) {                
             $this->addRequiredColumn($record->get('id'));
         }
     }
 }
Example #15
0
 public function generateRefidIntoRecordSet(Gpf_Data_IndexedRecordSet $recordSet) {
     $r1 = $recordSet->createRecord();
     $r1->set('name', 'refid');
     $r1->set('value', $this->getNewRefid());
     $recordSet->addRecord($r1);
 }
Example #16
0
 private function loadParamsFromArray($data)
 {
     for ($i = 1; $i < count($data); $i++) {
         $this->params->add($data[$i]);
     }
 }
 /**
  * 
  * @param $userID
  * @return Gpf_Data_IndexedRecordSet
  */
 private function getPap3UserPayoutData($userID) {
     $selectBuilder = new Gpf_SqlBuilder_SelectBuilder();
     $selectBuilder->select->add('code', 'code');
     $selectBuilder->select->add('value', 'value');
     $selectBuilder->from->add('wd_g_settings');
     $selectBuilder->where->add('userid', '=', $userID);
     $selectBuilder->where->add('id2', '=', null);         
     $condition = new Gpf_SqlBuilder_CompoundWhereCondition(); 
     $condition->add('code', 'LIKE', 'Aff_payoptionfield_%', 'OR');
     $condition->add('code', '=', 'Aff_payout_type', 'OR');
     $selectBuilder->where->addCondition($condition);
     
     $pap3PayoutSettings = new Gpf_Data_IndexedRecordSet('code');
     $pap3PayoutSettings->load($selectBuilder);
     return $pap3PayoutSettings;
 }