Documentation

SetStatus

bool
CFormResult::SetStatus(
 int result_id,
 int status_id,
 string check_rights = "Y"
)

Sets the new status for the result. Returns true on success and false otherwise. Non-static method.

Parameters

Parameter Description
result_id ID of the result..
status_id The new status ID.
check_rights Specifies that the current user access permissions should be checked.

The following values are possible:
  • Y - access permissions should be checked;
  • N - access permissions should not be checked.
The following access permissions are required for the new status to be successfully assigned to the specified result:
  1. For the web form to which the result being edited belongs:

    [20] Handle all results according to their status

    or, if you are the author of the status to be deleted, the following permission is sufficiet:

    [15] Handle own result according to its status
  2. For the status in which the currently edited result is:

    [EDIT] edit
  3. For the new status status_id:

    [MOVE] move results to this status
Optional. "Y" by default (check permissions).

Return Values

Returns true on success, or false otherwise.

Example


<?
$RESULT_ID = 189; // result ID
$STATUS_ID = 1; // the ID of the status "Published"

// assign a new status to a result
// check current user permissions
if (CFormResult::SetStatus($RESULT_ID, $STATUS_ID))
{
    echo "Status #".$STATUS_ID." for #".$RESULT_ID." successfully set.";
}
else // error
{
    global $strError;
    echo $strError;
}
?>
© «Bitrix24», 2001-2024
Up