Skip to content

Commit

Permalink
update für die userfelder. diese werden jetzt auch
Browse files Browse the repository at this point in the history
im roster angezeigt.
bessere darstellung der google-map und berechnung der
latitude und longitude.
  • Loading branch information
diddipoeler committed Jan 15, 2013
1 parent 2dfc543 commit cce0602
Show file tree
Hide file tree
Showing 125 changed files with 348 additions and 22 deletions.
23 changes: 20 additions & 3 deletions administrator/components/com_joomleague/controllers/club.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,31 @@ function save()
// Check for request forgeries
JRequest::checkToken() or die('JL_GLOBAL_INVALID_TOKEN');
$msg='';
$address_parts = array();
$post=JRequest::get('post');
$cid=JRequest::getVar('cid',array(0),'post','array');
$post['id']=(int) $cid[0];
$model=$this->getModel('club');

//echo 'club save post<pre>',print_r($post['extended'],true),'</pre><br>';

$address_parts[] = $post['address'];
$address_parts[] = $post['state'];
$address_parts[] = $post['zipcode'];
$address_parts[] = $post['location'];
$address_parts[] = Countries::getShortCountryName($post['country']);
$address_string = implode(', ', $address_parts);;
//$address_string = $model->getAddressString();
//echo 'club save post<pre>',print_r($post['extended'],true),'</pre><br>';
//echo 'club save post latitude<pre>',print_r($post['extended']['JL_ADMINISTRATIVE_AREA_LEVEL_1_LATITUDE'],true),'</pre><br>';
//echo 'club save address_string<pre>',print_r($address_string,true),'</pre><br>';

// auf alle fälle die koordinaten
$address_geocode_lat_long = $model->JLgetLatLongGeoCoords($address_string) ;
$lat = $address_geocode_lat_long['2'];
$lng = $address_geocode_lat_long['3'];
$post['extended']['JL_ADMINISTRATIVE_AREA_LEVEL_1_LATITUDE'] = $lat;
$post['extended']['JL_ADMINISTRATIVE_AREA_LEVEL_1_LONGITUDE'] = $lng;

if ($model->store($post))
if ($model->store($post))
{
$msg=JText::_('JL_ADMIN_CLUB_CTRL_SAVED');
$createTeam=JRequest::getVar('createTeam');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ CREATE TABLE IF NOT EXISTS `#__joomleague_jltable_fields` (
`description` VARCHAR(100) NOT NULL DEFAULT '' ,
`checked_out` INT(11) NOT NULL DEFAULT '0' ,
`checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' ,
`count` INT(11) NOT NULL DEFAULT '0' ,
PRIMARY KEY (`id`) ,
UNIQUE INDEX `name` (`tablename`,`fieldname`)
)
Expand All @@ -46,6 +47,7 @@ CREATE TABLE IF NOT EXISTS `#__joomleague_associations` (
`short_name` varchar(75) NOT NULL default '',
`middle_name` varchar(75) NOT NULL default '',
`website` varchar(250) NOT NULL default '',
`assocflag` VARCHAR(255) NOT NULL DEFAULT 'placeholder_flags.png' ,
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`,`country`)
) ENGINE=MyISAM ;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ CREATE TABLE IF NOT EXISTS `#__joomleague_jltable_fields` (
`description` VARCHAR(100) NOT NULL DEFAULT '' ,
`checked_out` INT(11) NOT NULL DEFAULT '0' ,
`checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' ,
`count` INT(11) NOT NULL DEFAULT '0' ,
PRIMARY KEY (`id`) ,
UNIQUE INDEX `name` (`tablename`,`fieldname`)
)
Expand All @@ -48,6 +49,7 @@ CREATE TABLE IF NOT EXISTS `#__joomleague_associations` (
`short_name` varchar(75) NOT NULL default '',
`middle_name` varchar(75) NOT NULL default '',
`website` varchar(250) NOT NULL default '',
`assocflag` VARCHAR(255) NOT NULL DEFAULT 'placeholder_flags.png' ,
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`,`country`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ class Tablejlextuserfield extends JTable
var $description;
var $checked_out;
var $checked_out_time;
var $count;



/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
echo 'divisions<pre>',print_r($this->divisions,true),'</pre><br>';
echo 'teams<pre>',print_r($this->teams,true),'</pre><br>';

echo 'project<pre>',print_r($this->project,true),'</pre><br>';

}

$nbcols = 2;
Expand Down Expand Up @@ -41,9 +43,7 @@
?>

<?php




if ( $this->project->country && $this->overallconfig['show_project_country_info'] == "1" )
{

Expand Down Expand Up @@ -134,6 +134,25 @@
</tr>
<?php
}

// diddipoeler
if ( $this->overallconfig['show_project_association'] == "1" && $this->project->assocname )
{
?>
<tr class="contentheading">
<td colspan="<?php echo $nbcols; ?>">
<?php
$path = JURI::root().'media/com_joomleague/flags_associations/'.$this->project->assocflag;
$attributes='';
$html = '<img src="'.$path.'" alt="'.$this->project->assocname.'" ';
$html .= 'title="'.$this->project->assocname.'" '.$attributes.' />';
echo $html . ' ' . $this->project->assocname;
?>
</td>
</tr>
<?php
}

?>
<tr class="contentheading">
<?php
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
defined('_JEXEC') or die('Restricted access');

jimport('joomla.application.component.model');
jimport('joomla.filesystem.folder');
jimport('joomla.filesystem.file');

require_once (JPATH_COMPONENT.DS.'models'.DS.'item.php');

/**
Expand Down Expand Up @@ -100,13 +103,36 @@ function _initData()
$object->checked_out_time = 0;
$object->extended = null;
$object->ordering = 0;

$object->website = null;
$object->assocflag = 'placeholder_flags.png';
$this->_data = $object;

return (boolean) $this->_data;
}
return true;
}


function getAssocFlags()
{
global $mainframe, $option;
$mainframe =& JFactory::getApplication();
//$baseFolder = JURI::root().'media/com_joomleague/flags_associations';
$baseFolder = JPATH_SITE.'/media/com_joomleague/flags_associations';
$mainframe->enqueueMessage(JText::_(''.$baseFolder),'NOTICE');

// $mainframe->enqueueMessage(JText::_(''.JPATH_BASE),'NOTICE');
// $mainframe->enqueueMessage(JText::_(''.JURI::root()),'NOTICE');
// $mainframe->enqueueMessage(JText::_(''.JURI::base()),'NOTICE');

$files = JFolder::files($baseFolder, '', false, false, array('index.html', '.svn') );

//echo 'getAssocFlags<pre>',print_r($files,true),'</pre><br>';

return $files;
}

/**
* Method to add a league if not already exists
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ class Tablejlextassociation extends JLTable {

var $checked_out;
var $checked_out_time;
var $website;
var $assocflag;

/**
* Constructor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@
<td valign="top" align="right" class="key"><label for="ordering"><?php echo JText::_('JL_ADMIN_ASSOCIATION_COUNTRY'); ?></label></td>
<td><?php echo $this->lists['countries']; ?>&nbsp;<?php echo Countries::getCountryFlag($this->object->country); ?>&nbsp;(<?php echo $this->object->country; ?>)</td>
</tr>

<tr>
<td valign="top" align="right" class="key"><label for="ordering"><?php echo JText::_('JL_ADMIN_ASSOCIATION_FLAG'); ?></label></td>
<td><?php echo $this->lists['assocflag']; ?></td>
</tr>

<tr>
<td valign="top" align="right" class="key"><label for="ordering"><?php echo JText::_('JL_ADMIN_ASSOCIATION_ORDERING'); ?></label></td>
<td><?php echo $this->lists['ordering']; ?></td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,15 @@ function _displayForm($tpl)
$object->order=0;
}

$assocflags = $model->getAssocFlags();
$options = array();
foreach ( $assocflags as $key => $value )
{
$options[] = JHTML::_('select.option', $value, $value );
}
$lists['assocflag'] = JHTML::_('select.genericlist', $options, 'assocflag', 'class="inputbox"', 'value', 'text', $object->assocflag);


//build the html select list for countries
$countries[]=JHTML::_('select.option','',JText::_('JL_ADMIN_ASSOCIATION_SELECT_COUNTRY'));
if ($res =& Countries::getCountryOptions()){$countries=array_merge($countries,$res);}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ class="text_area" onchange="document.adminForm.submit(); " />
echo JHTML::_('grid.sort','JL_ADMIN_ASSOCIATIONS_COUNTRY','objassoc.country',$this->lists['order_Dir'],$this->lists['order']);
?>
</th>

<th width="5" style="vertical-align: top; "><?php echo JText::_('JL_ADMIN_ASSOCIATION_FLAG'); ?></th>

<th width="85" nowrap="nowrap" style="vertical-align: top; ">
<?php
echo JHTML::_('grid.sort','JL_GLOBAL_ORDER','objassoc.ordering',$this->lists['order_Dir'],$this->lists['order']);
Expand Down Expand Up @@ -99,7 +102,16 @@ class="text_area" onchange="document.adminForm.submit(); " />
<td><?php echo $row->name; ?></td>
<td><?php echo $row->short_name; ?></td>
<td style="text-align:center; "><?php echo Countries::getCountryFlag($row->country); ?></td>
<td class="order">
<td style="text-align:center; ">
<?php
$path = JURI::root().'media/com_joomleague/flags_associations/'.$row->assocflag;
$attributes='';
$html = '<img src="'.$path.'" alt="'.$row->name.'" ';
$html .= 'title="'.$row->name.'" '.$attributes.' />';
echo $html;
?>
</td>
<td class="order">
<span>
<?php echo $this->pagination->orderUpIcon($i,$i > 0,'orderup','JL_GLOBAL_ORDER_UP',$ordering); ?>
</span>
Expand Down
7 changes: 5 additions & 2 deletions components/com_joomleague/models/project.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,16 @@ function getProject()
if (is_null($this->_project) && $this->projectid > 0)
{
$query='SELECT p.*, l.country,l.picture as league_picture,l.name as league_name,
l.extended as league_extended,
l.extended as league_extended,assoc.name as assocname,assoc.assocflag as assocflag,
CASE WHEN CHAR_LENGTH( p.alias )
THEN CONCAT_WS( \':\', p.id, p.alias )
ELSE p.id
END AS slug
FROM #__joomleague_project AS p
LEFT JOIN #__joomleague_league AS l ON p.league_id = l.id
LEFT JOIN #__joomleague_league AS l
ON p.league_id = l.id
LEFT JOIN #__joomleague_associations AS assoc
ON l.associations = assoc.id
WHERE p.id='. $this->_db->Quote($this->projectid);
$this->_db->setQuery($query,0,1);
$this->_project = $this->_db->loadObject();
Expand Down
34 changes: 30 additions & 4 deletions components/com_joomleague/models/roster.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ class JoomleagueModelRoster extends JoomleagueModelProject
var $projectteamid=0;
var $projectteam=null;
var $team=null;

var $jltable_person = '#__joomleague_person';

/**
* caching for team in out stats
* @var array
Expand All @@ -33,6 +34,19 @@ function __construct()
$this->getProjectTeam();
}

function getUserfields()
{
$query = "SELECT * FROM #__joomleague_jltable_fields
where userfield = 1
and visible = 1
and tablename like '".$this->jltable_person."'";
$this->_db->setQuery($query);
$result = $this->_db->loadObjectList();

return $result;
}


function getTrainingdata()
{
$projectteam =& $this->getprojectteam();
Expand Down Expand Up @@ -123,13 +137,25 @@ function getTeamPlayers()
$projectteam =& $this->getprojectteam();
if (empty($this->_players))
{
$query=' SELECT pr.firstname,
$userfields = $this->getUserfields();

$query = ' SELECT pr.firstname,
pr.nickname,
pr.lastname,
pr.country,
pr.birthday,
pr.deathday,
tp.id AS playerid,
pr.deathday,';
if ( $userfields )
{
foreach ( $userfields as $userfield)
{
$fields[] = 'pr.'.$userfield->fieldname;
}
$fields = implode(",",$fields);
$query .= $fields.',';
}

$query .= 'tp.id AS playerid,
pr.id AS pid,
pr.picture AS ppic,
tp.jerseynumber AS position_number,
Expand Down
9 changes: 8 additions & 1 deletion components/com_joomleague/settings/default/overall.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,20 @@
<option value="1">JL_GLOBAL_YES</option>
</param>

<param name="show_project_country" type="radio" default="0"
<param name="show_project_country" type="radio" default="1"
label="JL_FES_OVERALL_PARAM_LABEL_SHOW_PROJECT_COUNTRY"
description="JL_FES_OVERALL_PARAM_DESCR_SHOW_PROJECT_COUNTRY">
<option value="0">JL_GLOBAL_NO</option>
<option value="1">JL_GLOBAL_YES</option>
</param>

<param name="show_project_association" type="radio" default="1"
label="JL_FES_OVERALL_PARAM_LABEL_SHOW_PROJECT_ASSOCIATION"
description="JL_FES_OVERALL_PARAM_DESCR_SHOW_PROJECT_ASSOCIATION">
<option value="0">JL_GLOBAL_NO</option>
<option value="1">JL_GLOBAL_YES</option>
</param>

<param name="show_project_country_info" type="radio" default="0"
label="JL_FES_OVERALL_PARAM_LABEL_SHOW_PROJECT_COUNTRY_INFO"
description="JL_FES_OVERALL_PARAM_DESCR_SHOW_PROJECT_COUNTRY_INFO">
Expand Down
4 changes: 2 additions & 2 deletions components/com_joomleague/views/clubinfo/view.html.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,10 @@ function display( $tpl = null )
$this->map->setInfoWindowBehaviour('SINGLE_CLOSE_ON_MAPCLICK');
$this->map->setInfoWindowTrigger('CLICK');

$this->map->addMarkerByAddress($this->address_string, $this->club->name, '"<a href="'.$this->club->website.'" target="_blank">'.$this->club->website.'</a>"', "http://maps.google.com/mapfiles/kml/pal2/icon49.png");
//$this->map->addMarkerByAddress($this->address_string, $this->club->name, '"<a href="'.$this->club->website.'" target="_blank">'.$this->club->website.'</a>"', "http://maps.google.com/mapfiles/kml/pal2/icon49.png");
if ( $lat && $lng )
{
$this->map->addMarker($lat, $lng, $this->club->name, $this->address_string );
$this->map->addMarker($lat, $lng, $this->club->name, $this->address_string,JURI::root().'media/com_joomleague/map_icons/'.'icon49.png' );
}

$document->addScript($this->map->JLprintGMapsJS());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
if (count($this->games))
{
?>
<h2><?php echo JText::_('JL_PERSON_GAMES_HISTORY'); ?></h2>
<h2>

<?php echo JText::_('JL_PERSON_GAMES_HISTORY'); ?>

</h2>
<table width="96%" align="center" border="0" cellpadding="0"
cellspacing="0">
<tr>
Expand Down
9 changes: 9 additions & 0 deletions components/com_joomleague/views/player/view.html.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,15 @@ function display($tpl=null)
$this->assignRef('person',$person);
$this->assignRef('nickname',$nickname);

/*
* league extended data
*/
$paramsdata_league = $this->project->league_extended;
$paramsdefs_league = JLG_PATH_ADMIN.DS.'assets'.DS.'extended'.DS.'league.xml';
$extended_league = new JLGExtraParams($paramsdata_league,$paramsdefs_league);
$this->assignRef('league_extended',$extended_league);
$this->assign('show_debug_info', JComponentHelper::getParams('com_joomleague')->get('show_debug_info',0) );

$this->assignRef('teamPlayers',$model->getTeamPlayers());

// Select the teamplayer that is currently published (in case the player played in multiple teams in the project)
Expand Down
4 changes: 2 additions & 2 deletions components/com_joomleague/views/playground/view.html.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ function display( $tpl = null )
$this->map->showStreetViewControl(true);
$this->map->setInfoWindowBehaviour('SINGLE_CLOSE_ON_MAPCLICK');
$this->map->setInfoWindowTrigger('CLICK');
$this->map->addMarkerByAddress($this->address_string, $this->playground->name, '"<a href="'.$this->playground->website.'" target="_blank">'.$this->playground->website.'</a>"', "http://maps.google.com/mapfiles/kml/pal2/icon49.png");
//$this->map->addMarkerByAddress($this->address_string, $this->playground->name, '"<a href="'.$this->playground->website.'" target="_blank">'.$this->playground->website.'</a>"', "http://maps.google.com/mapfiles/kml/pal2/icon49.png");

foreach ( $extended->getGroups() as $key => $groups )
{
Expand All @@ -105,7 +105,7 @@ function display( $tpl = null )

if ( $lat && $lng )
{
$this->map->addMarker($lat, $lng, $this->playground->name, $this->address_string );
$this->map->addMarker($lat, $lng, $this->playground->name, $this->address_string,JURI::root().'media/com_joomleague/map_icons/'.'icon49.png' );
}

$document->addScript($this->map->JLprintGMapsJS());
Expand Down
Loading

0 comments on commit cce0602

Please sign in to comment.