From b29407b2e5d340abf4262486a6df1227cf9115f9 Mon Sep 17 00:00:00 2001 From: "vincent@cubedesigners.com" Date: Mon, 26 Jul 2021 15:58:17 +0000 Subject: [PATCH] wait #4216 @0.5 --- inc/commons/class.common.core.php | 1 + inc/ws/Controlleur/class.ws.flash.php | 2 +- inc/ws/DAO/class.ws.dao.theme.php | 15 +------------- inc/ws/Util/class.ws.ws3api.php | 28 ++------------------------- 4 files changed, 5 insertions(+), 41 deletions(-) diff --git a/inc/commons/class.common.core.php b/inc/commons/class.common.core.php index 1a490029e..6996daf0f 100644 --- a/inc/commons/class.common.core.php +++ b/inc/commons/class.common.core.php @@ -309,6 +309,7 @@ class commonCore extends cubeCore $db->ws3_themes->nom('varchar', 256, false); $db->ws3_themes->date('integer', 0, false); $db->ws3_themes->parametres('text', 0, false); + // Clés $db->ws3_themes->primary('ws3_pk_themes', 'theme_id'); $db->ws3_themes->index('ws3_index_themes_nom', 'BTREE', 'nom'); diff --git a/inc/ws/Controlleur/class.ws.flash.php b/inc/ws/Controlleur/class.ws.flash.php index f54d9179c..e91f84b93 100644 --- a/inc/ws/Controlleur/class.ws.flash.php +++ b/inc/ws/Controlleur/class.ws.flash.php @@ -513,7 +513,7 @@ class wsFlash extends cubeFlashGateway { global $core; $dao = new wsDAOIcone($core->con); - $icones = $dao->selectAll('ORDER BY FIELD(icone_id,13,15) DESC, icone_id DESC'); + $icones = $dao->selectAll('WHERE icone_id=15 ORDER BY FIELD(icone_id,13,15) DESC, icone_id DESC'); foreach ($icones as $icone) { $i = $this->xml->addChild('icone'); $i->addAttribute('id', $icone->icone_id); diff --git a/inc/ws/DAO/class.ws.dao.theme.php b/inc/ws/DAO/class.ws.dao.theme.php index 127249a2e..b10f61ee9 100644 --- a/inc/ws/DAO/class.ws.dao.theme.php +++ b/inc/ws/DAO/class.ws.dao.theme.php @@ -117,21 +117,8 @@ class wsDAOTheme extends commonDAO public function sauve($data) { - $parent = $this->selectById($data['theme_id']); - $c = $this->con->openCursor('themes'); - $c->date = TIME; - $p = new wsThemeParametres($parent); - foreach ($data as $k => $v) { - if (!isset($p->$k)) { - continue; - } - $p->$k = $v; - } - $c->parametres = serialize($p); - $c->update('WHERE theme_id=\'' . $this->con->escape($data['theme_id']) . '\''); - $api = new ws3API(); - $api->updateTheme($this->selectById($data['theme_id'], 'themes_vue', true)); + $api->updateTheme($data); } protected function getNextId() diff --git a/inc/ws/Util/class.ws.ws3api.php b/inc/ws/Util/class.ws.ws3api.php index dea2a93fd..f86fb1536 100644 --- a/inc/ws/Util/class.ws.ws3api.php +++ b/inc/ws/Util/class.ws.ws3api.php @@ -14,16 +14,6 @@ class ws3API extends Zend_Rest_Client } - /** - * @param wsTheme $theme - * @throws Zend_Http_Client_Exception - */ - public function createTheme($theme) - { - global $core; - return $this->restPost('/api/fluidbook-theme', ['api_token' => $core->user->api_token, 'theme' => $this->_themeData($theme)]); - } - public function renameTheme($theme_id, $newname) { global $core; @@ -36,10 +26,10 @@ class ws3API extends Zend_Rest_Client return $this->restPost('/api/fluidbook-theme/' . $theme_id . '/clone', ['api_token' => $core->user->api_token]); } - public function updateTheme($theme) + public function updateTheme($data) { global $core; - return $this->restPut('/api/fluidbook-theme/' . $theme->theme_id, ['api_token' => $core->user->api_token, 'theme' => $this->_themeData($theme)]); + return $this->restPut('/api/fluidbook-theme/' . $data['theme_id'], ['api_token' => $core->user->api_token, 'data' => $data]); } public function deleteTheme($themeId) @@ -54,20 +44,6 @@ class ws3API extends Zend_Rest_Client return $this->restPut('/api/fluidbook-theme/' . $themeId . '/uploadfile/' . $field, ['api_token' => $core->user->api_token, 'path' => $path]); } - /** - * @param wsTheme $theme - */ - protected function _themeData($theme) - { - $data = []; - $data['theme_id'] = $theme->theme_id; - $data['proprietaire'] = $theme->proprietaire; - $data['nom'] = $theme->nom; - $data['parametres'] = $theme->parametres->toArray(); - - return $data; - } - public static function getResponseBody(Zend_Http_Response $response) { return $response->getBody(); -- 2.39.5