Documentation

CCoursePackage::CreatePackage

bool
CCoursePackage::CreatePackage(
 int PACKAGE_DIR
);

The CreatePackage method creates an archive with the training course.

Parameters

ParameterDescription
PACKAGE_DIR Path to the directory (relative to the site root) where the course archive will be created.

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

  • CCoursePackage::CCoursePackage
  • CCoursePackage::CreateManifest
  • Example

    
    <?
    if (CModule::IncludeModule("learning"))
    {
        $COURSE_ID = 97;
    
        if (CCourse::GetPermission($COURSE_ID) >= 'W')
        {
            @set_time_limit(0);
            $package = new CCoursePackage($COURSE_ID);
    
            if (strlen($package->LAST_ERROR) > 0)
            {
                echo "Error: ".$package->LAST_ERROR;
            }
            else
            {
                $success = $package->CreatePackage($PACKAGE_DIR = "/upload/mypackage/");
    
                if (!$success)
                    echo "Error: ".$package->LAST_ERROR;
                else
                    echo "Ok!";
            }
        }
    }
    ?>
    © «Bitrix24», 2001-2024
    Up