Documentation

Methods

Class \Bitrix\Main\UI\Spotlight allows:

  • Registering a hint view instance by a specific user.
  • Determines to show pulsating circle to a specific user.
Method Description Available from version
new Spotlight(
   $id
)
Class constructor.

Parameter:

  • id - hint ID.

Example:

use \Bitrix\Main\UI\Spotlight;

$spotlight = new Spotlight("my-hint");
$spotlight->setEndDate(time() - 3600);
$spotlight->setLifetime(3600 * 5);
$spotlight->setUserTimeSpan(3600 * 5);
$spotlight->setUserType(Spotlight::USER_TYPE_NEW); //for new users
if ($spotlight->isAvailable())
{
  //allow showing the hint
}
spotlight.isAvailable(
   $userId = false
)
Returns true, when hint is shown to the user.

Parameters:

  • userId {number} - user ID.
spotlight.getActivationDate
Returns date (timestamp) for hint activation on site.
spotlight.activate(
   $activationDate = false
)
Activate hint on site.

Parameters:

  • activationDate {number} - Hint activation date on site in seconds (timestamp). Current time by default.
spotlight.deactivate
Deactivates hint on site.
spotlight.isViewed(
   $userId
)
Returns true, when hint was viewed.

Parameters:

  • userId {number} - user ID.
spotlight.getViewDate(
   $userId
)
Returns date for hint view.

Parameters:

  • userId {number} - user ID.
spotlight.setViewDate(
   $userId,
   $date = false
)
Sets date for hint view.

Parameters:

  • userId {number} - user ID.
  • date {number} - Date for hint view in seconds (timestamp). Current time by default.
spotlight.unsetViewDate(
   $userId
)
Resets hint view date.

Parameters:

  • userId {number} - user ID.
spotlight.getId
Returns hint ID.
spotlight.getUserType
Returns user type. Returned values:
  • NEW - new user.
  • OLD - old user.
  • ALL - any user.
spotlight.setUserType(
   $userType
)
Sets user type to determine hint availability.

Parameters:

  • userType - user type. Available values:
    • Spotlight::USER_TYPE_OLD - old user.
    • Spotlight::USER_TYPE_NEW - new user.
    • Spotlight::USER_TYPE_ALL - any user.
spotlight.setUserTimeSpan(
   $userTimeSpan
)
Sets time span, used to determine new/old user.

Parameters:

  • userTimeSpan {number} - timespan in seconds.
spotlight.getUserTimeSpan
Returns time span, used to determine new/old user.
spotlight.getLifetime
Returns hint lifetime in seconds.
spotlight.setLifetime(
   $lifetime
)
Sets hint's lifetime.

Parameters:

  • lifetime {number} - hint lifetime in seconds
spotlight.getStartDate
Returns start date for showing a hint. Returns null, if date is not specified.
spotlight.setStartDate(
   $startDate
)
Sets start date, from which the hint showing starts.

Parameters:

  • startDate {number|null} - Date, from which hint showing starts in seconds (timestamp).
spotlight.getEndDate
Returns end date, until which the hint is shown. Returns null, if date is not specified.
spotlight.setEndDate(
   $endDate
)
Sets date, until the hint showing is available.

Parameters:

  • endDate {number|null} - Date in seconds (timestamp) until hint showing is available.


© «Bitrix24», 2001-2024
Up