Exemplo n.º 1
0
 /**
  * Processes submitting of the form which is generated in
  * {@link \Mibew\Controller\GroupController::showMembersFormAction()} method.
  *
  * @param Request $request Incoming request.
  * @return string Rendered page content.
  * @throws NotFoundException If the operator's group with specified ID is
  *   not found in the system.
  */
 public function submitFormAction(Request $request)
 {
     csrf_check_token($request);
     $operators = get_operators_list();
     $group_id = $request->attributes->getInt('group_id');
     $group = group_by_id($group_id);
     // Check if specified group exists
     if (!$group) {
         throw new NotFoundException('The group is not found.');
     }
     // Update members list
     $new_members = array();
     foreach ($operators as $op) {
         if ($request->request->get('op' . $op['operatorid']) == 'on') {
             $new_members[] = $op['operatorid'];
         }
     }
     update_group_members($group_id, $new_members);
     // Redirect opeartor to group members page.
     $parameters = array('group_id' => $group_id, 'stored' => true);
     return $this->redirect($this->generateUrl('group_members', $parameters));
 }
Exemplo n.º 2
0
}
$groupid = verifyparam("gid", "/^\\d{1,9}\$/");
$page = array('groupid' => $groupid);
$page['operators'] = get_operators();
$errors = array();
$group = group_by_id($groupid);
if (!$group) {
    $errors[] = getlocal("page.group.no_such");
} else {
    if (isset($_POST['gid'])) {
        $new_members = array();
        foreach ($page['operators'] as $op) {
            if (verifyparam("op" . $op['operatorid'], "/^on\$/", "") == "on") {
                $new_members[] = $op['operatorid'];
            }
        }
        update_group_members($groupid, $new_members);
        header("Location: {$webimroot}/operator/groupmembers.php?gid={$groupid}&stored");
        exit;
    }
}
$page['formop'] = array();
$page['currentgroup'] = $group ? topage(htmlspecialchars($group['vclocalname'])) : "";
foreach (get_group_members($groupid) as $rel) {
    $page['formop'][] = $rel['operatorid'];
}
$page['stored'] = isset($_GET['stored']);
prepare_menu($operator);
setup_group_settings_tabs($groupid, 1);
start_html_output();
require '../view/groupmembers.php';