]> _ Git - cubeextranet.git/commitdiff
wip #5415 @0:15
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Wed, 24 Aug 2022 16:22:37 +0000 (16:22 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Wed, 24 Aug 2022 16:22:37 +0000 (16:22 +0000)
inc/commons/class.common.tools.php
inc/ws/Util/html5/master/class.ws.html5.compiler.php

index 8297bab997e4f3078927fac49c9e165ae5e5d530..2c022640edc4052cba069f8f810e1b4a491b8d36 100644 (file)
@@ -1471,91 +1471,6 @@ class commonTools
         header('Location: https://toolbox.fluidbook.com/quiz/');
     }
 
-    /**
-     * @param $tmp_name
-     * @param $name
-     * @return false|string
-     * @throws Exception
-     */
-    protected static function _updateOneQuiz($tmp_name, $name)
-    {
-        $tidySettings = ['input-xml' => 1, 'indent' => 1, 'wrap' => 0];
-
-        $template = ROOT . '/quiz/template.zip';
-        $temp = ROOT . '/quiz/quiz-' . md5(random_int(0, 10000000)) . '.zip';
-        copy($template, $temp);
-
-        $assets = ['assets/logo.png', 'assets/banner.jpg'];
-
-        $uploaded = new ZipArchive();
-        $uploaded->open($tmp_name);
-
-        $template = new ZipArchive();
-        $template->open($temp);
-
-        $data = simplexml_load_string($uploaded->getFromName('data.xml'), "SimpleXMLElement", LIBXML_NOERROR | LIBXML_ERR_NONE);
-        $quizTitle = (string)$data->xpath('/quiz/title')[0];
-
-        // Replace assets
-        foreach ($assets as $asset) {
-            $template->addFromString($asset, $uploaded->getFromName($asset));
-        }
-        // *** Replace XML ***
-        // First, merge both xml
-        $oMX = new MergeXML();
-        $oMX->AddSource($template->getFromName('data.xml'));
-        $oMX->AddSource($uploaded->getFromName('data.xml'));
-        $template->deleteName('data.xml');
-        // Save data.xml in dest zip
-        $template->addFromString('data.xml', tidy_repair_string($oMX->Get(1), $tidySettings));
-        // *** IMS Manifest ***
-        $imsmanifest = file_get_contents(ROOT . '/quiz/imsmanifest.xml');
-        $imsmanifest = str_replace('$title', $quizTitle, tidy_repair_string($imsmanifest, $tidySettings));
-        $template->addFromString('imsmanifest.xml', $imsmanifest);
-        // *** Save zip ***
-        $template->close();
-
-        $res = file_get_contents($temp);
-        unlink($temp);
-        return $res;
-    }
-
-    /**
-     * @throws Exception
-     */
-    public static function updateQuiz()
-    {
-        $multiple = count($_FILES['file']['name']) > 1;
-        if ($multiple) {
-            $fname = 'updated.zip';
-            $zip = new ZipArchive();
-            $zipName = ROOT . '/quiz/quiz-' . md5(random_int(0, 10000000)) . '.zip';
-            $zip->open($zipName, ZipArchive::CREATE);
-        } else {
-            $fname = $_FILES['file']['name'][0];
-        }
-
-        foreach ($_FILES['file']['name'] as $i => $name) {
-            $tmp_name = $_FILES['file']['tmp_name'][$i];
-            $res = self::_updateOneQuiz($tmp_name, $name);
-            if ($multiple) {
-                $zip->addFromString($name, $res);
-            }
-        }
-
-        header('Content-Type: application/zip');
-        header('Content-Disposition: attachment; filename=' . $fname);
-        ob_end_clean();
-
-        if ($multiple) {
-            $zip->close();
-            echo file_get_contents($zipName);
-            unlink($zipName);
-        } else {
-            echo $res;
-        }
-        exit;
-    }
 
     public static function formVerificationCode($args)
     {
index 76ce91d970ee5fe4afe201623fa8c948c39c5d65..1b8b24de36946e97ca9439875591291708bea132 100644 (file)
@@ -436,8 +436,6 @@ class wsHTML5Compiler
             $this->config->manifest = $this->writeManifest();
         }
 
-        $this->writeGPUDatabase();
-
         if ($this->config->form == 'bulle') {
             $this->addJsLib('bulle', 'js/libs/fluidbook/forms/fluidbook.form.bulle.js');
         } else if ($this->config->form == 'bourbon') {
@@ -962,19 +960,6 @@ class wsHTML5Compiler
         }
     }
 
-    public function writeGPUDatabase()
-    {
-        global $core;
-        $r = $core->con->select('SELECT gpu,rgpu,score FROM gpu');
-        $gpu = [];
-        while ($r->fetch()) {
-            $gpu[$r->gpu] = $r->score;
-            $gpu[$r->rgpu] = $r->score;
-        }
-        $this->config->gupsc = $gpu;
-        $this->config->gupse = wsServices::gpuSeparators();
-    }
-
     public function log($step)
     {
         $currenttime = microtime(true);