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; }
/** * Passes the variable throgh the filter and determines whether it passed or failed to pass * * @param mixed $value * @return boolean */ function filter($value) { return (bool) $this->callback->invokeArgs(array($value)); }