From: vincent@cubedesigners.com Date: Tue, 20 Apr 2010 13:25:48 +0000 (+0000) Subject: (no commit message) X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=f07c032e5d8fafe7a99e510b952fbb29cd86ce4d;p=cubeextranet.git --- diff --git a/inc/ws/Controlleur/class.ws.flash.php b/inc/ws/Controlleur/class.ws.flash.php index bff99cc33..2e8216eb1 100644 --- a/inc/ws/Controlleur/class.ws.flash.php +++ b/inc/ws/Controlleur/class.ws.flash.php @@ -140,15 +140,30 @@ class wsFlash extends cubeFlashGateway { public function getAllThemes() { global $core; + + $dao = new wsDAOBook($core->con); + $book = $dao->selectById($this->args['book_id']); + $dao = new wsDAOTheme($core->con); - $themes = $dao->getAllThemes(); + $themes = $dao->getAllThemes('ORDER BY theme_id DESC'); foreach($themes as $theme) { $t = $this->xml->addChild('theme'); $t->addAttribute('id', $theme->theme_id); $t->addAttribute('nom', $theme->nom); + if ($theme->theme_id == $book->theme) { + $t->addAttribute('selected', '1'); + } } } + public function setTheme() + { + global $core; + $dao = new wsDAOBook($core->con); + $data = array('book_id' => $this->args['book_id'], 'theme' => $this->args['theme']); + $dao->sauve($core->user->utilisateur_id, $data); + } + public function postThemeShot() { file_put_contents(ROOT . '/themes/' . $this->args['theme_id'] . '.jpg', base64_decode($this->args['data'])); diff --git a/inc/ws/Controlleur/class.ws.url.php b/inc/ws/Controlleur/class.ws.url.php index 68c83c607..0eb872f86 100644 --- a/inc/ws/Controlleur/class.ws.url.php +++ b/inc/ws/Controlleur/class.ws.url.php @@ -58,8 +58,8 @@ class wsUrl { $res .= '' . $f . ''; $res .= '' . $core->books_status[$book->status] . ''; $res .= '' . cubeMedia::cssRollover($core->typo->Voir('voir', '', false)) . ''; - $res .= '' . cubeMedia::cssRollover($core->typo->Editer('éditer', '', false)) . ''; - $res .= '' . cubeMedia::cssRollover($core->typo->Stats('stats', '', false)) . ''; + $res .= '' . cubeMedia::cssRollover($core->typo->Editer('éditer', '', false)) . ''; + $res .= '' . cubeMedia::cssRollover($core->typo->Stats('stats', '', false)) . ''; $res .= '' . cubeMedia::cssRollover($core->typo->Telecharger('télécharger', '', false)) . ''; $res .= '' . cubeMedia::cssRollover($core->typo->Supprimer('suppr.', '', false)) . ''; $res .= ''; diff --git a/inc/ws/DAO/class.ws.dao.book.php b/inc/ws/DAO/class.ws.dao.book.php index 5e4eb1749..f11febee8 100644 --- a/inc/ws/DAO/class.ws.dao.book.php +++ b/inc/ws/DAO/class.ws.dao.book.php @@ -21,7 +21,7 @@ class wsDAOBook extends extranetDAO { $p = unserialize($r->parametres); if (!$p) { $p = new wsBookParametres($book); - }else{ + } else { $p->setParent($book); } $book->parametres = $p; @@ -65,13 +65,28 @@ class wsDAOBook extends extranetDAO { return $this->singleton($r); } + /** + * wsDAOBook::sauve() + * + * @param mixed $createur + * @param mixed $data + * @return + */ public function sauve($createur, $data) { $c = $this->con->openCursor('books'); - $c->nom = $data['nom']; - $c->lang = $data['lang']; - $c->theme = $data['theme']; - $c->proprietaire = $data['proprietaire']; + if (isset($data['nom'])) { + $c->nom = $data['nom']; + } + if (isset($data['lang'])) { + $c->lang = $data['lang']; + } + if (isset($data['theme'])) { + $c->theme = $data['theme']; + } + if (isset($data['proprietaire'])) { + $c->proprietaire = $data['proprietaire']; + } if ($data['book_id'] == 'new' || $data['book_id'] == '') { $c->date = TIME; @@ -99,11 +114,10 @@ class wsDAOBook extends extranetDAO { $c->status = -1; $c->date_status = TIME; $c->parametres = serialize(new wsParametres()); - $c->theme=1; - $c->lang=1; + $c->theme = 1; + $c->lang = 1; $book_id = $c->book_id = $this->getNextId(); $c->insert(); - fb($book_id); return $this->selectById($book_id); } diff --git a/inc/ws/DAO/class.ws.dao.theme.php b/inc/ws/DAO/class.ws.dao.theme.php index 4ae1659e3..357d34aa7 100644 --- a/inc/ws/DAO/class.ws.dao.theme.php +++ b/inc/ws/DAO/class.ws.dao.theme.php @@ -32,9 +32,9 @@ class wsDAOTheme extends extranetDAO { return $this->singleton($r); } - public function getAllThemes() + public function getAllThemes($order='') { - $r = $this->con->select('SELECT * FROM themes'); + $r = $this->con->select('SELECT * FROM themes '.$order); return $this->factory($r); } }