Refer to licence and other details at the top of file Tourney.module.php
More info at http://dev.cmsmadesimple.org/projects/tourney
 
Processes form-submission from admin brackets tab
*/
if (isset($params['cancel']) || empty($params['selitems'])) {
    $this->Redirect($id, 'defaultadmin');
} elseif (isset($params['clone'])) {
    if (!$this->CheckAccess('admod')) {
        $this->Redirect($id, 'defaultadmin', '', array('tmt_message' => $this->PrettyMessage('lackpermission', FALSE)));
    }
    $vals = array_flip($params['selitems']);
    //convert strings
    $vals = array_flip($vals);
    if ($vals) {
        $funcs = new tmtClone();
        $res = $funcs->CloneBracket($this, $vals);
        if ($res !== TRUE) {
            $this->Redirect($id, 'defaultadmin', '', array('tmt_message' => $this->PrettyMessage($res, FALSE)));
        }
    }
} elseif (isset($params['group'])) {
    $smarty->assign('start_form', $this->CreateFormStart($id, 'process_items', $returnid));
    $smarty->assign('end_form', $this->CreateFormEnd());
    $smarty->assign('hidden', $this->CreateInputHidden($id, 'selitems', implode(';', $params['selitems'])));
    $smarty->assign('title', $this->Lang('title_bracketsgroup'));
    $options = $this->GetGroups();
    if ($options) {
        foreach ($options as &$row) {
            $row = $row['name'];
        }
<?php

/*
This file is part of CMS Made Simple module: Tourney.
Copyright (C) 2014-2015 Tom Phane <*****@*****.**>
Refer to licence and other details at the top of file Tourney.module.php
More info at http://dev.cmsmadesimple.org/projects/tourney
*/
if (!$this->CheckAccess('admod')) {
    $this->Redirect($id, 'defaultadmin', '', array('tmt_message' => $this->PrettyMessage('lackpermission', FALSE)));
}
$bid = (int) $params['bracket_id'];
$funcs = new tmtClone();
$res = $funcs->CloneBracket($this, $bid);
if ($res === TRUE) {
    $this->Redirect($id, 'addedit_comp', $returnid, array('bracket_id' => $bid));
} else {
    $this->Redirect($id, 'defaultadmin', '', array('tmt_message' => $this->PrettyMessage($res, FALSE)));
}