Answers a result data array for the given record object.

@param ViewableData $record
@param boolean $selected

@return array
779207
protected function getResultData(ViewableData $record, $selected = false)
    {
        return [
            'id' => $record->{$this->getIDField()},
            'text' => $record->{$this->getTextField()},
            'formattedResult' => $this->getFormattedResult($record),
            'formattedSelection' => $this->getFormattedSelection($record),
            'selected' => $selected
        ];
    }
1139747
public function fetchResults(Zend_Db_Select $select, Garp_Browsebox $browsebox) {
        if (!empty($this->_params)) {
            $model = new $this->_config['model']();
            $bindingOptions = $this->_config['bindingOptions'];
            $bindingOptions['modelClass'] = get_class($browsebox->getModel());
            $bindingOptions['conditions'] = $select;

            $model->bindModel('__related__', $bindingOptions);
            $record = $model->find($this->_params)->current();
            $model->unbindModel('__related__');

            return $record->__related__;
        } else {
            throw new Garp_Browsebox_Filter_Exception_NotApplicable();
        }
    }
81099
def selectedRecords(self):
        
        output = []
        for item in self.selectedItems():
            if ( isinstance(item, XOrbRecordItem) ):
                output.append(item.record())
        return output
1344554
private function _readSelection()
	{
		$length = self::_GetInt2d($this->_data, $this->_pos + 2);
		$recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length);

		// move stream pointer to next record
		$this->_pos += 4 + $length;

		if (!$this->_readDataOnly) {
			// offset: 0; size: 1; pane identifier
			$paneId = ord($recordData{0});

			// offset: 1; size: 2; index to row of the active cell
			$r = self::_GetInt2d($recordData, 1);

			// offset: 3; size: 2; index to column of the active cell
			$c = self::_GetInt2d($recordData, 3);

			// offset: 5; size: 2; index into the following cell range list to the
			//  entry that contains the active cell
			$index = self::_GetInt2d($recordData, 5);

			// offset: 7; size: var; cell range address list containing all selected cell ranges
			$data = substr($recordData, 7);
			$cellRangeAddressList = $this->_readBIFF5CellRangeAddressList($data); // note: also BIFF8 uses BIFF5 syntax

			$selectedCells = $cellRangeAddressList['cellRangeAddresses'][0];

			// first row '1' + last row '16384' indicates that full column is selected (apparently also in BIFF8!)
			if (preg_match('/^([A-Z]+1\:[A-Z]+)16384$/', $selectedCells)) {
				$selectedCells = preg_replace('/^([A-Z]+1\:[A-Z]+)16384$/', '${1}1048576', $selectedCells);
			}

			// first row '1' + last row '65536' indicates that full column is selected
			if (preg_match('/^([A-Z]+1\:[A-Z]+)65536$/', $selectedCells)) {
				$selectedCells = preg_replace('/^([A-Z]+1\:[A-Z]+)65536$/', '${1}1048576', $selectedCells);
			}

			// first column 'A' + last column 'IV' indicates that full row is selected
			if (preg_match('/^(A[0-9]+\:)IV([0-9]+)$/', $selectedCells)) {
				$selectedCells = preg_replace('/^(A[0-9]+\:)IV([0-9]+)$/', '${1}XFD${2}', $selectedCells);
			}

			$this->_phpSheet->setSelectedCells($selectedCells);
		}
	}
418122
private function getDataFromView(View $view)
    {
        $form = $this->getFormFromView($view);

        if (false === $form) {
            return $view->getData();
        }

        return $form;
    }
1162385
public function toRecords(string $recordClass): array
    {
        $array = [];
        foreach ($this->rows as $row) {
            /**
             * @var $row Row
             */
            $record = Record::instanceRecord($recordClass, $row->toArray());
            $record->setLoaded();
            $array[] = $record;
        }
        return $array;
    }
916353
public function pack(array $record, Data $data = null)
    {
        $types = Type::getInstance();
        $values = [];

        $attributes = $this->getAttributes();

        foreach ($record as $key => $value) {
            if (!isset($attributes[$key])) {
                continue;
            }

            $attribute = $attributes[$key];
            $values[$key] = $types->get($attribute['type'])->restore($value, $attribute);
        }

        if ($data) {
            $data->__pack($values, false);
        } else {
            $class = $this->class;
            $data = new $class(null, ['fresh' => false]);
            $data->__pack($values, true);
        }

        return $data;
    }
115126
public function getFields ($selector = null) 
    {
        if ($selector === null) {
            return array_merge($this->_fields, Helper::flatten(Helper::mapMethod($this->_records, 'getFields')));
        } else {
            return $this->select(Field::match($selector));
        }
    }
244606
public function get_document($record, $options = array()) {

        // Check if user still exists, before proceeding.
        $user = \core_user::get_user($options['user1id'], 'deleted');
        if ($user->deleted == 1) {
            return false;
        }

        // Get user context.
        try {
            $usercontext = \context_user::instance($options['user1id']);
        } catch (\moodle_exception $ex) {
            // Notify it as we run here as admin, we should see everything.
            debugging('Error retrieving ' . $this->areaid . ' ' . $record->id . ' document, not all required data is available: ' .
                    $ex->getMessage(), DEBUG_DEVELOPER);
            return false;
        }
        // Prepare associative array with data from DB.
        $doc = \core_search\document_factory::instance($record->id, $this->componentname, $this->areaname);
        $doc->set('title', content_to_text($record->subject, false));
        $doc->set('itemid', $record->id);
        $doc->set('content', content_to_text($record->smallmessage, false));
        $doc->set('contextid', $usercontext->id);
        $doc->set('courseid', SITEID);
        $doc->set('owneruserid', $options['user1id']);
        $doc->set('userid', $options['user2id']);
        $doc->set('modified', $record->timecreated);

        // Check if this document should be considered new.
        if (isset($options['lastindexedtime']) && $options['lastindexedtime'] < $record->timecreated) {
            // If the document was created after the last index time, it must be new.
            $doc->set_is_new(true);
        }

        return $doc;
    }
177160
public function get_document($record, $options = array()) {
        try {
            $cm = $this->get_cm('wiki', $record->wikiid, $record->courseid);
            $context = \context_module::instance($cm->id);
        } catch (\dml_missing_record_exception $ex) {
            // Notify it as we run here as admin, we should see everything.
            debugging('Error retrieving ' . $this->areaid . ' ' . $record->id . ' document, not all required data is available: ' .
                $ex->getMessage(), DEBUG_DEVELOPER);
            return false;
        } catch (\dml_exception $ex) {
            // Notify it as we run here as admin, we should see everything.
            debugging('Error retrieving ' . $this->areaid . ' ' . $record->id . ' document: ' . $ex->getMessage(), DEBUG_DEVELOPER);
            return false;
        }

        // Make a page object without extra fields.
        $page = clone $record;
        unset($page->courseid);
        unset($page->wikiid);

        // Conversion based wiki_print_page_content().
        // Check if we have passed the cache time.
        if ($page->timerendered + WIKI_REFRESH_CACHE_TIME < time()) {
            $content = wiki_refresh_cachedcontent($page);
            $page = $content['page'];
        }
        // Convert to text.
        $content = content_to_text($page->cachedcontent, FORMAT_MOODLE);

        // Prepare associative array with data from DB.
        $doc = \core_search\document_factory::instance($record->id, $this->componentname, $this->areaname);
        $doc->set('title', content_to_text($record->title, false));
        $doc->set('content', $content);
        $doc->set('contextid', $context->id);
        $doc->set('courseid', $record->courseid);
        if ($record->groupid > 0) {
            $doc->set('groupid', $record->groupid);
        }
        $doc->set('owneruserid', \core_search\manager::NO_OWNER_ID);
        $doc->set('modified', $record->timemodified);

        // Check if this document should be considered new.
        if (isset($options['lastindexedtime']) && ($options['lastindexedtime'] < $record->timecreated)) {
            // If the document was created after the last index time, it must be new.
            $doc->set_is_new(true);
        }

        return $doc;
    }
95088
public int getFieldTypes(Record record)
    {
        int iFieldTypes = m_iFieldTypes;
        if (iFieldTypes == -1)
        {
            iFieldTypes = BaseBuffer.PHYSICAL_FIELDS;
            if (!record.isAllSelected())
                iFieldTypes = BaseBuffer.DATA_FIELDS; // (Selected excluding virtual)
        }
        return iFieldTypes;
    }
524055
public function get_upload_datas(Request $request, record_adapter $record)
    {
        $key = $record->getId();
        $datas = [
            'title'       => $request->get('title_' . $key),
            'description' => $request->get('description_' . $key),
            'category'    => $request->get('category_' . $key),
            'tags'        => $request->get('tags_' . $key),
            'privacy'     => $request->get('privacy_' . $key),
        ];

        return $datas;
    }
849073
protected function getFormattedResult(ViewableData $record)
    {
        if ($format = $this->getFormatResult()) {
            return SSViewer::fromString($format)->process($record);
        }
    }
238423
public static function select(Collection $data, $selected = 0, $options = [], $htmlOptions = [])
    {
        if (empty($options['valueColumn']))
            $options['valueColumn'] = Model::PK;
        if (empty($options['titleColumn']))
            $options['titleColumn'] = 'title';
        if (is_array($selected))
            $selected = $selected[$options['valueColumn']];
        if ($selected instanceof Model) {
            $selected = $selected->{$options['valueColumn']};
        }
        if (empty($options['disabled']))
            $options['disabled'] = [];

        if ($options instanceof Std) {
            $options = $options->getData();
        }

        $htmlOptionsText = [];
        foreach ($htmlOptions as $key => $value) {
            if (is_numeric($key)) {
                $htmlOptionsText[] = $value;
            } else {
                $htmlOptionsText[] = $key . '="' . $value . '"';
            }
        }
        $htmlOptionsText = implode(' ', $htmlOptionsText);

        $html = '<select ' . $htmlOptionsText . '>' . "\n";
        if (
            isset($options['null']) && $options['null']
            &&
            $data->first()[$options['valueColumn']] !== 0 && $data->first()[$options['titleColumn']] !== '---'
        ) {
            $data->prepend([$options['valueColumn'] => 0, $options['titleColumn'] => '---']);
        }
        foreach ($data as $item) {
            $html .=
                '<option
                    value="' . $item[$options['valueColumn']] . '"' .
                ($item[$options['valueColumn']] == $selected ? ' selected="selected"' : '') .
                (in_array($item[$options['valueColumn']], $options['disabled']) ? ' disabled="disabled"' : '') .
                '>' .
                (
                    in_array('tree', $options) && isset($options['treeLevelColumn']) && isset($item[$options['treeLevelColumn']])
                        ? str_repeat(self::TREE_LEVEL_SYMBOL, (int)$item[$options['treeLevelColumn']])
                        : ''
                ) . ' ' .
                $item[$options['titleColumn']] .
                '</option>' . "\n";
        }
        $html .= '</select>';
        return $html;
    }
119200
protected static function extract_record($record, $prefix) {
        $result = [];
        $prefixlength = strlen($prefix);
        foreach ($record as $key => $value) {
            if (strpos($key, $prefix) === 0) {
                $result[substr($key, $prefixlength)] = $value;
            }
        }
        return (object) $result;
    }
1239589
public function get_document($record, $options = array()) {

        try {
            $cm = $this->get_cm($this->get_module_name(), $record->id, $record->course);
            $context = \context_module::instance($cm->id);
        } catch (\dml_missing_record_exception $ex) {
            // Notify it as we run here as admin, we should see everything.
            debugging('Error retrieving ' . $this->areaid . ' ' . $record->id . ' document, not all required data is available: ' .
                $ex->getMessage(), DEBUG_DEVELOPER);
            return false;
        } catch (\dml_exception $ex) {
            // Notify it as we run here as admin, we should see everything.
            debugging('Error retrieving ' . $this->areaid . ' ' . $record->id . ' document: ' . $ex->getMessage(), DEBUG_DEVELOPER);
            return false;
        }

        // Prepare associative array with data from DB.
        $doc = \core_search\document_factory::instance($record->id, $this->componentname, $this->areaname);
        $doc->set('title', content_to_text($record->name, false));
        $doc->set('content', content_to_text($record->content, $record->contentformat));
        $doc->set('contextid', $context->id);
        $doc->set('courseid', $record->course);
        $doc->set('owneruserid', \core_search\manager::NO_OWNER_ID);
        $doc->set('modified', $record->timemodified);
        $doc->set('description1', content_to_text($record->intro, $record->introformat));

        return $doc;
    }
910593
public function afterSelect(Select $event)
    {
        if ($this->lazyLoad) {
            return;
        }
        $data = $event->data;
        $multiple = $data instanceof RecordList;
        if ($multiple) {
            $data = $event->data->getArrayCopy();
        } else {
            $data = [$data];
        }
        if (empty($data)) {
            return;
        }
        $related = Entity\Manager::getInstance()
            ->get($this->getRelatedEntity());
        $relatedTable = $related->getEntity()->getTableName();
        $class = $related->getEntity()->getClassName();
        $dataCopy = $data;
        foreach ($dataCopy as $key => $row) {

            $pmk =  $this->getEntity()->getPrimaryKey();
            if (isset($row[$pmk]) && is_array($row[$pmk])) {
                $data[$key][$pmk] = reset($row[$pmk]);
            }
            $options = [];
            if (is_array($row)) {
                foreach ($row as $column => $value) {
                    if (preg_match('/^' . $relatedTable . '_(.*)/', $column)) {
                        unset($data[$key][$column]);
                        $name = str_replace($relatedTable . '_', '', $column);
                        $options[$name] = $value;
                    }
                }
            }
            $data[$key][$this->getPropertyName()] = new $class($options);
        }

        if ($multiple) {
            $event->data = new RecordList(['data' => $data]);
        } else {
            $event->data = reset($data);
        }
    }