function display($tpl = null) { $document = JFactory::getDocument(); $document->link = JRoute::_('index.php?option=com_joomleague'); $model = $this->getModel(); $config = $model->getTemplateConfig($this->getName()); $this->config = $config; $this->overallconfig = $model->getOverallConfig(); $this->homematches = $model->getHomeMatches($config['HomeMatchesOrderBy']); $this->awaymatches = $model->getAwayMatches($config['AwayMatchesOrderBy']); $this->project = $model->getProject(); $this->matches = array_merge($this->homematches, $this->awaymatches); foreach ($this->matches as $game) { $item = new JFeedItem(); $team1 = $game->tname1; $team2 = $game->tname2; $date = $game->match_date ? JoomleagueHelper::getMatchDate($game, 'r') : ''; $result = $game->cancel > 0 ? $game->cancel_reason : $game->team1_result . "-" . $game->team2_result; if (!empty($game->team1_result)) { $link = 'index.php?option=com_joomleague&view=matchreport&p='; } else { $link = 'index.php?option=com_joomleague&view=nextmatch&p='; } $item->title = $team1 . " - " . $team2 . " : " . $result; $item->link = JRoute::_($link . $game->project_id . '&mid=' . $game->id); $item->description = $game->summary; $item->date = $date; $item->category = "clubplan"; // loads item info into rss array $document->addItem($item); } }
/** * return an array of matches indexed by date * * @return array */ public function sortByDate() { $dates = array(); foreach ((array) $this->matches as $m) { $matchDate = JoomleagueHelper::getMatchDate($m); $dates[$matchDate][] = $m; } return $dates; }
public static function sortByDate($matches) { $sorted = array(); foreach ($matches as $m) { $matchDate = JoomleagueHelper::getMatchDate($m); $sorted[$matchDate][] = $m; } return $sorted; }
$playground_id = $match->team_playground_id; } elseif ($match->club_playground_id != "") { $playgroundname = $match->club_playground_name; $playground_id = $match->club_playground_id; } } if ($params->get('show_playground_link')) { $link = JoomleagueHelperRoute::getPlaygroundRoute($match->project_id, $playground_id); $playgroundname = JHtml::link($link, JText::sprintf('%1$s', $playgroundname)); } else { $playgroundname = JText::sprintf('%1$s', $playgroundname); } $textdiv .= $playgroundname . '</div>'; } $textdiv .= '<div class="jlplplanedate">'; $textdiv .= JoomleagueHelper::getMatchDate($match, $dateformat); $textdiv .= " " . JText::_('MOD_JOOMLEAGUE_PLAYGROUNDPLAN_START_TIME') . " "; $textdiv .= JoomleagueHelper::getMatchTime($match, $timeformat); $textdiv .= '</div>'; if ($params->get('show_project_name', 0)) { $textdiv .= '<div class="jlplplaneleaguename">'; $textdiv .= $match->project_name; $textdiv .= '</div>'; } if ($params->get('show_league_name', 0)) { $textdiv .= '<div class="jlplplaneleaguename">'; $textdiv .= $match->league_name; $textdiv .= '</div>'; } $textdiv .= '<div>'; $textdiv .= '<div class="jlplplanetname">';
} ?> <!-- Date --> <?php if ($this->config['show_match_date'] == 1) { if ($this->match->match_date) { ?> <tr> <td colspan="3" > <span class="label"><?php echo JText::_('COM_JOOMLEAGUE_MATCHREPORT_DATE'); ?> </span> <span><?php echo JoomleagueHelper::getMatchDate($this->match, JText::_('COM_JOOMLEAGUE_MATCHREPORT_GAMES_DATE')); ?> </span> </td> </tr> <?php } } ?> <!-- Time --> <?php if ($this->config['show_match_time'] == 1) { if ($this->match->match_date) { ?> <tr>
<td class="center"> <input onchange="document.getElementById('cb<?php echo $i; ?> ').checked=true" type="text" name="match_number<?php echo $row->id; ?> " value="<?php echo $row->match_number; ?> " size="6" tabindex="1" class="inputbox" /> </td> <td class="center"> <?php $date = JoomleagueHelper::getMatchDate($row, JText::_('COM_JOOMLEAGUE_ADMIN_MATCHES_DATE_FORMAT')); echo JHtml::calendar($date, 'match_date' . $row->id, 'match_date' . $row->id, JText::_('COM_JOOMLEAGUE_ADMIN_MATCHES_DATE_FORMAT_CAL'), 'size="9" tabindex="2" ondblclick="copyValue(\'match_date\')" onchange="document.getElementById(\'cb' . $i . '\').checked=true"'); ?> </td> <td class="left"> <?php $time = JoomleagueHelper::getMatchTime($row); ?> <input ondblclick="copyValue('match_time')" onchange="document.getElementById('cb<?php echo $i; ?> ').checked=true" type="text" name="match_time<?php echo $row->id; ?> "
<table class='matchreport' border='0'> <tr> <td><?php echo $this->showEventsContainerInResults($match, $this->projectevents, $events, $subs, $this->config); ?> </td> </tr> </table> </div> </td> </tr> <?php } $k = 1 - $k; $counter++; $MatchDateLine = JoomleagueHelper::getMatchDate($match, JText::_('COM_JOOMLEAGUE_CLUBPLAN_MATCHDATE')); $MatchDay = $match->name; ?> </table> <?php } ?> </table> <?php } else { ?> <h3><?php echo JText::_('COM_JOOMLEAGUE_TEAMPLAN_NO_MATCHES'); ?> </h3>
<?php if ($this->config['show_match_number']) { ?> <td class="sectiontableheader"><?php echo JText::_('COM_JOOMLEAGUE_PLAYGROUND_MATCH_NUMBER'); ?> </td> <?php } ?> <td align="left" colspan="<?php echo $colspan; ?> " class="sectiontableheader"> <?php echo JoomleagueHelper::getMatchDate($games[0], JText::_('COM_JOOMLEAGUE_GLOBAL_MATCHDAYDATE')); ?> </td> <?php if ($this->config['show_referee']) { ?> <td class="sectiontableheader"><?php echo JText::_('COM_JOOMLEAGUE_PLAYGROUND_REFEREE'); ?> </td> <?php } ?> </tr> <?php foreach ($games as $game) {
/** * return an array of matches indexed by date * * @return array */ public function sortByDate() { $dates = array(); foreach ((array) $this->matches as $m) { if (empty($m->match_date)) { $matchDate = "0000-00-00"; } else { $matchDate = JoomleagueHelper::getMatchDate($m); } $dates[$matchDate][] = $m; } return $dates; }
function display($tpl = null) { // Get a reference of the page instance in joomla $document = JFactory::getDocument(); $model = $this->getModel(); $match = $model->getMatch(); $config = $model->getTemplateConfig($this->getName()); $tableconfig = $model->getTemplateConfig("ranking"); $this->project = $model->getProject(); $this->config = $config; $this->tableconfig = $tableconfig; $this->overallconfig = $model->getOverallConfig(); if (!isset($this->overallconfig['seperator'])) { $this->overallconfig['seperator'] = ":"; } $this->match = $match; if ($match) { $newmatchtext = ""; if ($match->new_match_id > 0) { $ret = $model->getMatchText($match->new_match_id); $matchDate = JoomleagueHelper::getMatchDate($ret, JText::_('COM_JOOMLEAGUE_NEXTMATCH_NEXT_MATCHDATE')); $matchTime = JoomleagueHelperHtml::showMatchTime($ret, $this->config, $this->overallconfig, $this->project); $newmatchtext = $matchDate . " " . $matchTime . ", " . $ret->t1name . " - " . $ret->t2name; } $this->newmatchtext = $newmatchtext; $prevmatchtext = ""; if ($match->old_match_id > 0) { $ret = $model->getMatchText($match->old_match_id); $matchDate = JoomleagueHelper::getMatchDate($ret, JText::_('COM_JOOMLEAGUE_NEXTMATCH_PREVIOUS_MATCHDATE')); $matchTime = JoomleagueHelperHtml::showMatchTime($ret, $this->config, $this->overallconfig, $this->project); $prevmatchtext = $matchDate . " " . $matchTime . ", " . $ret->t1name . " - " . $ret->t2name; } $this->oldmatchtext = $prevmatchtext; $this->teams = $model->getMatchTeams(); $this->referees = $model->getReferees(); $this->playground = $model->getPlayground($this->match->playground_id); $this->homeranked = $model->getHomeRanked(); $this->awayranked = $model->getAwayRanked(); $this->chances = $model->getChances(); $this->home_highest_home_win = $model->getHomeHighestHomeWin(); $this->away_highest_home_win = $model->getAwayHighestHomeWin(); $this->home_highest_home_def = $model->getHomeHighestHomeDef(); $this->away_highest_home_def = $model->getAwayHighestHomeDef(); $this->home_highest_away_win = $model->getHomeHighestAwayWin(); $this->away_highest_away_win = $model->getAwayHighestAwayWin(); $this->home_highest_away_def = $model->getHomeHighestAwayDef(); $this->away_highest_away_def = $model->getAwayHighestAwayDef(); $games = $model->getGames(); $gamesteams = $model->getTeamsFromMatches($games); $this->games = $games; $this->gamesteams = $gamesteams; $previousx = $this->get('previousx'); $teams = $this->get('TeamsIndexedByPtid'); $this->previousx = $previousx; $this->allteams = $teams; } // Set page title $titleInfo = JoomleagueHelper::createTitleInfo(JText::_('COM_JOOMLEAGUE_NEXTMATCH_PAGE_TITLE')); if (count($this->teams) == 2) { if (!empty($this->teams[0])) { $titleInfo->team1Name = $this->teams[0]->name; } if (!empty($this->teams[1])) { $titleInfo->team2Name = $this->teams[1]->name; } } if (!empty($this->project)) { $titleInfo->projectName = $this->project->name; $titleInfo->leagueName = $this->project->league_name; $titleInfo->seasonName = $this->project->season_name; } $division = $model->getDivision(JRequest::getInt('division', 0)); if (!empty($division) && $division->id != 0) { $titleInfo->divisionName = $division->name; } $this->pagetitle = JoomleagueHelper::formatTitle($titleInfo, $this->config["page_title_format"]); $document->setTitle($this->pagetitle); parent::display($tpl); }
<?php if ($this->config['show_thumbs_picture'] == 1) { ?> <th align="center"> </th> <?php } ?> </tr> <?php } $k = 0; $cnt = 0; $club_id = JRequest::getInt('cid') != -1 ? JRequest::getInt('cid') : false; $prevDate = ''; foreach ($this->matches as $game) { $gameDate = JoomleagueHelper::getMatchDate($game, JText::_('COM_JOOMLEAGUE_CLUBPLAN_MATCHDATE')); if ($this->config['type_matches'] == 0) { if ($gameDate != $prevDate) { if ($this->config['showMatchDateLine']) { ?> <tr class="sectiontableheader"> <th colspan="16"> <?php if ($game->match_date) { echo $gameDate; } ?> </th> </tr> <?php }
/* echo JoomleagueModelTeamPlan::showPlayground( $hometeam, $guestteam, $match, $this->config['show_playground_alert'], $this->config['show_playground'], $match->project_id); */ ?> <?php if ($this->config['show_date']) { ?> <td width="10%"><?php if ($match->match_date) { echo JoomleagueHelper::getMatchDate($match, JText::_('COM_JOOMLEAGUE_GLOBAL_CALENDAR_DATE')); } else { echo " "; } ?> </td> <?php } ?> <?php if ($this->config['show_time']) { ?> <td width="10%"> <?php echo JoomleagueHelperHtml::showMatchTime($match, $this->config, $this->overallconfig, $this->project);
</th> </tr> </thead> <tbody> <?php $k = 0; foreach ($this->games as $game) { $report_link = JoomleagueHelperRoute::getMatchReportRoute($this->project->slug, $game->id); ?> <tr class="<?php echo $k == 0 ? $this->config['style_class1'] : $this->config['style_class2']; ?> "> <td><?php echo JHTML::link($report_link, JoomleagueHelper::getMatchDate($game, $this->config['games_date_format'])); ?> </td> <td class="td_r"><?php echo $this->teams[$game->projectteam1_id]->name; ?> </td> <td class="td_r"><?php echo $game->team1_result; ?> </td> <td class="td_c"><?php echo $this->overallconfig['seperator']; ?> </td> <td class="td_l"><?php
public function formatMatches(&$matches) { if ($this->params->get('lastsortorder') == 'desc') { $matches = $this->sortObject($matches, 'desc', 'alreadyplayed'); } if ($this->params->get('upcoming_first', 1) == 1) { $matches = $this->sortObject($matches, 'asc', 'upcoming'); } $matches = $this->sortObject($matches, 'asc', 'actplaying'); $matches = $this->sortObject($matches, 'asc', 'live'); $teams = $this->getTeamsFromMatches($matches); $rows = array(); $useicons = $this->iconpath; $cnt = JRequest::getVar('nr', 0, 'default', 'POST'); $hteam = false; $ateam = false; foreach ((array) $matches as $key => $match) { //echo 'NOW(): '.JHtml::_('date', $match->currenttime, $this->params->get('dateformat').' '.$this->params->get('timeformat'),0).'<br />'; if ($match->projectteam1_id) { $hteam = $teams[$match->projectteam1_id]; } if ($match->projectteam2_id) { $ateam = $teams[$match->projectteam2_id]; } //$matches[$key]->live = false; $rows[$match->match_id]['type'] = 'undefined'; if ($this->params->get('show_status_notice') == 1) { if ($match->live != 'z') { $rows[$match->match_id]['type'] = 'live'; } else { $matches[$key]->live = false; if ($match->actplaying != 'z') { $rows[$match->match_id]['type'] = 'actplaying'; } elseif ($match->alreadyplayed != 0) { $rows[$match->match_id]['type'] = 'alreadyplayed'; } elseif ($match->upcoming != 'z') { $rows[$match->match_id]['type'] = 'upcoming'; } } } $rows[$match->match_id]['date'] = JoomleagueHelper::getMatchDate($match, JText::_($this->params->get('dateformat'))); if ($useicons) { $rows[$match->match_id]['date'] = JHtml::_('image', $this->iconpath . 'date.png', 'Datum', array('title' => 'Datum', 'height' => '16', 'width' => '16')) . ' ' . $rows[$match->match_id]['date']; } $rows[$match->match_id]['time'] = JoomleagueHelper::getMatchTime($match, JText::_($this->params->get('timeformat'))); if ($useicons) { $rows[$match->match_id]['time'] = JHtml::_('image', $this->iconpath . 'time.png', 'Beginn', array('title' => 'Beginn', 'height' => '16', 'width' => '16')) . ' ' . $rows[$match->match_id]['time']; } if (isset($match->meeting)) { $rows[$match->match_id]['meeting'] = JHtml::_('date', $match->meetingtime, $this->params->get('timeformat'), null); if ($useicons) { $rows[$match->match_id]['meeting'] = JHtml::_('image', $this->iconpath . 'time_go.png', 'Treffpunkt', array('title' => 'Treffpunkt', 'height' => '16', 'width' => '16')) . ' ' . $rows[$match->match_id]['meeting']; } } $rows[$match->match_id]['project_id'] = $match->project_id; $rows[$match->match_id]['totaltime'] = $match->totaltime; $rows[$match->match_id]['round_id'] = $match->round_id; $rows[$match->match_id]['hometeam'] = $this->getTeamDetails($hteam, $cnt); $rows[$match->match_id]['homescore'] = !is_null($match->team1_result) ? $match->team1_result : '-'; $rows[$match->match_id]['homeover'] = $this->buildTeamLinks($hteam, $cnt); $rows[$match->match_id]['awayteam'] = $this->getTeamDetails($ateam, $cnt); $rows[$match->match_id]['awayscore'] = !is_null($match->team2_result) ? $match->team2_result : '-'; $rows[$match->match_id]['awayover'] = $this->buildTeamLinks($ateam, $cnt); $this->createMatchInfo($rows[$match->match_id], $match); $this->formatHeading($rows[$match->match_id], $match); $this->formatResults($rows[$match->match_id], $match); $this->createMatchLinks($rows[$match->match_id], $match); $this->createLocation($rows[$match->match_id], $match, $hteam); $this->createAjaxMenu($match, $cnt); $rows[$match->match_id]['ajax'] = $match->ajax; $cnt++; } return $rows; }
function getCorrectDateFormat($format, $matchinfo, $offset = 0, $timezone = 'UTC') { $id = 1; //$now = gmmktime(gmdate("H"),gmdate("i")-$offset,gmdate("s"),gmdate("m"),gmdate("d"),gmdate("Y")); // adjust GMT by client's offset $now = gmmktime() + $offset * 60 * 60; //Second for the first time (46 * 60) $first_time = 2760; //Second for the second time (47 * 60) $second_time = 2820; //Pause in second (15*60) $pause = 900; if ($format == '') { $format = '%a., %d. %b. %Y'; } $time = array(); foreach ($matchinfo as $match) { $unix_date[$id] = $match->match_date->toUnix() + $offset * 60 * 60; // is it future date or past date if ($now > $unix_date[$id] + $first_time + $second_time + $pause) { $time1[$id] = JoomleagueHelper::getMatchDate($match, $format); $time[$id] = $time1[$id]; } elseif ($now < $unix_date[$id]) { $time[$id] = JoomleagueHelper::getMatchDate($match, $format); } else { $difference[$id] = $now - $unix_date[$id]; if ($difference[$id] <= $first_time) { $difference1[$id] = floor($difference[$id] / 60); $mi = "'"; } elseif ($first_time + $pause < $difference[$id]) { $difference1[$id] = floor($difference[$id] / 60) - 15; $mi = "'"; } else { $difference1[$id] = "HT"; $mi = ""; } $time3[$id] = "<img src=\"modules/mod_joomleague_ticker/css/live_icon.jpg\" width=\"29\" border=\"0\" height=\"8\"><img src=\"modules/mod_joomleague_ticker/css/live.gif\" width=\"8\" border=\"0\" height=\"8\"> "; $time[$id] = $time3[$id] . $difference1[$id] . $mi; } $id++; } return $time; }
foreach ($items as $match) { ?> <tr class="d<?php echo $k; ?> "> <?php if ($params->get('show_date', 1)) { ?> <td class="mod_jl_results_date<?php echo $params->get('moduleclass_sfx'); ?> "> <?php echo JoomleagueHelper::getMatchDate($match, JText::_($params->get('date_format'))); ?> </td> <?php } ?> <?php if ($params->get('show_time', 1)) { ?> <td class="mod_jl_results_time<?php echo $params->get('moduleclass_sfx'); ?> "> <?php echo JoomleagueHelper::getMatchTime($match, JText::_($params->get('time_format')));
function getMatchesOptions($project_id, $division = 0, $required = false) { $lang = JFactory::getLanguage(); $extension = "com_joomleague"; $source = JPath::clean(JPATH_SITE . '/components/' . $extension); $lang->load($extension, JPATH_SITE, null, false, false) || $lang->load($extension, $source, null, false, false) || $lang->load($extension, JPATH_SITE, $lang->getDefault(), false, false) || $lang->load($extension, $source, $lang->getDefault(), false, false); $query = "\tSELECT\tm.id AS value, m.match_date,\n\t\t\t\t\t\t\tCONCAT(t1.middle_name, ' - ', t2.middle_name) AS text,\n\t\t\t\t\t\t\tp.timezone\n\t\t\t\t\tFROM #__joomleague_match AS m\n\t\t\t\t\tINNER JOIN #__joomleague_project_team AS pt1 ON m.projectteam1_id = pt1.id\n\t\t\t\t\tINNER JOIN #__joomleague_project_team AS pt2 ON m.projectteam2_id = pt2.id\n\t\t\t\t\tINNER JOIN #__joomleague_team AS t1 ON pt1.team_id=t1.id\n\t\t\t\t\tINNER JOIN #__joomleague_team AS t2 ON pt2.team_id=t2.id\n\t\t\t\t\tINNER JOIN #__joomleague_project p ON p.id = pt1.project_id\n\t\t\t\t\tWHERE pt1.project_id = " . $this->_db->Quote($project_id); if ($division > 0) { $query .= " AND (pt1.division_id = " . $this->_db->Quote($division); $query .= " OR pt2.division_id = " . $this->_db->Quote($division) . ") "; } $query .= " ORDER BY m.match_date, t1.short_name"; $this->_db->setQuery($query); $matches = $this->_db->loadObjectList(); foreach ($matches as $match) { JoomleagueHelper::convertMatchDateToTimezone($match); $match->text = JoomleagueHelper::getMatchDate($match, JText::_('COM_JOOMLEAGUE_MATCHDAYDATE') . ' H:i') . ' - ' . $match->text; } return $this->addGlobalSelectElement($matches, $required); }