29 lines
1.4 KiB
PHP
29 lines
1.4 KiB
PHP
<?php
|
||
require_once($_SERVER['DOCUMENT_ROOT'] . "/config.php");
|
||
|
||
if ($_SESSION['id'] && $_GET['id'] && is_numeric($_GET['id'])) {
|
||
$get = clearInputData($_GET);
|
||
$sql = "UPDATE user_client_events SET calendar_view = 1
|
||
where id = $get[id] and user_id = $_SESSION[id] and DATE(schedule_date) <= '".date("Y-m-d")."'";
|
||
mysql_query($sql);
|
||
|
||
// обновляем метку у меню календаря
|
||
// считаем события объектов
|
||
$sql = "SELECT count(id) FROM user_object_events WHERE user_id = $_SESSION[id] and calendar_view = 0
|
||
and schedule_date is not null and DATE(schedule_date) <= '".date("Y-m-d")."'";
|
||
$rez = mysql_query($sql);
|
||
$objectEventCount = mysql_result($rez,0);
|
||
|
||
// считаем события клиентов
|
||
$sql = "SELECT count(id) FROM user_client_events WHERE user_id = $_SESSION[id] and calendar_view = 0 and cancel = 0
|
||
and schedule_date is not null and DATE(schedule_date) <= '".date("Y-m-d")."'";
|
||
$rez = mysql_query($sql);
|
||
$clientEventCount = mysql_result($rez,0);
|
||
|
||
// суммарное количество событий по объектам и пользователям
|
||
$sumCount = intval($objectEventCount) + intval($clientEventCount);
|
||
echo $sumCount;
|
||
} else {
|
||
echo '0';
|
||
}
|