Esempio n. 1
0
function list_layout_heading($result, $i)
{
    echo '<h4>' . warnOnEmpty(mysql_result($result, $i, "layout_owner_firstname"), "first name") . ' ' . errorOnEmpty(mysql_result($result, $i, "layout_owner_lastname"), "last name") . '</h4>';
    echo 'layout name: ' . errorOnEmpty(mysql_result($result, $i, "layout_name"), "name") . '<br>';
    echo 'short desc: ' . warnOnEmpty(mysql_result($result, $i, "layout_short_description"), "short desc") . '<br>';
    echo 'long desc:  ' . errorOnEmpty(mysql_result($result, $i, "layout_long_description"), "long desc") . '<br>';
    echo "<p>\n";
    echo 'status code:  ' . warnOnEmpty(mysql_result($result, $i, "event_status_name"), "") . '<br>';
    if (!checkShowLayoutStatus($result, $i) && mysql_result($result, $i, "number") != "") {
        if (checkShowStatus($result, $i)) {
            echo '<span class="et-error-missing">Error: Unapproved layout visible on approved tour</span><br/>';
        } else {
            echo '<span class="et-warning-missing">Layout on proposed tour but not approved</span><br/>';
        }
    }
    echo "<p>\n";
    echo 'scale:  ' . errorOnEmpty(mysql_result($result, $i, "layout_scale"), "scale") . '<br>';
    echo 'prototype:  ' . warnOnEmpty(mysql_result($result, $i, "layout_prototype"), "proto") . '<br>';
    echo 'era:  ' . warnOnEmpty(mysql_result($result, $i, "layout_era"), "era") . '<br>';
    echo 'scenery:  ' . warnOnEmpty(mysql_result($result, $i, "layout_scenery"), "scenery") . '<br>';
    echo 'size:  ' . warnOnEmpty(mysql_result($result, $i, "layout_size"), "size") . '<br>';
    echo 'mainline length:  ' . warnOnEmpty(mysql_result($result, $i, "layout_mainline_length"), "main len") . '<br>';
    echo 'plan type:  ' . warnOnEmpty(mysql_result($result, $i, "layout_plan_type"), "plan type") . '<br>';
    echo 'ops scheme:  ' . warnOnEmpty(mysql_result($result, $i, "layout_ops_scheme"), "ops scheme") . '<br>';
    echo 'control:  ' . warnOnEmpty(mysql_result($result, $i, "layout_control"), "control") . '<br>';
    echo 'num ops:  ' . warnOnEmpty(mysql_result($result, $i, "layout_num_ops"), "numops") . '<br>';
    echo 'accessibility:  ' . warnOnEmpty(mysql_result($result, $i, "accessibility_name"), "accessible") . '<br>';
    echo 'wheelchair access:  ' . mysql_result($result, $i, "layout_wheelchair_access") . '<br>';
    echo 'duckunder entry:  ' . mysql_result($result, $i, "layout_duckunder_entry") . '<br>';
    echo 'owner url:  ' . mysql_result($result, $i, "layout_owner_url") . '<br>';
    echo 'first name:  ' . warnOnEmpty(mysql_result($result, $i, "layout_owner_firstname"), "first name") . '<br>';
    echo 'last name:  ' . errorOnEmpty(mysql_result($result, $i, "layout_owner_lastname"), "last name") . '<br>';
    echo 'phone:  ' . warnOnEmpty(mysql_result($result, $i, "layout_owner_phone"), "phone") . '<br>';
    echo 'call time:  ' . mysql_result($result, $i, "layout_owner_call_time") . '<br>';
    echo 'email:  ' . mysql_result($result, $i, "layout_owner_email") . '<br>';
    echo '<br>';
    echo 'street address:  ' . errorOnEmpty(mysql_result($result, $i, "layout_street_address"), "address") . '<br>';
    echo 'city:  ' . errorOnEmpty(mysql_result($result, $i, "layout_city"), "city") . '<br>';
    echo 'state:  ' . errorOnEmpty(mysql_result($result, $i, "layout_state"), "state") . '<br>';
    echo 'post code:  ' . warnOnEmpty(mysql_result($result, $i, "layout_postcode"), "zip") . '<br>';
    echo 'distance:  ' . warnOnEmpty(mysql_result($result, $i, "layout_distance"), "distance") . '<br>';
    echo '<br>';
    echo 'Fidelity to prototype:  ' . mysql_result($result, $i, "layout_fidelity") . '<br>';
    echo 'Rigor:  ' . mysql_result($result, $i, "layout_rigor") . '<br>';
    echo 'Documentation:  ' . mysql_result($result, $i, "layout_documentation") . '<br>';
    echo 'Session pace:  ' . mysql_result($result, $i, "layout_session_pace") . '<br>';
    echo 'Car forwarding:  ' . mysql_result($result, $i, "layout_car_forwarding") . '<br>';
    echo 'Tone:  ' . mysql_result($result, $i, "layout_tone") . '<br>';
    echo 'Dispatched by (primary):  ' . mysql_result($result, $i, "layout_dispatched_by1") . '<br>';
    echo 'Dispatched by (secondary):  ' . mysql_result($result, $i, "layout_dispatched_by2") . '<br>';
    echo 'Communications:  ' . mysql_result($result, $i, "layout_communications") . '<br>';
}
Esempio n. 2
0
function format_all_layouts_as_table($url = NONE, $where = NONE, $order = NONE)
{
    global $opts, $event_tools_db_prefix, $event_tools_href_add_on;
    global $event_tools_show_min_value;
    mysql_connect($opts['hn'], $opts['un'], $opts['pw']);
    @mysql_select_db($opts['db']) or die("Unable to select database");
    if ($order == NONE) {
        $order = "layout_owner_lastname, layout_owner_firstname";
    }
    if ($where != NONE) {
        $where = "WHERE " . $where . " AND ";
    } else {
        $where = "WHERE ";
    }
    $where .= " ( status_code >= " . $event_tools_show_min_value . " OR id IS NULL ) ";
    // good or blank status required
    $query = "\r\n        SELECT  *\r\n        FROM " . $event_tools_db_prefix . "eventtools_layout_with_layout_tours\r\n        " . $where . "\r\n        ORDER BY " . $order . "\r\n        ;\r\n    ";
    $result = mysql_query($query);
    $query = "\r\n        SELECT  *\r\n        FROM " . $event_tools_db_prefix . "eventtools_opsession_name\r\n        ORDER BY start_date\r\n        ;\r\n    ";
    $resultOps = mysql_query($query);
    $numOps = mysql_numrows($resultOps);
    $i = 0;
    $num = mysql_numrows($result);
    //echo "num: ".$num."<br/>\n";
    if ($num == 0) {
        mysql_close();
        return;
    }
    $lastmajorkey = "";
    $first = 0;
    while ($i < $num) {
        $majorkey = mysql_result($result, $i, "layout_id");
        // skip if not at sufficient level _and_ no associated tour
        if (!checkShowLayoutStatus($result, $i) && mysql_result($result, $i, "id") == '') {
            echo "\n<!-- skip " . $i;
            echo " " . mysql_result($result, $i, "layout_owner_firstname");
            echo " " . mysql_result($result, $i, "layout_owner_lastname");
            echo " #" . mysql_result($result, $i, "layout_status_code");
            echo '# -->' . "\n";
            $i++;
            continue;
        } else {
            echo "\n<!-- processing " . $i;
            echo " " . mysql_result($result, $i, "layout_owner_firstname");
            echo " " . mysql_result($result, $i, "layout_owner_lastname");
            echo " #" . mysql_result($result, $i, "layout_status_code");
            echo '# -->' . "\n";
        }
        if ($lastmajorkey != $majorkey) {
            $lastmajorkey = $majorkey;
            // end any existing table
            if ($first != 0) {
                echo "</table>\n";
            }
            $first = 1;
            // start a new table
            echo "\n";
            echo "<table border=\"1\" class=\"et-layout-table\">\n";
            // line 1 - Name
            echo "<tr class=\"et-layout-tr1\">\n";
            echo "  <td colspan=\"3\" class=\"et-layout-td1\">\n";
            echo "    <span class=\"et-layout-name\">\n";
            echo "      <a name=\"" . mysql_result($result, $i, "layout_id") . "\"></a>\n";
            echo "     " . errorOnEmpty(htmlspecialchars(mysql_result($result, $i, "layout_name")), "name");
            echo "      </span> \n";
            echo "  </td>\n";
            echo "</tr>\n";
            // line 2 - owner, city
            echo "<tr class=\"et-layout-tr2\">\n";
            echo "    <td colspan=\"2\" class=\"et-layout-td1\">\n";
            echo "        <span class=\"et-layout-owner\">" . warnOnEmpty(htmlspecialchars(mysql_result($result, $i, "layout_owner_firstname")), "first") . " " . warnOnEmpty(htmlspecialchars(mysql_result($result, $i, "layout_owner_lastname")), "last") . "</span> \n";
            echo "    </td>\n";
            echo "    <td class=\"et-layout-td3\">\n";
            echo "        <span class=\"et-layout-city\">" . warnOnEmpty(htmlspecialchars(mysql_result($result, $i, "layout_city")), "city") . "</span> \n";
            echo "    </td>\n";
            echo "</tr>\n";
            // line 3 - short description
            echo "<tr class=\"et-layout-tr3\">\n";
            echo "    <td colspan=\"3\" class=\"et-layout-td1\">\n";
            echo "        <span class=\"et-layout-shortdesc\">" . errorOnEmpty(htmlspecialchars(mysql_result($result, $i, "layout_short_description")), "short description") . "</span> \n";
            echo "    </td>\n";
            echo "</tr>\n";
            // line 4 - scale, prototype, URL
            echo "<tr class=\"et-layout-tr4\">\n";
            echo "    <td class=\"et-layout-td1\">\n";
            echo "        <span class=\"et-layout-scale\">" . errorOnEmpty(htmlspecialchars(mysql_result($result, $i, "layout_scale")), "scale") . "</span> \n";
            echo "    </td>\n";
            echo "    <td class=\"et-layout-td2\">\n";
            echo "        <span class=\"et-layout-prototype\">" . warnOnEmpty(htmlspecialchars(mysql_result($result, $i, "layout_prototype")), "proto") . "</span> \n";
            echo "    </td>\n";
            echo "    <td class=\"et-layout-td3\">\n";
            echo "        <span class=\"et-lt-layout-owner_url\">";
            echo "          <a " . $event_tools_href_add_on . " href=\"" . mysql_result($result, $i, "layout_owner_url") . "\">" . mysql_result($result, $i, "layout_owner_url") . "</a>\n";
            echo "        </span>\n";
            echo "    </td>\n";
            echo "</tr>\n";
            // line 5 - scenery, size, mainline length
            echo "<tr class=\"et-layout-tr5\">\n";
            $scenery = warnOnEmpty(htmlspecialchars(mysql_result($result, $i, "layout_scenery")), "scenery");
            if (mysql_result($result, $i, "layout_scenery") != '') {
                $scenery = 'Scenery: ' . $scenery;
            }
            echo "    <td class=\"et-layout-td1\">\n";
            echo "        <span class=\"et-layout-scenery\">" . $scenery . "</span> \n";
            echo "    </td>\n";
            echo "    <td class=\"et-layout-td2\">\n";
            echo "        <span class=\"et-layout-size\">" . warnOnEmpty(htmlspecialchars(mysql_result($result, $i, "layout_size")), "size") . "</span> \n";
            echo "    </td>\n";
            echo "    <td class=\"et-layout-td3\">\n";
            echo "        <span class=\"et-layout-mainline_length\">" . warnOnEmpty(htmlspecialchars(mysql_result($result, $i, "layout_mainline_length")), "main len") . "</span> \n";
            echo "    </td>\n";
            echo "</tr>\n";
            // line 6 - plan type, ops scheme, control
            echo "<tr class=\"et-layout-tr6\">\n";
            echo "    <td class=\"et-layout-td1\">\n";
            echo "        <span class=\"et-layout-plantype\">" . warnOnEmpty(htmlspecialchars(mysql_result($result, $i, "layout_plan_type")), "plan") . "</span> \n";
            echo "    </td>\n";
            echo "    <td class=\"et-layout-td2\">\n";
            echo "        <span class=\"et-layout-opsscheme\">" . warnOnEmpty(htmlspecialchars(mysql_result($result, $i, "layout_ops_scheme")), "ops scheme") . "</span> \n";
            echo "    </td>\n";
            echo "    <td class=\"et-layout-td3\">\n";
            echo "        <span class=\"et-layout-control\">" . warnOnEmpty(htmlspecialchars(mysql_result($result, $i, "layout_control")), "control") . "</span> \n";
            echo "    </td>\n";
            echo "</tr>\n";
            // line 7 - accessibility, era, photos
            if (mysql_result($result, $i, "accessibility_display") != "") {
                $accessibility = mysql_result($result, $i, "accessibility_display");
            } else {
                $accessibility = NONE;
            }
            echo "<tr class=\"et-layout-tr7\">\n";
            echo "    <td class=\"et-layout-td1\">\n";
            echo "        <span class=\"et-layout-accessibility\">" . warnOnEmpty($accessibility, "accessibility") . "</span> \n";
            echo "    </td>\n";
            echo "    <td class=\"et-layout-td2\">\n";
            echo "        <span class=\"et-layout-era\">" . warnOnEmpty(htmlspecialchars(mysql_result($result, $i, "layout_era")), "era") . "</span> \n";
            echo "    </td>\n";
            echo "    <td class=\"et-layout-td3\">\n";
            if (mysql_result($result, $i, "layout_photo_url") != '') {
                echo '<a href="' . htmlspecialchars(mysql_result($result, $i, "layout_photo_url")) . '">Photos</a>';
            }
            echo "    </td>\n";
            echo "</tr>\n";
            // line 8 - long description
            echo "<tr class=\"et-layout-tr8\">\n";
            echo "    <td colspan=\"3\" class=\"et-layout-td1\">\n";
            echo "        <div class=\"et-layout-longdesc\">" . errorOnEmpty(mysql_result($result, $i, "layout_long_description"), "long desc") . "</div> \n";
            echo "    </td>\n";
            echo "</tr>\n";
            // list all op sessions this layout belongs to
            $id = mysql_result($result, $i, "layout_id");
            $op = 0;
            while ($op < $numOps) {
                if (mysql_result($resultOps, $op, "layout_id1") == $id || mysql_result($resultOps, $op, "layout_id2") == $id) {
                    // Hit, display a row
                    echo '<tr class="et-layout-tr-ops">';
                    echo '<td class="et-layout-tr-ops-td1">';
                    echo '<span class="et-layout-ops-time">';
                    echo 'Op Session on ' . mysql_result($resultOps, $op, "presenting_time");
                    echo '</span>';
                    echo '</td>';
                    echo '<td class="et-layout-tr-ops-td1">';
                    echo '<span class="et-layout-ops-location">';
                    // handle two-fers
                    if (mysql_result($resultOps, $op, "layout_id1") == $id && mysql_result($resultOps, $op, "layout_id2") != 0) {
                        echo 'Combined with <a href="?layoutid=' . mysql_result($resultOps, $op, "layout_id2") . '">' . mysql_result($resultOps, $op, "layout_owner_firstname2") . ' ' . mysql_result($resultOps, $op, "layout_owner_lastname2") . ' ' . mysql_result($resultOps, $op, "layout_name2") . '</a>';
                    } else {
                        if (mysql_result($resultOps, $op, "layout_id2") == $id) {
                            echo 'Combined with <a href="?layoutid=' . mysql_result($resultOps, $op, "layout_id1") . '">' . mysql_result($resultOps, $op, "layout_owner_firstname1") . ' ' . mysql_result($resultOps, $op, "layout_owner_lastname1") . ' ' . mysql_result($resultOps, $op, "layout_name1") . '</a>';
                        } else {
                            // show regional location in field
                            echo mysql_result($resultOps, $op, "location");
                        }
                    }
                    echo '</span>';
                    echo '</td>';
                    echo '<td class="et-layout-tr-ops-td1">';
                    echo '<span class="et-layout-ops-distanceTime">';
                    echo mysql_result($resultOps, $op, "distance");
                    if (mysql_result($resultOps, $op, "distance") != '' && mysql_result($resultOps, $op, "travel_time") != '') {
                        echo ', ';
                    }
                    echo mysql_result($resultOps, $op, "travel_time");
                    echo '</span>';
                    echo '</td>';
                    echo '</tr>';
                }
                $op++;
            }
        }
        // list all layout tours this layout belongs to
        // checkShowStatus used because there are two statuses in the record, layout and tour, should have been selected in WHERE
        if (checkShowStatus($result, $i) && mysql_result($result, $i, "number") != "") {
            // only approved-status non-null tours
            echo "<tr class=\"et-layout-tr-tour\">\n";
            echo "  <td colspan=\"2\" class=\"et-layout-td1\">\n";
            echo "    <span class=\"et-layout-tourNumber\">\n";
            echo "      <a href=\"" . $url . mysql_result($result, $i, "number") . "\">";
            echo "      " . mysql_result($result, $i, "number");
            echo "    </a></span>\n";
            echo "    <span class=\"et-layout-tourShortName\">" . htmlspecialchars(mysql_result($result, $i, "name")) . "</span> \n";
            $date = daytime_from_long_format(mysql_result($result, $i, "start_date")) . " - " . time_from_long_format(mysql_result($result, $i, "end_date"));
            echo "  </td>\n";
            echo "  <td colspan=\"3\" class=\"et-layout-td2\">\n";
            echo "    <span class=\"et-layout-tourDateTime\">" . $date . "</span>\n";
            echo "  </td>\n";
            echo "</tr>\n";
        }
        $i++;
    }
    echo "</table>\n";
    // done, clean up
    mysql_close();
}