diff options
author | Kevin Chabowski <kevin@kch42.de> | 2011-12-27 01:36:09 +0100 |
---|---|---|
committer | Kevin Chabowski <kevin@kch42.de> | 2011-12-27 01:36:09 +0100 |
commit | cf2a4a79eb8344ab1c3303d4bdbb80c91d94925b (patch) | |
tree | 3ff7e96d9ce85686e1a365a40dbcb684d2e0a93d /ratatoeskr/backend.php | |
parent | cb172742c78517baf6a79b52f980b0b9dcb81274 (diff) | |
download | ratatoeskr-cms-cf2a4a79eb8344ab1c3303d4bdbb80c91d94925b.tar.gz ratatoeskr-cms-cf2a4a79eb8344ab1c3303d4bdbb80c91d94925b.tar.bz2 ratatoeskr-cms-cf2a4a79eb8344ab1c3303d4bdbb80c91d94925b.zip |
Section's Styles are nowonlyavailable by a getter.
Also fixed many MySQL Queries. These SELECT ... WHERE foo = (SELECT...)
have not worked as expected, so now there are many ugly joins...
Diffstat (limited to 'ratatoeskr/backend.php')
-rw-r--r-- | ratatoeskr/backend.php | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/ratatoeskr/backend.php b/ratatoeskr/backend.php index c5ae9c9..57d87f9 100644 --- a/ratatoeskr/backend.php +++ b/ratatoeskr/backend.php @@ -1095,8 +1095,8 @@ $backend_subactions = url_action_subactions(array( try { $section = Section::by_name($_GET["rmfrom"]); - $style = $_GET["rmstyle"]; - $section->styles = array_filter($section->styles, function($s) use ($style) { return $s->name != $style; }); + $style = Style::by_name($_GET["rmstyle"]); + $section->remove_style($style); $section->save(); $ste->vars["success"] = $translation["style_removed"]; } @@ -1175,11 +1175,7 @@ $backend_subactions = url_action_subactions(array( { $section = Section::by_name($_POST["section_select"]); $style = Style::by_name($_POST["style_to_add"]); - if(!in_array($style, $section->styles)) - { - $section->styles[] = $style; - $section->save(); - } + $section->add_style($style); $ste->vars["success"] = $translation["successfully_added_style"]; } catch(DoesNotExistError $e) @@ -1236,7 +1232,7 @@ $backend_subactions = url_action_subactions(array( "name" => $section->name, "title" => $titles, "template" => $section->template, - "styles" => array_map(function($style) { return $style->name; }, $section->styles), + "styles" => array_map(function($style) { return $style->name; }, $section->get_styles()), "default" => ($section->get_id() == $ratatoeskr_settings["default_section"]) ); }, $sections); |