function print_visits_table($vs) { $status_name = array("не проведена", "проведена", "отменена"); print "<div style='height: 450px; overflow: auto;'>" . "<table cellpadding='4' cellspacing='1' width='100%'><tr class='header'>" . "<td>№</td><td>Дата</td><td>Время</td><td>Место</td><td>Статус</td><td>Описание</td></tr>"; foreach ($vs as $v) { $place = ""; if ($v["filial_id"] == -1) { $place = "курьер"; if ($v["station_id"] > 0) { try { $subway_station = SubwayStation::find($v["station_id"]); $place .= " (ст. " . $subway_station["name"] . ")"; } catch (Exception $e) { $place = ''; } } } else { $place = "офис"; } $ts = sprintf("%02d:%02d", floor($v["tm_start"] / 60), $v["tm_start"] % 60); $tf = sprintf("%02d:%02d", floor($v["tm_finish"] / 60), $v["tm_finish"] % 60); print "<tr><td>" . $v["id"] . "</td><td>" . date("d.m.Y", $v["date"]) . "</td>" . "<td>" . $ts . "-" . $tf . "</td>" . "<td>" . $place . "</td>" . "<td>" . $status_name[$v["status"]] . "</td>" . "<td>" . $v["about"] . "</td></tr>"; } print "</table></div>"; }
function del_station_exec($Frm, $Err) { if (!$Err) { SubwayStation::delete($Frm->GetNmValueI('id')); $Frm->_gui->informer->OK("Удалено"); page_reloadSubSec(); } }
$frm = $GUI->Form("Добавить", 400, 170); $frm->Button("Добавить", 100, 110, 80, true); $frm->OnExecute = "add_station_exec"; $b = $frm->Button("К списку", 220, 110, 80); $b->Event = "document.location.href=\"?" . $GUI->Url(array('section', 'subsection', 'add')) . "\"; return false;"; $frm->Label("Название", 10, 10); $t = $frm->TextArea(10, 30, 378, 60); $t->AddValidator(new CGUI_VALIDATOR_NOEMPTY()); $t->AddValidator(new CGUI_VALIDATOR_MAXLEN(255)); $t->linkName = 'name'; } elseif (isset($_REQUEST["del"])) { // if (!user_has_right("sprav_w")) { // page_ReloadSubSec(); // } $id = intval($_REQUEST["del"]); $station = SubwayStation::find($id); if ($station) { $frm = $GUI->Form("Удалить", 300, 100); $t = $frm->Hidden($id); $t->linkName = 'id'; $frm->Button("Удалить", 60, 40, 80, true); $frm->OnExecute = "del_station_exec"; $b = $frm->Button("К списку", 160, 40, 80); $b->Event = "document.location.href=\"?" . $GUI->Url(array('section', 'subsection', 'del')) . "\"; return false;"; $frm->Label("Удалить '" . $station["name"] . "'?", 10, 10); } else { $GUI->informer->ERR("Запись не найдена"); page_ReloadSubSec(); } } elseif (isset($_REQUEST["imp"])) { // if (!user_has_right("sprav_w")) {
function get_station_name($station_id) { try { $station = SubwayStation::find($station_id); return $station['name']; } catch (InvalidArgumentException $e) { return 'не определено'; } }
function tp_get_station($value, $row, $table, &$info) { if (!$value) { return ""; } $station = SubwayStation::find($value); return $station['name']; }