Bitrix Site Manager

CStatEventType::GetByEvents

CDBResult
CStatEventType::GetByEvents(
 string event1,
 string event2
)

The method GetByEvents retrieves the event type by the specified identifiers.

Parameters

Parameter Description
event1 The event1 event type identifier.
event2 The event2 event type identifier.

Structure of the returned record

Array
(
    [TYPE_ID] => the event type ID
    [DYNAMIC_KEEP_DAYS] => days to keep statistical information
                           on this event type, on daily basis
    [KEEP_DAYS] => days to keep events of this type
    [DATE_ENTER_STR] => the date the event was created
)

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");
    }
}
?>