コード例 #1
0
                $errmsg .= '<br />' . implode('<br />', $errs);
            }
            $newparms['tmt_message'] = $errmsg;
        }
    }
} elseif (isset($params['getscore'])) {
    $newparms = $this->GetEditParms($params, 'resultstab');
    if (!empty($params['rsel'])) {
        $ok = TRUE;
        $sql = 'UPDATE ' . cms_db_prefix() . 'module_tmt_matches SET status=' . Tourney::ASKED . ' WHERE match_id=?';
        $errs = array();
        $ids = array_keys($params['res_status']);
        //match id's
        $funcs = new tmtComm($this);
        foreach ($params['rsel'] as $mid) {
            list($res, $errmsg) = $funcs->TellTeams($params['bracket_id'], $mid, 3, TRUE);
            if ($res) {
                $db->Execute($sql, array($mid));
            } else {
                $ok = FALSE;
                if ($errmsg) {
                    $errs[] = $errmsg;
                } else {
                    $idx = array_search($mid, $ids);
                    $tA = (int) $params['res_teamA'][$idx];
                    $tB = (int) $params['res_teamB'][$idx];
                    if ($tA > 0 && $tB > 0) {
                        $errs[] = sprintf($this->Lang('or_fmt', $this->TeamName($tA), $this->TeamName($tB)));
                    } elseif ($tA > 0) {
                        $errs[] = $this->TeamName($tA);
                    } elseif ($tB > 0) {
コード例 #2
0
} 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=?';
            $funcs = new tmtComm($this);
            foreach ($matches as $mid => $bid) {
                list($res, $errmsg) = $funcs->TellTeams((int) $bid, $mid, 1);
                //1 >> announcement template
                if ($res) {
                    $db->Execute($sql, array($mid));
                } elseif ($errmsg) {
                    if ($allmsg) {
                        $allmsg .= '<br />';
                    }
                    $allmsg .= $errmsg;
                }
            }
            if ($allmsg) {
                $this->Redirect($id, 'defaultadmin', '', array('tmt_message' => $this->PrettyMessage($allmsg, FALSE, FALSE, FALSE)));
            }
        }
    }