예제 #1
0
 /**
  * @before _secure, _admin
  */
 public function groupMembers($group_id)
 {
     $group = Group::first(array("id = ?" => $group_id));
     if (!$group || $group->name == "All") {
         $this->redirect("/admin");
     }
     $this->seo(array("title" => "Manage Group Members", "view" => $this->getLayoutView()));
     $view = $this->getActionView();
     $count = RequestMethods::get("count", 10);
     $group->users = json_decode($group->users);
     if ($count < count($group->users)) {
         $count = count($group->users) + 1;
     }
     $total = array();
     for ($i = 0; $i < $count; ++$i) {
         $total[] = $i;
     }
     if (RequestMethods::post("action") == "addMembers") {
         unset($_POST["action"]);
         $members = ArrayMethods::reArray($_POST);
         $members = json_encode($members);
         $group->users = $members;
         $group->save();
         $view->set("success", "Members were added for the group: {$group->name}");
     }
     $view->set("group", $group);
     $view->set("count", $total);
 }