本文整理汇总了PHP中UTIL_DateTime::formatDate方法的典型用法代码示例。如果您正苦于以下问题:PHP UTIL_DateTime::formatDate方法的具体用法?PHP UTIL_DateTime::formatDate怎么用?PHP UTIL_DateTime::formatDate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UTIL_DateTime
的用法示例。
在下文中一共展示了UTIL_DateTime::formatDate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($userId, $idList)
{
parent::__construct();
if (!empty($userId) && !empty($idList)) {
$this->user = BOL_UserService::getInstance()->findUserById($userId);
$userService = BOL_UserService::getInstance();
$avatars = BOL_AvatarService::getInstance()->getAvatarsUrlList($idList, 2);
$sexValue = array();
$list = array();
foreach (BOL_QuestionValueDao::getInstance()->findQuestionValues('sex') as $sexDto) {
$sexValue[$sexDto->value] = BOL_QuestionService::getInstance()->getQuestionValueLang('sex', $sexDto->value);
}
$userData = BOL_QuestionService::getInstance()->getQuestionData($idList, array('sex', 'birthdate', 'googlemap_location'));
foreach ($idList as $userId) {
$list[$userId]['userUrl'] = $userService->getUserUrl($userId);
$list[$userId]['displayName'] = $userService->getDisplayName($userId);
$list[$userId]['avatarUrl'] = $avatars[$userId];
$list[$userId]['activity'] = UTIL_DateTime::formatDate(BOL_UserService::getInstance()->findUserById($userId)->getActivityStamp());
if (!empty($userData[$userId]['birthdate'])) {
$date = UTIL_DateTime::parseDate($userData[$userId]['birthdate'], UTIL_DateTime::MYSQL_DATETIME_DATE_FORMAT);
$list[$userId]['age'] = UTIL_DateTime::getAge($date['year'], $date['month'], $date['day']);
}
if (!empty($userData[$userId]['sex'])) {
$list[$userId]['sex'] = $sexValue[$userData[$userId]['sex']];
}
if (!empty($userData[$userId]['googlemap_location'])) {
$list[$userId]['googlemap_location'] = $userData[$userId]['googlemap_location']['address'];
}
}
$this->assign('userName', BOL_UserService::getInstance()->getDisplayName($this->user->id));
$this->assign('list', $list);
} else {
$this->setVisible(FALSE);
}
}
示例2: __construct
/**
* @return Constructor.
*/
public function __construct($groupId)
{
parent::__construct();
$service = GROUPS_BOL_Service::getInstance();
$groupDto = $service->findGroupById($groupId);
$group = array('title' => htmlspecialchars($groupDto->title), 'description' => $groupDto->description, 'time' => $groupDto->timeStamp, 'imgUrl' => empty($groupDto->imageHash) ? false : $service->getGroupImageUrl($groupDto), 'url' => OW::getRouter()->urlForRoute('groups-view', array('groupId' => $groupDto->id)), "id" => $groupDto->id);
$imageUrl = empty($groupDto->imageHash) ? '' : $service->getGroupImageUrl($groupDto);
OW::getDocument()->addMetaInfo('image', $imageUrl, 'itemprop');
OW::getDocument()->addMetaInfo('og:image', $imageUrl, 'property');
$createDate = UTIL_DateTime::formatDate($groupDto->timeStamp);
$adminName = BOL_UserService::getInstance()->getDisplayName($groupDto->userId);
$adminUrl = BOL_UserService::getInstance()->getUserUrl($groupDto->userId);
$js = UTIL_JsGenerator::newInstance()->jQueryEvent('#groups_toolbar_flag', 'click', UTIL_JsGenerator::composeJsString('OW.flagContent({$entity}, {$id}, {$title}, {$href}, "groups+flags", {$ownerId});', array('entity' => GROUPS_BOL_Service::WIDGET_PANEL_NAME, 'id' => $groupDto->id, 'title' => $group['title'], 'href' => $group['url'], 'ownerId' => $groupDto->userId)));
OW::getDocument()->addOnloadScript($js, 1001);
$toolbar = array(array('label' => OW::getLanguage()->text('groups', 'widget_brief_info_create_date', array('date' => $createDate))), array('label' => OW::getLanguage()->text('groups', 'widget_brief_info_admin', array('name' => $adminName, 'url' => $adminUrl))));
if ($service->isCurrentUserCanEdit($groupDto)) {
$toolbar[] = array('label' => OW::getLanguage()->text('groups', 'edit_btn_label'), 'href' => OW::getRouter()->urlForRoute('groups-edit', array('groupId' => $groupId)));
}
if (OW::getUser()->isAuthenticated() && OW::getUser()->getId() != $groupDto->userId) {
$toolbar[] = array('label' => OW::getLanguage()->text('base', 'flag'), 'href' => 'javascript://', 'id' => 'groups_toolbar_flag');
}
$event = new BASE_CLASS_EventCollector('groups.on_toolbar_collect', array('groupId' => $groupId));
OW::getEventManager()->trigger($event);
foreach ($event->getData() as $item) {
$toolbar[] = $item;
}
$this->assign('toolbar', $toolbar);
$this->assign('group', $group);
}
示例3: getList
public function getList($params)
{
$data = OW::getEventManager()->call("guests.get_guests_list", array("userId" => OW::getUser()->getId()));
if (empty($data)) {
$this->assign("list", array());
return;
}
$idList = array();
$viewedMap = array();
$timeMap = array();
foreach ($data as $item) {
$idList[] = $item["userId"];
$viewedMap[$item["userId"]] = $item["viewed"];
$timeMap[$item["userId"]] = UTIL_DateTime::formatDate($item["timeStamp"]);
}
OW::getEventManager()->call("guests.mark_guests_viewed", array("userId" => OW::getUser()->getId(), "guestIds" => $idList));
$bookmarkList = OW::getEventManager()->call("bookmarks.get_mark_list", array("userId" => OW::getUser()->getId(), "idList" => $idList));
$bookmarkList = empty($bookmarkList) ? array() : $bookmarkList;
$avatarList = BOL_AvatarService::getInstance()->getDataForUserAvatars($idList, true, false);
$onlineMap = BOL_UserService::getInstance()->findOnlineStatusForUserList($idList);
foreach ($avatarList as $userId => $user) {
$color = array('r' => '100', 'g' => '100', 'b' => '100');
if (!empty($user['labelColor'])) {
$_color = explode(', ', trim($user['labelColor'], 'rgba()'));
$color = array('r' => $_color[0], 'g' => $_color[1], 'b' => $_color[2]);
}
$list[] = array("userId" => $userId, "displayName" => $user["title"], "avatarUrl" => $user["src"], "label" => $user["label"], "labelColor" => $color, "viewed" => $viewedMap[$userId], "online" => $onlineMap[$userId], "bookmarked" => !empty($bookmarkList[$userId]), "time" => $timeMap[$userId]);
}
$this->assign("list", $list);
}
示例4: __construct
public function __construct(BASE_CLASS_WidgetParameter $params)
{
parent::__construct();
$service = LinkService::getInstance();
$userId = $params->additionalParamList['entityId'];
if ($userId != OW::getUser()->getId() && !OW::getUser()->isAuthorized('links', 'view')) {
$this->setVisible(false);
return;
}
/* Check privacy permissions */
$eventParams = array('action' => LinkService::PRIVACY_ACTION_VIEW_LINKS, 'ownerId' => $userId, 'viewerId' => OW::getUser()->getId());
try {
OW::getEventManager()->getInstance()->call('privacy_check_permission', $eventParams);
} catch (RedirectException $ex) {
$this->setVisible(false);
return;
}
/* */
if ($service->countUserLinks($userId) == 0 && !$params->customizeMode) {
$this->setVisible(false);
return;
}
$this->assign('displayname', BOL_UserService::getInstance()->getDisplayName($userId));
$this->assign('username', BOL_UserService::getInstance()->getUsername($userId));
$list = array();
$count = $params->customParamList['count'];
$userLinkList = $service->findUserLinkList($userId, 0, $count);
$idList = array();
foreach ($userLinkList as $item) {
/* Check privacy permissions */
if ($item->userId != OW::getUser()->getId() && !OW::getUser()->isAuthorized('links')) {
$eventParams = array('action' => LinkService::PRIVACY_ACTION_VIEW_LINKS, 'ownerId' => $item->userId, 'viewerId' => OW::getUser()->getId());
try {
OW::getEventManager()->getInstance()->call('privacy_check_permission', $eventParams);
} catch (RedirectException $ex) {
continue;
}
}
/* */
$list[] = $item;
$idList[] = $item->id;
}
$commentInfo = array();
if (!empty($idList)) {
$commentInfo = BOL_CommentService::getInstance()->findCommentCountForEntityList('link', $idList);
$tb = array();
foreach ($list as $key => $item) {
if (mb_strlen($item->getDescription()) > 100) {
$item->setDescription(UTIL_String::truncate($item->getDescription(), 100, '...'));
}
$list[$key]->setDescription(strip_tags($item->getDescription()));
$tb[$item->getId()] = array(array('label' => '<span class="ow_txt_value">' . $commentInfo[$item->getId()] . '</span> ' . OW::getLanguage()->text('links', 'comments'), 'href' => OW::getRouter()->urlForRoute('link', array('id' => $item->getId()))), array('label' => UTIL_DateTime::formatDate($item->getTimestamp()), 'class' => 'ow_ic_date'));
}
$this->assign('tb', $tb);
}
$this->assign('list', $list);
$this->setSettingValue(self::SETTING_TOOLBAR, array(array('label' => OW::getLanguage()->text('base', 'view_all'), 'href' => OW::getRouter()->urlForRoute('links-user', array('user' => BOL_UserService::getInstance()->getUserName($userId))))));
}
示例5: findGuestsForUser
/**
* @param $userId
* @param $page
* @param $limit
* @return array
*/
public function findGuestsForUser($userId, $page, $limit)
{
if (!$userId) {
return array();
}
$guests = $this->guestDao->findUserGuests($userId, $page, $limit);
foreach ($guests as &$g) {
$g->visitTimestamp = UTIL_DateTime::formatDate($g->visitTimestamp, false);
}
return $guests;
}
示例6: render
public function render()
{
$rss = array_slice($this->rss, 0, $this->count);
$this->assign('rss', $rss);
$toolbars = array();
if (!$this->titleOnly) {
foreach ($rss as $key => $item) {
$toolbars[$key] = array(array('label' => UTIL_DateTime::formatDate($item['time'])));
}
}
$this->assign('toolbars', $toolbars);
return parent::render();
}
示例7: __construct
public function __construct(BASE_CLASS_WidgetParameter $params)
{
parent::__construct();
$service = PostService::getInstance();
$count = $params->customParamList['count'];
$previewLength = $params->customParamList['previewLength'];
$list = $service->findList(0, $count);
if ((empty($list) || false && !OW::getUser()->isAuthorized('blogs', 'add') && !OW::getUser()->isAuthorized('blogs', 'view')) && !$params->customizeMode) {
$this->setVisible(false);
return;
}
$posts = array();
$userService = BOL_UserService::getInstance();
$postIdList = array();
foreach ($list as $dto) {
/* @var $dto Post */
if (mb_strlen($dto->getTitle()) > 50) {
$dto->setTitle(UTIL_String::splitWord(UTIL_String::truncate($dto->getTitle(), 50, '...')));
}
$text = $service->processPostText($dto->getPost());
$posts[] = array('dto' => $dto, 'text' => UTIL_String::splitWord(UTIL_String::truncate($text, $previewLength)), 'truncated' => mb_strlen($text) > $previewLength, 'url' => OW::getRouter()->urlForRoute('user-post', array('id' => $dto->getId())));
$idList[] = $dto->getAuthorId();
$postIdList[] = $dto->id;
}
$commentInfo = array();
if (!empty($idList)) {
$avatars = BOL_AvatarService::getInstance()->getDataForUserAvatars($idList, true, false);
$this->assign('avatars', $avatars);
$urls = BOL_UserService::getInstance()->getUserUrlsForList($idList);
$commentInfo = BOL_CommentService::getInstance()->findCommentCountForEntityList('blog-post', $postIdList);
$toolbars = array();
foreach ($list as $dto) {
$toolbars[$dto->getId()] = array(array('class' => 'ow_icon_control ow_ic_user', 'href' => isset($urls[$dto->getAuthorId()]) ? $urls[$dto->getAuthorId()] : '#', 'label' => isset($avatars[$dto->getAuthorId()]['title']) ? $avatars[$dto->getAuthorId()]['title'] : ''), array('class' => 'ow_remark ow_ipc_date', 'label' => UTIL_DateTime::formatDate($dto->getTimestamp())));
}
$this->assign('tbars', $toolbars);
}
$this->assign('commentInfo', $commentInfo);
$this->assign('list', $posts);
if ($service->countPosts() > 0) {
$toolbar = array();
if (OW::getUser()->isAuthorized('blogs', 'add')) {
$toolbar[] = array('label' => OW::getLanguage()->text('blogs', 'add_new'), 'href' => OW::getRouter()->urlForRoute('post-save-new'));
}
if (OW::getUser()->isAuthorized('blogs', 'view')) {
$toolbar[] = array('label' => OW::getLanguage()->text('blogs', 'go_to_blog'), 'href' => Ow::getRouter()->urlForRoute('blogs'));
}
if (!empty($toolbar)) {
$this->setSettingValue(self::SETTING_TOOLBAR, $toolbar);
}
}
}
示例8: __construct
public function __construct(BASE_CLASS_WidgetParameter $params)
{
parent::__construct();
$service = LinkService::getInstance();
$count = $params->customParamList['count'];
$list = $service->findList(0, $count);
if ((empty($list) || false && !OW::getUser()->isAuthorized('links', 'add') && !OW::getUser()->isAuthorized('links', 'view')) && !$params->customizeMode) {
$this->setVisible(false);
return;
}
$links = array();
$toolbars = array();
$userService = BOL_UserService::getInstance();
$authorIdList = array();
foreach ($list as $dto) {
$dto->setUrl(strip_tags($dto->getUrl()));
$dto->setTitle(strip_tags($dto->getTitle()));
$dto->setDescription(strip_tags($dto->getDescription()));
$links[] = array('dto' => $dto);
$idList[] = $dto->id;
$authorIdList[] = $dto->getUserId();
}
$commentInfo = array();
$this->assign('avatars', null);
if (!empty($idList)) {
$commentInfo = BOL_CommentService::getInstance()->findCommentCountForEntityList('link', $idList);
$avatars = BOL_AvatarService::getInstance()->getDataForUserAvatars($authorIdList, true, false);
$this->assign('avatars', $avatars);
$urls = BOL_UserService::getInstance()->getUserUrlsForList($authorIdList);
}
$tbars = array();
foreach ($list as $dto) {
$tbars[$dto->getId()] = array(array('class' => 'ow_icon_control ow_ic_user', 'href' => !empty($urls[$dto->getUserId()]) ? $urls[$dto->getUserId()] : '#', 'label' => !empty($avatars[$dto->getUserId()]['title']) ? $avatars[$dto->getUserId()]['title'] : ''), array('class' => 'ow_remark ow_ipc_date', 'label' => UTIL_DateTime::formatDate($dto->getTimestamp())));
}
$this->assign('tbars', $tbars);
$this->assign('commentInfo', $commentInfo);
$this->assign('list', $links);
if ($service->countAll()) {
$toolbar = array();
if (OW::getUser()->isAuthorized('links', 'add')) {
$toolbar[] = array('label' => OW::getLanguage()->text('links', 'add_new'), 'href' => OW::getRouter()->urlForRoute('link-save-new'));
}
if (OW::getUser()->isAuthorized('links', 'view')) {
$toolbar[] = array('label' => OW::getLanguage()->text('links', 'go_to_links'), 'href' => Ow::getRouter()->urlForRoute('links'));
}
if (!empty($toolbar)) {
$this->setSettingValue(self::SETTING_TOOLBAR, $toolbar);
}
}
}
示例9: findLastMessages
public function findLastMessages($userId, $rosterId, $lastMessageTimestamp, $count = 10, $omit_last_message = 0)
{
$result_msg_list = array();
$msg_list = $this->messageDao->findLastMessages($userId, $rosterId, $lastMessageTimestamp, $count);
foreach ($msg_list as $id => $msg) {
if ($omit_last_message == 1 && $id == count($msg_list) - 1) {
continue;
} else {
//$msg->setMessage(UTIL_HtmlTag::autoLink($msg->getMessage()));
$msg->setRead(UTIL_DateTime::formatDate($msg->getTimestamp()));
$msg->setTimestamp($msg->getTimestamp() * 1000);
$result_msg_list[$id] = $msg;
}
}
return $result_msg_list;
}
示例10: onBeforeRender
public function onBeforeRender()
{
parent::onBeforeRender();
$tplList = array();
foreach ($this->response['feed']['entry'] as $item) {
$vid = $item['media$group']['yt$videoid']['$t'];
$uploaded = strtotime($item['media$group']['yt$uploaded']['$t']);
$duration = $item['media$group']['yt$duration']['seconds'];
$description = UTIL_String::truncate(strip_tags($item['media$group']['media$description']['$t']), 130, ' ...');
$title = UTIL_String::truncate(strip_tags($item['media$group']['media$title']['$t']), 65, ' ...');
$thumb = $item['media$group']['media$thumbnail'][0]['url'];
$image = $item['media$group']['media$thumbnail'][1]['url'];
$oembed = array('thumbnail_url' => $image, 'type' => 'video', 'title' => $title, 'description' => $description, 'html' => '<iframe class="attp-yt-iframe" width="300" height="230" src="http://www.youtube.com/embed/' . $vid . '?autoplay=1" frameborder="0" allowfullscreen></iframe>');
$tplList[] = array('title' => $title, 'description' => $description, 'thumb' => $thumb, 'video' => $vid, 'duration' => round($duration / 60), 'uploaded' => $uploaded, 'date' => UTIL_DateTime::formatDate($uploaded), 'oembed' => json_encode($oembed));
}
$this->assign('list', $tplList);
}
示例11: status
public function status()
{
$this->addComponent('menu', $this->getMenu());
$this->getComponent('menu')->getElement('status')->setActive(true);
$config = OW::getConfig();
$statusCongigs = $config->getValues('watchdog');
if ($statusCongigs[WATCHDOG_BOL_WatchdogService::COUNT_SPAM_ATTEMPT] <= 0) {
$statusCongigs[WATCHDOG_BOL_WatchdogService::COUNT_SPAM_ATTEMPT] = OW::getLanguage()->text('watchdog', 'count_spam_attempt_none');
}
if ($statusCongigs[WATCHDOG_BOL_WatchdogService::TIME_UPDATE_DATABASE] > 0) {
$statusCongigs[WATCHDOG_BOL_WatchdogService::TIME_UPDATE_DATABASE] = UTIL_DateTime::formatDate($statusCongigs[WATCHDOG_BOL_WatchdogService::TIME_UPDATE_DATABASE]);
} else {
$statusCongigs[WATCHDOG_BOL_WatchdogService::TIME_UPDATE_DATABASE] = OW::getLanguage()->text('watchdog', 'database_not_updated');
}
$this->assign('configs', $statusCongigs);
$this->assign('logo', OW::getPluginManager()->getPlugin('watchdog')->getStaticUrl() . 'images/Watchdog_logo.png');
OW::getDocument()->addStyleSheet(OW::getPluginManager()->getPlugin('watchdog')->getStaticCssUrl() . 'watchdog.css');
}
示例12: findUserVideos
public function findUserVideos($userId, $start, $offset)
{
$clipDao = VIDEO_BOL_ClipDao::getInstance();
$example = new OW_Example();
$example->andFieldEqual('status', 'approved');
$example->andFieldEqual('userId', $userId);
$example->setOrder('`addDatetime` DESC');
$example->setLimitClause($start, $offset);
$list = $clipDao->findListByExample($example);
$out = array();
foreach ($list as $video) {
$id = $video->id;
$videoThumb = VIDEO_BOL_ClipService::getInstance()->getClipThumbUrl($id);
$out[$id] = array('id' => $id, 'embed' => $video->code, 'title' => UTIL_String::truncate($video->title, 65, ' ...'), 'description' => UTIL_String::truncate($video->description, 130, ' ...'), 'thumb' => $videoThumb == 'undefined' ? null : $videoThumb, 'date' => UTIL_DateTime::formatDate($video->addDatetime), 'permalink' => OW::getRouter()->urlForRoute('view_clip', array('id' => $id)));
$out[$id]['oembed'] = json_encode(array('type' => 'video', 'thumbnail_url' => $out[$id]['thumb'], 'html' => $out[$id]['embed'], 'title' => $out[$id]['title'], 'description' => $out[$id]['description']));
}
return $out;
}
示例13: getGroupInfo
private function getGroupInfo()
{
static $groupInfo = array();
if (!empty($groupInfo)) {
return $groupInfo;
}
$groupInfo['id'] = $this->group->id;
$groupInfo['hasImage'] = !empty($this->group->imageHash);
$groupInfo['image'] = $this->groupService->getGroupImageUrl($this->group);
$groupInfo['title'] = htmlspecialchars($this->group->title);
$groupInfo['description'] = $this->group->description;
$groupInfo['url'] = $this->groupService->getGroupUrl($this->group);
$groupInfo['time'] = UTIL_DateTime::formatDate($this->group->timeStamp);
$groupInfo['admin'] = array();
$groupInfo['admin']['name'] = BOL_UserService::getInstance()->getDisplayName($this->group->userId);
$groupInfo['admin']['url'] = BOL_UserService::getInstance()->getUserUrl($this->group->userId);
return $groupInfo;
}
示例14: smarty_modifier_date
/**
* Smarty date modifier.
*
* @author Sardar Madumarov <madumarov@gmail.com>
* @package ow.ow_smarty.plugin
* @since 1.0
*/
function smarty_modifier_date($timeStamp, $dateOnly = false)
{
return UTIL_DateTime::formatDate($timeStamp, $dateOnly);
}
示例15: displayGroupList
private function displayGroupList($list, $paging, $menu = null)
{
$templatePath = OW::getPluginManager()->getPlugin('groups')->getCtrlViewDir() . 'groups_list.html';
$this->setTemplate($templatePath);
$out = array();
foreach ($list as $item) {
/* @var $item GROUPS_BOL_Group */
$userCount = GROUPS_BOL_Service::getInstance()->findUserListCount($item->id);
$title = strip_tags($item->title);
$toolbar = array(array('label' => OW::getLanguage()->text('groups', 'listing_users_label', array('count' => $userCount))));
$out[] = array('id' => $item->id, 'url' => OW::getRouter()->urlForRoute('groups-view', array('groupId' => $item->id)), 'title' => $title, 'imageTitle' => $title, 'content' => strip_tags($item->description), 'time' => UTIL_DateTime::formatDate($item->timeStamp), 'imageSrc' => GROUPS_BOL_Service::getInstance()->getGroupImageUrl($item), 'users' => $userCount, 'toolbar' => $toolbar);
}
$this->addComponent('paging', $paging);
if (!empty($menu)) {
$this->addComponent('menu', $menu);
} else {
$this->assign('menu', '');
}
$this->assign('canCreate', $this->service->isCurrentUserCanCreate());
$this->assign('list', $out);
}