public static function FormatDatasetFieldsTemplate(Dataset $dataset, $template, IDelegate $processValue = null) { $result = $template; foreach ($dataset->GetFields() as $field) { if ($dataset->IsLookupField($field->GetNameInDataset())) { $result = StringUtils::ReplaceVariableInTemplate($result, $field->GetAlias(), $processValue == null ? $dataset->GetFieldValueByName($field->GetAlias()) : $processValue->Call($dataset->GetFieldValueByName($field->GetAlias()), $field->GetAlias())); } else { $result = StringUtils::ReplaceVariableInTemplate($result, $field->GetName(), $processValue == null ? $dataset->GetFieldValueByName($field->GetNameInDataset()) : $processValue->Call($dataset->GetFieldValueByName($field->GetNameInDataset()), $field->GetNameInDataset())); } } return $result; }
protected function GetActualKeys() { $keys = array('Primary' => false, 'Foreign' => false); if ($this->GetGrid()->GetShowKeyColumnsImagesInHeader()) { if ($this->dataset->IsFieldPrimaryKey($this->fieldName)) { $keys['Primary'] = true; } if ($this->dataset->IsLookupField($this->fieldName)) { $keys['Foreign'] = true; if ($this->dataset->IsLookupFieldNameByDisplayFieldName($this->fieldName)) { if ($this->dataset->IsFieldPrimaryKey($this->dataset->IsLookupFieldNameByDisplayFieldName($this->fieldName))) { $keys['Primary'] = true; } } } } return $keys; }
public function GetGridColumnClass() { $result = parent::GetGridColumnClass() ? parent::GetGridColumnClass() : parent::GetGridColumnClass(); if ($this->GetGrid()->GetShowKeyColumnsImagesInHeader()) { if ($this->dataset->IsFieldPrimaryKey($this->fieldName)) { StringUtils::AddStr($result, 'primary-key', ' '); } if ($this->dataset->IsLookupField($this->fieldName)) { if ($this->dataset->IsLookupFieldNameByDisplayFieldName($this->fieldName)) { if ($this->dataset->IsFieldPrimaryKey($this->dataset->IsLookupFieldNameByDisplayFieldName($this->fieldName))) { StringUtils::AddStr($result, 'primary-key', ' '); } } StringUtils::AddStr($result, 'foreign-key', ' '); } } if ($this->ShowOrderingControl()) { StringUtils::AddStr($result, 'sortable', ' '); } StringUtils::AddStr($result, $this->GetSortOrderColumnClass(), ' '); return $result; }