Esempio n. 1
0
File: list.inc.php Progetto: mmr/b1n
 switch ($r['type']) {
     case "text":
     case "textarea":
         if ($r['check'] == 'email') {
             echo "&nbsp;<a href='mailto:" . $v . "'>" . b1n_inHtmlLimit($v) . "</a>";
         } else {
             echo b1n_inHtmlLimit($v);
         }
         break;
     case "select":
         switch ($r['extra']['seltype']) {
             case "date":
                 echo b1n_formatDateShow(b1n_formatDateFromDb($v));
                 break;
             case "date_hour":
                 echo b1n_formatDateHourShow(b1n_formatDateHourFromDb($v));
                 break;
             case "date_check_exp":
                 echo b1n_formatDateCheckExpShow(b1n_formatDateFromDb($v));
                 break;
             case "date_check_dob":
                 echo b1n_formatDateCheckDobShow(b1n_formatDateFromDb($v));
                 break;
             case "defined":
                 foreach ($r['extra']['options'] as $opt_title => $opt_value) {
                     if ($v == $opt_value) {
                         $v = $opt_title;
                         break;
                     }
                 }
                 echo b1n_inHtmlLimit($v);
Esempio n. 2
0
File: leg.lib.php Progetto: mmr/b1n
function b1n_regUpdateNextLegs($sql, &$ret_msgs, $r)
{
    $r['ete_diff'] = strftime('%H:%M', $r['ete_diff_ts']);
    $r['groundtime_diff'] = strftime('%H:%M', $r['groundtime_diff_ts']);
    // If we are PUSHing we have to check for Overflow
    if ($r['ete_signal'] == '+') {
        $r['ete_signal'] = '';
        if ($r['groundtime_signal'] == '+') {
            $r['groundtime_signal'] = '';
        }
        // Checking for overflow
        $rs = $sql->singleQuery("\n            SELECT\n                func_get_leg_push_overflow(\n                    '" . $r['trip'] . "',\n                    '" . $r['keeptrack'] . "',\n                    '" . $r['ete_diff'] . "', \n                    '" . $r['groundtime_diff'] . "') AS overflow");
        // If we have something from the Function that means we are overlapping someone (hmmm)
        if ($rs && !empty($rs['overflow'])) {
            // Yep, we are trying to overlap someone, lets warn the user and abort the operation
            $msg = 'The leg you are trying to change overlaps a leg with arbitrary ETD in the ';
            $aux = explode('|', $rs['overflow']);
            if ($r['trip'] != $aux[0]) {
                $msg .= $aux[0];
            } else {
                $msg .= 'current(' . $r['trip'] . ')';
            }
            $msg .= ' trip at ' . b1n_formatDateHourShow(b1n_formatDateHourFromDb($aux[1])) . '.<br />Process aborted.';
            b1n_retMsg($ret_msgs, b1n_FIZZLES, $msg);
            return false;
        }
    } elseif ($r['groundtime_signal'] == '+' && $r['groundtime_diff_ts'] > $r['ete_diff_ts']) {
        $r['groundtime_signal'] = '';
        // Checking for overflow
        $rs = $sql->singleQuery("\n            SELECT\n                func_get_leg_push_overflow(\n                    '" . $r['trip'] . "',\n                    '" . $r['keeptrack'] . "',\n                    '" . $r['ete_diff'] . "', \n                    '" . $r['groundtime_diff'] . "') AS overflow");
        // If we have something from the Function that means we are overlapping someone (hmmm)
        if ($rs && !empty($rs['overflow'])) {
            // Yep, we are trying to overlap someone, lets warn the user and abort the operation
            $msg = 'The leg you are trying to change overlaps a leg with arbitrary ETD in the ';
            $aux = explode('|', $rs['overflow']);
            if ($trip != $aux[0]) {
                $msg .= $aux[0];
            } else {
                $msg .= 'current(' . $trip . ')';
            }
            $msg .= ' trip at ' . b1n_formatDateHourShow(b1n_formatDateHourFromDb($aux[1])) . '.<br />Process aborted.';
            b1n_retMsg($ret_msgs, b1n_FIZZLES, $msg);
            return false;
        }
    } elseif ($r['ete_signal'] != '-' && $r['groundtime_signal'] != '-') {
        b1n_retMsg($ret_msgs, b1n_FIZZLES, "Unknown signal requested.");
        return false;
    }
    $query = "\n        UPDATE\n            \"leg\"\n        SET\n            leg_keeptrack_dt = leg_keeptrack_dt::timestamp\n            + \n                " . $r['ete_signal'] . "'" . b1n_inBd($r['ete_diff']) . "'::interval\n            +\n                " . $r['groundtime_signal'] . "'" . b1n_inBd($r['groundtime_diff']) . "'::interval\n        WHERE\n            leg_trip = '" . $r['trip'] . "' AND\n            leg_etd_dt IS NULL AND\n            leg_keeptrack_dt > '" . $r['keeptrack'] . "'";
    $rs = $sql->query($query);
    if ($rs) {
        $ret = true;
    } else {
        b1n_retMsg($ret_msgs, b1n_FIZZLES, 'Could not ' . $action . ' next legs.');
        $ret = false;
    }
    return $ret;
}
Esempio n. 3
0
File: history.php Progetto: mmr/b1n
<?php

// $Id: history.php,v 1.2 2004/04/12 00:34:26 mmr Exp $
if (is_array($history)) {
    echo '<table><tr><td>&nbsp;</td><td>&nbsp;</td></tr>';
    foreach ($history as $h) {
        echo '<tr>';
        echo '<td><nobr>' . b1n_formatDateHourShow($h['log_add_dt']) . '</nobr></td>';
        $msg = $lang['log_' . $h['log_action']];
        $vars = '';
        if (!empty($h['log_vars'])) {
            $vars = explode(';', $h['log_vars']);
            if (is_array($vars)) {
                foreach ($vars as $var) {
                    list($k, $v) = explode(':', $var);
                    if (b1n_cmp($k, 'money')) {
                        $v = b1n_formatCurrency($v);
                    }
                    $msg = str_replace('{' . $k . '}', $v, $msg);
                }
            }
        }
        echo '<td>' . $msg . '</td>';
        echo '</tr>';
    }
    echo "</table>";
}
Esempio n. 4
0
File: view.inc.php Progetto: mmr/b1n
 switch ($reg['type']) {
     case "text":
     case "textarea":
         if ($reg['check'] == 'email' && !empty($reg_data[$reg['reg_data']])) {
             echo "&nbsp;<a href='mailto:" . $reg_data[$reg['reg_data']] . "'>" . $reg_data[$reg['reg_data']] . "</a>";
         } else {
             echo "&nbsp;" . b1n_inHtml($reg_data[$reg['reg_data']]);
         }
         break;
     case "select":
         switch ($reg['extra']['seltype']) {
             case "date":
                 echo b1n_formatDateShow($reg_data[$reg['reg_data']]);
                 break;
             case "date_hour":
                 echo b1n_formatDateHourShow($reg_data[$reg['reg_data']]);
                 break;
             case "defined":
                 foreach ($reg['extra']['options'] as $opt_title => $opt_value) {
                     if ($reg_data[$reg['reg_data']] == $opt_value) {
                         echo $opt_title;
                         break;
                     }
                 }
                 break;
             case "fk":
                 if (!isset($reg['extra']['params'])) {
                     echo b1n_viewSelected($sql, $reg['extra']['value'], $reg['extra']['text'], $reg['extra']['table'], $reg_data[$reg['reg_data']]);
                 } else {
                     if (!isset($reg['extra']['where'])) {
                         $reg['extra']['where'] = array();