Files
Chamilo/main/common_cartridge/export/src/CcForum.php
T
Xes 73154ae174
Behat tests 1.11.x 🐞 / PHP 7.4 Test on ubuntu-latest (push) Canceled after 0s
PHP-CS-Fixer / composer_install (7.4) (push) Canceled after 0s
Chamilo 1.11.40 (ZIP oficial v1.11.40)
Fuente: https://github.com/chamilo/chamilo-lms/releases/download/v1.11.40/chamilo-1.11.40.zip
sha256: 1cf4bf2cc7bae1ef1a1eff643235db1d552f78ddf4b6dd1e2d2dac9868679439
Snapshot independiente (rama huerfana); diffable vs 1.11.38. vendor incluido.
2026-08-06 17:59:45 +02:00

50 lines
1.7 KiB
PHP

<?php
/* Source: https://github.com/moodle/moodle/blob/MOODLE_310_STABLE/backup/cc/cc_lib/cc_forum.php under GNU/GPL license */
class CcForum extends CcGeneralFile
{
public const DEAFULTNAME = 'discussion.xml';
protected $rootns = 'dt';
protected $rootname = 'topic';
protected $ccnamespaces = ['dt' => 'http://www.imsglobal.org/xsd/imsccv1p3/imsdt_v1p3',
'xsi' => 'http://www.w3.org/2001/XMLSchema-instance', ];
protected $ccnsnames = ['dt' => 'http://www.imsglobal.org/profile/cc/ccv1p3/ccv1p3_imsdt_v1p3.xsd'];
protected $title = null;
protected $textType = 'text/plain';
protected $text = null;
protected $attachments = [];
public function setTitle($title)
{
$this->title = self::safexml($title);
}
public function setText($text, $type = 'text/plain')
{
$this->text = self::safexml($text);
$this->textType = $type;
}
public function setAttachments(array $attachments)
{
$this->attachments = $attachments;
}
protected function onSave()
{
$rns = $this->ccnamespaces[$this->rootns];
$this->appendNewElementNs($this->root, $rns, 'title', $this->title);
$text = $this->appendNewElementNs($this->root, $rns, 'text', $this->text);
$this->appendNewAttributeNs($text, $rns, 'texttype', $this->textType);
if (!empty($this->attachments)) {
$attachments = $this->appendNewElementNs($this->root, $rns, 'attachments');
foreach ($this->attachments as $value) {
$att = $this->appendNewElementNs($attachments, $rns, 'attachment');
$this->appendNewAttributeNs($att, $rns, 'href', $value);
}
}
return true;
}
}