コード例 #1
0
ファイル: default.php プロジェクト: joomux/jTips
    /**
     * Take data assigned in $data and display it
     */
    function display()
    {
        global $jTipsCurrentUser, $mainframe, $database, $jLang, $jTips, $mosConfig_live_site;
        $mosConfig_offset = $mainframe->getCfg('offset');
        //$Itemid = jTipsGetParam($_REQUEST, 'Itemid', '');
        global $Itemid;
        //$mainframe->setPageTitle(getComponentName($Itemid).' > '.$jTips['Menu']['Tips']);
        //jTipsCommonHTML::loadOverlib();
        $useJs = false;
        if ($jTips['JsLadder'] != 'none') {
            $useJs = true;
        }
        if ($jTips['EnableComments'] == 1 and $jTips['EnableCommentFilter'] == 1) {
            $checkComment = "onclick='return validateComment(\"comment\");'";
        } else {
            $checkComment = "onClick='document.tips_form.submit();'";
        }
        //jtips_HTML::buildMenu('tips', $this->jSeason, $this->jTipsUser);
        //jtips_HTML::seasonsList($this->jTipsUser, $this->jSeasons, "onchange='getSeason(this);'", true, jTipsGetParam($_REQUEST, 'season', jTipsGetParam($_REQUEST, 'season_id', false)));
        $postURL = jTipsRoute("index.php?option=com_jtips&Itemid={$Itemid}");
        ?>
		<script type='text/javascript'>
		function getSeason(obj) {
			var id = obj.options[obj.selectedIndex].value;
			return window.location.href='<?php 
        echo html_entity_decode(jTipsRoute("index.php?option=com_jtips&Itemid={$Itemid}&task=Tips&season="));
        ?>
' + id;
		}
		</script>
		<form action='<?php 
        echo $postURL;
        ?>
' method='post' name='tips_form' id='tips_form'>
		<input type='hidden' name='option' value='com_jtips' />
		<input type='hidden' name='view' value='Tips' />
		<input type="hidden" name="action" value="save" />
		<input type='hidden' name='user_id' value='<?php 
        echo $jTipsCurrentUser->id;
        ?>
' />
		<input type="hidden" name="<?php 
        echo jTipsSpoofValue();
        ?>
" value="1" />
		<h2 class="contentheading jmain_heading"><?php 
        echo $this->jSeason->name;
        ?>
</h2>
		<h3 align="center">
		<?php 
        if ($this->jRound->getPrev()) {
            ?>
			<a style="font-size:smaller;" href='<?php 
            echo jTipsRoute("index.php?option=com_jtips&amp;Itemid={$Itemid}&amp;view=Tips&amp;rid=" . $this->jRound->getPrev());
            ?>
'>&laquo; <?php 
            echo $jLang['_COM_PREV_ROUND'];
            ?>
</a>
			<?php 
        }
        echo "&nbsp;" . $jLang['_COM_DASH_ROUND'] . " " . $this->jRound->round . "&nbsp;";
        if ($this->jRound->getNext()) {
            ?>
			<a  style="font-size:smaller;" href='<?php 
            echo jTipsRoute("index.php?option=com_jtips&amp;Itemid={$Itemid}&amp;view=Tips&amp;rid=" . $this->jRound->getNext());
            ?>
'><?php 
            echo $jLang['_COM_NEXT_ROUND'];
            ?>
 &raquo;</a>
			<?php 
        }
        ?>
		</h3>
		<?php 
        if ($this->jRound->exists()) {
            $jGameParams = array('round_id' => $this->jRound->id, 'order' => array('type' => 'order', 'by' => 'position', 'direction' => 'ASC'));
            $jGame = new jGame($database);
            $jGames = forceArray($jGame->loadByParams($jGameParams));
            $tags = "class='sectiontableheader jtableheader'";
            ?>
			<table width="100%" cellspacing="0">
			<thead>
				<tr class="sectiontableheader">
				<th <?php 
            echo $tags;
            ?>
 width="33%"><?php 
            echo $jLang['_COM_TIPS_TIPPING_CLOSE'];
            ?>
</th>
			<?php 
            if ($jTips['ShowJSCountdown'] == 1) {
                ?>
				<th <?php 
                echo $tags;
                ?>
 width="34%"><?php 
                echo $jLang['_COM_TIPS_TIME_TO_CLOSE'];
                ?>
</th>
				<?php 
            }
            ?>
				<th <?php 
            echo $tags;
            ?>
 width="33%"><?php 
            echo $jLang['_COM_TIPS_LASTUP'];
            ?>
</th>
				</tr>
			</thead>
			<tbody>
				<tr class="sectiontableentry1">
				<td style="text-align:center;">
				<?php 
            //BUG 136 - show closed/closes depending on start time
            echo TimeDate::toDisplayDateTime($this->jRound->start_time, false);
            ?>
</td>
				<?php 
            if ($jTips['ShowJSCountdown'] == 1) {
                ?>
				<td><div id='countdown' style="text-align:center;" class="highlight"><?php 
                echo $jLang['_COM_CLOSED'];
                ?>
</div></td>
			<?php 
            }
            $jTipParams = array('game_id' => array('type' => 'reference', 'query' => "SELECT DISTINCT id FROM #__jtips_games WHERE round_id = " . $this->jRound->id), 'user_id' => $jTipsCurrentUser->id);
            $jTip = new jTip($database);
            $jTipss = forceArray($jTip->loadByParams($jTipParams));
            ?>
<td><?php 
            if (count($jTipss) > 0) {
                echo TimeDate::toDisplayDateTime($jTipss[0]->updated, false);
            } else {
                echo "&nbsp;";
            }
            ?>
			</td>
			</tr>
			</tbody>
			</table>
			<?php 
            if (jTipsGetParam($jTips, 'TeamLadderPopup', 0)) {
                $url = "view=TeamLadder&Itemid={$Itemid}&menu=0";
                ?>
<p style="text-align:center;font-weight:bold;"><?php 
                if (isJoomla15()) {
                    /*?>
                    		<a class="modal" rel="{handler: 'iframe', size: {x: <?php echo $jTips['ShowTipsWidth']; ?>, y: <?php echo $jTips['ShowTipsHeight']; ?>}}" href="<?php echo jTipsRoute("index2.php?option=com_jtips&" .$url); ?>" title='Team Ladder'><?php echo $jLang['_COM_TIPS_SHOWHIDE']; ?></a>
                    		<?php*/
                    // better popup handling in J1.5
                    JHTML::_('behavior.modal');
                    $rel = json_encode(array('size' => array('x' => $jTips['ShowTipsWidth'], 'y' => $jTips['ShowTipsHeight'])));
                    $url = jTipsRoute("index.php?option=com_jtips&tmpl=component&" . $url);
                    $attribs = array('class' => 'modal', 'rel' => str_replace('"', "'", $rel), 'title' => $jLang['_COM_TIPS_SHOWHIDE']);
                    echo JHTML::link($url, $jLang['_COM_TIPS_SHOWHIDE'], $attribs);
                } else {
                    ?>
					<a href='javascript:void(0);' onClick="openPopup('<?php 
                    echo $url;
                    ?>
', 'Team Ladder');"><?php 
                    echo $jLang['_COM_TIPS_SHOWHIDE'];
                    ?>
</a>
					<?php 
                }
                ?>
</p><?php 
            }
            //BUG 189 - Which order should the tips panel be shown in
            if ($this->jSeason->tips_layout == 'away') {
                $left = 'away';
                $right = 'home';
            } else {
                $left = 'home';
                $right = 'away';
            }
            ?>
			<table align='center' width='100%' class="jdatatable" cellspacing="0">
				<tr>
					<th <?php 
            echo $tags;
            ?>
><?php 
            echo $jLang['_COM_GAME_' . strtoupper($left)];
            ?>
</th>
			<?php 
            if ($this->jSeason->team_starts) {
                ?>
                <th <?php 
                echo $tags;
                ?>
><?php 
                echo $jLang['_COM_TIPS_' . strtoupper($left) . 'START'];
                ?>
</th>
                <?php 
            }
            if ($this->jSeason->pick_score == 1) {
                ?>
					<th <?php 
                echo $tags;
                ?>
><?php 
                echo $jLang['_COM_TIPS_' . strtoupper($left) . 'SCORE'];
                ?>
</th>
				<?php 
            }
            ?>
					<th <?php 
            echo $tags;
            ?>
>
					<?php 
            if ($this->jSeason->pick_draw == 1 and ($this->jSeason->pick_score and !$jTips['HideTeamSelect'] or !$this->jSeason->pick_score)) {
                echo "&nbsp;" . $jLang['_COM_GAME_DRAW'] . "&nbsp;";
            } else {
                echo "&nbsp;";
            }
            ?>
</th>
			<?php 
            if ($this->jSeason->pick_score == 1) {
                ?>
					<th <?php 
                echo $tags;
                ?>
><?php 
                echo $jLang['_COM_TIPS_' . strtoupper($right) . 'SCORE'];
                ?>
</th>
				<?php 
            }
            if ($this->jSeason->team_starts) {
                ?>
                <th <?php 
                echo $tags;
                ?>
><?php 
                echo $jLang['_COM_TIPS_' . strtoupper($right) . 'START'];
                ?>
</th>
                <?php 
            }
            ?>
					<th <?php 
            echo $tags;
            ?>
><?php 
            echo $jLang['_COM_GAME_' . strtoupper($right)];
            ?>
</th>
			<?php 
            if ($this->jSeason->pick_margin == 1) {
                ?>
					<th <?php 
                echo $tags;
                ?>
><?php 
                echo $jLang['_COM_TIPS_MARGIN'];
                ?>
</th>
				<?php 
            }
            if ($this->jSeason->pick_bonus >= 1) {
                ?>
					<th <?php 
                echo $tags;
                ?>
><?php 
                echo $jLang['_COM_TIPS_BONUS'];
                ?>
</th>
				<?php 
            }
            if ($this->jSeason->game_times) {
                ?>
					<th <?php 
                echo $tags;
                ?>
><?php 
                echo $jLang['_COM_TIPS_TIME'];
                ?>
</th>
				<?php 
            }
            if ($this->jRound->scored == 1) {
                ?>
					<th <?php 
                echo $tags;
                ?>
><?php 
                echo $jLang['_COM_TIPS_RESULT'];
                ?>
</th>
				<?php 
            }
            ?>
				<th <?php 
            echo $tags;
            ?>
>&nbsp;</th>
				</tr>
			<?php 
            // BUG 316 - have TimeDate::toDatabaseDateTime around jRound->start_time was deducting an offset from a GMT time - bad
            if ($this->jRound->start_time < gmdate('Y-m-d H:i:s') or $jTipsCurrentUser->hasTipped($this->jRound->id) and $jTips['TipLockout'] == 1) {
                $disabled = "disabled";
            } else {
                $disabled = '';
            }
            $hasTipped = count($jTipss) > 0;
            $rowIndex = 0;
            foreach ($jGames as $jGame) {
                $leftTeam = new jTeam($database);
                $rightTeam = new jTeam($database);
                $jTipParams = array('user_id' => $jTipsCurrentUser->id, 'game_id' => $jGame->id);
                $jTip->loadByParams($jTipParams);
                $left_id_field = $left . '_id';
                $right_id_field = $right . '_id';
                $leftLoaded = $rightLoaded = false;
                if ($jGame->{$left_id_field}) {
                    $leftTeam->load($jGame->{$left_id_field});
                    $leftLoaded = true;
                }
                if ($jGame->{$right_id_field}) {
                    $rightTeam->load($jGame->{$right_id_field});
                    $rightLoaded = true;
                }
                if (!$leftLoaded and $rightLoaded) {
                    $this->byes[] = $rightTeam;
                }
                if ($leftLoaded and !$rightLoaded) {
                    $this->byes[] = $leftTeam;
                }
                if (!$leftLoaded or !$rightLoaded) {
                    continue;
                }
                if ($jGame->winner_id == $leftTeam->id) {
                    $left_style = "font-weight:bold;";
                    $right_style = "";
                } else {
                    if ($jGame->winner_id == -1) {
                        $left_style = "font-style:italics;";
                        $right_style = "font-style:italics;";
                    } else {
                        if ($jGame->winner_id == $rightTeam->id) {
                            $left_style = "";
                            $right_style = "font-weight:bold;";
                        } else {
                            $left_style = "";
                            $right_style = "";
                        }
                    }
                }
                $rowClasses = "class='sectiontableentry" . ($rowIndex % 2 + 1) . " jtablerow" . ($rowIndex % 2 + 1) . "'";
                if ($this->jSeason->pick_score and $jGame->has_score) {
                    $onClick = 'onClick="switchScore(' . $jGame->id . ');"';
                } else {
                    $onClick = '';
                }
                ?>
				<tr <?php 
                echo $rowClasses;
                ?>
>
					<td style='text-align:right;<?php 
                echo $left_style;
                ?>
'><label for="<?php 
                echo $left;
                ?>
_game<?php 
                echo $jGame->id;
                ?>
"><?php 
                echo $leftTeam->getDisplayLogoName('right');
                ?>
</label>&nbsp;
						<?php 
                if ($this->jSeason->pick_score and !$jTips['HideTeamSelect'] or !$this->jSeason->pick_score) {
                    ?>
							<input type='radio' <?php 
                    echo $onClick;
                    ?>
 class="inputbox" name='game<?php 
                    echo $jGame->id;
                    ?>
' id='<?php 
                    echo $left;
                    ?>
_game<?php 
                    echo $jGame->id;
                    ?>
' value='<?php 
                    echo $leftTeam->id;
                    ?>
' <?php 
                    echo $jTip->tip_id == $leftTeam->id ? 'checked="checked"' : '';
                    ?>
 <?php 
                    echo $disabled;
                    ?>
 />
							<?php 
                }
                ?>
					</td>
					<?php 
                if ($this->jSeason->team_starts) {
                    $left_start_field = $left . '_start';
                    $leftStart = $jGame->{$left_start_field} + 0;
                    if ($jGame->{$left_start_field} > 0) {
                        $leftStart = "+{$leftStart}";
                    } else {
                        if ($leftStart == 0) {
                            $leftStart = "&nbsp;";
                        }
                    }
                    ?>
                        <td style='text-align:center;'><?php 
                    echo $leftStart;
                    ?>
</td>
                        <?php 
                }
                if ($this->jSeason->pick_score == 1) {
                    ?>
						<td style='text-align:center;'>
						<?php 
                    if ($jGame->has_score == 1) {
                        ?>
							<input type='text' onKeyUp="this.value=this.value.replace(/[^\d]+/, '');" class="inputbox" id="<?php 
                        echo $left . $jGame->id;
                        ?>
" name='<?php 
                        echo $left . $jGame->id;
                        ?>
' style='text-align:center;' maxLength='5' size='5' value='<?php 
                        $left_score_field = $left . '_score';
                        echo $jTip->{$left_score_field};
                        ?>
' <?php 
                        echo $disabled;
                        ?>
 onBlur="setSelectedTeam(<?php 
                        echo $jGame->id;
                        ?>
);" />
							<?php 
                    } else {
                        ?>
&nbsp;<?php 
                    }
                    ?>
						</td>
						<?php 
                }
                if ($this->jSeason->pick_draw == 1 and ($this->jSeason->pick_score and !$jTips['HideTeamSelect'] or !$this->jSeason->pick_score)) {
                    ?>
						<td style='text-align:center;'>&nbsp;<input class="inputbox" type='radio' name='game<?php 
                    echo $jGame->id;
                    ?>
' id="draw_game<?php 
                    echo $jGame->id;
                    ?>
" value='-1' <?php 
                    echo $jTip->tip_id == -1 ? 'checked="checked"' : '';
                    ?>
 <?php 
                    echo $disabled;
                    ?>
 <?php 
                    echo $onClick;
                    ?>
/></td>
						<?php 
                } else {
                    ?>
						<td style='text-align:center;'>&nbsp;<?php 
                    echo $jLang['_COM_TEAM_VS'];
                    ?>
&nbsp;</td>
						<?php 
                }
                if ($this->jSeason->pick_score == 1) {
                    ?>
						<td style='text-align:center;'>
						<?php 
                    if ($jGame->has_score == 1) {
                        ?>
							<input type='text' onKeyUp="this.value=this.value.replace(/[^\d]+/, '');" class="inputbox" id="<?php 
                        echo $right . $jGame->id;
                        ?>
" name='<?php 
                        echo $right . $jGame->id;
                        ?>
' style='text-align:center;' maxLength='5' size='5' value='<?php 
                        $right_score_field = $right . '_score';
                        echo $jTip->{$right_score_field};
                        ?>
' <?php 
                        echo $disabled;
                        ?>
 onBlur="setSelectedTeam(<?php 
                        echo $jGame->id;
                        ?>
);" />
							<?php 
                    } else {
                        ?>
&nbsp;<?php 
                    }
                    ?>
						</td>
						<?php 
                }
                $right_start_field = $right . '_start';
                if ($this->jSeason->team_starts) {
                    $rightStart = $jGame->{$right_start_field} + 0;
                    if ($jGame->{$right_start_field} > 0) {
                        $rightStart = "+{$rightStart}";
                    } else {
                        if ($rightStart == 0) {
                            $rightStart = "&nbsp;";
                        }
                    }
                    ?>
                        <td style='text-align:center;'><?php 
                    echo $rightStart;
                    ?>
</td>
                        <?php 
                }
                ?>
					<td style='text-align:left;<?php 
                echo $right_style;
                ?>
'>
						<?php 
                if ($this->jSeason->pick_score and !$jTips['HideTeamSelect'] or !$this->jSeason->pick_score) {
                    ?>
							<input type='radio' <?php 
                    echo $onClick;
                    ?>
  class="inputbox" name='game<?php 
                    echo $jGame->id;
                    ?>
' value='<?php 
                    echo $rightTeam->id;
                    ?>
' <?php 
                    echo $jTip->tip_id == $rightTeam->id ? 'checked="checked"' : '';
                    ?>
 <?php 
                    echo $disabled;
                    ?>
 id="<?php 
                    echo $right;
                    ?>
_game<?php 
                    echo $jGame->id;
                    ?>
"/>
							<?php 
                }
                ?>
						&nbsp;<label for="<?php 
                echo $right;
                ?>
_game<?php 
                echo $jGame->id;
                ?>
"><?php 
                echo $rightTeam->getDisplayLogoName('left');
                ?>
</label>
					</td>
					<?php 
                if ($this->jSeason->pick_margin == 1) {
                    ?>
						<td style='text-align:center;'>
						<?php 
                    if ($jGame->has_margin == 1) {
                        ?>
							<input type='text' onKeyUp="this.value=this.value.replace(/[^\d]+/, '');" class="inputbox" name='margin<?php 
                        echo $jGame->id;
                        ?>
' style='text-align:center;' maxLength='5' size='5' value='<?php 
                        echo $jTip->margin;
                        ?>
' <?php 
                        echo $disabled;
                        ?>
 />
							<?php 
                    } else {
                        ?>
&nbsp;<?php 
                    }
                    ?>
						</td>
						<?php 
                }
                if ($this->jSeason->pick_bonus > 0) {
                    if ($jGame->has_bonus == 1) {
                        // BUG 302 - awayTeam and homeTeam do not exist anymore
                        $bonusTeams = array('' => $jLang['_ADMIN_CONF_NONE'], $jGame->{$left_id_field} => $leftTeam->getName(), $jGame->{$right_id_field} => $rightTeam->getName());
                        if ($this->jSeason->pick_bonus == 2) {
                            $bonusTeams['-2'] = $jLang['_ADMIN_SEASON_EPTB_BOT'];
                        }
                        ?>
							<td style='text-align:center;'><?php 
                        echo makeSelectList($bonusTeams, 'bonus' . $jGame->id, "{$disabled} class='inputbox'", $jTip->bonus_id);
                        ?>
</td>
							<?php 
                    } else {
                        ?>
							<td style='text-align:center;'>&nbsp;</td>
							<?php 
                    }
                }
                //show the game time
                if ($this->jSeason->game_times) {
                    ?>
<td><?php 
                    if ($jGame->start_time) {
                        echo TimeDate::toDisplayDateTime($jGame->start_time, false);
                    } else {
                        echo "&nbsp;";
                    }
                    ?>
</td><?php 
                }
                if ($this->jRound->scored == 1) {
                    $left_score_field = $left . '_score';
                    $right_score_field = $right . '_score';
                    ?>
							<th <?php 
                    echo $tags;
                    ?>
><?php 
                    echo $jGame->{$left_score_field} . " - " . $jGame->{$right_score_field};
                    ?>
&nbsp;</th>
						<?php 
                }
                ?>
<td><?php 
                if (!empty($jGame->description)) {
                    $description = nl2br(stripslashes($jGame->description));
                    echo jTipsToolTip($description, $jLang['_COM_GAME_ADDITIONAL_INFO']);
                } else {
                    echo "&nbsp;";
                }
                ?>
</td>
				</tr>
				<?php 
                $rowIndex++;
            }
            ?>
			</table>
			<div>
			<?php 
            $this->renderByes();
            ?>
			<table width="100%" cellspacing="10">
			<?php 
            if ($jTips['DoubleUp'] == 1) {
                if ($jTipsCurrentUser->doubleup > 0 && $jTipsCurrentUser->doubleup < $this->jRound->id || $disabled == 'disabled') {
                    $disable_doubleup = 'disabled';
                } else {
                    $disable_doubleup = '';
                }
                ?>
				<tr>
					<td style='text-align:center'><h4><label for="doubleup"><?php 
                echo $jLang['_COM_GAME_USEDOUBLE'];
                ?>
</label>&nbsp;<input type='checkbox' class="inputbox" id="doubleup" name='doubleup' value='<?php 
                echo $this->jRound->id;
                ?>
' <?php 
                echo $jTipsCurrentUser->doubleup == $this->jRound->id ? "checked" : "";
                ?>
 <?php 
                echo $disable_doubleup;
                ?>
 /></h4></td>
				</tr>
				<?php 
            }
            if ($jTips['EnableComments'] == 1) {
                if ($disabled == 'disabled') {
                    $commentArea = "<em>";
                    if (strlen($this->jComment->comment) > 0) {
                        $commentArea .= $this->jComment->comment;
                    } else {
                        $commentArea .= $jLang['_ADMIN_CONF_NONE'];
                    }
                    $commentArea .= "</em>";
                } else {
                    $comment = str_replace('"', "'", $this->jComment->comment);
                    $commentArea = '
					<input name="comment" id="comment" size="50" class="inputbox" value="' . $comment . '" />
					';
                }
                ?>
				<tr>
					<td style="text-align:center;"><?php 
                echo $jLang['_COM_DASH_COMMENT'];
                ?>
: <?php 
                echo $commentArea;
                ?>
</td>
				</tr>
				<?php 
            }
            ?>
			<tr>
				<td style='text-align:center' id='submittipsbuttonarea'><?php 
            echo $disabled != "disabled" ? "<input type='button' class='button' name='submittips' id='submittips' value='" . $jLang['_COM_TIPS_SAVE'] . "' {$checkComment} />" : "";
            ?>
</td>
			</tr>
			<tr>
				<td style='text-align:center; padding-top:5px; display:none;' id='ajaxloading'></td>
			</tr>
			</table>
			</div>
			<input type='hidden' name='round_id' value='<?php 
            echo $this->jRound->id;
            ?>
' />
			</form>
			<?php 
        } else {
            if ($this->jRound->exists() and TimeDate::toDatabaseDateTime($this->jRound->start_time) > gmdate('Y-m-d H:i:s')) {
                ?>
			<h2 style='text-align:center'><?php 
                echo $jLang['_COM_DASH_ROUND'] . " " . $this->jRound->round;
                ?>
</h2>
			<h2 style='text-align:center'><?php 
                echo $jLang['_COM_ROUND_CLOSED'];
                ?>
</h2>
			<?php 
            } else {
                if ($this->jRound->exists()) {
                    ?>
				<h2 style='text-align:center'><?php 
                    echo $jLang['_COM_DASH_ROUND'] . " " . $this->jRound->round;
                    ?>
</h2>
				<?php 
                } else {
                    ?>
				<h2 style='text-align:center'><?php 
                    echo $jLang['_COM_ROUND_NOGAMES'];
                    ?>
</h2>
				<?php 
                }
            }
        }
        if ($this->jRound->getStatus() === false and !empty($jTipsCurrentUser->id)) {
            $userTime = strtotime($this->jRound->start_time) - TimeDate::getOffset(false);
            $targetTime = date('Y-m-d H:i:s', $userTime);
            if ($jTips['ShowJSCountdown'] == 1) {
                $field = "'countdown'";
            } else {
                $field = "false";
            }
            ?>
			<script type='text/javascript'>
				window.addEvent('domready', function(){
					var year = <?php 
            echo TimeDate::format($targetTime, '%Y', true, false);
            ?>
;
					var month = <?php 
            echo TimeDate::format($targetTime, '%m', true, false) - 1;
            ?>
;
					var day = <?php 
            echo TimeDate::format($targetTime, '%d', true, false);
            ?>
;
					var hour = <?php 
            echo TimeDate::format($targetTime, '%H', true, false);
            ?>
;
					var min = <?php 
            echo TimeDate::format($targetTime, '%M', true, false);
            ?>
;
					var sec = 0;
					jTipsCountdown(year, month, day, hour, min, 1, <?php 
            echo $field;
            ?>
);
				});
			</script>
			<?php 
        }
    }
コード例 #2
0
ファイル: ShowTeam.php プロジェクト: joomux/jTips
require_once $mosConfig_absolute_path . '/administrator/components/com_jtips/classes/jround.class.php';
require_once $mosConfig_absolute_path . '/administrator/components/com_jtips/classes/jteam.class.php';
if (jTipsFileExists($mosConfig_absolute_path . '/components/com_jtips/custom/views/TeamLadder/ShowTeamRender.ext.php')) {
    require_once $mosConfig_absolute_path . '/components/com_jtips/custom/views/TeamLadder/ShowTeamRender.ext.php';
} else {
    require_once $mosConfig_absolute_path . '/components/com_jtips/views/TeamLadder/ShowTeamRender.php';
}
if (!isJoomla15()) {
    //Trash anything we have so far
    ob_clean();
    ob_start();
}
$render = new jTipsRenderShowTeam();
$id = jTipsGetParam($_REQUEST, 'id', '');
$jTeam = new jTeam($database);
$jTeam->load($id);
$render->assign('jTeam', $jTeam);
$jSeason = new jSeason($database);
$jSeason->load($jTeam->season_id);
$render->assign('jSeason', $jSeason);
$render->display();
if (!isJoomla15()) {
    die;
}
/*
$my = $mainframe->getUser();
$jTipsUser = new jTipsUser($database);
$jTipsUserParams = array(
	'user_id' => $my->id,
	'season_id' => $jTeam->season_id
);
コード例 #3
0
			</thead>
			<tbody>

		<?php 
        $rowIndex = 0;
        $left_id_field = $left . '_id';
        $right_id_field = $right . '_id';
        foreach ($jGames as $jGame) {
            if (!$jGame->home_id or !$jGame->away_id) {
                continue;
            }
            // Allow for BYES
            $leftTeam = new jTeam($database);
            $rightTeam = new jTeam($database);
            $leftTeam->load($jGame->{$left_id_field});
            $rightTeam->load($jGame->{$right_id_field});
            ?>
			<tr class="sectiontableentry<?php 
            echo $rowIndex++ % 2 + 1;
            ?>
">
			<td><?php 
            echo $leftTeam->getDisplayLogoName();
            ?>
</td>
			<td><?php 
            echo $rightTeam->getDisplayLogoName();
            ?>
</td>
			</tr>
			<?php 
コード例 #4
0
ファイル: locked.php プロジェクト: joomux/jTips
    /**
     * Take data assigned in $data and display it
     */
    function display()
    {
        global $jTipsCurrentUser, $mainframe, $database, $jLang, $jTips, $mosConfig_live_site;
        $mosConfig_offset = $mainframe->getCfg('offset');
        global $Itemid;
        $useJs = false;
        if ($jTips['JsLadder'] != 'none') {
            $useJs = true;
        }
        ?>
<h2 class="contentheading jmain_heading"><?php 
        echo $this->jSeason->name;
        ?>
</h2>
<h3 align="center"><?php 
        if ($this->jRound->getPrev()) {
            ?>
 <a style="font-size: smaller;"
	href='<?php 
            echo jTipsRoute("index.php?option=com_jtips&amp;Itemid={$Itemid}&amp;view=Tips&amp;layout=locked&amp;rid=" . $this->jRound->getPrev());
            ?>
'>&laquo;
	<?php 
            echo $jLang['_COM_PREV_ROUND'];
            ?>
</a> <?php 
        }
        echo "&nbsp;" . $jLang['_COM_DASH_ROUND'] . " " . $this->jRound->round . "&nbsp;";
        if ($this->jRound->getNext()) {
            ?>
 <a style="font-size: smaller;"
	href='<?php 
            echo jTipsRoute("index.php?option=com_jtips&amp;Itemid={$Itemid}&amp;view=Tips&amp;layout=locked&amp;rid=" . $this->jRound->getNext());
            ?>
'><?php 
            echo $jLang['_COM_NEXT_ROUND'];
            ?>
&raquo;</a> <?php 
        }
        ?>
</h3>
<?php 
        if ($this->jRound->exists()) {
            $jGameParams = array('round_id' => $this->jRound->id, 'order' => array('type' => 'order', 'by' => 'position', 'direction' => 'ASC'));
            $jGame = new jGame($database);
            $jGames = forceArray($jGame->loadByParams($jGameParams));
            $tags = "class='sectiontableheader jtableheader'";
            ?>
		<table width="100%" cellspacing="0">
			<thead>
				<tr class="sectiontableheader">
					<th <?php 
            echo $tags;
            ?>
 width="50%"><?php 
            echo $jLang['_COM_ROUND_START_TIME'];
            ?>
</th>
					<?php 
            if ($jTips['ShowJSCountdown'] == 1) {
                ?>
					<th <?php 
                echo $tags;
                ?>
 width="50%"><?php 
                echo $jLang['_COM_ROUND_TIME_TO_START'];
                ?>
</th>
					<?php 
            }
            ?>
				</tr>
			</thead>
			<tbody>
				<tr class="sectiontableentry1">
					<td style="text-align: center;"><?php 
            //BUG 136 - show closed/closes depending on start time
            echo TimeDate::toDisplayDateTime($this->jRound->start_time, false);
            ?>
</td>
					<?php 
            if ($jTips['ShowJSCountdown'] == 1) {
                ?>
					<td>
					<div id='countdown' style="text-align: center;" class="highlight"><?php 
                echo $jLang['_COM_CLOSED'];
                ?>
</div>
					</td>
					<?php 
            }
            ?>
				</tr>
			</tbody>
		</table>
					<?php 
            if (jTipsGetParam($jTips, 'TeamLadderPopup', 0)) {
                $url = "view=TeamLadder&Itemid={$Itemid}&menu=0";
                ?>
		<p style="text-align: center; font-weight: bold;">
						<?php 
                if (isJoomla15()) {
                    // better popup handling in J1.5
                    JHTML::_('behavior.modal');
                    $rel = json_encode(array('size' => array('x' => $jTips['ShowTipsWidth'], 'y' => $jTips['ShowTipsHeight'])));
                    $url = jTipsRoute("index.php?option=com_jtips&tmpl=component&" . $url);
                    $attribs = array('class' => 'modal', 'rel' => str_replace('"', "'", $rel), 'title' => $jLang['_COM_TIPS_SHOWHIDE']);
                    echo JHTML::link($url, $jLang['_COM_TIPS_SHOWHIDE'], $attribs);
                } else {
                    ?>
 <a href='javascript:void(0);'
							onClick="openPopup('<?php 
                    echo $url;
                    ?>
', 'Team Ladder');"><?php 
                    echo $jLang['_COM_TIPS_SHOWHIDE'];
                    ?>
</a>
							<?php 
                }
                ?>
</p><?php 
            }
            //BUG 189 - Which order should the tips panel be shown in
            if ($this->jSeason->tips_layout == 'away') {
                $left = 'away';
                $right = 'home';
            } else {
                $left = 'home';
                $right = 'away';
            }
            ?>
		<table align='center' width='100%' class="jdatatable" cellspacing="0">
			<tr>
				<th <?php 
            echo $tags;
            ?>
><?php 
            echo $jLang['_COM_GAME_' . strtoupper($left)];
            ?>
</th>
				<?php 
            if ($this->jSeason->team_starts) {
                ?>
				<th <?php 
                echo $tags;
                ?>
><?php 
                echo $jLang['_COM_TIPS_' . strtoupper($left) . 'START'];
                ?>
</th>
				<?php 
            }
            if ($this->jSeason->team_starts) {
                ?>
				<th <?php 
                echo $tags;
                ?>
><?php 
                echo $jLang['_COM_TIPS_' . strtoupper($right) . 'START'];
                ?>
</th>
				<?php 
            }
            ?>
				<th <?php 
            echo $tags;
            ?>
>&nbsp;</th>
				<th <?php 
            echo $tags;
            ?>
><?php 
            echo $jLang['_COM_GAME_' . strtoupper($right)];
            ?>
</th>
				<?php 
            if ($this->jSeason->game_times) {
                ?>
				<th <?php 
                echo $tags;
                ?>
><?php 
                echo $jLang['_COM_TIPS_TIME'];
                ?>
</th>
				<?php 
            }
            if ($this->jRound->scored == 1) {
                ?>
				<th <?php 
                echo $tags;
                ?>
><?php 
                echo $jLang['_COM_TIPS_RESULT'];
                ?>
</th>
				<?php 
            }
            ?>
				<th <?php 
            echo $tags;
            ?>
>&nbsp;</th>
			</tr>
			<?php 
            $rowIndex = 0;
            foreach ($jGames as $jGame) {
                $leftTeam = new jTeam($database);
                $rightTeam = new jTeam($database);
                $left_id_field = $left . '_id';
                $right_id_field = $right . '_id';
                $leftLoaded = $rightLoaded = false;
                if ($jGame->{$left_id_field}) {
                    $leftTeam->load($jGame->{$left_id_field});
                    $leftLoaded = true;
                }
                if ($jGame->{$right_id_field}) {
                    $rightTeam->load($jGame->{$right_id_field});
                    $rightLoaded = true;
                }
                if (!$leftLoaded and $rightLoaded) {
                    $this->byes[] = $rightTeam;
                }
                if ($leftLoaded and !$rightLoaded) {
                    $this->byes[] = $leftTeam;
                }
                if (!$leftLoaded or !$rightLoaded) {
                    continue;
                }
                if ($jGame->winner_id == $leftTeam->id) {
                    $left_style = "font-weight:bold;";
                    $right_style = "";
                } else {
                    if ($jGame->winner_id == -1) {
                        $left_style = "font-style:italics;";
                        $right_style = "font-style:italics;";
                    } else {
                        if ($jGame->winner_id == $rightTeam->id) {
                            $left_style = "";
                            $right_style = "font-weight:bold;";
                        } else {
                            $left_style = "";
                            $right_style = "";
                        }
                    }
                }
                $rowClasses = "class='sectiontableentry" . ($rowIndex % 2 + 1) . " jtablerow" . ($rowIndex % 2 + 1) . "'";
                ?>
			<tr <?php 
                echo $rowClasses;
                ?>
>
				<td style='text-align:right;<?php 
                echo $left_style;
                ?>
'><label
					for="<?php 
                echo $left;
                ?>
_game<?php 
                echo $jGame->id;
                ?>
"><?php 
                echo $leftTeam->getDisplayLogoName('right');
                ?>
</label></td>
					<?php 
                if ($this->jSeason->team_starts) {
                    $left_start_field = $left . '_start';
                    $leftStart = $jGame->{$left_start_field} + 0;
                    if ($jGame->{$left_start_field} > 0) {
                        $leftStart = "+{$leftStart}";
                    } else {
                        if ($leftStart == 0) {
                            $leftStart = "&nbsp;";
                        }
                    }
                    ?>
				<td style='text-align: center;'><?php 
                    echo $leftStart;
                    ?>
</td>
				<?php 
                }
                ?>
				<td style='text-align: center;'>&nbsp;<?php 
                echo $jLang['_COM_TEAM_VS'];
                ?>
&nbsp;</td>
				<?php 
                $right_start_field = $right . '_start';
                if ($this->jSeason->team_starts) {
                    $rightStart = $jGame->{$right_start_field} + 0;
                    if ($jGame->{$right_start_field} > 0) {
                        $rightStart = "+{$rightStart}";
                    } else {
                        if ($rightStart == 0) {
                            $rightStart = "&nbsp;";
                        }
                    }
                    ?>
				<td style='text-align: center;'><?php 
                    echo $rightStart;
                    ?>
</td>
				<?php 
                }
                ?>
				<td style='text-align:left;<?php 
                echo $right_style;
                ?>
'><label
					for="<?php 
                echo $right;
                ?>
_game<?php 
                echo $jGame->id;
                ?>
"><?php 
                echo $rightTeam->getDisplayLogoName('left');
                ?>
</label>
				</td>
				<?php 
                //show the game time
                if ($this->jSeason->game_times) {
                    ?>
					<td><?php 
                    if ($jGame->start_time) {
                        echo TimeDate::toDisplayDateTime($jGame->start_time, false);
                    } else {
                        echo "&nbsp;";
                    }
                    ?>
</td><?php 
                }
                if ($this->jRound->scored == 1) {
                    $left_score_field = $left . '_score';
                    $right_score_field = $right . '_score';
                    ?>
					<th <?php 
                    echo $tags;
                    ?>
><?php 
                    echo $jGame->{$left_score_field} . " - " . $jGame->{$right_score_field};
                    ?>
&nbsp;</th>
					<?php 
                }
                ?>
<td><?php 
                if (!empty($jGame->description)) {
                    $description = nl2br(stripslashes($jGame->description));
                    echo jTipsToolTip($description, $jLang['_COM_GAME_ADDITIONAL_INFO']);
                } else {
                    echo "&nbsp;";
                }
                ?>
</td>
			</tr>
			<?php 
                $rowIndex++;
            }
            ?>
		</table>
		<div><?php 
            $this->renderByes();
            ?>
</div>
		<?php 
        } else {
            if ($this->jRound->exists() and TimeDate::toDatabaseDateTime($this->jRound->start_time) > gmdate('Y-m-d H:i:s')) {
                ?>
		<h2 style='text-align: center'><?php 
                echo $jLang['_COM_DASH_ROUND'] . " " . $this->jRound->round;
                ?>
</h2>
		<h2 style='text-align: center'><?php 
                echo $jLang['_COM_ROUND_CLOSED'];
                ?>
</h2>
			<?php 
            } else {
                if ($this->jRound->exists()) {
                    ?>
		<h2 style='text-align: center'><?php 
                    echo $jLang['_COM_DASH_ROUND'] . " " . $this->jRound->round;
                    ?>
</h2>
				<?php 
                } else {
                    ?>
		<h2 style='text-align: center'><?php 
                    echo $jLang['_COM_ROUND_NOGAMES'];
                    ?>
</h2>
				<?php 
                }
            }
        }
        if ($this->jRound->getStatus() === false) {
            $userTime = strtotime($this->jRound->start_time) - TimeDate::getOffset(false);
            $targetTime = date('Y-m-d H:i:s', $userTime);
            if ($jTips['ShowJSCountdown'] == 1) {
                $field = "'countdown'";
            } else {
                $field = "false";
            }
            ?>
		<script type='text/javascript'>
						window.addEvent('domready', function(){
							var year = <?php 
            echo TimeDate::format($targetTime, '%Y', true, false);
            ?>
;
							var month = <?php 
            echo TimeDate::format($targetTime, '%m', true, false) - 1;
            ?>
;
							var day = <?php 
            echo TimeDate::format($targetTime, '%d', true, false);
            ?>
;
							var hour = <?php 
            echo TimeDate::format($targetTime, '%H', true, false);
            ?>
;
							var min = <?php 
            echo TimeDate::format($targetTime, '%M', true, false);
            ?>
;
							var sec = 0;
							jTipsCountdown(year, month, day, hour, min, 1, <?php 
            echo $field;
            ?>
);
						});
					</script>
			<?php 
        }
    }
コード例 #5
0
ファイル: default.php プロジェクト: joomux/jTips
    function display()
    {
        global $jLang, $database, $mosConfig_live_site, $Itemid;
        $left_id_field = $this->left . '_id';
        $right_id_field = $this->right . '_id';
        $left_score = $this->left . '_score';
        $right_score = $this->right . '_score';
        ?>
		<style type='text/css'>
		#loader2.ajax-loading {
			background:url(<?php 
        echo $mosConfig_live_site;
        ?>
/components/com_jtips/images/loading.gif) no-repeat center;
			padding: 20px 0;
		}
		</style>
		<div id="loader2"></div>
		<div id="games_table">
		<form action="index2.php?Itemid=<?php 
        echo $Itemid;
        ?>
" method="post" name="adminForm" id="jTipsRoundProcessForm">
		<input type="hidden" name="option" value="com_jtips" />
		<input type="hidden" name="view" value="Administration" />
		<input type="hidden" name="action" value="SaveRoundResults" />
		<input type="hidden" name="<?php 
        echo jTipsSpoofValue();
        ?>
" value="1" />
		<table class="admintable" cellspacing="0" width="100%">
		<thead>
		<tr class="sectiontableheader">
		<th><?php 
        echo $jLang['_COM_GAME_' . strtoupper($this->left)];
        ?>
</th>
		<th><?php 
        echo $jLang['_COM_GAME_' . strtoupper($this->right)];
        ?>
</th>
		<th><?php 
        echo $jLang['_COM_TIPS_' . strtoupper($this->left) . 'SCORE'];
        ?>
</th>
		<th><?php 
        echo $jLang['_COM_TIPS_' . strtoupper($this->right) . 'SCORE'];
        ?>
</th>
		<th><?php 
        echo $jLang['_ADMIN_GAME_BONUS'];
        ?>
</th>
		</tr>
		</thead>
		<tbody>
		<?php 
        $rowIndex = 0;
        foreach ($this->jGames as $jGame) {
            $leftTeam = new jTeam($database);
            $rightTeam = new jTeam($database);
            $leftTeam->load($jGame->{$left_id_field});
            $rightTeam->load($jGame->{$right_id_field});
            ?>
			<tr class="sectiontableentry<?php 
            echo $rowIndex++ % 2 + 1;
            ?>
">
			<td align="left">
				<input type="hidden" name="cid[]" value="<?php 
            echo $jGame->id;
            ?>
" />
				<?php 
            echo $leftTeam->getDisplayLogoName();
            ?>
			</td>
			<td align="left"><?php 
            echo $rightTeam->getDisplayLogoName();
            ?>
</td>
			<td><input type="text" size="5" class="inputbox" autocomplete="off" style="text-align:center;" name="<?php 
            echo $left_score;
            ?>
[]" value="<?php 
            echo $jGame->{$left_score};
            ?>
" /></td>
			<td><input type="text" size="5" class="inputbox" autocomplete="off" style="text-align:center;" name="<?php 
            echo $right_score;
            ?>
[]" value="<?php 
            echo $jGame->{$right_score};
            ?>
" /></td>
			<td align="left">
				<?php 
            $bonusDD = array(jTipsHTML::makeOption('', $jLang['_ADMIN_CONF_NONE']), jTipsHTML::makeOption($leftTeam->id, $leftTeam->getName()), jTipsHTML::makeOption($rightTeam->id, $rightTeam->getName()));
            if ($this->jSeason->pick_bonus == 2) {
                $bonusDD[] = jTipsHTML::makeOption(-2, $jLang['_ADMIN_SEASON_EPTB_BOT']);
            }
            echo jTipsHTML::selectList($bonusDD, 'bonus_id[]', "class='inputbox' style='width:95%;'", 'value', 'text', $jGame->bonus_id);
            ?>
			</td>
			</tr>
			<?php 
        }
        ?>
		</tbody>
		</table>
		<div class="contentheading" style="text-align:center;">
		<?php 
        if (isJoomla15()) {
            ?>
			<input type="submit" value="<?php 
            echo $jLang['_COM_ADMIN_RESULTS_SAVE_PROCESS'];
            ?>
" name="submit_process" class="button" />
			<input type="button" value="<?php 
            echo $jLang['_COM_CANCEL'];
            ?>
" name="cancel" onClick="window.parent.document.getElementById('sbox-window').close();" class="button" />
			<?php 
        } else {
            ?>
			<input type="submit" value="<?php 
            echo $jLang['_COM_ADMIN_RESULTS_SAVE_PROCESS'];
            ?>
" name="submit_process" class="button" />
			<input type="button" value="<?php 
            echo $jLang['_COM_CANCEL'];
            ?>
" name="cancel" onClick="$('mb_close_link').onclick();" class="button" />
			<?php 
        }
        ?>
		</div>
		</form>
		</div>
		<?php 
    }
コード例 #6
0
ファイル: jteam.class.php プロジェクト: joomux/jTips
 /**
  * Updates the team points based on the round passed in
  */
 static function updateLadder($jRound, $jSeason)
 {
     jTipsLogger::_log('updating team ladder for round ' . $jRound->id);
     global $database;
     $params = array('round_id' => $jRound->id);
     $jGame = new jGame($database);
     $jGames = forceArray($jGame->loadByParams($params));
     $byeTeams = array();
     foreach ($jGames as $jGame) {
         $home = new jTeam($database);
         $away = new jTeam($database);
         $homeLoaded = $awayLoaded = false;
         if ($jGame->home_id) {
             $home->load($jGame->home_id);
             $homeLoaded = true;
         }
         if ($jGame->away_id) {
             $away->load($jGame->away_id);
             $awayLoaded = true;
         }
         if (!$homeLoaded and $awayLoaded) {
             $byeTeams[] = $away;
         }
         if ($homeLoaded and !$awayLoaded) {
             $byeTeams[] = $home;
         }
         if (!$homeLoaded or !$awayLoaded) {
             continue;
         }
         // nothing to process here
         $home->wins = $home->_getNumberOfWins();
         $home->losses = $home->_getNumberOfLosses();
         $home->draws = $home->_getNumberOfDraws();
         $home->points_for = $home->_getPointsFor();
         $home->points_against = $home->_getPointsAgainst();
         $home->points = $home->_getTotalPoints();
         $away->wins = $away->_getNumberOfWins();
         $away->losses = $away->_getNumberOfLosses();
         $away->draws = $away->_getNumberOfDraws();
         $away->points_for = $away->_getPointsFor();
         $away->points_against = $away->_getPointsAgainst();
         $away->points = $away->_getTotalPoints();
         $home->save();
         $away->save();
     }
     if (!empty($byeTeams)) {
         foreach ($byeTeams as $team) {
             $team->wins = $team->_getNumberOfWins();
             $team->losses = $team->_getNumberOfLosses();
             $team->draws = $team->_getNumberOfDraws();
             $team->points_for = $team->_getPointsFor();
             $team->points_against = $team->_getPointsAgainst();
             $team->points = $team->_getTotalPoints();
             $team->points += $jSeason->team_bye;
             $team->save();
         }
     }
 }
コード例 #7
0
    }
    $query = "SELECT tip_id AS team_id, COUNT(*) times_picked " . "FROM #__jtips_tips JOIN #__jtips_users ON " . "#__jtips_tips.user_id = #__jtips_users.id ";
    if ($params->get('user') and $my->id) {
        $jTipsUserParams = array('season_id' => $jSeason->id, 'user_id' => $my->id, 'status' => 1);
        $jTipsFTModuleUser = new jTipsUser($database);
        $jTipsFTModuleUser->loadByParams($jTipsUserParams);
        if ($jTipsFTModuleUser->id) {
            $query .= "WHERE #__jtips_users.user_id = " . $database->Quote($my->id) . " ";
        }
    }
    $query .= "GROUP BY #__jtips_tips.tip_id ORDER BY times_picked DESC";
    $database->setQuery($query, 0, 1);
    $team = $database->loadRow();
    if ($team) {
        $jTeam = new jTeam($database);
        $jTeam->load($team[0]);
        ?>
<div style="text-align:center;"><?php 
        $popupUrl = "view=TeamLadder&action=ShowTeam&menu=0&id=" . $jTeam->id . "&season_id=" . $jTeam->season_id;
        if (isJoomla15()) {
            $x = $jTips['ShowTipsWidth'];
            $y = $jTips['ShowTipsHeight'];
            //BUG 274 - team ladder popup results in broken scroll bar
            if (basename($_SERVER['SCRIPT_FILENAME']) != 'index2.php') {
                $class = "class='modal'";
            } else {
                $class = '';
            }
            $teamname = "<a {$class} rel=\"{handler: 'iframe', size: {x: {$x}, y: {$y}}}\" href='" . jTipsRoute($mosConfig_live_site . "/index2.php?option=com_jtips&{$popupUrl}") . "'>";
        } else {
            $teamname = "<a href='javascript:void(0);' onClick='openPopup(\"{$popupUrl}\", \"" . $jTeam->getName() . "\");'>";
コード例 #8
0
ファイル: ShowTipsRender.php プロジェクト: joomux/jTips
    function display($hideColumns = array(), $showThisRound = true)
    {
        global $database, $jTips, $jLang, $mosConfig_live_site, $mainframe, $jTipsCurrentUser, $Itemid;
        if (empty($this->jTipsUser->id)) {
            echo "";
            return;
        }
        ?>
		<style type="text/css">
		@import url(<?php 
        echo $mosConfig_live_site;
        ?>
/templates/<?php 
        echo jTipsGetTemplateName();
        ?>
/css/template.css);
		@import url(<?php 
        echo $mosConfig_live_site;
        ?>
/components/com_jtips/css/jtips-popup.css);
		</style>
		<script type='text/javascript' src='<?php 
        echo $mosConfig_live_site;
        ?>
/components/com_jtips/js/mootools.js'></script>
		<script type='text/javascript' src='<?php 
        echo $mosConfig_live_site;
        ?>
/components/com_jtips/js/Popup.js'></script>
		<?php 
        $width = $jTips['ShowTipsWidth'] - 40;
        if ($jTips['ShowTipsPadding']) {
            ?>
			<div style="padding-top:10px;padding-left:10px;padding-right:10px;padding-bottom:10px;width:<?php 
            echo $width;
            ?>
px;text-align:center;">
			<?php 
        }
        ?>
		<h2 style='text-align:center;'><?php 
        echo $this->jSeason->name;
        ?>
 <?php 
        echo $jLang['_COM_SHOWTIPS_ROUND'];
        ?>
 <?php 
        echo $this->jRound->round;
        ?>
</h2>
		<?php 
        if ($jTips['SocialIntegration'] and $showThisRound) {
            if ($jTips['SocialIntegration'] == 'cb') {
                $imgSrc = getCommunityBuilderAvatar($this->jTipsUser->user_id);
                $link = jTipsRoute("index.php?option=com_comprofiler&amp;task=userProfile&amp;user={$this->jTipsUser->user_id}");
            } else {
                $imgSrc = getJomSocialAvatar($this->jTipsUser->user_id);
                $link = getJomSocialProfileLink($this->jTipsUser->user_id);
            }
            ?>
			<div style="text-align:center;">
				<a href="javascript:void(0);" onClick="parent.location='<?php 
            echo $link;
            ?>
';" title='View Profile' id='userLadderLink_<?php 
            echo $this->jTipsUser->id;
            ?>
'>
					<img src="<?php 
            echo $imgSrc;
            ?>
" border="0" alt="" />
				</a>
			</div>
			<?php 
        }
        if ($this->stats) {
            $this->showStats();
        }
        //BUG 189 - Which order should the tips panel be shown in
        if ($this->jSeason->tips_layout == 'away') {
            $left = 'away';
            $right = 'home';
        } else {
            $left = 'home';
            $right = 'away';
        }
        ?>
		<table align='center' width='100%' border='0' cellspacing='0' style="padding-top:25px;">
			<thead>
			<tr class="sectiontableheader">
			<?php 
        if (!in_array($left, $hideColumns)) {
            ?>
<th class="sectiontableheader TB_th"><?php 
            echo $jLang['_COM_GAME_' . strtoupper($left)];
            ?>
</th><?php 
        }
        if (!in_array($right, $hideColumns)) {
            ?>
<th class="sectiontableheader TB_th"><?php 
            echo $jLang['_COM_GAME_' . strtoupper($right)];
            ?>
</th><?php 
        }
        if (!in_array('tipped', $hideColumns)) {
            ?>
<th class="sectiontableheader TB_th"><?php 
            echo $jLang['_COM_DASH_TIPPED'];
            ?>
</th><?php 
        }
        if (!in_array('result', $hideColumns)) {
            ?>
<th class="sectiontableheader TB_th"><?php 
            echo $jLang['_COM_TIPS_RESULT'];
            ?>
</th><?php 
        }
        if (!in_array('more', $hideColumns)) {
            ?>
<th class="sectiontableheader TB_th"><?php 
            echo $jLang['_COM_TIPS_MORE'];
            ?>
</th><?php 
        }
        ?>
			</tr>
			</thead>
			<tbody>
		<?php 
        $rowIndex = 0;
        $i = 1;
        $hasTipped = $this->jTipsUser->hasTipped($this->jRound->id);
        $byeTeams = array();
        // Might want to list the byes somewhere later
        foreach ($this->jGames as $jGame) {
            $leftTeam = new jTeam($database);
            $left_id = $left . '_id';
            //$leftTeam->load($jGame->$left_id);
            $rightTeam = new jTeam($database);
            $right_id = $right . '_id';
            //$rightTeam->load($jGame->$right_id);
            // Skip games with byes
            $leftLoaded = $rightLoaded = false;
            if ($jGame->{$left_id}) {
                $leftTeam->load($jGame->{$left_id});
                $leftLoaded = true;
            }
            if ($jGame->{$right_id}) {
                $rightTeam->load($jGame->{$right_id});
                $rightLoaded = true;
            }
            if (!$leftLoaded and $rightLoaded) {
                $byeTeams[] = $rightTeam;
            }
            if ($leftLoaded and !$rightLoaded) {
                $byeTeams[] = $leftTeam;
            }
            if (!$leftLoaded or !$rightLoaded) {
                continue;
            }
            $jTip = new jTip($database);
            $jTipParams = array('user_id' => $this->jTipsUser->id, 'game_id' => $jGame->id);
            $jTip->loadByParams($jTipParams);
            $overlib_text = "";
            if ($jTip->tip_id == $leftTeam->id) {
                $tipName = $leftTeam->getName();
                $tip = $leftTeam->getDisplayLogoName();
                $nonName = $rightTeam->getName();
            } else {
                if ($jTip->tip_id == $rightTeam->id) {
                    $tipName = $rightTeam->getName();
                    $tip = $rightTeam->getDisplayLogoName();
                    $nonName = $leftTeam->getName();
                } else {
                    if ($jTip->tip_id == -1) {
                        $tip = $jLang['_COM_GAME_DRAW'];
                        $tipName = $leftTeam->getName();
                        $nonName = $rightTeam->getName();
                    } else {
                        $tip = $jLang['_ADMIN_CONF_NONE'];
                    }
                }
            }
            if ($jGame->winner_id == $jTip->tip_id) {
                $result = "<img src='" . $mosConfig_live_site . "/administrator/images/tick.png' alt='Y' border='0' align='middle' />";
            } else {
                $result = "<img src='" . $mosConfig_live_site . "/administrator/images/publish_x.png' alt='N' border='0' align='middle' />";
            }
            $onClick = "onClick='toggleMore(" . $jGame->id . ", this)'";
            $more = "<img src='{$mosConfig_live_site}/components/com_jtips/images/show.gif' alt='more' border='0' {$onClick} style='cursor:pointer;' />";
            $rowIndex++;
            ?>
			<tr class="sectiontableentry<?php 
            echo $i % 2 + 1;
            ?>
" valign='middle'>
			<?php 
            if (!in_array($left, $hideColumns)) {
                if ($jGame->winner_id == $leftTeam->id) {
                    $style = "style='font-weight:bold;'";
                } else {
                    if ($jGame->winner_id == -1) {
                        $style = "style='font-style:italic;'";
                    } else {
                        $style = '';
                    }
                }
                ?>
<td class="sectiontableentry<?php 
                echo $i % 2 + 1;
                ?>
" align="left" <?php 
                echo $style;
                ?>
><?php 
                echo $leftTeam->getDisplayLogoName();
                ?>
</td><?php 
            }
            if (!in_array($right, $hideColumns)) {
                if ($jGame->winner_id == $rightTeam->id) {
                    $style = "style='font-weight:bold;'";
                } else {
                    if ($jGame->winner_id == -1) {
                        $style = "style='font-style:italic;'";
                    } else {
                        $style = '';
                    }
                }
                ?>
<td class="sectiontableentry<?php 
                echo $i % 2 + 1;
                ?>
" align="left" <?php 
                echo $style;
                ?>
><?php 
                echo $rightTeam->getDisplayLogoName();
                ?>
</td><?php 
            }
            if (!in_array('tipped', $hideColumns)) {
                ?>
<td class="sectiontableentry<?php 
                echo $i % 2 + 1;
                ?>
" align="left"><?php 
                echo $tip;
                ?>
</td><?php 
            }
            if (!in_array('result', $hideColumns)) {
                ?>
<td class="sectiontableentry<?php 
                echo $i % 2 + 1;
                ?>
" style='text-align:center;'><?php 
                echo $result;
                ?>
</td><?php 
            }
            if (!in_array('more', $hideColumns)) {
                ?>
<td class="sectiontableentry<?php 
                echo $i % 2 + 1;
                ?>
" style='text-align:center;'><?php 
                echo $more;
                ?>
</td><?php 
            }
            ?>
			</tr>
			<?php 
            /*
             * Process the in-depth game analysis
             */
            $left_score_field = $left . '_score';
            $right_score_field = $right . '_score';
            if ($jGame->winner_id == $leftTeam->id) {
                $winnerName = $leftTeam->getDisplayLogoName();
            } else {
                if ($jGame->winner_id == $rightTeam->id) {
                    $winnerName = $rightTeam->getDisplayLogoName();
                } else {
                    if ($jGame->winner_id == -1) {
                        $winnerName = $jLang['_COM_GAME_DRAW'];
                    } else {
                        $winnerName = '';
                    }
                }
            }
            $gameTotal = 0;
            $tipWidth = 30;
            if (in_array('actual', $hideColumns)) {
                $tipWidth += 30;
            }
            if (in_array('awarded', $hideColumns)) {
                $tipWidth += 10;
            }
            ?>
			<tr>
			<td colspan="50" id="moreInfo<?php 
            echo $jGame->id;
            ?>
" style="display:none;">
				<table width="100%" cellspacing="0">
				<thead>
				<tr class="sectiontableheader">
				<th class="sectiontableheader" width="30%">&nbsp;</th>
				<th class="sectiontableheader" width="<?php 
            echo $tipWidth;
            ?>
%"><?php 
            echo $jLang['_COM_SHOWTIPS_PREDICTED'];
            ?>
</th>
				<?php 
            if (!in_array('actual', $hideColumns)) {
                ?>
				<th class="sectiontableheader" width="30%"><?php 
                echo $jLang['_COM_SHOWTIPS_ACTUAL'];
                ?>
</th>
				<?php 
            }
            if (!in_array('awarded', $hideColumns)) {
                ?>
				<th class="sectiontableheader" width="10%"><?php 
                echo $jLang['_COM_SHOWTIPS_AWARDED'];
                ?>
</th>
				<?php 
            }
            ?>
				</tr>
				</thead>
				<tbody>
					<tr class="sectiontableentry1">
					<th class="sectiontableentry1"><?php 
            echo $jLang['_COM_DASH_TIPPED'];
            ?>
</th>
					<td class="sectiontableentry1" align="left"><?php 
            echo $tip;
            ?>
&nbsp;</td>
					<?php 
            if (!in_array('actual', $hideColumns)) {
                ?>
						<td class="sectiontableentry1" align="left"><?php 
                echo $winnerName;
                ?>
&nbsp;</td>
						<?php 
            }
            if (!in_array('awarded', $hideColumns)) {
                ?>
						<td class="sectiontableentry1" style="text-align:right;">
						<?php 
                if ($hasTipped) {
                    if ($jGame->winner_id == $jTip->tip_id) {
                        // BUG 379 - Incorrect value displayed when draw correctly picked
                        if ($jGame->winner_id == -1) {
                            echo $this->jSeason->user_draw;
                            $gameTotal += $this->jSeason->user_draw;
                        } else {
                            echo $this->jSeason->user_correct;
                            $gameTotal += $this->jSeason->user_correct;
                        }
                    } else {
                        echo '0';
                    }
                } else {
                    //what were the default points here?
                    if ($this->jSeason->user_none >= 0) {
                        echo $this->jSeason->user_none;
                        $gameTotal += $this->jSeason->user_none;
                    } else {
                        if ($this->jSeason->user_none == -1) {
                            //holy crap! you got the lowest score equivalence!
                            echo $jLang['_ADMIN_CONF_ACT_NA'];
                        } else {
                            if ($this->jSeason->user_none == -2) {
                                //you got all the away teams
                                if ($jGame->winner_id == $jGame->away_id) {
                                    echo $this->jSeason->user_correct;
                                    $gameTotal += $this->jSeason->user_correct;
                                } else {
                                    echo '0';
                                }
                            }
                        }
                    }
                }
                ?>
						&nbsp;</td>
						<?php 
            }
            ?>
					</tr>
				<?php 
            $subIndex = 1;
            if ($jGame->has_score) {
                ?>
					<tr class="sectiontableentry<?php 
                echo $subIndex % 2 + 1;
                ?>
">
					<th class="sectiontableentry<?php 
                echo $subIndex % 2 + 1;
                ?>
"><?php 
                echo $jLang['_COM_DASH_POINTS'];
                ?>
</th>
					<td class="sectiontableentry<?php 
                echo $subIndex % 2 + 1;
                ?>
"><?php 
                echo $jTip->{$left_score_field} + 0;
                ?>
 - <?php 
                echo $jTip->{$right_score_field} + 0;
                ?>
&nbsp;</td>
					<?php 
                if (!in_array('actual', $hideColumns)) {
                    ?>
						<td class="sectiontableentry<?php 
                    echo $subIndex % 2 + 1;
                    ?>
"><?php 
                    echo $jGame->{$left_score_field};
                    ?>
 - <?php 
                    echo $jGame->{$right_score_field};
                    ?>
&nbsp;</td>
						<?php 
                }
                if (!in_array('awarded', $hideColumns)) {
                    ?>
						<td class="sectiontableentry<?php 
                    echo $subIndex % 2 + 1;
                    ?>
" style="text-align:right;">
						<?php 
                    if ($jTip->{$left_score_field} == $jGame->{$left_score_field} and $jTip->{$right_score_field} == $jGame->{$right_score_field}) {
                        echo $this->jSeason->user_pick_score;
                        $gameTotal += $this->jSeason->user_pick_score;
                    } else {
                        echo '0';
                    }
                    ?>
						&nbsp;</td>
						<?php 
                }
                ?>
					</tr>
					<?php 
                $subIndex++;
            }
            if ($jGame->has_margin) {
                ?>
					<tr class="sectiontableentry<?php 
                echo $subIndex % 2 + 1;
                ?>
">
					<th class="sectiontableentry<?php 
                echo $subIndex % 2 + 1;
                ?>
"><?php 
                echo $jLang['_COM_TIPS_MARGIN'];
                ?>
</th>
					<td class="sectiontableentry<?php 
                echo $subIndex % 2 + 1;
                ?>
"><?php 
                echo $jTip->margin + 0;
                ?>
&nbsp;</td>
					<?php 
                if (!in_array('actual', $hideColumns)) {
                    ?>
						<td class="sectiontableentry<?php 
                    echo $subIndex % 2 + 1;
                    ?>
"><?php 
                    echo abs($jGame->{$left_score_field} - $jGame->{$right_score_field});
                    ?>
&nbsp;</td>
						<?php 
                }
                if (!in_array('awarded', $hideColumns)) {
                    ?>
						<td class="sectiontableentry<?php 
                    echo $subIndex % 2 + 1;
                    ?>
" style="text-align:right;">
						<?php 
                    if ($jTip->margin == abs($jGame->{$left_score_field} - $jGame->{$right_score_field})) {
                        echo $this->jSeason->user_pick_margin;
                        $gameTotal += $this->jSeason->user_pick_margin;
                    } else {
                        echo '0';
                    }
                    ?>
						&nbsp;</td>
						<?php 
                }
                ?>
					</tr>
					<?php 
                $subIndex++;
            }
            if ($jGame->has_bonus) {
                if ($jGame->bonus_id == $leftTeam->id) {
                    $bonusTeam = $leftTeam->getDisplayLogoName();
                } else {
                    if ($jGame->bonus_id == $rightTeam->id) {
                        $bonusTeam = $rightTeam->getDisplayLogoName();
                    } else {
                        if ($jGame->bonus_id == -2) {
                            $bonusTeam = 'Both Teams';
                        } else {
                            $bonusTeam = "";
                        }
                    }
                }
                if ($jTip->bonus_id == $leftTeam->id) {
                    $bonusTip = $leftTeam->getDisplayLogoName();
                } else {
                    if ($jTip->bonus_id == $rightTeam->id) {
                        $bonusTip = $rightTeam->getDisplayLogoName();
                    } else {
                        if ($jTip->bonus_id == -2) {
                            $bonusTip = 'Both Teams';
                        } else {
                            $bonusTip = $jLang['_ADMIN_CONF_NONE'];
                        }
                    }
                }
                ?>
					<tr class="sectiontableentry<?php 
                echo $subIndex % 2 + 1;
                ?>
">
					<th class="sectiontableentry<?php 
                echo $subIndex % 2 + 1;
                ?>
"><?php 
                echo $jLang['_COM_SHOWTIPS_BONUS_TEAM'];
                ?>
</th>
					<td class="sectiontableentry<?php 
                echo $subIndex % 2 + 1;
                ?>
" align="left"><?php 
                echo $bonusTip;
                ?>
&nbsp;</td>
					<?php 
                if (!in_array('actual', $hideColumns)) {
                    ?>
						<td class="sectiontableentry<?php 
                    echo $subIndex % 2 + 1;
                    ?>
"><?php 
                    echo $bonusTeam;
                    ?>
&nbsp;</td>
						<?php 
                }
                if (!in_array('awarded', $hideColumns)) {
                    ?>
						<td class="sectiontableentry<?php 
                    echo $subIndex % 2 + 1;
                    ?>
" style="text-align:right;">
						<?php 
                    if ($jGame->bonus_id == $jTip->bonus_id) {
                        echo $this->jSeason->user_pick_bonus;
                        $gameTotal += $this->jSeason->user_pick_bonus;
                    } else {
                        echo '0';
                    }
                    ?>
						&nbsp;</td>
						<?php 
                }
                ?>
					</tr>
					<?php 
            }
            ?>
				</tbody>
				<?php 
            if (!in_array('awarded', $hideColumns)) {
                ?>
					<tfoot>
					<tr class="sectiontableheader">
					<th class="sectiontableheader" colspan="3"><?php 
                echo $jLang['_COM_SHOWTIPS_TOTAL'];
                ?>
</th>
					<th class="sectiontableheader" style="text-align:right;"><?php 
                echo $gameTotal;
                ?>
&nbsp;</th>
					</tr>
					</tfoot>
					<?php 
            }
            ?>
				</table>
			</td>
			</tr>
			<?php 
            $i++;
        }
        ?>
		</tbody>
		</table>
		<?php 
        /*
         * Do we have a comment to show
         */
        $jComment = new jComment($database);
        $jCommentParams = array('user_id' => $this->jTipsUser->id, 'round_id' => $this->jRound->id);
        $jComment->loadByParams($jCommentParams);
        if (isset($jComment->comment) && !empty($jComment->comment)) {
            ?>
			<hr />
			<p align="center"><?php 
            echo jTipsStripslashes($jComment->comment);
            ?>
</p>
			<?php 
        }
        /*
         * Show the Peek into Next Round link be shown and parsed
         */
        if ($jTips['EnableShowTips'] == 1 and $showThisRound) {
            //getCurrentUser
            $current_round_id = $this->jSeason->getCurrentRound();
            $showFuture = false;
            if (isset($jTipsCurrentUser->id) and !empty($jTipsCurrentUser->id)) {
                if ($jTips['ShowTipsAccess'] == 'any' or $jTips['ShowTipsAccess'] == 'processed' and $jTipsCurrentUser->hasTipped($current_round_id) or $jTips['ShowTipsAccess'] == 'inprogress' and $this->jRound->getStatus() !== false) {
                    $showFuture = true;
                }
            } else {
                if ($jTips['ShowTipsAccess'] == 'any') {
                    $showFuture = true;
                }
            }
            if ($current_round_id != $this->jRound->id and $current_round_id and $showFuture) {
                $hide = array('result', 'actual', 'awarded');
                $colsToHide = json_encode($hide);
                $data = "&season={$this->jSeason->id}&hide=" . rawurlencode($colsToHide);
                if ($Itemid) {
                    $data .= "&Itemid={$Itemid}";
                }
                if (isJoomla15()) {
                    ?>
					<p align="center"><a href="<?php 
                    echo jTipsRoute("index2.php?option=com_jtips&view=CompetitionLadder&menu=0&action=ShowTips&uid=" . $this->jTipsUser->id . "&rid=" . $current_round_id . $data);
                    ?>
"><?php 
                    echo $jLang['_POPUP_TIPS_PEEK'];
                    ?>
</a></p>
					<?php 
                } else {
                    ?>
					<p align="center"><a href="javascript:loadTipsPopup(<?php 
                    echo $this->jTipsUser->id;
                    ?>
, <?php 
                    echo $current_round_id;
                    ?>
, $('mb_caption'), '<?php 
                    echo $data;
                    ?>
');"><?php 
                    echo $jLang['_POPUP_TIPS_PEEK'];
                    ?>
</a></p>
					<?php 
                }
            }
        }
        if ($jTips['ShowTipsPadding']) {
            echo "</div>";
        }
    }
コード例 #9
0
                        echo $tip->margin ? $tip->margin : "&nbsp;";
                        ?>
</td>
						<?php 
                    }
                    ?>
						<td>
					<?php 
                    if ($otherTeam->id) {
                        echo jTipsToolTip($otherTeam->getName(), 'Versus');
                    } else {
                        if ($tip->tip_id == -1) {
                            $homeTeam = new jTeam($database);
                            $awayTeam = new jTeam($database);
                            $homeTeam->load($game->home_id);
                            $awayTeam->load($game->away_id);
                            echo jTipsToolTip($homeTeam->getName() . " v " . $awayTeam->getName(), 'Draw Selected');
                        } else {
                            echo "&nbsp;";
                        }
                    }
                    ?>
						</td>
					</tr>
					<?php 
                    $k++;
                }
                ?>
					</tbody>
				</table>
				<?php 
コード例 #10
0
ファイル: functions.inc.php プロジェクト: joomux/jTips
/**
 * Sends an email to the user confirming their selections
 * TODO: Make the email customisable
 *
 * @param object The jTipsUser to send to
 * @param array The set of tips for the user
 */
function sendTipsConfirmation($jTipsUser, $tips)
{
    global $database, $jTips;
    if (!$jTips['TipsNotifyEnable']) {
        jTipsLogger::_log('tips confirmation email disabled', 'INFO');
        return true;
    }
    jTipsLogger::_log('building tips confirmation email');
    $jSeason = new jSeason($database);
    $jSeason->load($jTipsUser->season_id);
    $from_name = $jTips['UserNotifyFromName'];
    $from_email = $jTips['UserNotifyFromEmail'];
    if ($jTips['DisplayName'] == 'user') {
        $name = 'username';
    } else {
        $name = 'name';
    }
    $subject = "Selection Confirmation";
    $content = "Hi " . $jTipsUser->getUserField($name) . ",<br /><br />" . "Thanks for submitting your tips!<br /><br />" . "You picked:<br /><br />";
    foreach ($tips as $jTip) {
        $jGame = new jGame($database);
        $jGame->load($jTip->game_id);
        $home = new jTeam($database);
        $away = new jTeam($database);
        $home->load($jGame->home_id);
        $away->load($jGame->away_id);
        $phrase = 'to defeat';
        if ($jTip->tip_id == $home->id or $jTip->tip_id == '-1') {
            $tipped =& $home;
            $notTipped =& $away;
        } else {
            $tipped =& $away;
            $notTipped =& $home;
        }
        if ($jTip->tip_id == '-1') {
            $phrase = 'to draw with';
        }
        $content .= $tipped->getName() . " {$phrase} " . $notTipped->getName();
        if ($jSeason->pick_margin == 1 and $jGame->has_margin == 1) {
            $content .= " by " . ($jTip->margin ? $jTip->margin : '0');
        }
        if ($jSeason->pick_score == 1 and $jGame->has_score == 1) {
            $content .= " with a final score of ";
            if ($jTip->tip_id == $home->id or $jTip->tip_id == '-1') {
                $content .= $jTip->home_score . " to " . $jTip->away_score;
            } else {
                $content .= $jTip->away_score . " to " . $jTip->home_score;
            }
        }
        $content .= "<br />";
    }
    $content .= "<br />";
    $content .= "Good Luck!<br />";
    $content .= $from_name;
    //BUG 223 - Send the email in plaintext for best compatibility, so convert the line breaks
    $content = str_replace('<br />', "\n", $content);
    jTipsLogger::_log($content, 'ERROR');
    jTipsLogger::_log('sending tips confirmation email to ' . $jTipsUser->getUserField('email') . ' from <' . $from_email . '>');
    if (jTipsMail($from_email, $from_name, $jTipsUser->getUserField('email'), $subject, $content)) {
        jTipsLogger::_log('tips email confirmation sent', 'INFO');
        return true;
    } else {
        jTipsLogger::_log('failed to sent tips confirmation email', 'ERROR');
        return false;
    }
}
コード例 #11
0
ファイル: ShowTeamRender.php プロジェクト: joomux/jTips
    function display()
    {
        global $jTipsCurrentUser, $database, $mainframe, $mosConfig_absolute_path, $jLang, $jTips, $mosConfig_live_site;
        $width = $jTips['ShowTipsWidth'] - 40;
        ?>
		<style type="text/css">
		@import url(<?php 
        echo $mosConfig_live_site;
        ?>
/templates/<?php 
        echo jTipsGetTemplateName();
        ?>
/css/template.css);
		@import url(<?php 
        echo $mosConfig_live_site;
        ?>
/components/com_jtips/css/jtips-popup.css);
		</style>
		<?php 
        if ($jTips['ShowTipsPadding']) {
            ?>
			<div style="float:left;padding-top:10px;padding-left:10px;padding-right:10px;padding-bottom:10px;width:<?php 
            echo $width;
            ?>
px;text-align:center;">
			<?php 
        }
        if (!empty($this->jTeam->url)) {
            ?>
			<div style="float:right;">
				<a href="<?php 
            echo $this->jTeam->url;
            ?>
" target="_blank"><img src="images/M_images/weblink.png" align="absmiddle" border="0" alt="<?php 
            echo $jLang['_COM_TEAM_HOME_PAGE'];
            ?>
" title="<?php 
            echo $this->jTeam->url;
            ?>
" /></a>
				&nbsp;<a href="<?php 
            echo $this->jTeam->url;
            ?>
" target="_blank"><?php 
            echo preg_replace('/.*[^\\/]:\\/+/i', '', $this->jTeam->url);
            ?>
</a>
			</div>
			<?php 
        }
        ?>
		<h1 align="left"><?php 
        echo $this->jTeam->getName();
        ?>
</h1>
		<?php 
        $img = '';
        if (!empty($this->jTeam->logo) and jTipsFileExists($mosConfig_absolute_path . '/' . getJtipsImage($this->jTeam->logo, 100))) {
            $path = getJtipsImage($this->jTeam->logo, 100);
            $name = $this->jTeam->getName();
            $img = "<img src='{$mosConfig_live_site}/{$path}' align='left' border='1' style='margin-right:10px;margin-bottom:10px;' alt='{$name}' />";
        }
        $about = $img . jTipsStripslashes($this->jTeam->about);
        if (!empty($about)) {
            ?>
		        <p style="padding-top:5px;" align="left">
		        <?php 
            echo $about;
            ?>
		        </p>
		        <?php 
        }
        ?>
		<div style="clear:both;">&nbsp;</div>
		<h2 align="center" class="contentheading"><?php 
        echo $jLang['_COM_TEAM_HISTORY'];
        ?>
</h2>
		<table width="100%" border="0" cellspacing="0">
		<thead>
		<tr class="sectiontableheader">
		<th><?php 
        echo $jLang['_COM_DASH_ROUND'];
        ?>
</th>
		<th><?php 
        echo $jLang['_ADMIN_ROUND_DATE'];
        ?>
</th>
		<th><?php 
        echo $jLang['_COM_TEAM_VS'];
        ?>
</th>
		<th><?php 
        echo $jLang['_ADMIN_TEAM_LOCATION'];
        ?>
</th>
		<th><?php 
        echo $jLang['_COM_SCORE'];
        ?>
</th>
		<th><?php 
        echo $jLang['_COM_TIPS_RESULT'];
        ?>
</th>
		</tr>
		</thead>
		<tbody>
		<?php 
        $rowIndex = 0;
        $history = $this->jTeam->getHistory();
        foreach ($history as $game) {
            $other = new jTeam($database);
            if ($this->jTeam->id == $game->home_id) {
                $other->load($game->away_id);
                $location = $jLang['_COM_TEAM_HOME'];
            } else {
                $other->load($game->home_id);
                $location = $jLang['_COM_TEAM_AWAY'];
            }
            $isBye = false;
            if (!$other->id) {
                $isBye = true;
            }
            if ($game->winner_id == $this->jTeam->id) {
                $result = 'tick';
                $alt = $jLang['_COM_TEAM_WIN'];
            } else {
                if ($game->winner_id == '-1') {
                    $result = 'draw';
                    $alt = $jLang['_COM_TEAM_DRAW'];
                } else {
                    $result = 'cross';
                    $alt = $jLang['_COM_TEAM_LOSS'];
                }
            }
            $date = TimeDate::toDisplayDate($game->start_time, true, false);
            $live_site = $mainframe->getCfg('live_site');
            if (strrpos($live_site, '/') == strlen($live_site) - 1) {
                $live_site = substr($live_site, 0, -1);
            }
            $thisRowIndex = $rowIndex++;
            ?>
			<tr class="sectiontableentry<?php 
            echo $thisRowIndex % 2 + 1;
            ?>
 jtablerow<?php 
            echo $thisRowIndex % 2 + 1;
            ?>
">
			<td align="center"><?php 
            echo $game->round;
            ?>
.</td>
			<td align="left"><?php 
            echo $date;
            ?>
</td>
			<td align="left"><?php 
            echo $isBye ? '<em>' . $jLang['_COM_BYE'] . '</em>' : $other->getDisplayLogoName();
            ?>
</td>
			<td align="center"><?php 
            echo $isBye ? '&nbsp;' : $location;
            ?>
</td>
			<td align="center"><?php 
            echo $isBye ? '&nbsp;' : $game->home_score . ' - ' . $game->away_score;
            ?>
</td>
			<td align="center"><img src="<?php 
            echo $mosConfig_live_site;
            ?>
/components/com_jtips/images/<?php 
            echo $result;
            ?>
.png" alt="<?php 
            echo $alt;
            ?>
" title="<?php 
            echo $alt;
            ?>
" border="0" /></td>
			</tr>
			<?php 
        }
        ?>
		</tbody>
		</table>
		<?php 
        if ($jTips['ShowTipsPadding']) {
            echo "</div>";
        }
    }
コード例 #12
0
ファイル: jtip.class.php プロジェクト: joomux/jTips
 function fillInAdditionalFields()
 {
     global $database;
     $jTipsUser = new jTipsUser($database);
     $jTipsUser->load($this->user_id);
     $this->user =& $jTipsUser;
     $jTeam = new jTeam($database);
     if ($this->tip_id > 0) {
         $jTeam->load($this->tip_id);
     }
     $this->team =& $jTeam;
     $jGame = new jGame($database);
     $jGame->load($this->game_id);
     $jRound = new jRound($database);
     $jRound->load($jGame->round_id);
     $this->round =& $jRound;
     $this->round_num = $jRound->round;
     $jSeason = new jSeason($database);
     $jSeason->load($jRound->season_id);
     $this->season =& $jSeason;
 }
コード例 #13
0
ファイル: edit.php プロジェクト: joomux/jTips
$tpl->selectLists = $filters;
$data = array();
//Now we have the preliminary options, get the set of games
if ($season_id and $round_id and $user_id) {
    $params = array('round_id' => $round_id);
    $jGame = new jGame($database);
    $jGames = forceArray($jGame->loadByParams($params));
    foreach ($jGames as $game) {
        $params = array('game_id' => $game->id, 'user_id' => $user_id);
        $jTip = new jTip($database);
        $jTip->loadByParams($params);
        //jTipsDebug($jTip);
        $jHome = new jTeam($database);
        $jAway = new jTeam($database);
        $jHome->load($game->home_id);
        $jAway->load($game->away_id);
        $team_options = array('' => '--None--', $jHome->id => $jHome->getName(), $jAway->id => $jAway->getName());
        $bonus_options = $team_options;
        $bonus_options['-2'] = '--Both Teams--';
        $data[$game->id] = array('home' => $jHome, 'away' => $jAway, 'home_score' => $jTip->home_score, 'away_score' => $jTip->away_score, 'margin' => $jTip->margin, 'bonus_id' => makeSelectList($team_options, 'g' . $game->id . '[bonus_id]', "", ''), 'home_tipped' => '', 'away_tipped' => '', 'draw_tipped' => '', 'id' => $jTip->id);
        if ($jTip->tip_id == $jHome->id) {
            $data[$game->id]['home_tipped'] = "checked";
        } else {
            if ($jTip->tip_id == $jAway->id) {
                $data[$game->id]['away_tipped'] = "checked";
            } else {
                if ($jTip->tip_id == -1) {
                    $data[$game->id]['draw_tipped'] = "checked";
                }
            }
        }