function defaultTitle($data = null, $model = false) { if (is_null($data)) { $data = $this->data; } if (!empty($data[$this->alias]['title'])) { return $data[$this->alias]['title']; } $titleParts = array('%val1%', array()); if (!empty($data[$this->alias]['not']) || $model) { $titleParts[1]['not'] = array('%val1%' => str_replace('%s', '%val1%', AdvTrans::sd('Not : %s', true))); } if ($model) { $titleParts[1]['val1'] = '%val1%'; } else { $titleParts[1]['val1'] = array('%val1%' => !empty($data[$this->alias]['val1']) ? $data[$this->alias]['val1'] : null); } $type = $this->getType($data); if ($type) { $titleParts = $type->alterFilterTitle($titleParts); } if (is_array($titleParts) && !$model) { $title = $titleParts[0]; foreach ($titleParts[1] as $key => $replace) { if (!is_array($replace)) { $replace = array($key => $replace); } $title = str_replace(array_keys($replace), array_values($replace), $title); } return $title; } else { return $titleParts; } }
function getLabel($translate = true) { $label = is_a($this->Type, 'DateFilterType') ? 'Before' : $this->label; if ($translate) { return AdvTrans::sd($label, true); } else { return $label; } }
function getLabel($translate = true) { if (empty($this->label)) { $this->label = Inflector::humanize($this->name); } if ($translate) { return AdvTrans::sd($this->label, true); } else { return $this->label; } }
function alterForm($form, $prefix) { $form[$prefix . 'val2'] = $form[$prefix . 'val1']; $form[$prefix . 'val2']['class'] = str_replace('customFilterCondVal1', 'customFilterCondVal2', $form[$prefix . 'val2']['class']); if (is_a($this->Type, 'DateFilterType')) { $form[$prefix . 'val1']['label'] = AdvTrans::sd("From", true); $form[$prefix . 'val2']['label'] = AdvTrans::sd("To", true); } else { $form[$prefix . 'val1']['label'] = AdvTrans::sd("Bigger or equal to", true); $form[$prefix . 'val2']['label'] = AdvTrans::sd("Smaller or equal to", true); } return $form; }