]> _ Git - cubeextranet.git/commitdiff
(no commit message)
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Wed, 11 Apr 2012 12:01:30 +0000 (12:01 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Wed, 11 Apr 2012 12:01:30 +0000 (12:01 +0000)
inc/ws/Controlleur/class.ws.flash.php
inc/ws/Controlleur/class.ws.url.php
inc/ws/DAO/class.ws.dao.book.php

index f67005b5eba8b844b4f3cae40438c56f6c65c398..6e5b5f5fbd6a97f89507f8a2f70a7527eedb0c85 100644 (file)
@@ -268,47 +268,41 @@ class wsFlash extends cubeFlashGateway {
 \r
        public function getPagesOfBook() {\r
                global $core;\r
+\r
+               $this->json = true;\r
+\r
                $dao = new wsDAOBook($core->con);\r
                $book = $dao->selectById($this->args['book_id']);\r
-               $pages = $dao->getPagesOfBook($this->args['book_id']);\r
-               $p = $this->xml->addChild('pages');\r
+               $pages = $dao->getPagesOfBook($this->args['book_id'], false);\r
+               $this->jsonDatas['pages'] = array();\r
                $docs = array();\r
                $defaultNum = array();\r
                foreach ($pages as $page => $info) {\r
                        $file = WS_DOCS . '/' . $info['document_id'] . '/p' . $info['document_page'] . '.jpg';\r
                        if (!file_exists($file)) {\r
-                               $dim = array(0, 0);\r
                                $info['resolution'] = 150;\r
                                $info['method'] = 1;\r
                                $info['objects'] = 1800;\r
                                $info['quality'] = 85;\r
                                $info['version'] = 'stable';\r
-                       } else {\r
+                       } elseif (!isset($this->jsonDatas['thumbWidth'])) {\r
                                $dim = getimagesize($file);\r
+                               $this->jsonDatas['thumbWidth'] = $dim[0];\r
+                               $this->jsonDatas['thumbHeight'] = $dim[1];\r
                        }\r
 \r
-\r
-\r
-                       $pa = $p->addChild('page');\r
-                       $pa->addAttribute('page', $page);\r
-                       $pa->addAttribute('document_id', $info['document_id']);\r
-                       $pa->addAttribute('document_page', $info['document_page']);\r
-                       $pa->addAttribute('width', $dim[0]);\r
-                       $pa->addAttribute('height', $dim[1]);\r
-                       $pa->addAttribute('resolution', $info['resolution']);\r
-                       $pa->addAttribute('quality', $info['quality']);\r
-                       $pa->addAttribute('methode', $info['method']);\r
-                       $pa->addAttribute('objects', $info['objects']);\r
-                       $pa->addAttribute('version', $info['version']);\r
                        $docs[] = $info['document_id'];\r
                        $defaultNum[] = $info['defaultNum'];\r
+\r
+                       $this->jsonDatas['pages'][] = array($info['document_id'], $info['document_page']);\r
                }\r
                $docs = array_unique($docs);\r
-               $p->addAttribute('documents', implode(',', $docs));\r
+               $this->jsonDatas['documents'] = array_unique($docs);\r
+\r
                if (is_null($book->numerotation) || !$book->numerotation || $book->numerotation == 'null') {\r
-                       $this->xml->addChild('numerotation', implode(',', $defaultNum));\r
+                       $this->jsonDatas['numerotation'] = $defaultNum;\r
                } else {\r
-                       $this->xml->addChild('numerotation', $book->numerotation);\r
+                       $this->jsonDatas['numerotation'] = explode(',', $book->numerotation);\r
                }\r
        }\r
 \r
@@ -481,16 +475,11 @@ class wsFlash extends cubeFlashGateway {
                $pages = $dao->getPagesOfBook($this->args['book_id']);\r
                $nb_pages = count($pages);\r
 \r
-\r
-\r
-\r
-\r
                $daoDoc = new wsDAODocument($core->con);\r
                $firstDoc = $daoDoc->selectById($pages[1]['document_id']);\r
                $size = $firstDoc->generalInfos['size'];\r
                $daoDoc->getLinksAndRulers($this->args['book_id'], $links, $rulers);\r
 \r
-\r
                $this->json = false;\r
                $this->json = true;\r
 \r
@@ -600,7 +589,7 @@ class wsFlash extends cubeFlashGateway {
                global $core;\r
                $dao = new wsDAOBook($core->con);\r
                $book = $dao->selectById($this->args['book_id']);\r
-               $pages = $dao->getPagesOfBook($this->args['book_id']);\r
+               $pages = $dao->getPagesOfBook($this->args['book_id'], false);\r
                $daoDoc = new wsDAODocument($core->con);\r
                $nb_pages = count($pages);\r
                $this->xml->addChild('pages', $nb_pages);\r
@@ -628,11 +617,6 @@ class wsFlash extends cubeFlashGateway {
                $res .= __('Taille moyenne des pages') . ' : ' . "\n";\r
                $res .= $average . "\n";\r
                $res .= "\n";\r
-               /* $res .= __('Taille du PDF') . ' : ' . "\n";\r
-                 $res .= '7898 Ko' . "\n";\r
-                 $res .= "\n";\r
-                 $res .= __('Qualité de conversion') . ' : ' . "\n";\r
-                 $res .= '150dpi (qualité 85%)' . "\n"; */\r
                $this->xml->addChild('infos', $res);\r
        }\r
 \r
index e1f0552c504900451f1378c4fe8c90ba8f61ad85..697efe73e9fed64c24a0ad4a77ac5ef3c6854e18 100644 (file)
@@ -244,8 +244,10 @@ class wsUrl {
                $res = '<div class="contextMenu viewbookContextMenu" id="' . $id . '">';\r
                $res .= '<ul>';\r
                $res .= '<li class="head">' . __("Sélectionnez la version") . '</li>';\r
-               foreach ($viewers as $v => $infos) {\r
-                       $res .= '<li><a class="popupFSBar" rel="toolbar=yes" rev="' . $v . '_$1" href="' . SITE_PATH . $v . '/$1_$2/">' . $infos['icon'] . $infos['title'] . '</a></li>';\r
+               if (isset($viewers)) {\r
+                       foreach ($viewers as $v => $infos) {\r
+                               $res .= '<li><a class="popupFSBar" rel="toolbar=yes" rev="' . $v . '_$1" href="' . SITE_PATH . $v . '/$1_$2/">' . $infos['icon'] . $infos['title'] . '</a></li>';\r
+                       }\r
                }\r
                $res .= '</ul></div>';\r
                return $res;\r
@@ -391,7 +393,7 @@ class wsUrl {
 \r
                $s->setTitle(cubeText::str2URL($lang_name));\r
 \r
-               $tab = cubeLang::getTranslationsList(array(PLAYER_SOURCES, WS_COMPILE_ASSETS . '/_html5/js'), array('php', 'as','js'), array(), $lang->traductions);\r
+               $tab = cubeLang::getTranslationsList(array(PLAYER_SOURCES, WS_COMPILE_ASSETS . '/_html5/js'), array('php', 'as', 'js'), array(), $lang->traductions);\r
 \r
                $s->setCellValueByColumnAndRow(0, 1, 'ID', true);\r
                $s->setCellValueByColumnAndRow(1, 1, $ref_name, true);\r
@@ -1058,17 +1060,9 @@ html{height:100%}' . "\n";
                global $core;\r
                cubePHP::neverStop();\r
                $daoBook = new wsDAOBook($core->con);\r
-               $book = $daoBook->selectById($book_id);\r
 \r
-               $pages = $daoBook->getPagesOfBook($book_id);\r
-               $toUpdate = array();\r
-               foreach ($pages as $p => $infos) {\r
-                       if ($infos['version'] < 2) {\r
-                               $toUpdate[] = $infos['document_id'];\r
-                       }\r
-               }\r
 \r
-               $toUpdate = array_unique($toUpdate);\r
+               $toUpdate = $daoBook->getDocumentsToUpdate($book_id);\r
                foreach ($toUpdate as $document_id) {\r
                        self::updateDocument($document_id);\r
                }\r
index 3ba65d778890aecb40eb34e86cd538e451aaeff2..2bfb062fbdc630eddd8729c3379fa6f9fe9dbe5e 100644 (file)
@@ -246,15 +246,24 @@ class wsDAOBook extends commonDAO {
                return unserialize($pages);\r
        }\r
 \r
-       public function getPagesOfBook($book_id) {\r
+       public function getDocumentsToUpdate($book_id) {\r
+               $res = array();\r
+               $r = $this->con->select('SELECT DISTINCT d.document_id FROM book_pages b,documents d WHERE b.book_id=\'' . $this->con->escape($book_id) . '\' AND d.version=1 AND b.document_id=d.document_id');\r
+               while ($r->fetch()) {\r
+                       $res[] = $r->document_id;\r
+               }\r
+               return $res;\r
+       }\r
+\r
+       public function getPagesOfBook($book_id, $conversion = true) {\r
                $pages = array();\r
-               $r = $this->con->select('SELECT b.*,d.numberSections AS num,d.conversionInfos AS conversion,d.pages AS doc_pages,d.version AS version FROM book_pages b JOIN documents d ON d.document_id=b.document_id WHERE b.book_id=\'' . $this->con->escape($book_id) . '\' ORDER BY book_page');\r
+\r
+               $sql = 'SELECT b.*,d.numberSections AS num,d.conversionInfos AS conversion,d.pages AS doc_pages,d.version AS version FROM book_pages b JOIN documents d ON d.document_id=b.document_id WHERE b.book_id=\'' . $this->con->escape($book_id) . '\' ORDER BY book_page';\r
+\r
+               $r = $this->con->select($sql);\r
                while ($r->fetch()) {\r
                        $n = explode(',', $r->num);\r
-                       if ($r->conversion != '') {\r
-                               $c = unserialize($r->conversion);\r
-                               $c = $c->pages[$r->document_page];\r
-                       }\r
+\r
                        if (isset($n[$r->document_page - 1])) {\r
                                $num = $n[$r->document_page - 1];\r
                        } else {\r
@@ -267,10 +276,16 @@ class wsDAOBook extends commonDAO {
                                'nb_pages' => $r->doc_pages\r
                        );\r
 \r
-                       $qp = array('resolution', 'method', 'quality', 'objects');\r
-                       foreach ($qp as $p) {\r
-                               if (isset($c) && isset($c->$p)) {\r
-                                       $pages[$r->book_page][$p] = $c->$p;\r
+                       if ($conversion) {\r
+                               if ($r->conversion != '') {\r
+                                       $c = unserialize($r->conversion);\r
+                                       $c = $c->pages[$r->document_page];\r
+                               }\r
+                               $qp = array('resolution', 'method', 'quality', 'objects');\r
+                               foreach ($qp as $p) {\r
+                                       if (isset($c) && isset($c->$p)) {\r
+                                               $pages[$r->book_page][$p] = $c->$p;\r
+                                       }\r
                                }\r
                        }\r
                }\r