Bitrix Site Manager

CStatEvent::GetListByGuest

CDBResult
CStatEvent::GetListByGuest(
 int guest_id,
 mixed type_id = false,
 mixed event3 = false,
 mixed time = false
)

The method GetListByGuest returns a list of event identifiers by the site visitor ID.

Parameters

Parameter Description
guest_id The visitor ID.
type_id The event type ID. If "false", the returned list is not filtered by the event type.
event3 The event auxiliary parameter event3. If "false", the returned list is not filtered by event3.
time Number of seconds elapsed since now. If "false", the returned list is not filtered by time.

Structure of the returned record

Array
(
    [ID] => the event ID
)

See Also

Example



<?
// register an event of the type 
// "CHM file download" (download/manual)
// if it does not exist, it will be created
// register the event using the current visitor parameters

// check if the current visitor tried to download the file
// within the last hour

// get the event type ID
$rs = CStatEventType::GetByEvents($event1, $event2);
if ($ar = $rs->Fetch())
{
    // get all events of this type for the current visitor
    // for the last hour (3600 sec)
    $rs = CStatEvent::GetListByGuest($_SESSION["SESS_GUEST_ID"], 
                                     $ar["TYPE_ID"], "", 3600);
    
    // if no such event occurred
    if (!($ar=$rs->Fetch()))
    {
        // add the event!
        CStatEvent::AddCurrent("download", "manual");
    }
}
?>