Esempio n. 1
0
        change(1);
        break;
    case 'unpublish':
        change(0);
        break;
    case 'gotoedit':
        gotoedit();
        break;
    case 'country_list':
        country_list();
        break;
    case 'show_map':
        show_map();
        break;
    case 'show_matrix':
        show_matrix();
        break;
    default:
        showredirect();
        break;
}
function show_conditions()
{
    $form_id = JRequest::getVar('form_id');
    $row = JTable::getInstance('formmaker', 'Table');
    $row->load($form_id);
    $ids = array();
    $types = array();
    $labels = array();
    $paramss = array();
    $all_ids = array();
Esempio n. 2
0
function show_vector($result, $fieldnames = array())
{
    // There are two types of vector: those that are a set of items and those
    // that are just like a row in the database. For the second case, reuse the
    // show_matrix function considering the vector as a 1-row matrix
    if (!isset($result[0])) {
        // This happens when $result is an indexed array (i.e. $result["fieldname"]. In this
        // case consider $result as a 1 row matrix
        $foo_matrix = array();
        $foo_matrix[] = $result;
        show_matrix($foo_matrix, $fieldnames);
        return;
    }
    $title = isset($fieldnames[0]) ? $fieldnames[0] : "Result";
    $length = strlen($title);
    // get the maximum length for a single item
    foreach ($result as $item) {
        if (is_array($item)) {
            continue;
        }
        // shouldn't happen
        $length = max(strlen($item), $length);
    }
    $length = $length + 2;
    // +2 for having spaces at the beginning and the end
    // show the title
    echo "+" . str_repeat("-", $length) . "+\n";
    echo "|" . center_text($title, $length) . "|\n";
    echo "+" . str_repeat("-", $length) . "+\n";
    // show each item
    foreach ($result as $item) {
        echo "| " . $item . str_repeat(" ", $length - strlen($item) - 1) . "|\n";
    }
    // show last line
    echo "+" . str_repeat("-", $length) . "+\n";
}