/** * @before _secure, changeLayout, _admin */ public function shuffleitem($shuffle_id) { $this->seo(array("title" => "Shuffle Content", "view" => $this->getLayoutView())); $view = $this->getActionView(); $fields = array("usr_x", "usr_y", "usr_w", "usr_h", "txt_x", "txt_y", "txt_size", "txt_angle", "txt_color"); $shuffle = Shuffle::first(array("id = ?" => $shuffle_id)); if (RequestMethods::post("action") == "shuffle") { $item = new ShuffleItem(array("shuffle_id" => $shuffle->id, "meta_key" => "gender", "meta_value" => RequestMethods::post("gender"), "base_im" => $this->_upload("base_im"), "live" => true)); foreach ($fields as $key => $value) { $item->{$value} = RequestMethods::post($value, "0"); } $item->save(); } $items = ShuffleItem::all(array("shuffle_id = ?" => $shuffle->id)); $view->set("shuffle", $shuffle); $view->set("items", $items); }