| 232 |
'#type' => 'hidden', |
'#type' => 'hidden', |
| 233 |
'#value' => $field['tablelist'], |
'#value' => $field['tablelist'], |
| 234 |
); |
); |
|
$form['group'][$i]['label'] = array( |
|
|
'#type' => 'textfield', |
|
|
'#title' => t('Label'), |
|
|
'#field_prefix' => 'ViewsCalc: ', |
|
|
'#default_value' => str_replace('ViewsCalc: ', '', $field['label']), |
|
|
'#description' => t('The views field name for this field (i.e. Views Calc: My Calculation).'), |
|
|
); |
|
| 235 |
$form['group'][$i]['base'] = array( |
$form['group'][$i]['base'] = array( |
| 236 |
'#type' => 'select', |
'#type' => 'select', |
| 237 |
'#title' => t('Base table'), |
'#title' => t('Base table'), |
| 238 |
'#options' => $options, |
'#options' => $options, |
| 239 |
'#default_value' => !empty($field['base']) && array_key_exists($field['base'], $options) ? $field['base'] : 'node', |
'#default_value' => !empty($field['base']) && array_key_exists($field['base'], $options) ? $field['base'] : 'node', |
| 240 |
'#description' => t('The base table for this field.'), |
'#description' => t('The base table for this field.'), |
| 241 |
|
); |
| 242 |
|
$form['group'][$i]['label'] = array( |
| 243 |
|
'#type' => 'textfield', |
| 244 |
|
'#title' => t('Label'), |
| 245 |
|
'#field_prefix' => 'ViewsCalc: ', |
| 246 |
|
'#default_value' => str_replace('ViewsCalc: ', '', $field['label']), |
| 247 |
|
'#description' => t('The views field name for this field (i.e. Views Calc: My Calculation).'), |
| 248 |
); |
); |
| 249 |
$form['group'][$i]['calc'] = array( |
$form['group'][$i]['calc'] = array( |
| 250 |
'#type' => 'textarea', |
'#type' => 'textarea', |
| 251 |
'#title' => t('Calculation'), |
'#title' => t('Calculation'), |
| 252 |
'#default_value' => strtr($field['calc'], $substitutions), |
'#default_value' => strtr($field['calc'], $substitutions), |
| 253 |
'#description' => t('<p>The query operation to be performed, using numbers, field substitutions, and '. implode(' ', _views_calc_operators()) .'. <strong>'. t('Note that all fields must be from the base table selected above!') .'</strong></p>'), |
'#description' => t("<p>The query operation to be performed, using numbers, field substitutions, and ". implode(' ', _views_calc_operators()) .". Leave spaces between parentheses and field names, i.e. 'CONCAT( %field1, ' ', %field2 )'. <strong>". t('Note that all fields must be from the base table selected above! You cannot combine fields from different base tables.') ."</strong></p>"), |
| 254 |
); |
); |
| 255 |
$form['group'][$i]['format'] = array( |
$form['group'][$i]['format'] = array( |
| 256 |
'#type' => 'select', |
'#type' => 'select', |
| 349 |
$fields = array(); |
$fields = array(); |
| 350 |
foreach ($value_patterns as $pattern) { |
foreach ($value_patterns as $pattern) { |
| 351 |
if (preg_match($pattern, $form_values[$delta]['calc'], $results)) { |
if (preg_match($pattern, $form_values[$delta]['calc'], $results)) { |
| 352 |
$fields[] = trim($results[0]); |
$fields[trim($results[0])] = trim($results[0]); |
| 353 |
$tmp = explode('.', trim($results[0])); |
$tmp = explode('.', trim($results[0])); |
| 354 |
if (trim($tmp[0])) { |
if (trim($tmp[0])) { |
| 355 |
$tables[trim($tmp[0])] = trim($tmp[0]); |
$tables[trim($tmp[0])] = trim($tmp[0]); |