Chamilo is a learning management system focused on ease of use and accessibility
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
chamilo-lms/main/common_cartridge/export/src/converter/CcConverterPage.php

41 lines
1.5 KiB

<?php
/* Source: https://github.com/moodle/moodle/blob/MOODLE_310_STABLE/backup/cc/cc_lib/cc_converter_page.php under GNU/GPL license */
class CcConverterPage extends CcConverters
{
public function __construct(CcIItem &$item, CcIManifest &$manifest, $rootpath, $path)
{
$this->ccType = CcVersion13::WEBCONTENT;
$this->defaultfile = 'page.xml';
$this->defaultname = uniqid().'.html';
parent::__construct($item, $manifest, $rootpath, $path);
}
public function convert($outdir, $objPage)
{
$rt = new CcPage();
$title = $objPage['title'];
$intro = '';
$contextid = $objPage['source_id'];
$pagecontent = $objPage['comment'];
$rt->setTitle($title);
$rawname = str_replace(' ', '_', strtolower(trim(Security::filter_filename($title))));
if (!empty($rawname)) {
$this->defaultname = $rawname.".html";
}
$result = CcHelpers::processLinkedFiles($pagecontent,
$this->manifest,
$this->rootpath,
$contextid,
$outdir,
true);
$rt->setContent($result[0]);
$rt->setIntro($intro);
//store everything
$this->store($rt, $outdir, $title, $result[1]);
return true;
}
}