]> _ Git - cubeextranet.git/commitdiff
fix #3271 @0.75
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Fri, 13 Dec 2019 18:52:02 +0000 (18:52 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Fri, 13 Dec 2019 18:52:02 +0000 (18:52 +0000)
inc/ws/Controlleur/class.ws.url.php

index a5785f8a6c39636eb974682750a086284a521ac3..774b38939af5028d3f08205c8784572ec05a24a3 100644 (file)
@@ -2221,14 +2221,25 @@ html.tall{height:150%}' . "\n";
         $xls = new PHPExcel();
         $sheet = $xls->getActiveSheet();
         $sheet->freezePane('B2');
-        $standardSettings = ['book_id' => 'book_id', 'lang' => 'lang', 'theme' => 'theme', 'status' => 'status', 'proprietaire_id' => 'owner', 'date' => 'date', 'changedate' => 'changedate', 'exportdatas' => 'exportdata'];
+        $standardSettings = ['book_id' => 'book_id', 'lang' => 'lang', 'theme' => 'theme', 'status' => 'status', 'proprietaire_id' => 'owner', 'date' => 'date', 'changedate' => 'changedate', 'hosting' => 'hosting', 'exportdatas' => 'exportdata'];
         $j = 0;
         foreach ($standardSettings as $column => $label) {
+            $readonly = false;
             if ($label === 'exportdata') {
-
+                $readonly = true;
             } else {
                 $sheet->getColumnDimensionByColumn($j)->setAutoSize(true);
             }
+            if ($label === 'hosting') {
+                $readonly = true;
+            }
+
+            if (strpos($column, 'date') !== false) {
+                $readonly = true;
+            }
+            if ($readonly) {
+                self::_readonlyStyle($sheet->getStyle(PHPExcel_Cell::stringFromColumnIndex($j)));
+            }
             $sheet->setCellValueByColumnAndRow($j, 1, $label);
             $j++;
         }
@@ -2236,13 +2247,18 @@ html.tall{height:150%}' . "\n";
         foreach ($p->getForms() as $form) {
             $form = $p->getForm($form, true);
             foreach ($form['fields'] as $k => $field) {
+                $readonly = false;
                 if (!$field['editable']) {
-                    continue;
+                    $readonly = true;
                 }
 
+                if ($readonly) {
+                    self::_readonlyStyle($sheet->getStyle(PHPExcel_Cell::stringFromColumnIndex($j)));
+                }
                 $sheet->getCommentByColumnAndRow($j, 1)->getText()->createTextRun($field['label']);
                 $sheet->getColumnDimensionByColumn($j)->setAutoSize(true);
                 $sheet->setCellValueByColumnAndRow($j, 1, $k);
+
                 $paramCols[] = $k;
                 $j++;
             }
@@ -2252,11 +2268,26 @@ html.tall{height:150%}' . "\n";
         foreach ($books as $id => $book) {
             $j = 0;
             foreach ($standardSettings as $column => $label) {
-                $val = $book->$column;
+                $url = false;
+                if ($column === 'hosting') {
+                    $export = json_decode($book->exportdatas, true);
+                    if (isset($export['install_hosting']['online']['dir']) && $export['install_hosting']['online']['dir']) {
+                        $val = 'https://hosting.fluidbook.com/' . $export['install_hosting']['online']['dir'];
+                        $url = $val;
+                    } else {
+                        $val = '-';
+                    }
+                } else {
+                    $val = $book->$column;
+                }
                 if (strpos($column, 'date') !== false) {
                     $val = date('Y-m-d', $val);
                 }
                 $sheet->setCellValueByColumnAndRow($j, $i, $val);
+                if ($url) {
+                    $sheet->getCellByColumnAndRow($j, $i)->getHyperlink()->setUrl($url);
+                }
+
                 $j++;
             }
             foreach ($paramCols as $col) {
@@ -2272,4 +2303,13 @@ html.tall{height:150%}' . "\n";
         $writer->save('php://output');
         exit;
     }
+
+    /**
+     * @param $style PHPExcel_Style
+     */
+    protected static function _readonlyStyle($style)
+    {
+        $style->getFill()->setFillType(PHPExcel_Style_Fill::FILL_SOLID)->getStartColor()->setRGB('dddddd');
+        $style->getFont()->getColor()->setRGB('666666');
+    }
 }