Documentation

CAdvType::Set

varchar(255)
CAdvType::Set(
 array arFields,
 varchar(255) TYPE_SID="",
 char(1) CHECK_RIGHTS="Y"
);

The method Set creates a new type of banners, or modifies the existing one if a symbolic type ID is passed in the second parameter. Returns the created type ID, or the modified type ID.

Parameters

arFields
An array of the type parameters. The following keys are possible in this array:
  • SID - symbolic type ID (used in the public section when displaying banners by their type);
  • ACTIVE - active state flag: if "Y", the type is active, if "N" the type is inactive;
  • NAME - name of type;
  • DESCRIPTION - description of type;
  • SORT - sort order of this type in lists.
TYPE_SID
The ID of an existing type. If omitted, a new type is created.
CHECK_RIGHTS
Flag indicating that the current user permissions should be checked. If "Y", the current user permissions should be checked. If "N", a type can be created and modified disregarding the current user permissions.

Example


<!-- 
The following example adds a new type
or modifies the existing one:
 -->
<?
if ((strlen($save)>0 || 
    strlen($apply)>0) && 
    $REQUEST_METHOD=="POST")
{
    $arFields = array(
        "SID"               => $SID,
        "ACTIVE"            => $ACTIVE,
        "SORT"              => $SORT,
        "NAME"              => $NAME,
        "DESCRIPTION"       => $DESCRIPTION
        );
    if ($SID = CAdvType::Set($arFields, $OLD_SID))
    {
        if (strlen($strError)<=0)
        {
            if (strlen($save) > 0)
                LocalRedirect("adv_type_list.php?lang=".LANG); 
            else
                LocalRedirect("adv_type_edit.php?SID=".$SID."〈=".LANG);
        }
    }
    $DB->PrepareFields("b_adv_type");
}
?>
© «Bitrix24», 2001-2024
Up