]> _ Git - cubeextranet.git/commitdiff
(no commit message)
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Wed, 11 Apr 2012 17:16:42 +0000 (17:16 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Wed, 11 Apr 2012 17:16:42 +0000 (17:16 +0000)
inc/ws/Controlleur/class.ws.maintenance.php
inc/ws/Controlleur/class.ws.services.php
inc/ws/Controlleur/class.ws.url.php
inc/ws/DAO/class.ws.dao.document.php
inc/ws/Util/class.ws.links.php

index 9ecbe623b79c608011045c7566484eb8b9497217..01f5edbfaec73840619de7d5f5467e24deb96e11 100644 (file)
@@ -236,6 +236,21 @@ class wsMaintenance {
                }\r
        }\r
 \r
+       public static function copyLinks($args) {\r
+               list($from, $to) = $args;\r
+               global $core;\r
+\r
+               $dao = new wsDAODocument($core->con);\r
+\r
+               $dao->getLinksAndRulers($from, $fromlinks, $fromrulers);\r
+               $dao->getLinksAndRulers($to, $tolinks, $torulers);\r
+\r
+               $tolinks = array_merge($tolinks, $fromlinks);\r
+               $torulers = array_merge($torulers, $fromrulers);\r
+\r
+               $dao->setLinksAndRulers($to, $tolinks, $torulers, 'Copy links from #' . $from . '  to #' . $to,$core->user->utilisateur_id);\r
+       }\r
+\r
        public static function importBooks($oldBooks) {\r
                global $core, $allTrads, $signatures;\r
                // Importe les fluidbooks\r
@@ -502,9 +517,9 @@ class wsMaintenance {
                                }\r
                                `rm -rf $f`;\r
                        }\r
-                       \r
-                       if(!file_exists($dir)){\r
-                               mkdir($dir,0777,true);\r
+\r
+                       if (!file_exists($dir)) {\r
+                               mkdir($dir, 0777, true);\r
                        }\r
                }\r
        }\r
index 2342df2ce94df66456707aa585ab03c80eb0b434..581a188c65c9100fcea7276efb6a157566cc9f5a 100644 (file)
@@ -1,6 +1,7 @@
 <?php\r
 \r
 class wsServices extends cubeFlashGateway {\r
+\r
        const CNAME = __CLASS__;\r
 \r
        public static function in($args) {\r
@@ -279,14 +280,17 @@ class wsServices extends cubeFlashGateway {
                $pdftk->setPath(CONVERTER_PATH);\r
                $pdftk->setManualArg($args);\r
                $pdftk->execute();\r
-               // Debug\r
-               fb($pdftk->command);\r
-               fb($pdftk->output);\r
                // Return the url of the resulting pdf\r
                http::redirect($destURL);\r
                exit;\r
        }\r
 \r
+       public function proxy() {\r
+               ob_end_clean();\r
+               fb(netHttp::quickGet($_GET['u'], 'php://output'));\r
+               $this->outputXML=false;\r
+       }\r
+\r
 }\r
 \r
 ?>
\ No newline at end of file
index 697efe73e9fed64c24a0ad4a77ac5ef3c6854e18..63de0c21ec15149b925f98313812fa6ef540cdeb 100644 (file)
@@ -556,6 +556,8 @@ html{height:100%}' . "\n";
        public static function exportLinksAsExcel($args) {\r
                global $core;\r
 \r
+               cubePHP::neverStop();\r
+               \r
                $book_id = $args[1];\r
                $time = $args[2];\r
 \r
index c1a6e5a3b7f558ef3f295c18594251408e7f7be4..fc147da9bbc3f31a3250cb6fc02ed6028fc8daa3 100644 (file)
@@ -33,7 +33,7 @@ class wsDAODocument extends commonDAO {
                }\r
        }\r
 \r
-       public function restoreLinksVersion($book_id, $update, $user=0) {\r
+       public function restoreLinksVersion($book_id, $update, $user = 0) {\r
 \r
                $daoBook = new wsDAOBook($this->con);\r
                $pages = $daoBook->getPagesOfBookAt($book_id, $update);\r
@@ -109,10 +109,16 @@ class wsDAODocument extends commonDAO {
                return implode("\n", $log);\r
        }\r
 \r
-       public function setLinksAndRulers($book_id, $links, $rulers, $comments='', $user=0) {\r
+       public function setLinksAndRulers($book_id, $links, $rulers, $comments = '', $user = 0) {\r
                $daoBook = new wsDAOBook($this->con);\r
-               $pages = $daoBook->getPagesOfBook($book_id);\r
-\r
+               $pages = $daoBook->getPagesOfBook($book_id,false);\r
+               \r
+               if (is_array($links)) {\r
+                       $links = json_encode($links);\r
+               }\r
+               if (is_array($rulers)) {\r
+                       $rulers = json_encode($rulers);\r
+               }\r
                $links = json_decode($links, false);\r
                $rulers = json_decode($rulers, false);\r
 \r
@@ -256,7 +262,7 @@ class wsDAODocument extends commonDAO {
 \r
                krsort($links);\r
 \r
-               foreach($links as $document_id=>$l){\r
+               foreach ($links as $document_id => $l) {\r
                        wsLinks::setDocumentLinks($document_id, json_encode($l), json_encode(array()), 0, 'Import from Fluidbook V1', TIME);\r
                }\r
 \r
@@ -265,7 +271,7 @@ class wsDAODocument extends commonDAO {
                $c->update('WHERE book_id=\'' . $this->con->escape($book_id) . '\'');\r
        }\r
 \r
-       public function getLinksAndRulers($book_id, &$links, &$rulers, $time=null) {\r
+       public function getLinksAndRulers($book_id, &$links, &$rulers, $time = null) {\r
                return wsLinks::getLinksAndRulers($book_id, $links, $rulers, $time);\r
        }\r
 \r
index 96f24c946096aaac581461abfa2235fa2f69fc82..33138201bc2ccc37b8ccf0ed325442a9ad02c244 100644 (file)
@@ -13,7 +13,7 @@
 class wsLinks {
 
        public static function linksToExcel($links, $rulers, $pages = null) {
-               $cols = array('document_id' => __('Document'), 'document_page' => __('Page du document'),
+               $cols = array(
                        'page' => __('Page de la publication'), 'left' => __('x'), 'top' => __('y'), 'width' => __('Largeur'), 'height' => __('Hauteur'),
                        'type' => __('Type'), 'to' => __('Destination'), 'target' => __('Cible'),
                        'infobulle' => __('Infobulle'), 'numerotation' => __('Numérotation'),
@@ -23,9 +23,19 @@ class wsLinks {
                        'interactive' => __('Interactivité'), 'video_service' => __('Webvideo : service'),
                        'display_area' => __('Afficher le lien au rollover'),
                        'extra' => __('Paramètre supplémentaire'),
-                       'alternative'=>__('Alternative')
+                       'alternative' => __('Alternative')
                );
 
+               new PHPExcel();
+               
+               $cacheMethod = PHPExcel_CachedObjectStorageFactory::cache_to_memcache;
+               $cacheSettings = array('memcacheServer' => 'localhost',
+                       'memcachePort' => 11211,
+                       'cacheTime' => 600
+               );
+               PHPExcel_Settings::setCacheStorageMethod($cacheMethod, $cacheSettings);
+
+
                $xls = new PHPExcel();
                $s = $xls->setActiveSheetIndex(0);
                $s->setTitle('Links');
@@ -73,7 +83,7 @@ class wsLinks {
                $s = $xls->createSheet();
                $s->setTitle('Rulers');
 
-               $rcols = array('document_id', 'document_page', 'page', 'type', 'pos');
+               $rcols = array( 'page', 'type', 'pos');
                $i = 0;
                // Labels
                foreach ($rcols as $id) {
@@ -143,7 +153,7 @@ class wsLinks {
 
        public static function getDocumentVersionLinks($document_id, $time) {
                global $core;
-               $r = $core->con->select('SELECT * FROM document_links_versions WHERE document_id=' . $document_id.' AND `update`<='.$time .' ORDER BY `update` DESC LIMIT 1');
+               $r = $core->con->select('SELECT * FROM document_links_versions WHERE document_id=' . $document_id . ' AND `update`<=' . $time . ' ORDER BY `update` DESC LIMIT 1');
                return self::_recordToLinks($r);
        }
 
@@ -178,7 +188,7 @@ class wsLinks {
                $rulers = array();
 
                fb($time);
-               
+
                foreach ($documents as $d) {
                        if (is_null($time)) {
                                $lr = self::getDocumentLastLinks($d);