Documentation

Add

Description and parameters

int
CRubric::Add(
    array arFields
);

Method updates a newsletter. If this newsletter is active and automatic, adds an agent for generating newsletters in case of corresponding module setting (non-cron generating method). Non-static method.

Parameters

ParameterDescriptionAvailable from version
arFieldsArray with values for "Newsletter" field objects.

Requirements for fields, passed to arFields

  • NAME - must not be empty.
  • LID - must not be empty and must contain a correct site id.
  • DAYS_OF_MONTH - must not be empty or must contain a correct list of days of the month (DD|DD-DD)[[,(DD|DD-DD)],...].
  • DAYS_OF_WEEK - must not be empty or must contain a correct list of days of the month DD[[,DD],...].
  • TIMES_OF_DAY - must not be empty or must contain a correct list time attributes HH:MM[[,HH:MM],...].
  • TEMPLATE - must not be empty or must contain a correct template ID.
  • LAST_EXECUTED - must not be empty or must contain a correct time value.
  • AUTO - of defined and set as "Y", must have defined DAYS_OF_MONTH or DAYS_OF_WEEK, as well as TIMES_OF_DAY and LAST_EXECUTED. And the field FROM_FIELD must contain a correct e-mail address (see check_email).

Returned value

If successfully added, returns a newsletter ID. Otherwise returns false, and the LAST_ERROR class variable contains error.

Examples

$rubric = new CRubric;
$arFields = Array(
    "ACTIVE" => ($ACTIVE <> "Y"? "N":"Y"),
    "NAME" => $NAME,
    "SORT" => $SORT,
    "DESCRIPTION" => $DESCRIPTION,
    "LID" => $LID
);
$ID = $rubric->Add($arFields);
if($ID == false)
    echo $rubric->LAST_ERROR;

© «Bitrix24», 2001-2024
Up