Documentation

CCourse::Update

bool
CCourse::Update(
 int   ID,
 array arFields
);

The Update method modifies the parameters of the course identified by the ID.

Parameters

ParameterDescription
ID The course ID.
arFields An array in the format Array("field"=>"value", ...). The array contains values of all fields of a course.

Additionally, the SITE_ID field contains an array of the site identifiers describing sites to which the course is bound.

You can specify permissions of different user groups to access the course by passing an array of associations between group ID's and access permissions passed in the GROUP_ID field. (see CCourse::SetPermission).

Return Values

The method returns true on success, or false otherwise. If an error occurs, the exception will contain the error description.

See Also

  • Course fields
  • CCourse::Add

    Example

    
    <?
    
    if (CModule::IncludeModule("learning"))
    {
        $arFields = Array(
            "ACTIVE" => "Y",
            "NAME" => "New name",
            "SITE_ID" => Array("en"), //Sites
        );
    
        $ID = 1;//Course ID
    
        $course = new CCourse;
        $success = $course->Update($ID, $arFields);
    
        if($success)
        {
            echo "Ok!";
            
        }
        else
        {
            if($e = $APPLICATION->GetException())
                echo "Error: ".$e->GetString();
        }
    }
    ?>
  • © «Bitrix24», 2001-2024
    Up