From: vincent@cubedesigners.com Date: Fri, 11 Jun 2010 14:25:12 +0000 (+0000) Subject: (no commit message) X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=149889cd0cf9d4f4188da3dc28ff6935991f314d;p=cubeextranet.git --- diff --git a/inc/extranet/Controlleur/class.extranet.core.php b/inc/extranet/Controlleur/class.extranet.core.php index d7aac95f9..55a0e7bb1 100644 --- a/inc/extranet/Controlleur/class.extranet.core.php +++ b/inc/extranet/Controlleur/class.extranet.core.php @@ -340,6 +340,7 @@ class extranetCore extends cubeCore { $db->books->date_status('integer', 0, false); $db->books->parametres('text', 0, false); $db->books->chapters('text',0,false); + $db->books->links('text',0,false); $db->books->date('integer', 0, false); // Clés $db->books->primary('pk_books', 'book_id'); diff --git a/inc/ws/Controlleur/class.ws.flash.php b/inc/ws/Controlleur/class.ws.flash.php index 0c37aef82..af82a84c3 100644 --- a/inc/ws/Controlleur/class.ws.flash.php +++ b/inc/ws/Controlleur/class.ws.flash.php @@ -165,9 +165,9 @@ class wsFlash extends cubeFlashGateway { $t->addAttribute('nom', $theme->nom); if (isset($book) && $theme->theme_id == $book->theme) { $t->addAttribute('selected', '1'); - $mine=true; - }else{ - $mine=false; + $mine = true; + } else { + $mine = false; } if ($core->user->ws_grade == 4) { $right = 'w'; @@ -179,7 +179,7 @@ class wsFlash extends cubeFlashGateway { $right = '-'; } $t->addAttribute('right', $right); - $t->addAttribute('books', ($theme->nbBooks)-($mine?'1':'0')); + $t->addAttribute('books', ($theme->nbBooks) - ($mine?'1':'0')); } } @@ -299,6 +299,25 @@ class wsFlash extends cubeFlashGateway { $this->xml->addChild('chapters', json_encode($book->chapters)); } + public function getLinks() + { + global $core; + $dao = new wsDAOBook($core->con); + $book = $dao->selectById($this->args['book_id']); + $this->xml->addChild('links', json_encode($book->links)); + $pages = $dao->getPagesOfBook($this->args['book_id']); + $nb_pages = count($pages); + $this->xml->addChild('pages', $nb_pages); + + $daoDoc = new wsDAODocument($core->con); + $firstDoc = $daoDoc->selectById($pages[1]['document_id']); + $size = $firstDoc->generalInfos['size']; + + $this->xml->addChild('width', $size[0]); + $this->xml->addChild('height', $size[1]); + fb($book->links); + } + public function formatSize($val) { $str = files::size($val); diff --git a/inc/ws/DAO/class.ws.dao.book.php b/inc/ws/DAO/class.ws.dao.book.php index 2fbd80a42..4cb9ca96e 100644 --- a/inc/ws/DAO/class.ws.dao.book.php +++ b/inc/ws/DAO/class.ws.dao.book.php @@ -23,6 +23,12 @@ class wsDAOBook extends extranetDAO { $book->chapters = json_decode($r->chapters, false); } + if ($r->links == '') { + $book->links = $this->getLinksFromCSV($r->book_id); + } else { + $book->links = json_decode($r->links, false); + } + $p = unserialize($r->parametres); if (!$p || $p->isEmpty()) { $p = new wsBookParametres($book); @@ -248,6 +254,43 @@ class wsDAOBook extends extranetDAO { $c->chapters = json_encode(json_decode($json, false)); $c->update('WHERE book_id=\'' . $this->con->escape($book_id) . '\''); } + + public function getLinksFromCSV($book_id) + { + $pages = $this->getPagesOfBook($book_id); + $res = array(); + foreach($pages as $page => $p) { + $csv = ROOT . '/docs/' . $p['document_id'] . '/p' . $p['document_page'] . '.csv'; + $fp = fopen($csv, 'rb'); + + while (true) { + $line = fgetcsv($fp, 512, ';', '"'); + // End of file + if (!$line) { + break; + } + // Commentaire || ligne vide + if (substr($line[0], 0, 1) == '#' || is_null($line[0])) { + continue; + } + $link = array(); + $cols = array('page' => '', 'type' => '', 'to' => '','left'=>'', 'top' => '', 'width' => '', 'height' => '', 'target' => '_blank', 'video_loop' => '1', 'video_auto_start' => '1', 'video_controls' => '1', 'video_sound_on' => '1'); + $k = 0; + foreach($cols as $col => $default) { + if (isset($line[$k])) { + $link[$col] = $line[$k]; + } else { + $link[$col] = $default; + } + $k++; + } + $link['page'] = $page; + $res[] = $link; + fb($link); + } + } + return $res; + } } ?> \ No newline at end of file diff --git a/inc/ws/Metier/class.ws.book.php b/inc/ws/Metier/class.ws.book.php index dd3b20046..5ca097864 100644 --- a/inc/ws/Metier/class.ws.book.php +++ b/inc/ws/Metier/class.ws.book.php @@ -26,6 +26,7 @@ class wsBook extends cubeMetier { protected $pages; protected $chapters; + protected $links; } ?> \ No newline at end of file diff --git a/swf/_src/assets/fleches-fb3d.png b/swf/_src/assets/fleches-fb3d.png new file mode 100644 index 000000000..4cb8651f7 Binary files /dev/null and b/swf/_src/assets/fleches-fb3d.png differ diff --git a/swf/_src/wsComposer.fla b/swf/_src/wsComposer.fla index f98be38ea..3c47a9df4 100644 Binary files a/swf/_src/wsComposer.fla and b/swf/_src/wsComposer.fla differ