本文整理汇总了PHP中Datetime::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Datetime::create方法的具体用法?PHP Datetime::create怎么用?PHP Datetime::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Datetime
的用法示例。
在下文中一共展示了Datetime::create方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getMessage
function getMessage()
{
if ($date = Versioned::current_archived_date()) {
$dateObj = Datetime::create();
$dateObj->setValue($date);
return "<div id=\"SilverStripeNavigatorMessage\" title=\"" . _t('ContentControl.NOTEWONTBESHOWN', 'Note: this message will not be shown to your visitors') . "\">" . _t('ContentController.ARCHIVEDSITEFROM', 'Archived site from') . "<br>" . $dateObj->Nice() . "</div>";
}
}
示例2: SilverStripeNavigator
public function SilverStripeNavigator()
{
$member = Member::currentUser();
$items = '';
$message = '';
if (Director::isDev() || Permission::check('CMS_ACCESS_CMSMain') || Permission::check('VIEW_DRAFT_CONTENT')) {
if ($this->dataRecord) {
Requirements::css(CMS_DIR . '/css/SilverStripeNavigator.css');
Requirements::javascript(FRAMEWORK_DIR . '/thirdparty/jquery/jquery.js');
Requirements::javascript(CMS_DIR . '/javascript/SilverStripeNavigator.js');
$return = $nav = SilverStripeNavigator::get_for_record($this->dataRecord);
$items = $return['items'];
$message = $return['message'];
}
if ($member) {
$firstname = Convert::raw2xml($member->FirstName);
$surname = Convert::raw2xml($member->Surname);
$logInMessage = _t('ContentController.LOGGEDINAS', 'Logged in as') . " {$firstname} {$surname} - <a href=\"Security/logout\">" . _t('ContentController.LOGOUT', 'Log out') . "</a>";
} else {
$logInMessage = sprintf('%s - <a href="%s">%s</a>', _t('ContentController.NOTLOGGEDIN', 'Not logged in'), Config::inst()->get('Security', 'login_url'), _t('ContentController.LOGIN', 'Login') . "</a>");
}
$viewPageIn = _t('ContentController.VIEWPAGEIN', 'View Page in:');
return <<<HTML
\t\t\t\t<div id="SilverStripeNavigator">
\t\t\t\t\t<div class="holder">
\t\t\t\t\t<div id="logInStatus">
\t\t\t\t\t\t{$logInMessage}
\t\t\t\t\t</div>
\t\t\t\t\t<div id="switchView" class="bottomTabs">
\t\t\t\t\t\t{$viewPageIn}
\t\t\t\t\t\t{$items}
\t\t\t\t\t</div>
\t\t\t\t\t</div>
\t\t\t\t</div>
\t\t\t\t\t{$message}
HTML;
// On live sites we should still see the archived message
} else {
if ($date = Versioned::current_archived_date()) {
Requirements::css(CMS_DIR . '/css/SilverStripeNavigator.css');
$dateObj = Datetime::create($date, null);
// $dateObj->setVal($date);
return "<div id=\"SilverStripeNavigatorMessage\">" . _t('ContentController.ARCHIVEDSITEFROM') . "<br>" . $dateObj->Nice() . "</div>";
}
}
}