Radio Streaming - 50% Lifetime Discount with purchase of any Joomla Web Radio Addon. Discount Code: STR15-Z
See Radio Streaming Plans

Results 1 to 6 of 6

Thread: Player form module

  1. #1
    Super Moderator
    Join Date
    Mar 2012
    Posts
    183

    Player form module

    --------------------------------------------------
    Topic Transfered from old forum
    --------------------------------------------------

    Thanks for your support so far. Excellent information and I have managed to edit the pages as required. One more question please...

    The player form module is showing the same as the top players module. This may be due to the fact that all our games are listed under the same match day. Is there any way to change the player form module to calculate the form by the last 3 games (not match days)?

    Regards
    Support Operator
    MultiHosting.com

  2. #2
    Super Moderator
    Join Date
    Mar 2012
    Posts
    183
    --------------------------------------------------
    Topic Transfered from old forum
    --------------------------------------------------

    Hello

    it is possible to make that change but this will need many changes to the code of the module.
    first you will have to change the query that is in line 32

    from

    $query="SELECT id ".
    " FROM `#__masterleaguepro_matchday` ".
    " WHERE season_id=$season ".
    " ORDER BY `date` DESC,id DESC ".
    " LIMIT 0 ,". $forMatchdays ;

    to

    $query="SELECT m.id ".
    " FROM `#__masterleaguepro_match` m ".
    " INNER JOIN `#__masterleaguepro_matchday` md ON md.id=m.matchday_id AND md.season_id=".$season.
    " WHERE m.home_score IS NOT NULL AND m.away_score IS NOT NULL ".
    " ORDER BY m.match_start_time DESC,id DESC ".
    " LIMIT 0,".$forMatchdays;

    and then change the query inthe line 57
    from
    $query="SELECT u.username,log.user_id,SUM(log.points) as points ,SUM(log.win) as wins,SUM(log.draw) as draws ,SUM(log.lose) as loses,SUM(log.matches_played) as matches_played,SUM(log.goal_for) as goal_for,".
    "SUM(log.goal_against) as goal_against, SUM(log.goal_difference) as goal_difference ".
    "FROM `#__masterleaguepro_users` mu ".
    "INNER JOIN `#__masterleaguepro_user_log` log ON log.user_id=mu.user_id ".
    "INNER JOIN `#__users` u ON mu.user_id=u.id ".
    "WHERE mu.league_id=".$league." and log.matchday_id IN(".$matchdays.") ".
    "GROUP BY mu.user_id ".
    "ORDER BY points DESC,goal_for DESC,goal_difference DESC ".
    "LIMIT 0,".$to;

    to

    $query="SELECT u.username,log.user_id,SUM(log.points) as points ,SUM(log.win) as wins,SUM(log.draw) as draws ,SUM(log.lose) as loses,SUM(log.matches_played) as matches_played,SUM(log.goal_for) as goal_for, SUM(log.goal_against) as goal_against, SUM(log.goal_difference) as goal_difference ".
    " FROM `#__masterleaguepro_users` mu ".
    " INNER JOIN `#__masterleaguepro_user_log` log ON log.user_id=mu.user_id ".
    " INNER JOIN `#__users` u ON mu.user_id=u.id ".
    " INNER JOIN `#__masterleaguepro_match` m ON log.matchday_id=m.matchday_id ".
    " WHERE mu.league_id=".$league." and m.id IN (".$matchdays.") ".
    " GROUP BY mu.user_id ".
    " ORDER BY points DESC,goal_for DESC,goal_difference DESC ".
    " LIMIT 0,".$to;


    with this changes you will get the players from the league you selected in the module configurations in last X matches you selected in the configuration

    Kind regards
    Support Department
    Support Operator
    MultiHosting.com

  3. #3
    Super Moderator
    Join Date
    Mar 2012
    Posts
    183
    --------------------------------------------------
    Topic Transfered from old forum
    --------------------------------------------------

    Thanks again for the support. I have changed the module --> player form --> helper.php file as below however the module is still showing the same as the top player module. In the module my settings are Top = 3 for the last 1 matchday. Season and League are already selected.

    <?php
    /**
    * @version 1.0.0
    * @package com_masterleaguepro
    * @copyright Copyright (C) 2014. All rights reserved.
    * @license GNU General Public License version 2 or later; see http://master-league.com/master-leag...s-licence.html
    * @author multihosting.gr <info@multihosting.gr> - http://www.multihosting.gr
    */


    // no direct access
    defined('_JEXEC') or die;

    class modMasterLeagueProPlayerform
    {
    /**
    * Retrieves the hello message
    *
    * @param array $params An object containing the module parameters
    * @access public
    */
    public static function getTopPlayers( $params )
    {
    $season=$params->get('season');
    $league=$params->get("league");
    $to=$params->get('numberOfShown');
    $forMatchdays=$params->get("forMatchdays");

    $db = JFactory::getDbo();

    /*get the matchdays*/
    $query="SELECT m.id ".
    " FROM `#__masterleaguepro_match` m ".
    " INNER JOIN `#__masterleaguepro_matchday` md ON md.id=m.matchday_id AND md.season_id=".$season.
    " WHERE m.home_score IS NOT NULL AND m.away_score IS NOT NULL ".
    " ORDER BY m.match_start_time DESC,id DESC ".
    " LIMIT 0,".$forMatchdays;

    $db->setQuery($query);

    $matchdayList=$db->loadObjectList();
    if(empty($matchdayList)){
    return array();
    }

    /*create a id string of matchdays(mysql version does not support limit inside the IN query*/
    $matchdays="";

    foreach ($matchdayList as $key => $matchday) {
    $matchdays.=$matchday->id.",";
    }

    $matchdays=rtrim($matchdays,',');



    /*get the log*/
    $query="SELECT u.username,log.user_id,SUM(log.points) as points ,SUM(log.win) as wins,SUM(log.draw) as draws ,SUM(log.lose) as loses,SUM(log.matches_played) as matches_played,SUM(log.goal_for) as goal_for, SUM(log.goal_against) as goal_against, SUM(log.goal_difference) as goal_difference ".
    " FROM `#__masterleaguepro_users` mu ".
    " INNER JOIN `#__masterleaguepro_user_log` log ON log.user_id=mu.user_id ".
    " INNER JOIN `#__users` u ON mu.user_id=u.id ".
    " INNER JOIN `#__masterleaguepro_match` m ON log.matchday_id=m.matchday_id ".
    " WHERE mu.league_id=".$league." and m.id IN (".$matchdays.") ".
    " GROUP BY mu.user_id ".
    " ORDER BY points DESC,goal_for DESC,goal_difference DESC ".
    " LIMIT 0,".$to;

    $db->setQuery($query);
    return $db->loadObjectList();
    }
    }


    ?>
    Support Operator
    MultiHosting.com

  4. #4
    Super Moderator
    Join Date
    Mar 2012
    Posts
    183
    --------------------------------------------------
    Topic Transfered from old forum
    --------------------------------------------------

    Hello,

    we noticed that the user log is saved by matchday so we came up with new database query to get the correct result , so please try this code

    from

    $query="SELECT u.username,log.user_id,SUM(log.points) as points ,SUM(log.win) as wins,SUM(log.draw) as draws ,SUM(log.lose) as loses,SUM(log.matches_played) as matches_played,SUM(log.goal_for) as goal_for, SUM(log.goal_against) as goal_against, SUM(log.goal_difference) as goal_difference ".
    " FROM `#__masterleaguepro_users` mu ".
    " INNER JOIN `#__masterleaguepro_user_log` log ON log.user_id=mu.user_id ".
    " INNER JOIN `#__users` u ON mu.user_id=u.id ".
    " INNER JOIN `#__masterleaguepro_match` m ON log.matchday_id=m.matchday_id ".
    " WHERE mu.league_id=".$league." and m.id IN (".$matchdays.") ".
    " GROUP BY mu.user_id ".
    " ORDER BY points DESC,goal_for DESC,goal_difference DESC ".
    " LIMIT 0,".$to;



    to


    $query="SELECT z.username,z.user_id,z.points,z.win as wins,z.draw as draws,z.lose as loses,(z.win+z.draw+z.lose) as matches_played,z.gu as goal_for,z.gk as goal_against,(z.gu+z.gk) as goal_difference
    " FROM( ".
    " SELECT u.username,t.user_id,((t.correct_score*l.correct_s core)+(t.correct_result*l.correct_result)+(t.incor rect_result*l.incorrect_result)) as points,(t.correct_result+t.incorrect_result) as matches,t.correct_score as win,t.correct_result-t.correct_score as draw,t.incorrect_result as lose,((t.correct_score*10+t.correct_result)/(t.correct_result+t.incorrect_result)) as rating,
    @rownum := @rownum+1 AS position ,(t.gu_home+t.gu_away) as gu,(t.gk_home+t.gk_away) as gk ".
    " FROM( ".
    " SELECT ".
    " us.id as user_id, ".
    " SUM(IF(pp.home_prediction=m.home_score AND pp.away_prediction=m.away_score,1,0)) AS correct_score, ".
    " SUM(IF(((pp.home_prediction<pp.away_prediction AND m.home_score<m.away_score) ".
    " OR (pp.home_prediction>pp.away_prediction AND m.home_score>m.away_score) ".
    " OR (pp.home_prediction=pp.away_prediction AND m.home_score=m.away_score) ".
    " ),1,0))AS correct_result, ".
    " SUM(IF(((pp.home_prediction<pp.away_prediction AND m.home_score>=m.away_score) ".
    " OR (pp.home_prediction>pp.away_prediction AND m.home_score<=m.away_score) ".
    " OR (pp.home_prediction=pp.away_prediction AND m.home_score!=m.away_score) ".
    " ),1,0))AS incorrect_result, ".
    " SUM(IF(pp.home_prediction=m.home_score,1,0))AS gu_home, ".
    " SUM(IF(pp.away_prediction=m.away_score,1,0))AS gu_away, ".
    " SUM(IF(pp.home_prediction!=m.home_score,-1,0))AS gk_home, ".
    " SUM(IF(pp.away_prediction!=m.away_score,-1,0))AS gk_away ".
    " FROM `#__users` us ".
    " LEFT JOIN `#__masterleaguepro_player_prediction` pp ON pp.user_id=us.id ".
    " LEFT JOIN `#__masterleaguepro_match` m ON m.id=pp.match_id AND m.id IN (".$matchdays.") ".
    " GROUP BY us.id ".
    " )t ".
    " JOIN (SELECT @rownum := 0) r ".
    " INNER JOIN `#__users` u ON t.user_id=u.id ".
    " INNER JOIN `#__masterleaguepro_users` mu ON mu.user_id=u.id ".
    " INNER JOIN `#__masterleaguepro_leagues` l ON mu.league_id=l.id AND l.id=".$league.
    " ORDER BY points DESC,rating DESC ".
    " ) z ".
    " ORDER BY z.points DESC,z.gu DESC ,goal_difference DESC ".
    " LIMIT 0,".$to;



    Kind Regards
    Support Department
    Multihosting
    Support Operator
    MultiHosting.com

  5. #5
    Super Moderator
    Join Date
    Mar 2012
    Posts
    183
    --------------------------------------------------
    Topic Transfered from old forum
    --------------------------------------------------

    Hi Team, thanks for the code. When I replace the code with the new code it results in a blank homepage. The error on the website is Parse error: syntax error, unexpected T_STRING in /modules/mod_masterleaguepro_playerform/helper.php on line 58

    Here is the edited helper.php file
    <?php
    /**
    * @version 1.0.0
    * @package com_masterleaguepro
    * @copyright Copyright (C) 2014. All rights reserved.
    * @license GNU General Public License version 2 or later; see http://master-league.com/master-leag...s-licence.html
    * @author multihosting.gr <info@multihosting.gr> - http://www.multihosting.gr
    */


    // no direct access
    defined('_JEXEC') or die;

    class modMasterLeagueProPlayerform
    {
    /**
    * Retrieves the hello message
    *
    * @param array $params An object containing the module parameters
    * @access public
    */
    public static function getTopPlayers( $params )
    {
    $season=$params->get('season');
    $league=$params->get("league");
    $to=$params->get('numberOfShown');
    $forMatchdays=$params->get("forMatchdays");

    $db = JFactory::getDbo();

    /*get the matchdays*/
    $query="SELECT id ".
    " FROM `#__masterleaguepro_matchday` ".
    " WHERE season_id=$season ".
    " ORDER BY `date` DESC,id DESC ".
    " LIMIT 0 ,". $forMatchdays ;

    $db->setQuery($query);

    $matchdayList=$db->loadObjectList();
    if(empty($matchdayList)){
    return array();
    }

    /*create a id string of matchdays(mysql version does not support limit inside the IN query*/
    $matchdays="";

    foreach ($matchdayList as $key => $matchday) {
    $matchdays.=$matchday->id.",";
    }

    $matchdays=rtrim($matchdays,',');



    /*get the log*/
    $query="SELECT z.username,z.user_id,z.points,z.win as wins,z.draw as draws,z.lose as loses,(z.win+z.draw+z.lose) as matches_played,z.gu as goal_for,z.gk as goal_against,(z.gu+z.gk) as goal_difference
    " FROM( ".
    " SELECT u.username,t.user_id,((t.correct_score*l.correct_s core)+(t.correct_result*l.correct_result)+(t.incor rect_result*l.incorrect_result)) as points,(t.correct_result+t.incorrect_result) as matches,t.correct_score as win,t.correct_result-t.correct_score as draw,t.incorrect_result as lose,((t.correct_score*10+t.correct_result)/(t.correct_result+t.incorrect_result)) as rating,
    @rownum := @rownum+1 AS position ,(t.gu_home+t.gu_away) as gu,(t.gk_home+t.gk_away) as gk ".
    " FROM( ".
    " SELECT ".
    " us.id as user_id, ".
    " SUM(IF(pp.home_prediction=m.home_score AND pp.away_prediction=m.away_score,1,0)) AS correct_score, ".
    " SUM(IF(((pp.home_prediction<pp.away_prediction AND m.home_score<m.away_score) ".
    " OR (pp.home_prediction>pp.away_prediction AND m.home_score>m.away_score) ".
    " OR (pp.home_prediction=pp.away_prediction AND m.home_score=m.away_score) ".
    " ),1,0))AS correct_result, ".
    " SUM(IF(((pp.home_prediction<pp.away_prediction AND m.home_score>=m.away_score) ".
    " OR (pp.home_prediction>pp.away_prediction AND m.home_score<=m.away_score) ".
    " OR (pp.home_prediction=pp.away_prediction AND m.home_score!=m.away_score) ".
    " ),1,0))AS incorrect_result, ".
    " SUM(IF(pp.home_prediction=m.home_score,1,0))AS gu_home, ".
    " SUM(IF(pp.away_prediction=m.away_score,1,0))AS gu_away, ".
    " SUM(IF(pp.home_prediction!=m.home_score,-1,0))AS gk_home, ".
    " SUM(IF(pp.away_prediction!=m.away_score,-1,0))AS gk_away ".
    " FROM `#__users` us ".
    " LEFT JOIN `#__masterleaguepro_player_prediction` pp ON pp.user_id=us.id ".
    " LEFT JOIN `#__masterleaguepro_match` m ON m.id=pp.match_id AND m.id IN (".$matchdays.") ".
    " GROUP BY us.id ".
    " )t ".
    " JOIN (SELECT @rownum := 0) r ".
    " INNER JOIN `#__users` u ON t.user_id=u.id ".
    " INNER JOIN `#__masterleaguepro_users` mu ON mu.user_id=u.id ".
    " INNER JOIN `#__masterleaguepro_leagues` l ON mu.league_id=l.id AND l.id=".$league.
    " ORDER BY points DESC,rating DESC ".
    " ) z ".
    " ORDER BY z.points DESC,z.gu DESC ,goal_difference DESC ".
    " LIMIT 0,".$to;

    $db->setQuery($query);
    return $db->loadObjectList();
    }
    }


    ?>
    Support Operator
    MultiHosting.com

  6. #6
    Super Moderator
    Join Date
    Mar 2012
    Posts
    183
    --------------------------------------------------
    Topic Transfered from old forum
    --------------------------------------------------

    Replace the line after : /*get the log*/
    with the following one:

    $query="SELECT z.username,z.user_id,z.points,z.win as wins,z.draw as draws,z.lose as loses,(z.win+z.draw+z.lose) as matches_played,z.gu as goal_for,z.gk as goal_against,(z.gu+z.gk) as goal_difference".

    so it should look something like this :

    /*get the log*/
    $query="SELECT z.username,z.user_id,z.points,z.win as wins,z.draw as draws,z.lose as loses,(z.win+z.draw+z.lose) as matches_played,z.gu as goal_for,z.gk as goal_against,(z.gu+z.gk) as goal_difference".
    " FROM( ".

    (essentially the quotes were mismatched and a dot was missing)
    and try again

    Kind Regards
    Support Department
    Support Operator
    MultiHosting.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •