Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/Parameters/InsertDocumentParameters.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,20 @@
*/
final class InsertDocumentParameters extends MetaParameters
{
/** @var array<string,array{filename: string, downloadable: bool|null, removable: bool|null}> */
/** @var array<string,array{filename: string, downloadable: bool|null, removable: bool|null, current: bool|null}> */
private array $presentations = [];

public function __construct(protected string $meetingID)
{
}

public function addPresentation(string $url, string $filename, ?bool $downloadable = null, ?bool $removable = null): self
public function addPresentation(string $url, string $filename, ?bool $downloadable = null, ?bool $removable = null, ?bool $current = null): self
{
$this->presentations[$url] = [
'filename' => $filename,
'downloadable' => $downloadable,
'removable' => $removable,
'current' => $current,
];

return $this;
Expand Down Expand Up @@ -73,6 +74,10 @@ public function getPresentationsAsXML(): string|false
if (\is_bool($content['removable'])) {
$presentation->addAttribute('removable', $content['removable'] ? 'true' : 'false');
}

if (\is_bool($content['current'])) {
$presentation->addAttribute('current', $content['current'] ? 'true' : 'false');
}
}
$result = $xml->asXML();
}
Expand Down
1 change: 1 addition & 0 deletions tests/fixtures/insert_document_presentations.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
<document url="http://localhost/foobar.png" filename="Foobar.png"/>
<document url="http://localhost/foobar.pdf" filename="Foobar.pdf" downloadable="true"/>
<document url="http://localhost/foobar.svg" filename="Foobar.svg" downloadable="true" removable="false"/>
<document url="http://localhost/foobar.jpg" filename="Foobar.jpg" downloadable="true" removable="true" current="true"/>
</module>
</modules>
1 change: 1 addition & 0 deletions tests/unit/Parameters/InsertDocumentParametersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public function testInsertingDocuments(): void
$params->addPresentation('http://localhost/foobar.png', 'Foobar.png');
$params->addPresentation('http://localhost/foobar.pdf', 'Foobar.pdf', true);
$params->addPresentation('http://localhost/foobar.svg', 'Foobar.svg', true, false);
$params->addPresentation('http://localhost/foobar.jpg', 'Foobar.jpg', true, true, true);
$params->addPresentation('http://localhost/demo.pdf', 'Demo.pdf', true);

// Removing presentation
Expand Down