本文整理汇总了PHP中TimeDate::getOffset方法的典型用法代码示例。如果您正苦于以下问题:PHP TimeDate::getOffset方法的具体用法?PHP TimeDate::getOffset怎么用?PHP TimeDate::getOffset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TimeDate
的用法示例。
在下文中一共展示了TimeDate::getOffset方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
//.........这里部分代码省略.........
<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: display
//.........这里部分代码省略.........
echo $tags;
?>
><?php
echo $jGame->{$left_score_field} . " - " . $jGame->{$right_score_field};
?>
</th>
<?php
}
?>
<td><?php
if (!empty($jGame->description)) {
$description = nl2br(stripslashes($jGame->description));
echo jTipsToolTip($description, $jLang['_COM_GAME_ADDITIONAL_INFO']);
} else {
echo " ";
}
?>
</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
}
}
示例3: jTipsRenderMenu
global $mosConfig_absolute_path, $database, $mainframe, $jTips, $jLang, $mosConfig_live_site, $jTipsCurentUser, $Itemid;
//Extend the render class if it exists
if (jTipsFileExists($mosConfig_absolute_path . '/components/com_jtips/custom/views/Menu/tmpl/default.ext.php')) {
require_once $mosConfig_absolute_path . '/components/com_jtips/custom/views/Menu/tmpl/default.ext.php';
} else {
require_once $mosConfig_absolute_path . '/components/com_jtips/views/Menu/tmpl/default.php';
}
$render = new jTipsRenderMenu();
jTipsLogger::_log('MENU TASK: ' . $task);
//$Itemid = jTipsGetParam($_REQUEST, 'Itemid', $Itemid); //Itemid is a global!
if (!isJoomla15()) {
$dateFormat = '%Y-%m-%d';
} else {
$dateFormat = $jTips['DateFormat'];
}
$mainframe->addCustomHeadTag("<script type='text/javascript'>var jTipsLiveSite = '{$mosConfig_live_site}';var Offset = " . TimeDate::getOffset(false) . ";var DateFormat = '" . $dateFormat . "';</script>");
$jSeason = new jSeason($database);
$season_id = getSeasonID();
$jSeason->load($season_id);
$season_link = '';
//"&season=" .$jSeason->id;
$render->assign('jSeason', $jSeason);
$render->assign('season_link', $season_link);
$render->assign('adminUrl', "view=Administration&Itemid={$Itemid}&season=" . getSeasonID());
/*
* TODO: BUG: XXX - the admin scripts were not loaded if the scorer was not part of a competition
*/
$my =& $mainframe->getUser();
if ($jSeason->scorer_id == $my->id) {
//$mainframe->addCustomHeadTag('<script type="text/javascript" src="' .$mosConfig_live_site. '/components/com_jtips/views/Administration/Administration.js"></script>');
//$mainframe->addCustomHeadTag('<script type="text/javascript" src="' .$mosConfig_live_site. '/administrator/components/com_jtips/lib/date.js"></script>');
示例4: EditMode
require_once 'components/com_jtips/modules/Rounds/edit.tmpl.php';
$mainframe->addCustomHeadTag("<script type='text/javascript' src='components/com_jtips/lib/date.js'></script>");
$mainframe->addCustomHeadTag("<script type='text/javascript' src='components/com_jtips/modules/Rounds/Edit.js'></script>");
if (!isJoomla15()) {
$dateFormat = '%Y-%m-%d';
} else {
$dateFormat = $jTips['DateFormat'];
}
// Set default values for newer config variables
if (!isset($jTips['Is24Hour'])) {
$jTips['Is24Hour'] = '0';
}
if (!isset($jTips['MinuteValues'])) {
$jTips['MinuteValues'] = '0';
}
$mainframe->addCustomHeadTag("<script type='text/javascript'>var DateFormat = '" . $dateFormat . "'; var Offset = " . TimeDate::getOffset() . "; var MinuteValues = {$jTips['MinuteValues']}; var Is24Hour = {$jTips['Is24Hour']};</script>");
//BUG 259 - No need to define style here - causes problems in J1.0 with IE
//$mainframe->addCustomHeadTag("<style type='text/css'>.pick_score {display:none;} .pick_margin {display:none} .pick_bonus {display:none;} .team_starts {display:none;}</style>");
$tpl = new EditMode();
$focus = new jRound($database);
$ids = jTipsGetParam($_REQUEST, 'cid', array());
if (!empty($ids)) {
$id = array_shift($ids);
$focus->load($id);
}
//load the jRound object into the script
$mainframe->addCustomHeadTag("<script type='text/javascript'>var jRound = " . @json_encode($focus) . ";</script>");
$tpl->formData = array('title' => $jLang['_ADMIN_ROUND_TITLE'] . ": " . ($focus->exists() ? $jLang['_ADMIN_OTHER_EDIT'] : $jLang['_ADMIN_OTHER_NEW']));
$tpl->focus =& $focus;
$tpl->status = $focus->getStatus();
if ($focus->getStatus() !== false) {
示例5: strtotime
if ($params->get('showclose') != '0') {
if ($params->get('showclose') == 'static') {
?>
<p align="center"><?php
echo TimeDate::toDisplayDateTime($jRound->start_time, false);
?>
</p>
<?php
} else {
if ($params->get('showclose') == 'count') {
// $mainframe->addCustomHeadTag("<script type='text/javascript' src='" .$mosConfig_live_site. "/components/com_jtips/js/countdown.js'></script>");
echo "<script type='text/javascript' src='" . $mosConfig_live_site . "/components/com_jtips/js/language.js'></script>";
echo "<script type='text/javascript' src='" . $mosConfig_live_site . "/components/com_jtips/js/mootools.js'></script>";
echo "<script type='text/javascript' src='" . $mosConfig_live_site . "/components/com_jtips/js/countdown.js'></script>";
//$userTime = strtotime($jRound->start_time);
$userTime = strtotime($this->jRound->start_time) - TimeDate::getOffset(false);
// let's make this consistent with the component
$targetTime = date('Y-m-d H:i:s', $userTime);
$randId = rand();
?>
<p align="center" id="counter<?php
echo $randId;
?>
"></p>
<script type='text/javascript'>
window.addEvent('domready', function(){
var year = <?php
echo TimeDate::format($targetTime, '%Y', true, false);
?>
;
var month = <?php
示例6: format
/**
* Changes the date(time) string into the format passed in.
* Argument should be used with strftime. Default is the config var
*
* @param string The date(time) string
* @param [string] The target format - must be compatible with strftime()
* @param [bool] True if the first parameter includes time. Defaults to false
* @param [bool] True if calling from the admin area, false when calling from the front-end
*
* @return string The date/time in the format passed in
*/
static function format($date, $format = null, $hasTime = false, $isAdmin = true)
{
global $jTips, $jTipsCurrentUser, $mainframe;
if (is_null($format)) {
if ($hasTime) {
$format = $jTips['DateFormat'] . ' ' . $jTips['TimeFormat'];
} else {
$format = $jTips['TimeFormat'];
}
}
$time = strtotime($date);
if ($hasTime) {
$time += TimeDate::getOffset($isAdmin);
}
return strftime($format, $time);
}