Pommo_Rules::getEnglish PHP Method

getEnglish() public static method

public static getEnglish ( $str = null )
    public static function getEnglish($str = null)
    {
        $english = array('is' => Pommo::_T('is'), 'not' => Pommo::_T('is not'), 'true' => Pommo::_T('is checked'), 'false' => Pommo::_T('is not checked'), 'greater' => Pommo::_T('is greater than'), 'less' => Pommo::_T('is less than'), 'is_in' => Pommo::_T('or in group'), 'not_in' => Pommo::_T('and not in group'));
        if (is_array($str)) {
            $out = array();
            foreach ($str as $val) {
                if (array_key_exists($val, $english)) {
                    $out[$val] = $english[$val];
                }
            }
            return $out;
        }
        return empty($str) ? $english : $english[$str];
    }

Usage Example

Example #1
0
 }
 if ($_REQUEST['ruleType'] == 'field') {
     $field = current(Pommo_Fields::get(array('id' => $_REQUEST['fieldID'])));
     $logic = isset($_REQUEST['logic']) && $_REQUEST['logic'] != "0" ? $_REQUEST['logic'] : false;
     $type = $_REQUEST['type'] == 'or' ? 'or' : 'and';
     $values = array();
     // check to see if we're editing [logic is passed *only* when edit button is clicked]
     if ($logic) {
         foreach ($group['rules'] as $rule) {
             if ($rule['logic'] == $logic && $rule['field_id'] == $_REQUEST['fieldID']) {
                 $values[] = $field['type'] == 'date' ? Pommo_Helper::timeFromStr($rule['value']) : $rule['value'];
             }
         }
     }
     $firstVal = empty($values) ? false : array_shift($values);
     $logic = $logic ? Pommo_Rules::getEnglish(array($logic)) : Pommo_Rules::getEnglish(end(Pommo_Rules::getLegal($group, array($field))));
     $smarty->assign('type', $type);
     $smarty->assign('field', $field);
     $smarty->assign('logic', $logic);
     $smarty->assign('values', $values);
     $smarty->assign('firstVal', $firstVal);
     $smarty->display('ajax/rule.field.tpl');
     Pommo::kill();
 } elseif ($_REQUEST['ruleType'] == 'group') {
     $match = Pommo_Groups::getNames($_REQUEST['fieldID']);
     $key = key($match);
     $smarty->assign('match_name', $match[$key]);
     $smarty->assign('match_id', $key);
     $smarty->display('ajax/rule.group.tpl');
     Pommo::kill();
 }
All Usage Examples Of Pommo_Rules::getEnglish