public function toObject() { $this->localizeRecordSet($this->cachedData); $response = new Gpf_Rpc_Object(); $response->rows = $this->cachedData->toObject(); $response->count = (int) $this->size; return $response; }
public function toObject() { $object = new stdClass(); $object->rows = $this->rows->toObject(); $object->from = $this->from; $object->to = $this->to; $object->count = $this->count; return $object; }
/** * @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; }
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()); }
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); }
/** * 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; }
public function toObject() { return $this->data->toObject(); }
/** * @param $result * @return Gpf_Rpc_Object */ protected function createGridResponse(Gpf_Data_RecordSet $result) { //TODO: use Gpf_Data_Grid $response = new Gpf_Rpc_Object(); $response->rows = $result->toObject(); $response->count = $this->getCount(); return $response; }