Привет всем копателям joomleague! Насчет технических результатов решил следующим способом:
1. В базе данных находим таблицу jos_joomleague_matches, меняем типы полей matchpart1_result и matchpart2_result с значения float на значение varchar(2) ( самый действенный способ менять через phpMyAdmin ).
2. Открываем файл
/administrator/components/com_joomleague/classes/Ranking.class.php
, находим в нем функцию
function collectPoints(& $data, $mode, $match, $shownegpoints) {
и заменяем следующим кодом
function collectPoints(& $data, $mode, $match, $shownegpoints) {
$homeId = $match->matchpart1;
$awayId = $match->matchpart2;
$decision = $match->decision;
if ($decision == 0) {
$home_score=$match->home_score;
$away_score=$match->away_score;
$leg1=$match->l1;
$leg2=$match->l2;
}
else {
$home_score=$match->home_score_decision;
$away_score=$match->away_score_decision;
$leg1=$match->l1;
$leg2=$match->l2;
}
if ($mode == 0 || $mode == 1) $home = & $data[$homeId];
else {
$home = new stdClass(); //in that case, $data wont be affected
$this->init_stdclass($home); //and now they are also initialized in php4
}
if ($mode == 0 || $mode == 2) $away = & $data[$awayId];
else {
$away = new stdClass(); //in that case, $data wont be affected
$this->init_stdclass($away); //and now they are also initialized in php4
}
if (!isset($data[$homeId]->headtohead[$awayId])) {
$home->headtohead[$awayId]=0;
$home->headtohead_diff[$awayId]=0;
$home->headtohead_goal_for[$awayId]=0;
$home->headtohead_awaygoals[$awayId]=0;
}
if (!isset($data[$awayId]->headtohead[$homeId])) {
$away->headtohead[$homeId]=0;
$away->headtohead_diff[$homeId]=0;
$away->headtohead_goal_for[$homeId]=0;
$away->headtohead_awaygoals[$homeId]=0;
}
$home->cnt_matches++;
$away->cnt_matches++;
$resultType = ($this->project->allow_add_time) ? $match->match_result_type : 0;
switch($resultType){
case 1: $arr = explode(",",$this->project->points_after_add_time);break;
case 2: $arr = explode(",",$this->project->points_after_penalty);break;
default: $arr = explode(",",$this->project->points_after_regular_time);break;
}
$win_points = $arr[0];
$draw_points = $arr[1];
$loss_points = $arr[2];
if ($decision!=1 || ( $decision==1 && (isset($home_score) || isset($away_score)))) {
if ( $home_score == "+" or $home_score == "-" or $away_score == "+" or $away_score == "-") {
if( $home_score == "+" and $away_score == "-" ){
$home->cnt_won++;
$home->cnt_won_home++;
$home->sum_points += $win_points; //home_score can't be null...
$away->cnt_lost++;
$away->sum_points += ( $decision == 0 || isset($away_score) ? $loss_points : 0);
if ( $shownegpoints==1) {
$home->neg_points += $loss_points;
$away->neg_points += ( $decision == 0 || isset($away_score) ? $win_points : 0);
}
$home->headtohead[$awayId]++;
$away->headtohead[$homeId]--;
}
else if ( $home_score == "-" and $away_score == "-" ){
$home->cnt_lost++;
$home->cnt_lost_home++;
$home->sum_points += ( $decision == 0 || isset($home_score) ? $loss_points : 0);
$away->cnt_lost++;
$away->sum_points += ( $decision == 0 || isset($away_score) ? $loss_points : 0);
if ($shownegpoints==1) {
$home->neg_points += ( $decision == 0 || isset($home_score) ? $win_points : 0);
$away->neg_points += ( $decision == 0 || isset($away_score) ? $win_points : 0);
}
$away->headtohead[$homeId]--;
$home->headtohead[$awayId]--;
}
else if ( $home_score == "-" and $away_score == "+"){
$home->cnt_lost++;
$home->cnt_lost_home++;
$home->sum_points += ( $decision == 0 || isset($home_score) ? $loss_points : 0);
$away->cnt_won++;
$away->sum_points += $win_points;
if ( $shownegpoints==1) {
$home->neg_points += ( $decision == 0 || isset($home_score) ? $win_points : 0);
$away->neg_points += $loss_points;
}
$home->headtohead[$awayId]--;
$away->headtohead[$homeId]++;
}
} else {
if( $home_score > $away_score ){
$home->cnt_won++;
$home->cnt_won_home++;
$home->sum_points += $win_points; //home_score can't be null...
$away->cnt_lost++;
$away->sum_points += ( $decision == 0 || isset($away_score) ? $loss_points : 0);
if ( $shownegpoints==1) {
$home->neg_points += $loss_points;
$away->neg_points += ( $decision == 0 || isset($away_score) ? $win_points : 0);
}
$home->headtohead[$awayId]++;
$away->headtohead[$homeId]--;
}
else if ( $home_score == $away_score ){
$home->cnt_draw++;
$home->cnt_draw_home++;
$home->sum_points += ( $decision == 0 || isset($home_score) ? $draw_points : 0);
$away->cnt_draw++;
$away->sum_points += ( $decision == 0 || isset($away_score) ? $draw_points : 0);
if ($shownegpoints==1) {
$home->neg_points += ( $decision == 0 || isset($home_score) ? $draw_points : 0);
$away->neg_points += ( $decision == 0 || isset($away_score) ? $draw_points : 0);
}
}
else if ( $home_score < $away_score){
$home->cnt_lost++;
$home->cnt_lost_home++;
$home->sum_points += ( $decision == 0 || isset($home_score) ? $loss_points : 0);
$away->cnt_won++;
$away->sum_points += $win_points;
if ( $shownegpoints==1) {
$home->neg_points += ( $decision == 0 || isset($home_score) ? $win_points : 0);
$away->neg_points += $loss_points;
}
$home->headtohead[$awayId]--;
$away->headtohead[$homeId]++;
}
}
/* bonus points */
$home->sum_points += $match->home_bonus;
$home->bonus_points += $match->home_bonus;
$away->sum_points += $match->away_bonus;
$away->bonus_points += $match->away_bonus;
/* goals for/against/diff */
$home->sum_matchpart1_result += $home_score;
$home->sum_matchpart2_result += $away_score;
$home->diff_matchpart_results= $home->sum_matchpart1_result - $home->sum_matchpart2_result;
$home->sum_matchpart1_legs += $leg1;
$home->sum_matchpart2_legs += $leg2;
$home->diff_matchpart_legs= $home->sum_matchpart1_legs - $home->sum_matchpart2_legs;
$away->sum_matchpart1_result += $away_score;
$away->sum_matchpart2_result += $home_score;
$away->diff_matchpart_results= $away->sum_matchpart1_result - $away->sum_matchpart2_result;
$away->sum_matchpart1_legs += $leg2;
$away->sum_matchpart2_legs += $leg1;
$away->diff_matchpart_legs= $away->sum_matchpart1_legs - $away->sum_matchpart2_legs;
/* head to head goal diff */
$home->headtohead_diff[$awayId]+=($home_score-$away_score);
$away->headtohead_diff[$homeId]-=($home_score-$away_score);
/*head to head goals for/away goals*/
$home->headtohead_goal_for[$awayId]+=$home_score;
$away->headtohead_goal_for[$homeId]+=$away_score;
$away->headtohead_awaygoals[$homeId]+=$away_score;
}
else { //none of the 2 teams gets any points
if ($shownegpoints==1) {
$home->neg_points += $loss_points;
$away->neg_points += $loss_points;
}
$home->cnt_lost++;
$away->cnt_lost++;
}
}
Принимаются следующие значения:
-
+/- Техническая победа/Техническийпроигрыш;
-
-/+ Технический проигрыш/Техническая победа;
-
-/- Технический проигрыш/Технический проигрыш;
Работоспособность способа тестировалась на русской сборке с сайта
http://rusliga.bgme.net/index.php?option=com_frontpage&Itemid=1. Очки насчитываются как за стандартную победу в матче.