$db->ws3_themes->nom('varchar', 256, false);\r
$db->ws3_themes->date('integer', 0, false);\r
$db->ws3_themes->parametres('text', 0, false);\r
+\r
// Clés\r
$db->ws3_themes->primary('ws3_pk_themes', 'theme_id');\r
$db->ws3_themes->index('ws3_index_themes_nom', 'BTREE', 'nom');\r
{
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);
\r
public function sauve($data)\r
{\r
- $parent = $this->selectById($data['theme_id']);\r
- $c = $this->con->openCursor('themes');\r
- $c->date = TIME;\r
- $p = new wsThemeParametres($parent);\r
- foreach ($data as $k => $v) {\r
- if (!isset($p->$k)) {\r
- continue;\r
- }\r
- $p->$k = $v;\r
- }\r
- $c->parametres = serialize($p);\r
- $c->update('WHERE theme_id=\'' . $this->con->escape($data['theme_id']) . '\'');\r
-\r
$api = new ws3API();\r
- $api->updateTheme($this->selectById($data['theme_id'], 'themes_vue', true));\r
+ $api->updateTheme($data);\r
}\r
\r
protected function getNextId()\r
\r
}\r
\r
- /**\r
- * @param wsTheme $theme\r
- * @throws Zend_Http_Client_Exception\r
- */\r
- public function createTheme($theme)\r
- {\r
- global $core;\r
- return $this->restPost('/api/fluidbook-theme', ['api_token' => $core->user->api_token, 'theme' => $this->_themeData($theme)]);\r
- }\r
-\r
public function renameTheme($theme_id, $newname)\r
{\r
global $core;\r
return $this->restPost('/api/fluidbook-theme/' . $theme_id . '/clone', ['api_token' => $core->user->api_token]);\r
}\r
\r
- public function updateTheme($theme)\r
+ public function updateTheme($data)\r
{\r
global $core;\r
- return $this->restPut('/api/fluidbook-theme/' . $theme->theme_id, ['api_token' => $core->user->api_token, 'theme' => $this->_themeData($theme)]);\r
+ return $this->restPut('/api/fluidbook-theme/' . $data['theme_id'], ['api_token' => $core->user->api_token, 'data' => $data]);\r
}\r
\r
public function deleteTheme($themeId)\r
return $this->restPut('/api/fluidbook-theme/' . $themeId . '/uploadfile/' . $field, ['api_token' => $core->user->api_token, 'path' => $path]);\r
}\r
\r
- /**\r
- * @param wsTheme $theme\r
- */\r
- protected function _themeData($theme)\r
- {\r
- $data = [];\r
- $data['theme_id'] = $theme->theme_id;\r
- $data['proprietaire'] = $theme->proprietaire;\r
- $data['nom'] = $theme->nom;\r
- $data['parametres'] = $theme->parametres->toArray();\r
-\r
- return $data;\r
- }\r
-\r
public static function getResponseBody(Zend_Http_Response $response)\r
{\r
return $response->getBody();\r