Documentation

CCourseImport::CCourseImport

bool
CCourseImport::CCourseImport(
 string PACKAGE_DIR,
 array arSITE_ID
);

The CCourseImport constructor of the CCourseImport class is used to initialize the course to be imported.

Parameters

ParameterDescription
PACKAGE_DIR Path to the directory (relative to the site root) where the course archive is located.
arSITE_ID An array of the site identifiers describing sites to which the imported course will be bound.

Remarks

If an error occurs, the LAST_ERROR object property will contain the error description.

See Also

  • CCourseImport::ImportPackage
  • 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
    Up