?> <td width="10%" nowrap="nowrap" style="text-align: left;"><?php if ($row->birthday != "0000-00-00") { switch ($this->config['show_birthday_staff']) { case 1: // show Birthday and Age $birthdateStr = JHTML::date($row->birthday, JText::_('COM_JOOMLEAGUE_GLOBAL_DAYDATE')); $birthdateStr .= " (" . JoomleagueHelper::getAge($row->birthday, $row->deathday) . ")"; break; case 2: // show Only Birthday $birthdateStr = JHTML::date($row->birthday, JText::_('COM_JOOMLEAGUE_GLOBAL_DAYDATE')); break; case 3: // show Only Age $birthdateStr = "(" . JoomleagueHelper::getAge($row->birthday, $row->deathday) . ")"; break; case 4: // show Only Year of birth $birthdateStr = JHTML::date($row->birthday, 'Y'); break; default: $birthdateStr = ""; break; } } else { $birthdateStr = "-"; } // deathday if ($row->deathday != "0000-00-00") { $birthdateStr .= ' [ † ' . JHTML::date($row->deathday, JText::_('COM_JOOMLEAGUE_GLOBAL_DAYDATE')) . ']';
</span></td> <td class="data"><?php #$this->playerage', $model->getAge( $this->player->birthday, $this->project->start_date ); switch ($this->config['show_birthday']) { case 1: // show Birthday and Age $birthdateStr = $this->person->birthday != "0000-00-00" ? JHtml::date($this->person->birthday . ' UTC', JText::_('COM_JOOMLEAGUE_GLOBAL_DAYDATE'), JoomleagueHelper::getTimezone($this->project, $this->overallconfig)) : "-"; $birthdateStr .= " (" . JoomleagueHelper::getAge($this->person->birthday, $this->person->deathday) . ")"; break; case 2: // show Only Birthday $birthdateStr = $this->person->birthday != "0000-00-00" ? JHtml::date($this->person->birthday . ' UTC', JText::_('COM_JOOMLEAGUE_GLOBAL_DAYDATE'), JoomleagueHelper::getTimezone($this->project, $this->overallconfig)) : "-"; break; case 3: // show Only Age $birthdateStr = JoomleagueHelper::getAge($this->person->birthday, $this->person->deathday); break; case 4: // show Only Year of birth $birthdateStr = $this->person->birthday != "0000-00-00" ? JHtml::date($this->person->birthday . ' UTC', JText::_('%Y'), JoomleagueHelper::getTimezone($this->project, $this->overallconfig)) : "-"; break; default: $birthdateStr = ""; break; } echo $birthdateStr; ?> </td> </tr> <?php }
default: $showbirthday = 0; $showage = 0; break; } if ($showage == 1) { ?> <div> <span class="jl_roster_persondetails_label"> <?php echo JText::_("COM_JOOMLEAGUE_PERSON_AGE"); ?> </span> <span class="jl_roster_persondetails_data"> <?php echo JoomleagueHelper::getAge($this->row->birthday, $this->row->deathday); ?> </span> </div> <?php } if ($showbirthday == 1) { ?> <div> <span class="jl_roster_persondetails_label"> <?php echo JText::_("COM_JOOMLEAGUE_PERSON_BIRTHDAY"); ?> </span> <span class="jl_roster_persondetails_data"> <?php
<td class="data"> <?php #$this->playerage = $model->getAge( $this->player->birthday, $this->project->start_date ); switch ($this->config['show_birthday']) { case 1: // show Birthday and Age $birthdateStr = $this->referee->birthday != "0000-00-00" ? JHtml::date($this->referee->birthday . ' UTC', JText::_('COM_JOOMLEAGUE_GLOBAL_DAYDATE'), JoomleagueHelper::getTimezone($this->project, $this->overallconfig)) : "-"; $birthdateStr .= " (" . JoomleagueHelper::getAge($this->referee->birthday, $this->referee->deathday) . ")"; break; case 2: // show Only Birthday $birthdateStr = $this->referee->birthday != "0000-00-00" ? JHtml::date($this->referee->birthday . ' UTC', JText::_('COM_JOOMLEAGUE_GLOBAL_DAYDATE'), JoomleagueHelper::getTimezone($this->project, $this->overallconfig)) : "-"; break; case 3: // show Only Age $birthdateStr = JoomleagueHelper::getAge($this->referee->birthday, $this->referee->deathday); break; case 4: // show Only Year of birth $birthdateStr = $this->referee->birthday != "0000-00-00" ? JHtml::date($this->referee->birthday . ' UTC', JText::_('%Y'), JoomleagueHelper::getTimezone($this->project, $this->overallconfig)) : "-"; break; default: $birthdateStr = ""; break; } echo $birthdateStr; ?> </td> </tr> <?php }
/** * Get total number of players assigned to a team * @param int projectid * @param int projectteamid * @return int */ function getPlayerMeanAge($projectid, $projectteamid) { //$player = array(); $meanage = 0; $countplayer = 0; $age = 0; $query = " SELECT ps.*" . " FROM #__joomleague_person AS ps " . " INNER JOIN #__joomleague_team_player AS tp ON tp.person_id = ps.id " . " INNER JOIN #__joomleague_project_team AS pt ON tp.projectteam_id = pt.id " . " WHERE pt.project_id=" . $projectid . " AND pt.id=" . $projectteamid . " AND tp.published = 1 " . " AND ps.published = 1 "; $this->_db->setQuery($query); $players = $this->_db->loadObjectList(); foreach ($players as $player) { if ($player->birthday != '0000-00-00') { $age += JoomleagueHelper::getAge($player->birthday, $player->deathday); $countplayer++; } } // diddipoeler // damit kein fehler hochkommt: Warning: Division by zero if ($age != 0) { $meanage = round($age / $countplayer, 2); } return $meanage; }
case 3: // show Only Age $birthdateStr = "(" . JoomleagueHelper::getAge($row->birthday, $row->deathday) . ")"; break; case 4: // show Only Year of birth $birthdateStr = JHTML::date($row->birthday, 'Y'); break; default: $birthdateStr = ""; break; } // das alter berechnen zur weiterberechnung des durchschnittsalters // nicht das alter normal berechnen, sonder das alter des spielers in der saison //$age += JoomleagueHelper::getAge( $row->birthday,$row->deathday ); $age += JoomleagueHelper::getAge($row->birthday, $this->lastseasondate); $countplayer++; } else { $birthdateStr = "-"; } // deathday if ($row->deathday != "0000-00-00") { $birthdateStr .= ' [† ' . JHTML::date($row->deathday, JText::_('COM_JOOMLEAGUE_GLOBAL_DAYDATE')) . ']'; } echo $birthdateStr; ?> </td><?php } elseif ($this->config['show_birthday_staff'] > 0) { ?> <td width="10%" nowrap="nowrap" style="text-align: left;"> </td><?php }
// show Only Birthday $birthdateStr = JHTML::date($players->birthday, JText::_('COM_JOOMLEAGUE_GLOBAL_DAYDATE')); break; case 3: // show Only Age $birthdateStr = "(" . JoomleagueHelper::getAge($players->birthday, $players->deathday) . ")"; break; case 4: // show Only Year of birth $birthdateStr = JHTML::date($players->birthday, 'Y'); break; default: $birthdateStr = ""; break; } $age += JoomleagueHelper::getAge($players->birthday, $players->deathday); $countplayer++; } else { $birthdateStr = "-"; } // deathday if ($players->deathday != "0000-00-00") { $birthdateStr .= ' [† ' . JHTML::date($players->deathday, JText::_('COM_JOOMLEAGUE_GLOBAL_DAYDATE')) . ']'; } echo $birthdateStr; ?> </td> <?php } if ($this->config['show_games_played']) { $played = $players->start + $players->came_in;