Documentation

CLQuestion::Add

int
CLQuestion::Add(
 array arFields
);

The Add method adds a new question.

Parameters

ParameterDescription
arFields The array Array("field"=>"value", ...). Contains values of all question fields. Required fields must be filled.

Return Values

The method returns the ID of the added question on success, or false otherwise. If an error occurs, the exception will contain the error description.

See Also

  • CLQuestion::Update
  • Question fields

    Example

    
    <?
    if (CModule::IncludeModule("learning"))
    {
        $LESSON_ID = 431;
    
        $arFields = Array(
            "ACTIVE" => "Y",
            "LESSON_ID" => $LESSON_ID,
            "NAME" => "Lesson 1",
            "SORT" => "1",
            "NAME" => "Assume there are several sites in the system.".
                      "Is it possible to assign users permissions on access ".
                      "to viewing statistics individually for each site?"
        );
    
        $question = new CLQuestion;
        $ID = $question->Add($arFields);
        $success = ($ID>0);
    
        if($success)
        {
            echo "Ok!";
        }
        else
        {
            if($e = $APPLICATION->GetException())
                echo "Error: ".$e->GetString();
        }
    }
    ?>
  • © «Bitrix24», 2001-2024