function getResultRound($round_id) { $this->SimpleDB->connect(); $SQL = "select games_id, members_name from t_games where id_round_tour='{$round_id}' "; $rst = $this->SimpleDB->query($SQL); $this->SimpleDB->disconnect(); $key = 0; $arrList = array(); while (is_object($rst) && $rst->next()) { $games = new games($rst->get(0)); $data = $games->getDetail(); $arrList[$key]['name'] = $rst->get(1); $out = 0; $in = 0; for ($a = 1; $a <= 18; $a++) { if ($a <= 9) { $out += $data[$a]['score']; } if ($a > 9) { $in += $data[$a]['score']; } $arrList[$key]['hole' . $a . '_score'] = $data[$a]['score']; } $arrList[$key]['holeout_score'] = $out; $arrList[$key]['holein_score'] = $in; $arrList[$key]['holetotal_score'] = $out + $in; $key++; } return $arrList; }
function drawScoreCare(&$smarty, $games_id) { $games = new games($games_id); $data = $games->getDetail(); $out_length = 0; $out_par = 0; $out_score = 0; $in_length = 0; $in_par = 0; $in_score = 0; $fir = 0; $lr1 = 0; $rr1 = 0; $bunker1 = 0; $penalty1 = 0; $gir = 0; $fairway = 0; $lr2 = 0; $rr2 = 0; $on = 0; $bunker2 = 0; $penalty2 = 0; $putts = 0; $control = 0; $saves = 0; for ($a = 1; $a <= 18; $a++) { if ($a <= 9) { $out_length += $data[$a]["length"]; $out_par += $data[$a]["par"]; $out_score += $data[$a]["score"]; } else { $in_length += $data[$a]["length"]; $in_par += $data[$a]["par"]; $in_score += $data[$a]["score"]; } $fir += $data[$a]["fir"]; $lr1 += $data[$a]["lr1"]; $rr1 += $data[$a]["rr1"]; $bunker1 += $data[$a]["bunker1"]; $penalty1 += $data[$a]["penalty1"]; $gir += $data[$a]["gir"]; $fairway += $data[$a]["fairway"]; $lr2 += $data[$a]["lr2"]; $rr2 += $data[$a]["rr2"]; $on += $data[$a]["on"]; $bunker2 += $data[$a]["bunker2"]; $penalty2 += $data[$a]["penalty2"]; $putts += $data[$a]["putts"]; $control += $data[$a]["control"]; $saves += $data[$a]["saves"]; $smarty->assign('hole' . $a . '_length', $data[$a]["length"]); $smarty->assign('hole' . $a . '_par', $data[$a]["par"]); $smarty->assign('hole' . $a . '_hcp', $data[$a]["hcp"] == "0" ? "" : $data[$a]["hcp"]); $smarty->assign('hole' . $a . '_score', $data[$a]["score"] == "0" ? "" : $data[$a]["score"]); $smarty->assign('hole' . $a . '_fir', $data[$a]["fir"] == "0" ? "" : $data[$a]["fir"]); $smarty->assign('hole' . $a . '_rr1', $data[$a]["rr1"] == "0" ? "" : $data[$a]["rr1"]); $smarty->assign('hole' . $a . '_lr1', $data[$a]["lr1"] == "0" ? "" : $data[$a]["lr1"]); $smarty->assign('hole' . $a . '_bunker1', $data[$a]["bunker1"] == "0" ? "" : $data[$a]["bunker1"]); $smarty->assign('hole' . $a . '_penalty1', $data[$a]["penalty1"] == "0" ? "" : $data[$a]["penalty1"]); $smarty->assign('hole' . $a . '_gir', $data[$a]["gir"] == "0" ? "" : $data[$a]["gir"]); $smarty->assign('hole' . $a . '_fairway', $data[$a]["fairway"] == "0" ? "" : $data[$a]["fairway"]); $smarty->assign('hole' . $a . '_rr2', $data[$a]["rr2"] == "0" ? "" : $data[$a]["rr2"]); $smarty->assign('hole' . $a . '_lr2', $data[$a]["lr2"] == "0" ? "" : $data[$a]["lr2"]); $smarty->assign('hole' . $a . '_on', $data[$a]["on"] == "0" ? "" : $data[$a]["on"]); $smarty->assign('hole' . $a . '_bunker2', $data[$a]["bunker2"] == "0" ? "" : $data[$a]["bunker2"]); $smarty->assign('hole' . $a . '_penalty2', $data[$a]["penalty2"] == "0" ? "" : $data[$a]["penalty2"]); $smarty->assign('hole' . $a . '_putts', $data[$a]["putts"] == "0" ? "" : $data[$a]["putts"]); $smarty->assign('hole' . $a . '_control', $data[$a]["control"] == "0" ? "" : $data[$a]["control"]); $smarty->assign('hole' . $a . '_saves', $data[$a]["saves"] == "0" ? "" : $data[$a]["saves"]); } $smarty->assign('holeout_length', $out_length == "0" ? "" : $out_length); $smarty->assign('holein_length', $in_length == "0" ? "" : $in_length); $smarty->assign('holetotal_length', $in_length + $out_length); $smarty->assign('holeout_par', $out_par == "0" ? "" : $out_par); $smarty->assign('holein_par', $in_par == "0" ? "" : $in_par); $smarty->assign('holetotal_par', $in_par + $out_par); $smarty->assign('holeout_score', $out_score == "0" ? "" : $out_score); $smarty->assign('holein_score', $in_score == "0" ? "" : $in_score); $smarty->assign('holetotal_score', $in_score + $out_score); $smarty->assign('holetotal_fir', $fir == "0" ? "" : $fir); $smarty->assign('holetotal_rr1', $rr1 == "0" ? "" : $rr1); $smarty->assign('holetotal_lr1', $lr1 == "0" ? "" : $lr1); $smarty->assign('holetotal_bunker1', $bunker1 == "0" ? "" : $bunker1); $smarty->assign('holetotal_penalty1', $penalty1 == "0" ? "" : $penalty1); $smarty->assign('holetotal_gir', $gir == "0" ? "" : $gir); $smarty->assign('holetotal_fairway', $fairway == "0" ? "" : $fairway); $smarty->assign('holetotal_rr2', $rr2 == "0" ? "" : $rr2); $smarty->assign('holetotal_lr2', $lr2 == "0" ? "" : $lr2); $smarty->assign('holetotal_on', $on == "0" ? "" : $on); $smarty->assign('holetotal_bunker2', $bunker2 == "0" ? "" : $bunker2); $smarty->assign('holetotal_penalty2', $penalty2 == "0" ? "" : $penalty2); $smarty->assign('holetotal_putts', $putts == "0" ? "" : $putts); $smarty->assign('holetotal_control', $control == "0" ? "" : $control); $smarty->assign('holetotal_saves', $saves == "0" ? "" : $saves); }
function drawScore(&$smarty, $games_id) { $games = new games($games_id); $data = $games->getDetail(); for ($a = 1; $a <= 18; $a++) { $smarty->assign('hole' . $a . '_length', $data[$a]["length"]); $smarty->assign('hole' . $a . '_par', $data[$a]["par"]); $smarty->assign('hole' . $a . '_score', $data[$a]["score"] == "0" ? "" : $data[$a]["score"]); } }