1
0

Added book [MoL]

This commit is contained in:
Mike Schwörer 2019-12-29 17:49:10 +01:00
parent 15f6d121de
commit ce290fcae8
10 changed files with 68 additions and 7 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 876 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 222 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 217 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 201 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 152 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 217 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 165 KiB

View File

@ -26,6 +26,8 @@ class Books
$a['extraimages_paths'] []= __DIR__ . '/../data/images/book_img/' . $a['id'] . '_img' . $i . '.jpg'; $a['extraimages_paths'] []= __DIR__ . '/../data/images/book_img/' . $a['id'] . '_img' . $i . '.jpg';
} }
$a['book_count'] = is_array($a['pdf']) ? count($a['pdf']) : 1;
return $a; return $a;
} }
@ -61,6 +63,16 @@ class Books
{ {
if (!file_exists($eipath)) return ['result'=>'err', 'message' => 'Extra-Image not found ' . $prog['title_short']]; if (!file_exists($eipath)) return ['result'=>'err', 'message' => 'Extra-Image not found ' . $prog['title_short']];
} }
if ($prog['book_count'] <= 0) return ['result'=>'err', 'message' => 'BookCount must be greater than zero ' . $prog['title_short']];
if ($prog['book_count'] > 1 && !is_array($prog['pdf'])) return ['result'=>'err', 'message' => 'Attribute [pdf] must be an array ' . $prog['title_short']];
if ($prog['book_count'] > 1 && count($prog['pdf']) !== $prog['book_count']) return ['result'=>'err', 'message' => 'Attribute [pdf] must be the correct size ' . $prog['title_short']];
if ($prog['book_count'] === 1 && !is_string($prog['pdf'])) return ['result'=>'err', 'message' => 'Attribute [pdf] must be an string ' . $prog['title_short']];
if ($prog['book_count'] > 1 && !is_array($prog['pages'])) return ['result'=>'err', 'message' => 'Attribute [pages] must be an array ' . $prog['title_short']];
if ($prog['book_count'] > 1 && count($prog['pages']) !== $prog['book_count']) return ['result'=>'err', 'message' => 'Attribute [pages] must be the correct size ' . $prog['title_short']];
if ($prog['book_count'] === 1 && !is_string($prog['pages'])) return ['result'=>'err', 'message' => 'Attribute [pages] must be an string ' . $prog['title_short']];
} }
if ($warn != null) return $warn; if ($warn != null) return $warn;

View File

@ -39,7 +39,21 @@ if ($book === NULL) httpError(404, 'Book not found');
<div class="bookv_right_value" style="grid-row:1"><?php echo htmlspecialchars($book['title_short']) ?></div> <div class="bookv_right_value" style="grid-row:1"><?php echo htmlspecialchars($book['title_short']) ?></div>
<div class="bookv_right_key" style="grid-row:2">Pages:</div> <div class="bookv_right_key" style="grid-row:2">Pages:</div>
<div class="bookv_right_value" style="grid-row:2"><?php echo $book['pages'] ?></div> <div class="bookv_right_value" style="grid-row:2"><?php
if (is_string($book['pages']))
{
echo $book['pages'];
}
else
{
$pagi = 1;
foreach ($book['pages'] as $page)
{
echo 'Buch ' . $pagi . ': ' . $page . '<br/>';
$pagi++;
}
}
?></div>
<div class="bookv_right_key" style="grid-row:3">Author:</div> <div class="bookv_right_key" style="grid-row:3">Author:</div>
<div class="bookv_right_value" style="grid-row:3"><?php echo htmlspecialchars($book['author']) ?></div> <div class="bookv_right_value" style="grid-row:3"><?php echo htmlspecialchars($book['author']) ?></div>
@ -64,12 +78,23 @@ if ($book === NULL) httpError(404, 'Book not found');
</svg> </svg>
<span>Homepage</span> <span>Homepage</span>
</a> </a>
<a class="iconbutton" href="<?php echo $book['pdf'] ?>"> <?php if (is_string($book['pdf'])): ?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24"> <a class="iconbutton" href="<?php echo $book['pdf'] ?>">
<use xlink:href="/data/images/icons.svg#pdf"/> <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24">
</svg> <use xlink:href="/data/images/icons.svg#pdf"/>
<span>PDF</span> </svg>
</a> <span>PDF</span>
</a>
<?php else: ?>
<?php $pdfi = 1; foreach ($book['pdf'] as $pdf): ?>
<a class="iconbutton" href="<?php echo $pdf ?>">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24">
<use xlink:href="/data/images/icons.svg#pdf"/>
</svg>
<span>PDF (Buch <?php echo $pdfi; $pdfi++; ?>)</span>
</a>
<?php endforeach; ?>
<?php endif; ?>
</div> </div>
</div> </div>

View File

@ -71,4 +71,28 @@ return
'size' => [12.5, 19.0], 'size' => [12.5, 19.0],
'imagecount' => 4, 'imagecount' => 4,
], ],
[
'id' => 'mol',
'title' => 'Mother of Learning',
'title_short' => 'Mother of Learning',
'date' => '2019-11-24',
'repository' => 'https://github.com/Mikescher/Mother-of-Learning-Lyx',
'pages' => ['298', '328', '330', '362', '372', '346', '396', /*'???'*/],
'pdf' =>
[
'https://github.com/Mikescher/Mother-of-Learning-Lyx/blob/master/build/Book_1_1.pdf',
'https://github.com/Mikescher/Mother-of-Learning-Lyx/blob/master/build/Book_1_2.pdf',
'https://github.com/Mikescher/Mother-of-Learning-Lyx/blob/master/build/Book_2_1.pdf',
'https://github.com/Mikescher/Mother-of-Learning-Lyx/blob/master/build/Book_2_2.pdf',
'https://github.com/Mikescher/Mother-of-Learning-Lyx/blob/master/build/Book_3_1.pdf',
'https://github.com/Mikescher/Mother-of-Learning-Lyx/blob/master/build/Book_3_2.pdf',
'https://github.com/Mikescher/Mother-of-Learning-Lyx/blob/master/build/Book_3_3.pdf',
//'https://github.com/Mikescher/Mother-of-Learning-Lyx/blob/master/build/Book_3_4.pdf',
],
'online' => 'https://www.fictionpress.com/s/2961893',
'author' => 'Domagoj Kurmaic',
'size' => [12.5, 19.0],
'imagecount' => 5,
],
]; ];