Ejemplo n.º 1
0
    $val = $params['alias'];
} else {
    DisplayErrorPage($this, $smarty, $db, $params, TRUE, $this->Lang('err_tag'));
    return;
}
$bdata = $db->GetRow($sql, array($val));
if (!$bdata) {
    DisplayErrorPage($this, $smarty, $db, $params, TRUE, $this->Lang('err_missing'));
    return;
}
$bracket_id = $bdata['bracket_id'];
//refresh the matches table,if necessary
$sch = new tmtSchedule();
switch ($bdata['type']) {
    case Tourney::DETYPE:
        $res = $sch->UpdateDEMatches($this, $bracket_id);
        break;
    case Tourney::RRTYPE:
        $res = $sch->NextRRMatches($this, $bracket_id);
        break;
    default:
        // case Tourney:KOTYPE:
        $res = $sch->UpdateKOMatches($this, $bracket_id);
        break;
}
if ($res === TRUE) {
    $bdata['chartbuild'] = 1;
}
//tell downstream that rebuild is needed
$lyt = new tmtLayout();
if (empty($params['view']) || $params['view'] == 'chart') {
                 $db->Execute($sql, array($bid, (int) $movetid));
             }
         }
         $params['real_action'] = 'edit';
         break;
     default:
         //refresh matches if appropriate
         $pref = cms_db_prefix();
         $sql = 'SELECT COUNT(match_id) AS num FROM ' . $pref . 'module_tmt_matches WHERE bracket_id=? AND flags=0';
         if ($db->GetOne($sql, array($bid))) {
             $sch = new tmtSchedule();
             $sql = 'SELECT type FROM ' . $pref . 'module_tmt_brackets WHERE bracket_id=?';
             $type = $db->GetOne($sql, array($bid));
             switch ($type) {
                 case Tourney::DETYPE:
                     $sch->UpdateDEMatches($this, $bid);
                     break;
                 case Tourney::RRTYPE:
                     $sch->NextRRMatches($this, $bid);
                     break;
                 default:
                     //case Tourney::KOTYPE:
                     $sch->UpdateKOMatches($this, $bid);
                     break;
             }
             unset($sch);
         }
 }
 $funcs = new tmtData();
 $data = $funcs->GetBracketData($this, $params['real_action'], $id, $bid, $params);
 unset($funcs);