<?php

defined('_JEXEC') or die('Restricted access');
?>
<table class="contentpaneopen">
	<tr>
		<td class="contentheading"><?php 
$pageTitle = 'COM_JOOMLEAGUE_MATCHREPORT_TITLE';
if (isset($this->round->name)) {
    $matchDate = JoomleagueHelper::getTimestamp($this->match->match_date, 1);
    echo '&nbsp;' . JText::sprintf($pageTitle, $this->round->name, JHTML::date($matchDate, JText::_('COM_JOOMLEAGUE_MATCHREPORT_GAMES_DATE')), JoomleagueHelperHtml::showMatchTime($this->match, $this->config, $this->overallconfig, $this->project));
} else {
    echo '&nbsp;' . JText::sprintf($pageTitle, '', '', '');
}
?>
</td>
	</tr>
</table>
 function display($tpl = null)
 {
     // Get a reference of the page instance in joomla
     $document = JFactory::getDocument();
     $model = $this->getModel();
     $project =& $model->getProject();
     $config = $model->getTemplateConfig($this->getName());
     if (isset($project)) {
         $this->assignRef('project', $project);
         $this->assignRef('overallconfig', $model->getOverallConfig());
         $this->assignRef('config', $this->overallconfig);
         $this->assignRef('teams', $model->getTeamsIndexedByPtid());
         $this->assignRef('matches', $model->getMatches($config));
     }
     // load a class that handles ical formats.
     require_once JLG_PATH_SITE . DS . 'helpers' . DS . 'iCalcreator.class.php';
     // create a new calendar instance
     $v = new vcalendar();
     foreach ($this->matches as $match) {
         $hometeam = $this->teams[$match->projectteam1_id];
         $home = sprintf('%s', $hometeam->name);
         $guestteam = $this->teams[$match->projectteam2_id];
         $guest = sprintf('%s', $guestteam->name);
         $summary = $project->name . ': ' . $home . ' - ' . $guest;
         //  check if match gots a date, if not it will not be included
         //  in ical
         if (!strstr($match->match_date, "0000-00-00")) {
             $syear = JHTML::date($match->match_date, "%Y");
             $sday = JHTML::date($match->match_date, "%d");
             $smonth = JHTML::date($match->match_date, "%m");
             $shour = JHTML::date($match->match_date, "%H");
             $smin = JHTML::date($match->match_date, "%M");
             //$start	= JHTML::date($match->match_date, "%Y-%m-%d %H:%M:%S" );
             $start = strftime("%Y-%m-%d %H:%M:%S", strtotime($match->match_date));
             $start_oldphpversion = array('year' => $syear, 'month' => $smonth, 'day' => $sday, 'hour' => $shour, 'min' => $smin, 'sec' => 0);
             $time_to_ellapse = $project->halftime * ($project->game_parts - 1) + $project->game_regular_time;
             $endtime = JoomleagueHelper::getTimestamp($match->match_date) + $time_to_ellapse * 60;
             $year = JHTML::date($endtime, "%Y");
             $day = JHTML::date($endtime, "%d");
             $month = JHTML::date($endtime, "%m");
             $hour = JHTML::date($endtime, "%H");
             $min = JHTML::date($endtime, "%M");
             //$end		= JHTML::date($endtime, "%Y-%m-%d %H:%M:%S" );
             $end = strftime("%Y-%m-%d %H:%M:%S", $endtime);
             $end_oldphpversion = array('year' => $year, 'month' => $month, 'day' => $day, 'hour' => $hour, 'min' => $min, 'sec' => 0);
             // check if exist a playground in match or team or club
             if ($match->playground_id != "") {
                 $stringlocation = $match->playground_address . ", " . $match->playground_zipcode . " " . $match->playground_city;
                 $stringname = $match->playground_name;
             } else {
                 if ($match->team_playground_id != "") {
                     $stringlocation = $match->team_playground_address . ", " . $match->team_playground_zipcode . " " . $match->team_playground_city;
                     $stringname = $match->team_playground_name;
                 } elseif ($match->club_playground_id != "") {
                     $stringlocation = $match->club_playground_address . ", " . $match->club_playground_zipcode . " " . $match->club_playground_city;
                     $stringname = $match->club_playground_name;
                 }
             }
             $location = $stringlocation;
             //if someone want to insert more in description here is the place
             $description = $stringname;
             // create an event and insert it in calendar
             $vevent = new vevent();
             $vevent->setProperty("dtstart", $start, array("TZID" => $project->timezone));
             $vevent->setProperty("dtend", $end, array("TZID" => $project->timezone));
             $vevent->setProperty('LOCATION', $location);
             $vevent->setProperty('summary', $summary);
             $vevent->setProperty('description', $description);
             $v->setComponent($vevent);
         }
     }
     $v->returnCalendar();
     // exit before display
     //		parent::display( $tpl );
 }
 function sendMemberTipResults($predictionMemberID, $predictionGameID, $RoundID, $ProjectID, $joomlaUserID)
 {
     $option = JRequest::getCmd('option');
     $document =& JFactory::getDocument();
     $mainframe =& JFactory::getApplication();
     $configprediction = $this->getPredictionTemplateConfig('predictionentry');
     $overallConfig = $this->getPredictionOverallConfig();
     $configprediction = array_merge($overallConfig, $configprediction);
     $predictionProjectSettings = $this->getPredictionProject($ProjectID);
     $predictionProject = $this->getPredictionGame();
     $predictionProjectS = $this->getPredictionProjectS();
     if ($configprediction['use_pred_select_matches']) {
         $match_ids = $configprediction['predictionmatchid'];
     }
     $roundResults = $this->getMatchesDataForPredictionEntry($predictionGameID, $ProjectID, $RoundID, $joomlaUserID, $match_ids);
     //  $mainframe->enqueueMessage(JText::_('roundResults -> <pre> '.print_r($roundResults,true).'</pre><br>' ),'Notice');
     //  $mainframe->enqueueMessage(JText::_('predictionProject -> <pre> '.print_r($predictionProject,true).'</pre><br>' ),'Notice');
     //  $mainframe->enqueueMessage(JText::_('predictionProjectS -> <pre> '.print_r($predictionProjectS,true).'</pre><br>' ),'Notice');
     $predictionGameMemberMail = $this->getPredictionMemberEMailAdress($predictionMemberID);
     //$mainframe->enqueueMessage(JText::_('predictionGameMemberMail -> <pre> '.print_r($predictionGameMemberMail,true).'</pre><br>' ),'Notice');
     //Fetch the mail object
     $mailer =& JFactory::getMailer();
     // als html
     $mailer->isHTML(TRUE);
     //Set a sender
     $config =& JFactory::getConfig();
     $sender = array($config->getValue('config.mailfrom'), $config->getValue('config.fromname'));
     $mailer->setSender($sender);
     $mailer->addRecipient($predictionGameMemberMail);
     //Create the mail
     $mailer->setSubject(JText::_('COM_JOOMLEAGUE_PRED_ENTRY_MAIL_TITLE'));
     foreach ($predictionProjectS as $predictionProject) {
         $body = '';
         // jetzt die ergebnisse
         $body .= "<html>";
         $body .= "<table class='blog' cellpadding='0' cellspacing='0' width='100%'>";
         $body .= "<tr>";
         $body .= "<td class='sectiontableheader'>";
         $body .= JText::sprintf('COM_JOOMLEAGUE_PRED_HEAD_ACTUAL_PRED_GAME', '<b><i>' . $predictionProject->projectName . '</i></b>');
         $body .= "</td>";
         $body .= "</tr>";
         $body .= "</table>";
         $body .= "<table width='100%' cellpadding='0' cellspacing='0'>";
         $body .= "<tr>";
         $body .= "<th class='sectiontableheader' style='text-align:center;'>" . JText::_('COM_JOOMLEAGUE_PRED_ENTRY_DATE_TIME') . "</th>";
         $body .= "<th class='sectiontableheader' style='text-align:center;' colspan='5' >" . JText::_('COM_JOOMLEAGUE_PRED_ENTRY_MATCH') . "</th>";
         $body .= "<th class='sectiontableheader' style='text-align:center;'>" . JText::_('COM_JOOMLEAGUE_PRED_ENTRY_RESULT') . "</th>";
         $body .= "<th class='sectiontableheader' style='text-align:center;'>" . JText::_('COM_JOOMLEAGUE_PRED_ENTRY_YOURS') . "</th>";
         $body .= "<th class='sectiontableheader' style='text-align:center;'>" . JText::_('COM_JOOMLEAGUE_PRED_ENTRY_POINTS') . "</th>";
         $body .= "</tr>";
         // schleife über die ergebnisse in der runde
         foreach ($roundResults as $result) {
             $class = $k == 0 ? 'sectiontableentry1' : 'sectiontableentry2';
             $resultHome = isset($result->team1_result) ? $result->team1_result : '-';
             if (isset($result->team1_result_decision)) {
                 $resultHome = $result->team1_result_decision;
             }
             $resultAway = isset($result->team2_result) ? $result->team2_result : '-';
             if (isset($result->team2_result_decision)) {
                 $resultAway = $result->team2_result_decision;
             }
             $closingtime = $configprediction['closing_time'];
             //3600=1 hour
             $matchTimeDate = JoomleagueHelper::getTimestamp($result->match_date, 1, $predictionProjectSettings->serveroffset);
             $thisTimeDate = JoomleagueHelper::getTimestamp('', 1, $predictionProjectSettings->serveroffset);
             $matchTimeDate = $matchTimeDate - $closingtime;
             $body .= "<tr class='" . $class . "'>";
             $body .= "<td class='td_c'>";
             $body .= JHtml::date($result->match_date, 'd.m.Y H:i', false);
             $body .= " - ";
             //$body .= JHTML::date(date("Y-m-d H:i:s",$matchTimeDate),$configprediction['time_format']);
             $body .= "</td>";
             $homeName = $this->getMatchTeam($result->projectteam1_id);
             $awayName = $this->getMatchTeam($result->projectteam2_id);
             // clublogo oder vereinsflagge hometeam
             $body .= "<td nowrap='nowrap' class='td_r'>";
             $body .= $homeName;
             $body .= "</td>";
             $body .= "<td nowrap='nowrap' class='td_c'>";
             if ($configprediction['show_logo_small'] == 1) {
                 $logo_home = $this->getMatchTeamClubLogo($result->projectteam1_id);
                 if ($logo_home == '' || !file_exists($logo_home)) {
                     $logo_home = 'images/com_joomleague/database/placeholders/placeholder_small.gif';
                 }
                 $imgTitle = JText::sprintf('COM_JOOMLEAGUE_PRED_ENTRY_LOGO_OF', $homeName);
                 $body .= JHTML::image(JURI::root() . $logo_home, $imgTitle, array(' title' => $imgTitle));
                 $body .= ' ';
             }
             if ($configprediction['show_logo_small'] == 2) {
                 $country_home = $this->getMatchTeamClubFlag($result->projectteam1_id);
                 $body .= Countries::getCountryFlag($country_home);
             }
             $body .= "</td>";
             $body .= "<td nowrap='nowrap' class='td_c'>";
             $body .= "<b>" . $configprediction['seperator'] . "</b>";
             $body .= "</td>";
             // clublogo oder vereinsflagge awayteam
             $body .= "<td nowrap='nowrap' class='td_c'>";
             if ($configprediction['show_logo_small'] == 1) {
                 $logo_away = $this->getMatchTeamClubLogo($result->projectteam2_id);
                 if ($logo_away == '' || !file_exists($logo_away)) {
                     $logo_away = 'images/com_joomleague/database/placeholders/placeholder_small.gif';
                 }
                 $imgTitle = JText::sprintf('COM_JOOMLEAGUE_PRED_ENTRY_LOGO_OF', $awayName);
                 $body .= ' ';
                 $body .= JHTML::image(JURI::root() . $logo_away, $imgTitle, array(' title' => $imgTitle));
             }
             if ($configprediction['show_logo_small'] == 2) {
                 $country_away = $this->getMatchTeamClubFlag($result->projectteam2_id);
                 $body .= Countries::getCountryFlag($country_away);
             }
             $body .= "</td>";
             $body .= "<td nowrap='nowrap' class='td_l'>";
             $body .= $awayName;
             $body .= "</td>";
             // spielergebnisse
             $body .= "<td class='td_c'>";
             $body .= $resultHome . $configprediction['seperator'] . $resultAway;
             $body .= "</td>";
             // tippergebnisse
             $body .= "<td class='td_c'>";
             if ($predictionProject->mode == '0') {
                 $body .= $result->tipp_home . $configprediction['seperator'] . $result->tipp_away;
             }
             if ($predictionProject->mode == '1') {
                 $body .= $result->tipp;
             }
             $body .= "</td>";
             // punkte
             $body .= "<td class='td_c'>";
             $points = $this->getMemberPredictionPointsForSelectedMatch($predictionProject, $result);
             $totalPoints = $totalPoints + $points;
             $body .= $points;
             $body .= "</td>";
             $body .= "</tr>";
             // tendencen im tippspiel
             if ($configprediction['show_tipp_tendence']) {
                 $body .= "<tr class='tipp_tendence'>";
                 $body .= "<td class='td_c'>";
                 $body .= "&nbsp;";
                 $body .= "</td>";
                 $body .= "<td class='td_l' colspan='8'>";
                 $totalCount = $this->getTippCountTotal($predictionGameID, $result->id);
                 $homeCount = $this->getTippCountHome($predictionGameID, $result->id);
                 $awayCount = $this->getTippCountAway($predictionGameID, $result->id);
                 $drawCount = $this->getTippCountDraw($predictionGameID, $result->id);
                 if ($totalCount > 0) {
                     $percentageH = round($homeCount * 100 / $totalCount, 2);
                     $percentageD = round($drawCount * 100 / $totalCount, 2);
                     $percentageA = round($awayCount * 100 / $totalCount, 2);
                 } else {
                     $percentageH = 0;
                     $percentageD = 0;
                     $percentageA = 0;
                 }
                 $body .= "<span style='color:" . $configprediction['color_home_win'] . "' >";
                 $body .= JText::sprintf('COM_JOOMLEAGUE_PRED_ENTRY_PERCENT_HOME_WIN', $percentageH, $homeCount) . "</span><br />";
                 $body .= "<span style='color:" . $configprediction['color_draw'] . "'>";
                 $body .= JText::sprintf('COM_JOOMLEAGUE_PRED_ENTRY_PERCENT_DRAW', $percentageD, $drawCount) . "</span><br />";
                 $body .= "<span style='color:" . $configprediction['color_guest_win'] . "'>";
                 $body .= JText::sprintf('COM_JOOMLEAGUE_PRED_ENTRY_PERCENT_AWAY_WIN', $percentageA, $awayCount) . "</span>";
                 $body .= "</td>";
                 //$body .= "<td colspan='8'>&nbsp;</td>";
                 $body .= "</tr>";
             } else {
                 $k = 1 - $k;
             }
         }
         $body .= "<tr>";
         $body .= "<td colspan='8'>&nbsp;</td>";
         $body .= "<td class='td_c'>" . JText::sprintf('COM_JOOMLEAGUE_PRED_ENTRY_TOTAL_POINTS_COUNT', $totalPoints) . "</td>";
         $body .= "</tr>";
         $body .= "<table>";
         if ($configprediction['show_help'] == 1 || $configprediction['show_help'] == 2) {
             $body .= $this->createHelptText($predictionProject->mode);
         }
         $body .= "</html>";
     }
     $mailer->setBody($body);
     //Sending the mail
     $send =& $mailer->Send();
     if ($send !== true) {
         //echo 'Error sending email to:<br />'.print_r($recipient,true).'<br />';
         //echo 'Error message: '.$send->message;
         $mainframe->enqueueMessage(JText::_('COM_JOOMLEAGUE_PRED_ENTRY_MAIL_SEND_ERROR'), 'Error');
     } else {
         //echo 'Mail sent';
         $emailadresses = implode(",", $predictionGameMemberMail);
         $mainframe->enqueueMessage(JText::sprintf('COM_JOOMLEAGUE_PRED_ENTRY_MAIL_SEND_OK', $emailadresses), '');
     }
 }
 if (count($roundResults) > 0) {
     // schleife über die ergebnisse in der runde
     foreach ($roundResults as $result) {
         $class = $k == 0 ? 'sectiontableentry1' : 'sectiontableentry2';
         $resultHome = isset($result->team1_result) ? $result->team1_result : '-';
         if (isset($result->team1_result_decision)) {
             $resultHome = $result->team1_result_decision;
         }
         $resultAway = isset($result->team2_result) ? $result->team2_result : '-';
         if (isset($result->team2_result_decision)) {
             $resultAway = $result->team2_result_decision;
         }
         $closingtime = $this->config['closing_time'];
         //3600=1 hour
         $matchTimeDate = JoomleagueHelper::getTimestamp($result->match_date, 1, $predictionProjectSettings->serveroffset);
         $thisTimeDate = JoomleagueHelper::getTimestamp('', 1, $predictionProjectSettings->serveroffset);
         // änderungen erlaubt ?   $this->config['show_help']
         if ($this->show_debug_info) {
             echo '<br />this->closingtime<pre>~' . print_r($closingtime, true) . '~</pre><br />';
             echo '<br />this->matchTimeDate<pre>~' . print_r($matchTimeDate, true) . '~</pre><br />';
             echo '<br />this->thisTimeDate<pre>~' . print_r($thisTimeDate, true) . '~</pre><br />';
             echo '<br />this->allowedAdmin<pre>~' . print_r($this->allowedAdmin, true) . '~</pre><br />';
             echo '<br />this->predictionMember->admintipp<pre>~' . print_r($this->predictionMember->admintipp, true) . '~</pre><br />';
             echo '<br />this->use_tipp_admin<pre>~' . print_r($this->config['use_tipp_admin'], true) . '~</pre><br />';
         }
         $matchTimeDate = $matchTimeDate - $closingtime;
         $tippAllowed = $thisTimeDate < $matchTimeDate && $resultHome == '-' && $resultAway == '-' || $this->allowedAdmin && $this->predictionMember->admintipp;
         //$tippAllowed = true;
         if (!$tippAllowed) {
             $disabled = ' disabled="disabled" ';
         } else {
 function display($tpl = null)
 {
     // Get a refrence of the page instance in joomla
     $document =& JFactory::getDocument();
     $option = JRequest::getCmd('option');
     $optiontext = strtoupper(JRequest::getCmd('option') . '_');
     $this->assignRef('optiontext', $optiontext);
     $this->assign('show_debug_info', JComponentHelper::getParams('com_joomleague')->get('show_debug_info', 0));
     $mainframe = JFactory::getApplication();
     $document->addScript(JURI::root() . 'components/com_joomleague/assets/js/json2.js');
     $document->addScript(JURI::root() . 'components/com_joomleague/assets/js/swfobject.js');
     $model =& $this->getModel();
     $mdlPredUsers = JModel::getInstance("predictionusers", "JoomleagueModel");
     $this->assignRef('predictionGame', $mdlPredUsers->getPredictionGame());
     if (isset($this->predictionGame)) {
         $config = $mdlPredUsers->getPredictionTemplateConfig('predictionusers');
         $overallConfig = $mdlPredUsers->getPredictionOverallConfig();
         $tipprankingconfig = $mdlPredUsers->getPredictionTemplateConfig('predictionranking');
         $flashconfig = $mdlPredUsers->getPredictionTemplateConfig("predictionflash");
         $configavatar = $mdlPredUsers->getPredictionTemplateConfig('predictionusers');
         //$rankingconfig	= $model->getPredictionTemplateConfig('ranking');
         //      $this->assignRef('debuginfo',	$model->getDebugInfo());
         $this->assignRef('model', $mdlPredUsers);
         $this->assignRef('roundID', $this->model->roundID);
         $this->assignRef('config', array_merge($overallConfig, $tipprankingconfig, $config));
         $this->assignRef('configavatar', $configavatar);
         $this->assignRef('predictionMember', $mdlPredUsers->getPredictionMember($configavatar));
         if (!isset($this->predictionMember->id)) {
             $this->predictionMember->id = 0;
             $this->predictionMember->pmID = 0;
         }
         $this->assignRef('predictionProjectS', $mdlPredUsers->getPredictionProjectS());
         $this->assignRef('actJoomlaUser', JFactory::getUser());
         $this->assignRef('isPredictionMember', $mdlPredUsers->checkPredictionMembership());
         $this->assignRef('memberData', $mdlPredUsers->memberPredictionData());
         $this->assignRef('allowedAdmin', $mdlPredUsers->getAllowed());
         if (!empty($this->predictionMember->user_id)) {
             $this->assignRef('showediticon', $mdlPredUsers->getAllowed($this->predictionMember->user_id));
         }
         $this->_setPointsChartdata(array_merge($flashconfig, $config));
         $this->_setRankingChartdata(array_merge($flashconfig, $config));
         //echo '<br /><pre>~' . print_r($this->predictionMember,true) . '~</pre><br />';
         $lists = array();
         if ($this->predictionMember->pmID > 0) {
             $dMemberID = $this->predictionMember->pmID;
         } else {
             $dMemberID = 0;
         }
         if (!$this->allowedAdmin) {
             $userID = $this->actJoomlaUser->id;
         } else {
             $userID = null;
         }
         $predictionMembers[] = JHTML::_('select.option', '0', JText::_('COM_JOOMLEAGUE_PRED_SELECT_MEMBER'), 'value', 'text');
         if ($res =& $mdlPredUsers->getPredictionMemberList($this->config, $userID)) {
             $predictionMembers = array_merge($predictionMembers, $res);
         }
         $lists['predictionMembers'] = JHTML::_('select.genericList', $predictionMembers, 'uid', 'class="inputbox" onchange="this.form.submit(); "', 'value', 'text', $dMemberID);
         unset($res);
         unset($predictionMembers);
         if (empty($this->predictionMember->fav_team)) {
             $this->predictionMember->fav_team = '0,0';
         }
         $sFavTeamsList = explode(';', $this->predictionMember->fav_team);
         foreach ($sFavTeamsList as $key => $value) {
             $dFavTeamsList[] = explode(',', $value);
         }
         foreach ($dFavTeamsList as $key => $value) {
             $favTeamsList[$value[0]] = $value[1];
         }
         //echo '<br /><pre>~' . print_r($this->predictionMember->champ_tipp,true) . '~</pre><br />';
         if (empty($this->predictionMember->champ_tipp)) {
             $this->predictionMember->champ_tipp = '0,0';
         }
         $sChampTeamsList = explode(';', $this->predictionMember->champ_tipp);
         foreach ($sChampTeamsList as $key => $value) {
             $dChampTeamsList[] = explode(',', $value);
         }
         foreach ($dChampTeamsList as $key => $value) {
             $champTeamsList[$value[0]] = $value[1];
         }
         if ($this->getLayout() == 'edit') {
             $dArray[] = JHTML::_('select.option', 0, JText::_('JNO'));
             $dArray[] = JHTML::_('select.option', 1, JText::_('JYES'));
             $lists['show_profile'] = JHTML::_('select.radiolist', $dArray, 'show_profile', 'class="inputbox" size="1"', 'value', 'text', $this->predictionMember->show_profile);
             $lists['reminder'] = JHTML::_('select.radiolist', $dArray, 'reminder', 'class="inputbox" size="1"', 'value', 'text', $this->predictionMember->reminder);
             $lists['receipt'] = JHTML::_('select.radiolist', $dArray, 'receipt', 'class="inputbox" size="1"', 'value', 'text', $this->predictionMember->receipt);
             $lists['admintipp'] = JHTML::_('select.radiolist', $dArray, 'admintipp', 'class="inputbox" size="1"', 'value', 'text', $this->predictionMember->admintipp);
             $lists['approvedForGame'] = JHTML::_('select.radiolist', $dArray, 'approved', 'class="inputbox" size="1" disabled="disabled"', 'value', 'text', $this->predictionMember->approved);
             unset($dArray);
             // schleife über die projekte
             foreach ($this->predictionProjectS as $predictionProject) {
                 if ($this->show_debug_info) {
                     echo 'predictionuser view.html -> predictionProject<br /><pre>~' . print_r($predictionProject, true) . '~</pre><br />';
                 }
                 $projectteams[] = JHTML::_('select.option', '0', JText::_('COM_JOOMLEAGUE_PRED_USERS_SELECT_TEAM'), 'value', 'text');
                 if ($res =& $model->getPredictionProjectTeams($predictionProject->project_id)) {
                     $projectteams = array_merge($projectteams, $res);
                 }
                 if (!isset($favTeamsList[$predictionProject->project_id])) {
                     $favTeamsList[$predictionProject->project_id] = 0;
                 }
                 $lists['fav_team'][$predictionProject->project_id] = JHTML::_('select.genericList', $projectteams, 'fav_team[' . $predictionProject->project_id . ']', 'class="inputbox"', 'value', 'text', $favTeamsList[$predictionProject->project_id]);
                 // kann champion ausgewaehlt werden ?
                 if ($predictionProject->champ) {
                     $disabled = '';
                     // ist überhaupt das startdatum gesetzt ?
                     if ($predictionProject->start_date == '0000-00-00') {
                         $mainframe->enqueueMessage(JText::_('COM_JOOMLEAGUE_PRED_PREDICTION_NOT_EXISTING_STARTDATE'), 'Error');
                         $disabled = ' disabled="disabled" ';
                     } else {
                         // ist die saison beendet ?
                         $predictionProjectSettings = $mdlPredUsers->getPredictionProject($predictionProject->project_id);
                         $time = strtotime($predictionProject->start_date);
                         $time += 86400;
                         // Ein Tag in Sekunden
                         $showDate = date("Y-m-d", $time);
                         $thisTimeDate = JoomleagueHelper::getTimestamp('', 1, $predictionProjectSettings->serveroffset);
                         $competitionStartTimeDate = JoomleagueHelper::getTimestamp($showDate, 1, $predictionProjectSettings->serveroffset);
                         $tippAllowed = $thisTimeDate < $competitionStartTimeDate;
                         if (!$tippAllowed) {
                             $disabled = ' disabled="disabled" ';
                         } else {
                             $disabled = '';
                         }
                     }
                     $predictionMembers[] = JHTML::_('select.option', '0', JText::_('COM_JOOMLEAGUE_GLOBAL_SELECT_PREDICTION_MEMBER_GROUP'), 'value', 'text');
                     if ($res =& $mdlPredUsers->getPredictionGroupList()) {
                         $predictionMembers = array_merge($predictionMembers, $res);
                     }
                     $lists['grouplist'] = JHTML::_('select.genericList', $predictionMembers, 'group_id', 'class="inputbox" ' . $disabled . 'onchange=""', 'value', 'text', $this->predictionMember->group_id);
                     unset($res);
                     unset($predictionMembers);
                     if ($this->show_debug_info) {
                         echo '<br />predictionuser view.html edit -> time <pre>~' . print_r($time, true) . '~</pre><br />';
                         echo '<br />predictionuser view.html edit -> showDate <pre>~' . print_r($showDate, true) . '~</pre><br />';
                         echo '<br />predictionuser view.html edit -> thisTimeDate <pre>~' . print_r($thisTimeDate, true) . '~</pre><br />';
                         echo '<br />predictionuser view.html edit -> competitionStartTimeDate <pre>~' . print_r($competitionStartTimeDate, true) . '~</pre><br />';
                         echo '<br />predictionuser view.html edit -> tippAllowed <pre>~' . print_r($tippAllowed, true) . '~</pre><br />';
                         echo '<br />predictionuser view.html edit -> disabled <pre>~' . print_r($disabled, true) . '~</pre><br />';
                         echo '<br />predictionuser view.html edit -> this->predictionProjectS <pre>~' . print_r($this->predictionProjectS, true) . '~</pre><br />';
                     }
                 } else {
                     $disabled = ' disabled="disabled" ';
                 }
                 if (!isset($champTeamsList[$predictionProject->project_id])) {
                     $champTeamsList[$predictionProject->project_id] = 0;
                 }
                 $lists['champ_tipp_disabled'][$predictionProject->project_id] = JHTML::_('select.genericList', $projectteams, 'champ_tipp[' . $predictionProject->project_id . ']', 'class="inputbox"' . $disabled . '', 'value', 'text', $champTeamsList[$predictionProject->project_id]);
                 $lists['champ_tipp_enabled'][$predictionProject->project_id] = JHTML::_('select.genericList', $projectteams, 'champ_tipp[' . $predictionProject->project_id . ']', 'class="inputbox"' . $disabled . '', 'value', 'text', $champTeamsList[$predictionProject->project_id]);
                 unset($projectteams);
             }
             $this->assignRef('form', $this->get('form'));
             $this->form->setValue('picture', null, $this->predictionMember->picture);
         } else {
             $this->assignRef('favTeams', $favTeamsList);
             $this->assignRef('champTeams', $champTeamsList);
         }
         $this->assignRef('lists', $lists);
         $this->assignRef('tippallowed', $tippAllowed);
         // Set page title
         $pageTitle = JText::_('COM_JOOMLEAGUE_PRED_USERS_TITLE');
         $document->setTitle($pageTitle);
         parent::display($tpl);
     } else {
         JError::raiseNotice(500, JText::_('COM_JOOMLEAGUE_PRED_PREDICTION_NOT_EXISTING'));
     }
 }
$dummyOutputShown = false;
foreach ($this->predictionProjectS as $predictionProject) {
    if ($this->model->pjID == 0 || $this->model->pjID == $predictionProject->project_id) {
        if ($predictionProjectSettings = $this->model->getPredictionProject($predictionProject->project_id)) {
            //$predictionProjectSettings->start_date='2010-08-08';
            //$time=time();
            $time = strtotime($predictionProjectSettings->start_date);
            //$date=date("Y-m-d",$time);
            //echo $date.'/';
            $time += 86400;
            // Ein Tag in Sekunden
            $showDate = date("Y-m-d", $time);
            //echo $showDate;
            $thisTimeDate = JoomleagueHelper::getTimestamp('', 1, $predictionProjectSettings->serveroffset);
            //$competitionStartTimeDate = JoomleagueHelper::getTimestamp($predictionProjectSettings->start_date,1,$predictionProjectSettings->serveroffset);
            $competitionStartTimeDate = JoomleagueHelper::getTimestamp($showDate, 1, $predictionProjectSettings->serveroffset);
            $showChamp = $thisTimeDate > $competitionStartTimeDate;
            //if (($showChamp) || ($this->showediticon))
            if ($this->show_debug_info) {
                echo '<br />predictionuser info -> time <pre>~' . print_r($time, true) . '~</pre><br />';
                echo '<br />predictionuser info -> showDate <pre>~' . print_r($showDate, true) . '~</pre><br />';
                echo '<br />predictionuser info -> thisTimeDate <pre>~' . print_r($thisTimeDate, true) . '~</pre><br />';
                echo '<br />predictionuser info -> competitionStartTimeDate <pre>~' . print_r($competitionStartTimeDate, true) . '~</pre><br />';
                echo '<br />predictionuser info -> showChamp <pre>~' . print_r($showChamp, true) . '~</pre><br />';
            }
            if ($showChamp) {
                if ($res =& $this->model->getPredictionProjectTeams($predictionProject->project_id)) {
                    foreach ($res as $team) {
                        foreach ($this->champTeams as $key => $value) {
                            if ($team->value == $value) {
                                $found = true;