]> _ Git - cubeextranet.git/commitdiff
wip #3655 @1
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 26 May 2020 16:17:24 +0000 (16:17 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 26 May 2020 16:17:24 +0000 (16:17 +0000)
inc/ws/Util/class.ws.links.php

index c3c84afade0c56cd7ccf1e306cfd1f7fbe00c796..a22f1ad60f830e0c72588dcdc975414481b397f9 100644 (file)
@@ -544,12 +544,11 @@ class wsLinks
         $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';
@@ -571,16 +570,20 @@ class wsLinks
                 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]);
@@ -591,7 +594,7 @@ class wsLinks
                     $k++;
                 }
                 $link['page'] = $page;
-                $links[$page][] = $link;
+                $links[] = $link;
             }
 
         }