print "<div style='overflow:auto; background:white; border: 1px solid gray; height: 78px'>" . "<table cellpadding=0 cellspacing=0 style='font-size:8pt; margin-left:2px;'>" . "<tr style='color:gray'><td>Сотрудник</td><td style='width:10px' nowrap></td><td>Занятость</td></tr>"; // Филиал сотрудника. Если нет филиала, то используем 8 часов раб день $worklong = 0; if ($_SESSION["user"]["data"]["filial_id"]) { $fil = fils_get($_SESSION["user"]["data"]["filial_id"]); $dweek = date("w", $date) - 1; if ($dweek == -1) { $dweek = 6; } fils_getworktime($fil, $dweek, $st, $en); $worklong = $en - $st; } if (!$worklong) { $worklong = 480; } foreach ($users as $u) { print "<tr><td>" . $u["fio"] . "</td><td></td><td>" . round(100 * $u["visits_sum"] / $worklong) . "%</td></tr>"; } print "</table></div>"; } else { $meetings = db::get_arrays("SELECT tm_start, tm_finish, station_id FROM " . TABLE_VISITS . " WHERE user_id = " . $uid . " AND date = " . $date); if ($meetings) { print "<div style='font-size:10pt'>"; foreach ($meetings as $r) { print utils_cvt_i2times($r["tm_start"]) . "-" . utils_cvt_i2times($r["tm_finish"]) . ' - ' . get_station_name($r['station_id']) . "<br>"; } print "</div>"; } else { print "на выбранную дату у сотрудника нет встреч"; } }
} }*/ $sql = "SELECT coming,going FROM StationMovables WHERE movableid='{$movable}' AND statid='{$to}' and ({$condstr}) "; //echo $sql; $res2 = pg_query($sql); $num2 = pg_num_rows($res2); if ($num2) { $coming = pg_result($res2, 0, 0); if (!$coming) { $coming = pg_result($res2, 0, 1); } if (strtotime($coming) - strtotime($going) > 60 * 60 * 18) { } else { /* $sql = "SELECT going, fromstation, tostation, extratxt FROM StationMovables WHERE statid='$from' and movableid='$movable' order by going"; $res2 = pg_query($sql); while ($row = pg_fetch_assoc($res2)) {*/ echo "<tr>"; echo "<td><a href='index.php?movable=" . $movable . "'>" . $movable . "</a></td>"; echo "<td>" . $going . "</td>"; echo "<td>" . $coming . "</td>"; $fs = get_station_name($fromstation); $ts = get_station_name($tostation); echo "<td>{$fs}</td><td>{$ts}</td><td>" . $extratxt . "</td>"; echo "</tr>"; } } } echo "</table>"; exit;
</p> </a> </li> <li> <a href="?rand=<?php echo rand(0, 9999); ?> #usb" data-transition="slide" rel="external">USB</a> </li> <li data-theme="d" data-role="list-divider"> Stations </li> <?php $cnt = get_stations(); for ($i = 0; $i < $cnt; $i++) { echo "<li data-theme=\"d\">" . " <a href=\"?play={$i}#page1\" data-transition=\"slide\" rel=\"external\">" . get_station_name($i) . "<span class=\"ui-li-count\">" . get_station_genre($i) . "</span></a></a><a href=\"#really_delete\" onclick=\"document.getElementById('del_item').value={$i};\" data-rel=\"dialog\" data-position-to=\"window\" data-transition=\"pop\" data-icon=\"delete\">Delete</a></li>"; } ?> </ul> </div> <div data-role="footer" class="ui-bar" data-position="fixed"> <a href="#add_station" data-rel="dialog" data-role="button" data-icon="plus">Add</a> <a href="#add_url" data-rel="dialog" data-role="button" data-icon="plus">Add shoutcast URL</a> </div> <input type="hidden" value="0" id="del_item" /> </div> <!-- =================== NOW PLAYING ================ --> <div data-role="page" id="page1">
function get_station($statid) { //return; $stationname = get_station_name($statid); $stationnameorig = urlencode(recode("UTF8..windows-1250", $stationname)); $stationurl = "http://vred.hznet.hr/hzinfo/Default.asp?KO={$stationnameorig}&Category=hzinfo&Service=izvr3&LANG=HR&SCREEN=2"; $html = file_get_dom($stationurl); //$html = file_get_dom('http://vred.hznet.hr/hzinfo/Default.asp?KO=Zagreb+Gl.+Kol.&Category=hzinfo&Service=izvr3&LANG=HR&SCREEN=2&SESSIONID=%3Csessionid%3E'); //$statid = get_station_id($stationname); //if ($statid == -1) return; foreach ($html->find('td') as $element) { $foundin = 0; foreach ($element->find("a") as $innerel) { //echo trim($innerel->innertext)."\n"; // commit previous work here if ($vlaknr) { if ($vlakiz) { $vlakiz = get_station_id($vlakiz); } else { $vlakiz = 0; } if ($vlakza) { $vlakza = get_station_id($vlakza); } else { $vlakza = 0; } $vlakdolstr = "'{$vlakdol}'"; if ($vlakdol == '') { $vlakdolstr = "NULL"; } $vlakodlstr = "'{$vlakodl}'"; if ($vlakodl == '') { $vlakodlstr = "NULL"; } $sun = 1; $sat = 1; $vlaknaphandled = 0; // blah, this is tiresome if ($vlaknap == "") { $vlaknaphandled = 1; } if ($vlaknap == "Ne vozi nedjeljom i blagdanom") { $sun = 0; $vlaknaphandled = 1; } if ($vlaknap == "Ne vozi subotom") { $sat = 0; $vlaknaphandled = 1; } if ($vlaknap == "Vozi nedjeljom") { $vlaknaphandled = 1; } if ($vlaknap == "Vozi nedjeljom i blagdanom") { $vlaknaphandled = 1; } if ($vlaknap == "Vozi subotom, nedjeljom i blagdanom") { $vlaknaphandled = 1; } if ($vlaknap == "Ne vozi subotom, nedjeljom i blagdanom") { $sat = 0; $sun = 0; $vlaknaphandled = 1; } //$pos = strpos("Ne vozi subotom, nedjeljom i blagdanom", $vlaknap); //if ($pos > 0) $sql = "INSERT INTO StationMovables values('{$statid}','{$vlaknr}',{$vlakdolstr}, {$vlakodlstr}, '{$vlakiz}' ,'{$vlakza}','{$vlaknap}','{$sun}','{$sat}','{$vlaknaphandled}');"; echo $sql . "\n"; pg_query($sql); } $vlaknr = trim($innerel->innertext); $foundin = 1; $col = 0; } if (!$foundin) { $txt = trim($element->innertext); $txt = str_ireplace("<BR>", "", $txt); switch ($col) { case 0: $vlakdol = $txt; break; case 1: $vlakodl = $txt; break; case 6: $vlakiz = recode("windows1250..UTF-8", $txt); break; case 7: $vlakza = recode("windows1250..UTF-8", $txt); break; case 8: $vlaknap = recode("windows1250..UTF-8", $txt); break; } $col++; } } if ($vlaknr) { if ($vlakiz) { $vlakiz = get_station_id($vlakiz); } else { $vlakiz = 0; } if ($vlakza) { $vlakza = get_station_id($vlakza); } else { $vlakza = 0; } $vlakdolstr = "'{$vlakdol}'"; if ($vlakdol == '') { $vlakdolstr = "NULL"; } $vlakodlstr = "'{$vlakodl}'"; if ($vlakodl == '') { $vlakodlstr = "NULL"; } $sql = "INSERT INTO StationMovables values('{$statid}','{$vlaknr}',{$vlakdolstr}, {$vlakodlstr}, '{$vlakiz}' ,'{$vlakza}','{$vlaknap}');"; echo $sql . "\n"; pg_query($sql); } $html->clear; unset($html); }
<?php include "settings.inc.php"; include "station.php"; if (isset($_GET["play"])) { echo get_station_name($_GET["play"]); file_put_contents($current_station_path, get_station_name($_GET["play"])); shell_exec("/home/pi/start_stream.sh " . get_station_url($_GET["play"]) . " > /dev/null 2>/dev/null &"); } ?>
function editvisit_exec($Frm, $Err) { global $vis_statuses; if (!$Err) { $changes = array(); $vis = Meeting::find($Frm->GetNmValueI("vid")); if (!$vis) { $Frm->_gui->ERR("Встреча не найдена"); return false; } $sum = $Frm->GetNmValueI("summa"); $sumf = $Frm->GetNmValueI("summaf"); $targ = $Frm->GetNmValueH("about"); $stat = $Frm->GetNmValueI("status"); $rep = $Frm->GetNmValueH("report"); $dt = explode("-", $Frm->GetNmValue("date")); $dt = mktime(0, 0, 0, $dt[1], $dt[0], $dt[2]); $tms = $Frm->GetNmValueI("start"); $tme = $Frm->GetNmValueI("finish"); if ($stat != 1 && $sumf > 0) { $Frm->_gui->ERR("Фактическая сумма не может быть изменена, если встреча не проведена"); return false; } if ($stat == 1 && $sum > $sumf) { $Frm->_gui->ERR("Фактическая сумма " . $sumf . " " . $GLOBALS["ofc_currency"] . " меньше суммы, которую нужно получить " . $sum . " " . $GLOBALS["ofc_currency"]); return false; } if ($sum != $vis["summa"]) { $changes[] = "'деньги' с " . $vis["summa"] . " на " . $sum . " " . $GLOBALS["ofc_currency"]; } if ($sumf != $vis["summaf"]) { $changes[] = "'деньги фактически' с " . $vis["summaf"] . " на " . $sumf . " " . $GLOBALS["ofc_currency"]; } if ($targ != $vis["about"]) { $changes[] = "'цель'"; } if ($stat != $vis["status"]) { $changes[] = "'статус' с '" . $vis_statuses[$vis["status"]] . "' на '" . $vis_statuses[$stat] . "'"; } if ($rep != $vis["report"]) { $changes[] = "'отчет'"; } if ($dt != $vis["date"]) { $changes[] = "'дата встречи' с " . date("d-m-Y", $vis["date"]) . " на " . date("d-m-Y", $dt); } if ($tms != $vis["tm_start"]) { $changes[] = "'начало' с " . utils_cvt_i2times($vis["tm_start"]) . " на " . utils_cvt_i2times($tms); } if ($tme != $vis["tm_finish"]) { $changes[] = "'окончание' с " . utils_cvt_i2times($vis["tm_finish"]) . " на " . utils_cvt_i2times($tme); } $station_id = 0; $opisanie_klienta = ""; $opisanie_pyti = ""; if ($vis['filial_id'] == -1) { $station_id = $Frm->GetNmValueI("station"); $opisanie_klienta = $Frm->GetNmValueH("opisanie_klienta"); $opisanie_pyti = $Frm->GetNmValueH("opisanie_pyti"); if ($station_id != $vis["station_id"]) { $changes[] = "'станция' с " . get_station_name($vis["station_id"]) . " на " . get_station_name($station_id); } if ($opisanie_klienta != $vis["opisanie_klienta"]) { $changes[] = "'описание клиента' с '" . $vis["opisanie_klienta"] . "' на '" . $opisanie_klienta . "'"; } if ($opisanie_pyti != $vis["opisanie_pyti"]) { $changes[] = "'описание пути' с '" . $vis["opisanie_pyti"] . "' на '" . $opisanie_pyti . "'"; } } if ($sumf > $sum) { $Frm->_gui->ERR("Фактическая сумма не может превышать " . $sum . " " . $GLOBALS["ofc_currency"]); return; } if ($tms > $tme) { $Frm->_gui->ERR("Некорректно задано время"); return; } if ($stat && !$rep) { $Frm->_gui->ERR("Необходим отчет о встрече"); return; } $msg = "Произошли следующие изменения по встрече №" . $vis["id"] . ":<br>"; foreach ($changes as $c) { $msg .= $c . "<br>"; } $msg .= "<a href='?section=vis&subsection=2&visit=" . $vis["id"] . "'>Перейти к просмотру</a>"; Meeting::update($vis["id"], array("date" => $dt, "status" => $stat, "tm_start" => $tms, "tm_finish" => $tme, "about" => $targ, "summa" => $sum, "summaf" => $sumf, "report" => $rep, "opisanie_klienta" => $opisanie_klienta, "opisanie_pyti" => $opisanie_pyti, "station_id" => $station_id)); Order::update($vis["order_id"], array('oplata_kln' => $sumf)); $Frm->_gui->OK("Сохранено"); // Письмо тому кто проводит если статус 0 if (count($changes) && $vis["status"] == 0) { //$to, $from, $subj, $text, $prior, $srok, $parent=0, $order=0, $klient=0, $visit=0, $tender=0 $msg_id = mls_Send("u" . $vis["user_id"], "u" . $_SESSION["user"]["data"]["id"], "Изменение параметров встречи №" . $vis["id"], $msg, 1, 0, 0, $vis["order_id"], $vis["client_id"], $vis["id"], 0); \Components\Classes\Author::enqueue_message_to_email($msg_id, array($vis["user_id"]), \Components\Entity\EmailNotificationType::TO_AUTHOR_ON_ORDER_CHANGE); } } }
} echo "</table>"; } else { if ($movable) { $sql = "SELECT distinct coming,going, fromstation, tostation, extratxt, statid FROM StationMovables where movableid='{$movable}' order by going asc"; $res = pg_query($sql); echo "<table>"; while ($row = pg_fetch_assoc($res)) { echo "<tr>"; $statid = $row['statid']; $stationname = get_station_name($statid); echo "<td><a href='index.php?station=" . $row['statid'] . "'>" . $stationname . "</a></td>"; echo "<td>" . $row['coming'] . "</td>"; echo "<td>" . $row['going'] . "</td>"; $fs = get_station_name($row['fromstation']); $ts = get_station_name($row['tostation']); echo "<td>{$fs}</td><td>{$ts}</td><td>" . $row['extratxt'] . "</td>"; echo "</tr>"; } echo "</table>"; } else { $res = pg_query("SELECT * FROM Stations"); $num = pg_num_rows($res); for ($i = 0; $i < $num; $i++) { $id = pg_result($res, $i, 0); $name = pg_result($res, $i, 1); echo "<a href='index.php?station={$id}'>{$name}</a><br>"; } } } ?>