Exemplo n.º 1
0
function bpminbox_process_advanced_actions(&$focus, $field, $meta_array, &$rel_this)
{
    ////////////Later expand to be able to also extract from the rel_this as the choice of returning dynamic values
    global $current_user;
    if ($meta_array['adv_type'] == 'exist_user') {
        if ($meta_array['value'] == 'current_user') {
            if (!empty($current_user)) {
                if ($meta_array['ext1'] == "Self") {
                    //kbrill bug #14923
                    return $current_user->id;
                }
                if ($meta_array['ext1'] == "Manager") {
                    //kbrill bug #14923
                    return get_manager_info($current_user->id);
                }
            } else {
                return 1;
            }
            //if value is current_user
        }
        if ($meta_array['ext1'] == "Self") {
            return $focus->{$meta_array}['value'];
        }
        if ($meta_array['ext1'] == "Manager") {
            return get_manager_info($focus->{$meta_array}['value']);
        }
    }
    if ($meta_array['adv_type'] == 'exist_team') {
        if ($meta_array['value'] == 'current_team') {
            if (!empty($current_user)) {
                return $current_user->default_team;
            } else {
                return 1;
            }
            //if value is current_team
        }
        return $focus->{$meta_array}['value'];
    }
    if ($meta_array['adv_type'] == 'value_calc') {
        $jang = get_expression($meta_array['ext1'], $rel_this->{$field}, $meta_array['value']);
        //echo $jang;
        return $jang;
    }
    if ($meta_array['adv_type'] == 'enum_step') {
        global $app_list_strings;
        $options_name = $rel_this->field_defs[$field]['options'];
        $target_array = $app_list_strings[$options_name];
        bpminbox_find_start_position($target_array, $rel_this->{$field});
        if ($meta_array['ext1'] == 'retreat') {
            for ($i = 0; $i < $meta_array['value']; $i++) {
                prev($target_array);
            }
        }
        if ($meta_array['ext1'] == 'advance') {
            for ($i = 0; $i < $meta_array['value']; $i++) {
                next($target_array);
            }
        }
        $new_option = key($target_array);
        if (!empty($new_option) && $new_option != "") {
            return $new_option;
        } else {
            return $rel_this->{$field};
        }
    }
}
Exemplo n.º 2
0
function display_expression( $wdlanguages, $xml, $defined_meaning, $languages ) {
        $string = '';
        $wdlanguages = get_wdlanguages();

        $string .= "<h3>expressions / translations</h3>";
        $string .= section_reverse_link();
        $string .= '<ul>';


        if ( $_REQUEST['trainer_step'] == '0' || $_REQUEST['trainer_step'] == '1' ) {
                $languages = array();
                $languages[] = $wdlanguages[0];
        } else {
                $languages = $wdlanguages;
        }

        $expressions = get_expression( $xml, $defined_meaning, $languages );
        foreach ( $expressions['wdlanguage'] as $wdlanguage ) {

                if ( ( current( $expressions['indentical_meaning'] ) ) == '1' ) {
                        $string .= '<li class="ow_voc_expression">';
                } else {
                        $string .= '<li class="ow_voc_expression_not_identical">';
                }

                # echo '<li>';
                $string .= $wdlanguage . ': ';
                $string .= '<em>' . current( $expressions['expression'] ) . '</em>';

                if ( ( current( $expressions['indentical_meaning'] ) ) == '0' ) {
                        $string .= " (not identical) ";
                }

                $string .= '</li>';
                next( $expressions['expression'] );
                next( $expressions['indentical_meaning'] );
        }
        $string .= '</ul>';
return $string;
}