Documentation

CCourseImport::ImportPackage

bool
CCourseImport::ImportPackage();

The ImportPackage method imports a course.

Parameters

No parameters.

Return Values

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

See Also

  • CCourseImport::CCourseImport
  • Example

    
    <?
    if (CModule::IncludeModule("learning"))
    {
        if ($USER->IsAdmin())
        {
            @set_time_limit(0);
            $package = new CCourseImport($PACKAGE_DIR = "/upload/mypackage/", 
                                         Array("ru", "en"));
    
            if (strlen($package->LAST_ERROR) > 0)
            {
                echo "Error: ".$package->LAST_ERROR;
            }
            else
            {
                $success = $package->ImportPackage();
    
                if (!$success)
                    echo "Error: ".$package->LAST_ERROR;
                else
                    echo "Ok!";
            }
        }
    }
    ?>
    © «Bitrix24», 2001-2024