Skip to content

Commit

Permalink
Merge pull request #333 from oat-sa/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
kilatib authored Sep 30, 2022
2 parents 5953596 + b1fa8e5 commit 1f162a6
Show file tree
Hide file tree
Showing 28 changed files with 1,731 additions and 9 deletions.
81 changes: 81 additions & 0 deletions src/qtism/data/content/xhtml/html5/Rb.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<?php

/**
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; under version 2
* of the License (non-upgradable).
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Copyright (c) 2022 (original work) Open Assessment Technologies SA;
*/

declare(strict_types=1);

namespace qtism\data\content\xhtml\html5;

use qtism\data\content\FlowStatic;
use qtism\data\content\FlowTrait;
use qtism\data\content\InlineCollection;

class Rb extends Html5Element implements FlowStatic
{
use FlowTrait;

public const QTI_CLASS_NAME = 'rb';

/**
* The Block components composing the SimpleBlock object.
*
* @var InlineCollection
* @qtism-bean-property
*/
private $content;

/**
* Create a new figcaption object.
*/
public function __construct($title = null, $role = null, $id = null, $class = null, $lang = null, $label = null)
{
parent::__construct($title, $role, $id, $class, $lang, $label);
$this->setContent(new InlineCollection());
}

public function getQtiClassName()
{
return self::QTI_CLASS_NAME;
}

public function getComponents()
{
return $this->getContent();
}

/**
* Set the collection of Flow objects composing the Div.
*
* @param InlineCollection $content A collection of Flow objects.
*/
public function setContent(InlineCollection $content)
{
$this->content = $content;
}

/**
* Get the collection of Flow objects composing the Div.
*
* @return InlineCollection
*/
public function getContent()
{
return $this->content;
}
}
81 changes: 81 additions & 0 deletions src/qtism/data/content/xhtml/html5/Rp.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<?php

/**
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; under version 2
* of the License (non-upgradable).
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Copyright (c) 2022 (original work) Open Assessment Technologies SA;
*/

declare(strict_types=1);

namespace qtism\data\content\xhtml\html5;

use qtism\data\content\FlowStatic;
use qtism\data\content\FlowTrait;
use qtism\data\content\InlineCollection;

class Rp extends Html5Element implements FlowStatic
{
use FlowTrait;

public const QTI_CLASS_NAME = 'rp';

/**
* The Block components composing the SimpleBlock object.
*
* @var InlineCollection
* @qtism-bean-property
*/
private $content;

/**
* Create a new figcaption object.
*/
public function __construct($title = null, $role = null, $id = null, $class = null, $lang = null, $label = null)
{
parent::__construct($title, $role, $id, $class, $lang, $label);
$this->setContent(new InlineCollection());
}

public function getQtiClassName()
{
return self::QTI_CLASS_NAME;
}

public function getComponents()
{
return $this->getContent();
}

/**
* Set the collection of Flow objects composing the Div.
*
* @param InlineCollection $content A collection of Flow objects.
*/
public function setContent(InlineCollection $content)
{
$this->content = $content;
}

/**
* Get the collection of Flow objects composing the Div.
*
* @return InlineCollection
*/
public function getContent()
{
return $this->content;
}
}
81 changes: 81 additions & 0 deletions src/qtism/data/content/xhtml/html5/Rt.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<?php

/**
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; under version 2
* of the License (non-upgradable).
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Copyright (c) 2022 (original work) Open Assessment Technologies SA;
*/

declare(strict_types=1);

namespace qtism\data\content\xhtml\html5;

use qtism\data\content\FlowStatic;
use qtism\data\content\FlowTrait;
use qtism\data\content\InlineCollection;

class Rt extends Html5Element implements FlowStatic
{
use FlowTrait;

public const QTI_CLASS_NAME = 'rt';

/**
* The Block components composing the SimpleBlock object.
*
* @var InlineCollection
* @qtism-bean-property
*/
private $content;

/**
* Create a new figcaption object.
*/
public function __construct($title = null, $role = null, $id = null, $class = null, $lang = null, $label = null)
{
parent::__construct($title, $role, $id, $class, $lang, $label);
$this->setContent(new InlineCollection());
}

public function getQtiClassName()
{
return self::QTI_CLASS_NAME;
}

public function getComponents()
{
return $this->getContent();
}

/**
* Set the collection of Flow objects composing the Div.
*
* @param InlineCollection $content A collection of Flow objects.
*/
public function setContent(InlineCollection $content)
{
$this->content = $content;
}

/**
* Get the collection of Flow objects composing the Div.
*
* @return InlineCollection
*/
public function getContent()
{
return $this->content;
}
}
81 changes: 81 additions & 0 deletions src/qtism/data/content/xhtml/html5/Ruby.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<?php

/**
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; under version 2
* of the License (non-upgradable).
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Copyright (c) 2022 (original work) Open Assessment Technologies SA;
*/

declare(strict_types=1);

namespace qtism\data\content\xhtml\html5;

use qtism\data\content\FlowCollection;
use qtism\data\content\FlowStatic;
use qtism\data\content\FlowTrait;

class Ruby extends Html5Element implements FlowStatic
{
use FlowTrait;

public const QTI_CLASS_NAME = 'ruby';

/**
* The Block components composing the SimpleBlock object.
*
* @var FlowCollection
* @qtism-bean-property
*/
private $content;

/**
* Create a new figure object.
*/
public function __construct($title = null, $role = null, $id = null, $class = null, $lang = null, $label = null)
{
parent::__construct($title, $role, $id, $class, $lang, $label);
$this->setContent(new FlowCollection());
}

public function getQtiClassName()
{
return self::QTI_CLASS_NAME;
}

public function getComponents()
{
return $this->getContent();
}

/**
* Set the collection of Flow objects composing the Div.
*
* @param FlowCollection $content A collection of Flow objects.
*/
public function setContent(FlowCollection $content)
{
$this->content = $content;
}

/**
* Get the collection of Flow objects composing the Div.
*
* @return FlowCollection
*/
public function getContent()
{
return $this->content;
}
}
20 changes: 19 additions & 1 deletion src/qtism/data/storage/xml/marshalling/ContentMarshaller.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@
use qtism\data\content\TemplateInline;
use qtism\data\content\xhtml\html5\Figcaption;
use qtism\data\content\xhtml\html5\Figure;
use qtism\data\content\xhtml\html5\Rb;
use qtism\data\content\xhtml\html5\Rp;
use qtism\data\content\xhtml\html5\Rt;
use qtism\data\content\xhtml\html5\Ruby;
use qtism\data\content\xhtml\lists\Dl;
use qtism\data\content\xhtml\lists\DlElement;
use qtism\data\content\xhtml\lists\Li;
Expand Down Expand Up @@ -144,6 +148,10 @@ public function __construct($version)
'i',
'kbd',
'q',
Ruby::QTI_CLASS_NAME,
Rb::QTI_CLASS_NAME,
Rp::QTI_CLASS_NAME,
Rt::QTI_CLASS_NAME,
'samp',
'small',
'span',
Expand Down Expand Up @@ -181,7 +189,7 @@ public function __construct($version)
'feedbackBlock',
'bdo',
Figure::QTI_CLASS_NAME_FIGURE,
Figcaption::QTI_CLASS_NAME_FIGCAPTION
Figcaption::QTI_CLASS_NAME_FIGCAPTION,
];

/**
Expand Down Expand Up @@ -297,6 +305,14 @@ protected function getChildrenComponents(QtiComponent $component)
return $component->getContent()->getArrayCopy();
} elseif ($component instanceof Figcaption) {
return $component->getContent()->getArrayCopy();
} elseif ($component instanceof Ruby) {
return $component->getContent()->getArrayCopy();
} elseif ($component instanceof Rb) {
return $component->getContent()->getArrayCopy();
} elseif ($component instanceof Rp) {
return $component->getContent()->getArrayCopy();
} elseif ($component instanceof Rt) {
return $component->getContent()->getArrayCopy();
}
}

Expand Down Expand Up @@ -352,6 +368,8 @@ protected function getChildrenElements(DOMElement $element)
return $this->getChildElementsByTagName($element, 'simpleAssociableChoice');
} elseif ($localName === Figure::QTI_CLASS_NAME_FIGURE) {
return $this->getChildElementsByTagName($element, [Figcaption::QTI_CLASS_NAME_FIGCAPTION, Img::QTI_CLASS_NAME_IMG]);
} elseif ($localName === Ruby::QTI_CLASS_NAME) {
return $this->getChildElementsByTagName($element, [Rb::QTI_CLASS_NAME, Rp::QTI_CLASS_NAME, Rt::QTI_CLASS_NAME]);
} elseif ($localName === 'gapImg') {
return $this->getChildElementsByTagName($element, 'object');
} else {
Expand Down
Loading

0 comments on commit 1f162a6

Please sign in to comment.