Sam sobie odpowiem na to pytanie
includes/function_calendar.php
Szukamy Kod:
$events = $vbulletin->db->query_read_slave("
SELECT event.*,
user.username, IF(user.displaygroupid = 0, user.usergroupid, user.displaygroupid) AS displaygroupid,
IF(dateline_to = 0, 1, 0) AS singleday
" . iif($vbulletin->userinfo['userid'], ", subscribeevent.eventid AS subscribed") . "
FROM " . TABLE_PREFIX . "event AS event
LEFT JOIN " . TABLE_PREFIX . "user AS user ON (user.userid = event.userid)
" . iif($vbulletin->userinfo['userid'], "LEFT JOIN " . TABLE_PREFIX . "subscribeevent AS subscribeevent ON (subscribeevent.eventid = event.eventid AND subscribeevent.userid = " . $vbulletin->userinfo['userid'] . ")") . "
WHERE calendarid = $calendarinfo[calendarid] AND
((dateline_to >= $beginday AND dateline_from < $endday) OR (dateline_to = 0 AND dateline_from >= $beginday AND dateline_from <= $endday )) AND
visible = 1
ORDER BY dateline_from
");
Zamieniamy na
Kod:
if ($calendarinfo[calendarid] == 1)
{
$events = $vbulletin->db->query_read_slave("
SELECT event.*,
user.username, IF(user.displaygroupid = 0, user.usergroupid, user.displaygroupid) AS displaygroupid,
IF(dateline_to = 0, 1, 0) AS singleday
" . iif($vbulletin->userinfo['userid'], ", subscribeevent.eventid AS subscribed") . "
FROM " . TABLE_PREFIX . "event AS event
LEFT JOIN " . TABLE_PREFIX . "user AS user ON (user.userid = event.userid)
" . iif($vbulletin->userinfo['userid'], "LEFT JOIN " . TABLE_PREFIX . "subscribeevent AS subscribeevent ON (subscribeevent.eventid = event.eventid AND subscribeevent.userid = " . $vbulletin->userinfo['userid'] . ")") . "
WHERE calendarid = 1 or calendarid = 2 or calendarid = 3 or calendarid = 4 or calendarid = 5 or calendarid = 6 AND
((dateline_to >= $beginday AND dateline_from < $endday) OR (dateline_to = 0 AND dateline_from >= $beginday AND dateline_from <= $endday )) AND
visible = 1
ORDER BY dateline_from
");
}
else
{
$events = $vbulletin->db->query_read_slave("
SELECT event.*,
user.username, IF(user.displaygroupid = 0, user.usergroupid, user.displaygroupid) AS displaygroupid,
IF(dateline_to = 0, 1, 0) AS singleday
" . iif($vbulletin->userinfo['userid'], ", subscribeevent.eventid AS subscribed") . "
FROM " . TABLE_PREFIX . "event AS event
LEFT JOIN " . TABLE_PREFIX . "user AS user ON (user.userid = event.userid)
" . iif($vbulletin->userinfo['userid'], "LEFT JOIN " . TABLE_PREFIX . "subscribeevent AS subscribeevent ON (subscribeevent.eventid = event.eventid AND subscribeevent.userid = " . $vbulletin->userinfo['userid'] . ")") . "
WHERE calendarid = $calendarinfo[calendarid] AND
((dateline_to >= $beginday AND dateline_from < $endday) OR (dateline_to = 0 AND dateline_from >= $beginday AND dateline_from <= $endday )) AND
visible = 1
ORDER BY dateline_from
");
}
gdzie
if ($calendarinfo[calendarid] == 1) - 1 to id kalendarza który ma robić sztuczkę
WHERE calendarid = 1 or calendarid = 2 or calendarid = 3 or calendarid = 4 or calendarid = 5 or calendarid = 6 - to wymienione id kalendarzy, które mają być wyświetlane