$pages = $daoBook->getPagesOfBook($book_id);
$booleans = array('video_loop', 'video_auto_start', 'video_controls', 'video_sound_on');
+ $numbers = ['left', 'top', 'width', 'height'];
$links = [];
foreach ($pages as $page => $info) {
- $links[$page] = [];
-
$csv = wsDocument::getDir($info['document_id']) . '/p' . $info['document_page'] . '.csv';
if (!file_exists($csv) && file_exists($csv . '.gz')) {
$csv = 'compress.zlib://' . $csv . '.gz';
if (substr($line[0], 0, 1) == '#' || is_null($line[0])) {
continue;
}
- $link = array();
+ $link = [];
if ($newformat) {
$cols = array('page' => '', 'left' => '', 'top' => '', 'width' => '', 'height' => '', 'type' => '', 'to' => '', 'target' => '_blank', 'video_loop' => true, 'video_auto_start' => true, 'video_controls' => true, 'video_sound_on' => true, 'infobulle' => '', 'numerotation' => 'physical');
} else {
$cols = array('page' => '', 'type' => '', 'to' => '', 'left' => '', 'top' => '', 'width' => '', 'height' => '', 'target' => '_blank', 'video_loop' => true, 'video_auto_start' => true, 'video_controls' => true, 'video_sound_on' => true, 'infobulle' => '', 'numerotation' => 'physical');
}
+
+
$k = 0;
foreach ($cols as $col => $default) {
if (isset($line[$k])) {
- if (in_array($k, $booleans)) {
+ if (in_array($k, $numbers)) {
+ $link[$col] = (float)str_replace(',', '.', $line[$k]);
+ } else if (in_array($k, $booleans)) {
$link[$col] = ($line[$k] == '1');
} else {
$link[$col] = utf8_encode($line[$k]);
$k++;
}
$link['page'] = $page;
- $links[$page][] = $link;
+ $links[] = $link;
}
}