$readOnly = array(1);
$dao = new wsDAOTheme($core->con);
- $themes = $dao->getAllThemes($core->user, 'ORDER BY FIELD (theme_id,' . $this->args['book_id'] . ',' . implode(',', $demos) . ') DESC, theme_id DESC', $demos);
+ $themes = $dao->getAllThemes($core->user, 'ORDER BY FIELD (theme_id,' . $this->args['book_id'] . ',' . implode(',', $demos) . ') DESC, theme_id DESC', $demos,$this->xml);
foreach ($themes as $theme) {
$t = $this->xml->addChild('theme');
$t->addAttribute('id', $theme->theme_id);
$sql = 'SELECT * FROM themes_vue';\r
} else {\r
$or = '';\r
- if (wsDroits::revendeur() && !is_null($demos)) {\r
- $or = ' OR theme_id IN(' . implode(',', $demos) . ')';\r
+ if (wsDroits::revendeur()) {\r
+ if (!is_null($demos)) {\r
+ $or .= ' OR theme_id IN(' . implode(',', $demos) . ') ';\r
+ }\r
+ $or .= ') OR ( proprietaire IN(' . $user->ws_rights . ') ';\r
}\r
$sql = 'SELECT * FROM themes_vue WHERE theme_id IN (SELECT theme FROM books WHERE proprietaire IN(' . $user->ws_rights . ') ' . $or . ')';\r
}\r
- $r = $this->con->select($sql . ' ' . $order);\r
+ $sql .= ' ' . $order;\r
+\r
+ $r = $this->con->select($sql);\r
return $this->factory($r);\r
}\r
\r
}\r
\r
\r
- $theme=$this->selectById($c->theme_id);\r
+ $theme = $this->selectById($c->theme_id);\r
try {\r
$api = new ws3API();\r
$api->createTheme($theme);\r
- }catch (Exception $e){\r
+ } catch (Exception $e) {\r
print_r($e);\r
exit;\r
}\r