$vc = count($vals);
        $fillers = str_repeat('?,', $vc - 1) . '?';
        $pref = cms_db_prefix();
        $sql = 'UPDATE ' . $pref . 'module_tmt_brackets SET groupid=? WHERE bracket_id IN (' . $fillers . ')';
        array_unshift($vals, $gid);
        $db->Execute($sql, $vals);
    }
} elseif (isset($params['delete_item'])) {
    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 tmtDelete();
        $funcs->DeleteBracket($this, $vals);
    }
} elseif (isset($params['notify'])) {
    $vals = array_flip($params['selitems']);
    //convert strings
    $vals = array_flip($vals);
    if ($vals) {
        $vc = count($vals);
        $fillers = str_repeat('?,', $vc - 1) . '?';
        $pref = cms_db_prefix();
        $sql = 'SELECT match_id,bracket_id FROM ' . $pref . 'module_tmt_matches WHERE bracket_id IN (' . $fillers . ') AND flags=0 AND status<' . Tourney::MRES . ' AND playwhen IS NOT NULL AND ((teamA IS NOT NULL AND teamA>0) OR (teamB IS NOT NULL AND teamB>0))';
        $matches = $db->GetAssoc($sql, $vals);
        if ($matches) {
            $allmsg = '';
            $sql = 'UPDATE ' . $pref . 'module_tmt_matches SET status=' . Tourney::TOLD . ' WHERE match_id=?';
<?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)));
}
if (empty($params['bracket_id'])) {
    $this->Redirect($id, 'defaultadmin');
}
$funcs = new tmtDelete();
$funcs->DeleteBracket($this, (int) $params['bracket_id']);
$this->Redirect($id, 'defaultadmin', '', array('tmt_message' => $this->PrettyMessage('comp_deleted')));