Jump to content

Adding a pix to a Joomla Stats Module-- echoing the picture from Roster Page


treybraid

Recommended Posts

Using a component and a stats module by Fastball Productions called "GridIron"... I'd like to add an echo to pull in the player pix from the roster page that is generated from the component....

 

I have attached the component and module in question... hoping someone can help me out real here with the php echo...

 

Thanks

Trey

 

[attachment deleted by admin]

This is what I have added so far... since the logo is being called from com_gridiron. this should work right?

 

<?php

/**

* @version $Id: mod_fastball_stat_leaders.php, v1.5.4 September 2011 01:32:15---- this is also a stats leader for football...

* @author Fastball Productions

* @package Fastball

* @copyright Copyright © 2011 Fastball Productions

* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL

*/

 

// no direct access

defined( '_JEXEC' ) or die( 'Restricted access' );

 

$com_params = &JComponentHelper::getParams('com_gridiron');

$menuitemid = JRequest::getInt( 'Itemid' );

 

$db =& JFactory::getDBO();

 

/* get the component parameters so we know how to calc ERA (7 or 9 innings); */

$component = JComponentHelper::getComponent('com_gridiron');

$cparams = new JParameter($component->params);

$innings_calculated = $cparams->get('innings_calculated');

 

/* get the module parameters; */

$heading = $params->get( 'heading', '' );

$seasonid = $params->get( 'seasonid', '1' );

$gametypes = $params->get( 'gametypes', '1' );

$teamids = $params->get( 'teamids', '' );

$leagueids = $params->get( 'leagueids', '' );

$divisionids = $params->get( 'divisionids', '' );

$category = $params->get( 'category', '' );

$sort = $params->get( 'sort', 'DESC' );

$stats = $params->get( 'stats', 'player' );

$records = $params->get( 'records', 3 );

$displaylogo = $params->get( 'displaylogo', 0);

 

if (is_array($gametypes)) {

$gametypes = implode(',', $gametypes);

}

if (is_array($teamids)) {

$teamids = implode(',', $teamids);

}

if (is_array($leagueids)) {

$leagueids = implode(',', $leagueids);

}

if (is_array($divisionids)) {

$divisionids = implode(',', $divisionids);

}

 

/* create lookup arrays for the different type of stats - batting/base-running and pitching; */

/* this is needed to determine what query we need to run to get the stats; */

$offense = array('passing', 'rushing', 'receiving');

$defense = array('tackles', 'sacks', 'interceptions');

 

/* need to get a listing of all teams that are a part of the league and/or division; */

if ($teamids) {

$ids = $teamids;

}

else {

if ($divisionids) {

/* get a listing of all team ID's that belong in the league and division; */

$sql = "SELECT id, name, shortname FROM #__gridiron_team WHERE (FIND_IN_SET(divisionid, '$divisionids'))";

}

else {

/* get a listing of all team ID's that belong in the league; */

$sql = "SELECT id, name, shortname FROM #__gridiron_team WHERE (FIND_IN_SET(leagueid, '$leagueids'))";

}

$db->setQuery($sql);

$ids = $db->loadResultArray();

$ids = implode(',', $ids);

}

 

/* determine what stat category is configured and run the correct query; */

if (in_array($category, $offense)) {

if ($stats == 'player') {

if ($category == 'passing') {

$category = 'totalyards';

$db->setQuery("SELECT s.playerid AS id, CONCAT(p.fname, ' ', p.lname) AS name, s.teamid, t.logo, SUM(s.yards) AS totalyards FROM #__gridiron_passing AS s LEFT JOIN #__gridiron_player AS p ON p.id = s.playerid LEFT JOIN #__gridiron_team AS t ON t.id = p.teamid LEFT JOIN #__gridiron_schedule AS e ON e.id = s.gameid WHERE (FIND_IN_SET(s.teamid, '$ids') AND FIND_IN_SET(e.gametype, '$gametypes') AND s.yards > 0 AND s.seasonid = {$seasonid}) GROUP BY p.playerid ORDER BY totalyards $sort LIMIT 0, {$records}");

}

 

if ($category == 'rushing') {

$category = 'totalyards';

$db->setQuery("SELECT s.playerid AS id, CONCAT(p.fname, ' ', p.lname) AS name, s.teamid, t.logo, SUM(s.yards) AS totalyards FROM #__gridiron_rushing AS s LEFT JOIN #__gridiron_player AS p ON p.id = s.playerid LEFT JOIN #__gridiron_team AS t ON t.id = p.teamid LEFT JOIN #__gridiron_schedule AS e ON e.id = s.gameid WHERE (FIND_IN_SET(s.teamid, '$ids') AND FIND_IN_SET(e.gametype, '$gametypes') AND s.yards > 0 AND s.seasonid = {$seasonid}) GROUP BY p.playerid ORDER BY totalyards $sort LIMIT 0, {$records}");

}

 

if ($category == 'receiving') {

$category = 'totalyards';

$db->setQuery("SELECT s.playerid AS id, CONCAT(p.fname, ' ', p.lname) AS name, s.teamid, t.logo, SUM(s.yards) AS totalyards FROM #__gridiron_receiving AS s LEFT JOIN #__gridiron_player AS p ON p.id = s.playerid LEFT JOIN #__gridiron_team AS t ON t.id = p.teamid LEFT JOIN #__gridiron_schedule AS e ON e.id = s.gameid WHERE (FIND_IN_SET(s.teamid, '$ids') AND FIND_IN_SET(e.gametype, '$gametypes') AND s.yards > 0 AND s.seasonid = {$seasonid}) GROUP BY p.playerid ORDER BY totalyards $sort LIMIT 0, {$records}");

}

}

else {

if ($category == 'passing') {

$category = 'totalyards';

$db->setQuery("SELECT s.teamid AS id, t.logo, t.name AS name, t.shortname, SUM(s.yards) AS totalyards FROM #__gridiron_passing AS s LEFT JOIN #__gridiron_team AS t ON t.id = s.teamid LEFT JOIN #__gridiron_schedule AS e ON e.id = s.gameid WHERE (FIND_IN_SET(s.teamid, '$ids') AND s.yards > 0 AND s.seasonid = {$seasonid}) GROUP BY s.teamid ORDER BY totalyards $sort LIMIT 0, {$records}");

}

 

if ($category == 'rushing') {

$category = 'totalyards';

$db->setQuery("SELECT s.teamid AS id, t.logo, t.name AS name, t.shortname, SUM(s.yards) AS totalyards FROM #__gridiron_rushing AS s LEFT JOIN #__gridiron_team AS t ON t.id = s.teamid LEFT JOIN #__gridiron_schedule AS e ON e.id = s.gameid WHERE (FIND_IN_SET(s.teamid, '$ids') AND s.yards > 0 AND s.seasonid = {$seasonid}) GROUP BY s.teamid ORDER BY totalyards $sort LIMIT 0, {$records}");

}

 

if ($category == 'receiving') {

$category = 'totalyards';

$db->setQuery("SELECT s.teamid AS id, t.logo, t.name AS name, t.shortname, SUM(s.yards) AS totalyards FROM #__gridiron_receiving AS s LEFT JOIN #__gridiron_team AS t ON t.id = s.teamid LEFT JOIN #__gridiron_schedule AS e ON e.id = s.gameid WHERE (FIND_IN_SET(s.teamid, '$ids') AND s.yards > 0 AND s.seasonid = {$seasonid}) GROUP BY s.teamid ORDER BY totalyards $sort LIMIT 0, {$records}");

}

}

$rows = $db->loadObjectList();

}

else if (in_array($category, $defense)) {

if ($stats == 'player') {

if ($category == 'tackles') {

$category = 'total';

$db->setQuery("SELECT s.playerid AS id, CONCAT(p.fname, ' ', p.lname) AS name, s.teamid, t.logo, SUM(s.total) AS total FROM #__gridiron_defense AS s LEFT JOIN #__gridiron_player AS p ON p.id = s.playerid LEFT JOIN #__gridiron_team AS t ON t.id = p.teamid LEFT JOIN #__gridiron_schedule AS e ON e.id = s.gameid WHERE (FIND_IN_SET(s.teamid, '$ids') AND FIND_IN_SET(e.gametype, '$gametypes') AND s.total > 0 AND s.seasonid = {$seasonid}) GROUP BY p.playerid ORDER BY total $sort LIMIT 0, {$records}");

}

 

if ($category == 'sacks') {

$category = 'total';

$db->setQuery("SELECT s.playerid AS id, CONCAT(p.fname, ' ', p.lname) AS name, s.teamid, t.logo, SUM(s.sacks) AS total FROM #__gridiron_defense AS s LEFT JOIN #__gridiron_player AS p ON p.id = s.playerid LEFT JOIN #__gridiron_team AS t ON t.id = p.teamid LEFT JOIN #__gridiron_schedule AS e ON e.id = s.gameid WHERE (FIND_IN_SET(s.teamid, '$ids') AND FIND_IN_SET(e.gametype, '$gametypes') AND s.total > 0 AND s.seasonid = {$seasonid}) GROUP BY p.playerid ORDER BY total $sort LIMIT 0, {$records}");

}

 

if ($category == 'interceptions') {

$category = 'total';

$db->setQuery("SELECT s.playerid AS id, CONCAT(p.fname, ' ', p.lname) AS name, s.teamid, t.logo, SUM(s.interceptions) AS total FROM #__gridiron_interceptions AS s LEFT JOIN #__gridiron_player AS p ON p.id = s.playerid LEFT JOIN #__gridiron_team AS t ON t.id = p.teamid LEFT JOIN #__gridiron_schedule AS e ON e.id = s.gameid WHERE (FIND_IN_SET(s.teamid, '$ids') AND FIND_IN_SET(e.gametype, '$gametypes') AND s.interceptions > 0 AND s.seasonid = {$seasonid}) GROUP BY p.playerid ORDER BY total $sort LIMIT 0, {$records}");

}

}

else {

if ($category == 'tackles') {

$category = 'total';

$db->setQuery("SELECT s.teamid AS id, t.logo, t.name AS name, t.shortname, SUM(s.total) AS total FROM #__gridiron_defense AS s LEFT JOIN #__gridiron_player AS p ON p.id = s.playerid LEFT JOIN #__gridiron_team AS t ON t.id = s.teamid LEFT JOIN #__gridiron_schedule AS e ON e.id = s.gameid WHERE (FIND_IN_SET(s.teamid, '$ids') AND FIND_IN_SET(e.gametype, '$gametypes') AND s.total > 0 AND s.seasonid = {$seasonid}) GROUP BY s.teamid ORDER BY total $sort LIMIT 0, {$records}");

}

 

if ($category == 'sacks') {

$category = 'total';

$db->setQuery("SELECT s.teamid AS id, t.logo, t.name AS name, t.shortname, SUM(s.sacks) AS total FROM #__gridiron_defense AS s LEFT JOIN #__gridiron_player AS p ON p.id = s.playerid LEFT JOIN #__gridiron_team AS t ON t.id = s.teamid LEFT JOIN #__gridiron_schedule AS e ON e.id = s.gameid WHERE (FIND_IN_SET(s.teamid, '$ids') AND FIND_IN_SET(e.gametype, '$gametypes') AND s.total > 0 AND s.seasonid = {$seasonid}) GROUP BY s.teamid ORDER BY total $sort LIMIT 0, {$records}");

}

 

if ($category == 'interceptions') {

$category = 'total';

$db->setQuery("SELECT s.teamid AS id, t.logo, t.name AS name, t.shortname, SUM(s.interceptions) AS total FROM #__gridiron_interceptions AS s LEFT JOIN #__gridiron_player AS p ON p.id = s.playerid LEFT JOIN #__gridiron_team AS t ON t.id = s.teamid LEFT JOIN #__gridiron_schedule AS e ON e.id = s.gameid WHERE (FIND_IN_SET(s.teamid, '$ids') AND FIND_IN_SET(e.gametype, '$gametypes') AND s.interceptions > 0 AND s.seasonid = {$seasonid}) GROUP BY s.teamid ORDER BY total $sort LIMIT 0, {$records}");

}

}

$rows = $db->loadObjectList();

}

else {

/* stat category could not be determined so mimic a blank rowset; */

$rows = array();

}

?>

<table border="0" cellspacing="0" cellpadding="0">

  <tr>

    <td width="100" rowspan="2" ><img src="<?php echo JURI::base() . $com_params->get('images_path') . $player->photo;?>" alt="" width="100" align="middle" border="0"/></td>

    <td colspan="3"><b><?php echo $heading;?></b></td>

  </tr>

  <?php foreach ($rows as $row) { ?>

<?php $row->shortname ? $row->name = $row->shortname:NULL;?>

  <tr>

  <?php if ($displaylogo) { ?>

    <td nowrap="nowrap">

<?php if ($stats == 'player') { ?>

<a href="<?php echo JRoute::_("index.php?option=com_gridiron&view=player&id=$row->id&Itemid=$menuitemid");?>"><?php echo $row->name;?></a>

<?php } else { ?>

<a href="<?php echo JRoute::_("index.php?option=com_gridiron&view=team&id=$row->id&Itemid=$menuitemid");?>"><?php echo $row->name;?></a>

<?php } ?></td>

    <td align="right" nowrap="nowrap"><?php echo $row->$category;?> <?php echo $category == 'totalyards' ? 'Yds':NULL;?></td>

<?php } ?>

     

    <td width="50"><img src="<?php echo JURI::base() . $com_params->get('images_path') . $row->logo;?>" alt="" width="50" align="middle" border="0" /></td>

  </tr>

  <?php } ?>

</table>

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.