本文整理汇总了PHP中UTIL_DateTime类的典型用法代码示例。如果您正苦于以下问题:PHP UTIL_DateTime类的具体用法?PHP UTIL_DateTime怎么用?PHP UTIL_DateTime使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了UTIL_DateTime类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: getInfoList
protected function getInfoList($userIdList)
{
$fields = array();
$qs = array();
$qBdate = BOL_QuestionService::getInstance()->findQuestionByName('birthdate');
if ($qBdate->onView) {
$qs[] = 'birthdate';
}
$qSex = BOL_QuestionService::getInstance()->findQuestionByName('sex');
if ($qSex->onView) {
$qs[] = 'sex';
}
$questionList = BOL_QuestionService::getInstance()->getQuestionData($userIdList, $qs);
foreach ($questionList as $uid => $q) {
$info = array();
if (!empty($q['sex'])) {
$info['sex'] = BOL_QuestionService::getInstance()->getQuestionValueLang('sex', $q['sex']);
}
if (!empty($q['birthdate'])) {
$date = UTIL_DateTime::parseDate($q['birthdate'], UTIL_DateTime::MYSQL_DATETIME_DATE_FORMAT);
$age = UTIL_DateTime::getAge($date['year'], $date['month'], $date['day']);
$info['age'] = $age;
}
$fields[$uid] = $info;
}
return $fields;
}
开发者ID:vazahat,项目名称:dudex,代码行数:27,代码来源:abstract_user_bridge.php
示例2: getList
public function getList(array $params)
{
OW::getDocument()->setHeading(OW::getLanguage()->text('bookmarks', 'list_headint_title'));
$this->setTemplate(OW::getPluginManager()->getPlugin('bookmarks')->getCtrlViewDir() . 'list.html');
$userId = OW::getUser()->getId();
$page = !empty($_GET['page']) && intval($_GET['page']) > 0 ? $_GET['page'] : 1;
$userOnPage = (int) OW::getConfig()->getValue('base', 'users_on_page');
$first = ($page - 1) * $userOnPage;
$list = $this->service->findBookmarksUserIdList($userId, $first, $userOnPage, $params['category']);
$count = $this->service->findBookmarksCount($userId, $params['category']);
$sexValue = array();
$userDataList = array();
$questionService = BOL_QuestionService::getInstance();
$data = $questionService->getQuestionData($list, array('sex', 'googlemap_location', 'birthdate'));
foreach (BOL_QuestionValueDao::getInstance()->findQuestionValues('sex') as $sexDto) {
$sexValue[$sexDto->value] = $questionService->getQuestionValueLang('sex', $sexDto->value);
}
foreach ($data as $userId => $user) {
if (isset($user['birthdate'])) {
$date = UTIL_DateTime::parseDate($user['birthdate'], UTIL_DateTime::MYSQL_DATETIME_DATE_FORMAT);
$age = UTIL_DateTime::getAge($date['year'], $date['month'], $date['day']);
} else {
$age = '';
}
$userDataList[$userId] = array('info_gender' => !empty($user['sex']) && !empty($sexValue[$user['sex']]) ? $sexValue[$user['sex']] : '' . ' ' . $age, 'location' => !empty($user['googlemap_location']) ? $user['googlemap_location']['address'] : '');
}
$this->addComponent('list', OW::getClassInstance('BASE_CMP_Users', $userDataList, array(), $count));
}
开发者ID:hardikamutech,项目名称:loov,代码行数:28,代码来源:list.php
示例3: onNewsfeedItemRender
public function onNewsfeedItemRender(OW_Event $event)
{
$params = $event->getParams();
$content = $event->getData();
if (!empty($params['action']['entityType']) && !empty($params['action']['pluginKey']) && $params['action']['entityType'] == 'birthday' && $params['action']['pluginKey'] == 'birthdays') {
$html = '<div class="ow_user_list_data"></div>';
if (!empty($content['birthdate']) && !empty($content['userData'])) {
$date = UTIL_DateTime::parseDate($content['birthdate'], UTIL_DateTime::MYSQL_DATETIME_DATE_FORMAT);
$birthdate = UTIL_DateTime::formatBirthdate($date['year'], $date['month'], $date['day']);
if ($date['month'] == intval(date('m'))) {
if (intval(date('d')) + 1 == intval($date['day'])) {
$birthdate = '<span class="ow_green" style="font-weight: bold; text-transform: uppercase;">' . OW::getLanguage()->text('base', 'date_time_tomorrow') . '</a>';
} else {
if (intval(date('d')) == intval($date['day'])) {
$birthdate = '<span class="ow_green" style="font-weight: bold; text-transform: uppercase;">' . OW::getLanguage()->text('base', 'date_time_today') . '</span>';
}
}
}
$html = '<div class="ow_user_list_data">
<a href="' . $content['userData']["url"] . '">' . $content['userData']["title"] . '</a><br><span style="font-weight:normal;" class="ow_small">' . OW::getLanguage()->text('birthdays', 'birthday') . ' ' . $birthdate . '</span>
</div>';
}
$userId = $params['action']['entityId'];
$usersData = BOL_AvatarService::getInstance()->getDataForUserAvatars(array($userId));
$content['content'] = '<div class="ow_user_list_picture">' . OW::getThemeManager()->processDecorator('avatar_item', $usersData[$userId]) . '</div>';
$content['content'] .= $html;
$content['content'] = '<div class="clearfix">' . $content['content'] . '</div>';
$content['view'] = array('iconClass' => 'ow_ic_birthday');
$event->setData($content);
}
}
开发者ID:tammyrocks,项目名称:birthdays,代码行数:31,代码来源:event_handler.php
示例4: __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);
}
}
开发者ID:hardikamutech,项目名称:loov,代码行数:35,代码来源:notify.php
示例5: __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);
}
开发者ID:vazahat,项目名称:dudex,代码行数:32,代码来源:brief_info_content.php
示例6: getAvatarInfo
public function getAvatarInfo($idList)
{
$data = parent::getAvatarInfo($idList);
$birthdays = BOL_QuestionService::getInstance()->getQuestionData($idList, array('birthdate'));
foreach ($data as $userId => $item) {
$yearOld = '';
if (!empty($birthdays[$userId]['birthdate'])) {
switch ($this->key) {
case 'birthdays_today':
$date = UTIL_DateTime::parseDate($birthdays[$userId]['birthdate'], UTIL_DateTime::MYSQL_DATETIME_DATE_FORMAT);
$yearOld = UTIL_DateTime::getAge($date['year'], $date['month'], $date['day']) . " " . OW::getLanguage()->text('base', 'questions_age_year_old');
break;
case 'birthdays_this_week':
$date = UTIL_DateTime::parseDate($birthdays[$userId]['birthdate'], UTIL_DateTime::MYSQL_DATETIME_DATE_FORMAT);
$yearOld = OW::getLanguage()->text('birthdays', 'birthday') . ' ' . UTIL_DateTime::formatBirthdate($date['year'], $date['month'], $date['day']) . " ";
break;
}
}
if (!empty($data[$userId]['title'])) {
$data[$userId]['attrs'] = ' data-birthday="' . (!empty($yearOld) ? $yearOld : '') . '"';
} else {
if (!empty($yearOld)) {
$data[$userId]['attrs'] = ' data-birthday="' . $yearOld . '"';
}
}
}
OW::getDocument()->addOnloadScript("\n \$('*[title]', \$('.birthdays_avatar_list') ).each( function(i, o){\n \$(o).off('mouseenter');\n \$(o).on('mouseenter', function(){ \n var title = \$(this).attr('title');\n var birthday = \$(this).data('birthday');\n \n if ( !birthday )\n {\n OW.showTip(\$(this), {timeout:200});\n }\n else if ( !title && birthday )\n {\n birthday = '<span class=\"ow_small\" style=\"font-weight:normal;\">' + birthday + '</span>';\n \n OW.showTip(\$(this), {timeout:200, show:birthday});\n }\n else\n {\n birthday = '<br><span class=\"ow_small\" style=\"font-weight:normal;\">' + birthday + '</span>';\n \n OW.showTip(\$(this), {timeout:200, show:title + birthday});\n }\n });\n \$(o).off('mouseleave');\n \$(o).on('mouseleave', function(){ OW.hideTip(\$(this)); });\n });");
return $data;
}
开发者ID:tammyrocks,项目名称:birthdays,代码行数:29,代码来源:avatar_user_list.php
示例7: 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);
}
开发者ID:hardikamutech,项目名称:loov,代码行数:30,代码来源:guests.php
示例8: __construct
public function __construct($users, $size, $layout)
{
parent::__construct();
$questionService = BOL_QuestionService::getInstance();
$userService = BOL_UserService::getInstance();
$this->uniqId = uniqid('ucl_');
$idList = $this->fetchIdList($users);
$qList = $questionService->getQuestionData($idList, array('sex', 'birthdate'));
$displayNames = $userService->getDisplayNamesForList($idList);
$urls = $userService->getUserUrlsForList($idList);
$tplData = array();
foreach ($idList as $userId) {
$tplData[$userId] = array();
$tplData[$userId]['displayName'] = empty($displayNames[$userId]) ? null : $displayNames[$userId];
$tplData[$userId]['url'] = empty($urls[$userId]) ? null : $urls[$userId];
$tplData[$userId]['sex'] = empty($qList[$userId]['sex']) || in_array($layout, array(3, 4)) ? null : strtolower(BOL_QuestionService::getInstance()->getQuestionValueLang('sex', $qList[$userId]['sex']));
$tplData[$userId]['birthdate'] = null;
if (!empty($qList[$userId]['birthdate']) && in_array($layout, array(1, 3))) {
$date = UTIL_DateTime::parseDate($qList[$userId]['birthdate'], UTIL_DateTime::MYSQL_DATETIME_DATE_FORMAT);
$age = UTIL_DateTime::getAge($date['year'], $date['month'], $date['day']);
$tplData[$userId]['birthdate'] = $age;
}
$avatar = BOL_AvatarService::getInstance()->getAvatarUrl($userId, 2);
$tplData[$userId]['thumb'] = $avatar ? $avatar : BOL_AvatarService::getInstance()->getDefaultAvatarUrl(2);
}
$sizes = array('small' => 100, 'medium' => 150, 'big' => OW::getConfig()->getValue('base', 'avatar_big_size'));
$this->assign('list', $tplData);
$avatarSize = $sizes[$size];
$this->assign('size', $size);
$this->assign('uniqId', $this->uniqId);
OW::getDocument()->addStyleDeclaration('.uc-avatar-size { width: ' . $avatarSize . 'px; height: ' . ($avatarSize + $avatarSize / 10) . 'px; }');
OW::getDocument()->addStyleDeclaration('.uc-carousel-size { height: ' . ($avatarSize + 50) . 'px; }');
OW::getDocument()->addStyleDeclaration('.uc-shape-waterWheel .uc-carousel { width: ' . ($avatarSize + 20) . 'px; }');
}
开发者ID:vazahat,项目名称:dudex,代码行数:34,代码来源:users.php
示例9: getList
public function getList($params)
{
$service = SKADATEIOS_ABOL_Service::getInstance();
$auth = array('photo.view' => $service->getAuthorizationActionStatus('photo', 'view'), 'base.search_users' => $service->getAuthorizationActionStatus('base', 'search_users'));
$this->assign('auth', $auth);
if ($auth["base.search_users"]["status"] != BOL_AuthorizationService::STATUS_AVAILABLE) {
$this->assign("list", array());
$this->assign("total", 0);
return;
}
$_criteriaList = array_filter($params["criteriaList"]);
$userId = OW::getUser()->getId();
$userInfo = BOL_QuestionService::getInstance()->getQuestionData(array($userId), array("sex"));
$_criteriaList["sex"] = !empty($userInfo[$userId]["sex"]) ? $userInfo[$userId]["sex"] : null;
$questionList = BOL_QuestionService::getInstance()->findQuestionByNameList(array_keys($_criteriaList));
$criteriaList = array();
foreach ($_criteriaList as $questionName => $questionValue) {
if (empty($questionList[$questionName])) {
continue;
}
$criteriaList[$questionName] = $this->convertQuestionValue($questionList[$questionName]->presentation, $questionValue);
}
$idList = OW::getEventManager()->call("usearch.get_user_id_list", array("criterias" => $criteriaList, "limit" => array($params["first"], $params["count"])));
$idList = empty($idList) ? array() : $idList;
//$idList = BOL_UserService::getInstance()->findUserIdListByQuestionValues($criteriaList, $params["first"], $params["count"]);
$total = BOL_UserService::getInstance()->countUsersByQuestionValues($params["criteriaList"]);
$userData = BOL_AvatarService::getInstance()->getDataForUserAvatars($idList, false, false, true, true);
$questionsData = BOL_QuestionService::getInstance()->getQuestionData($idList, array("googlemap_location", "birthdate"));
foreach ($questionsData as $userId => $data) {
$date = UTIL_DateTime::parseDate($data['birthdate'], UTIL_DateTime::MYSQL_DATETIME_DATE_FORMAT);
$userData[$userId]["ages"] = UTIL_DateTime::getAge($date['year'], $date['month'], $date['day']);
$userData[$userId]["location"] = empty($data["googlemap_location"]["address"]) ? null : $data["googlemap_location"]["address"];
}
$photoList = array();
$avatarList = array();
foreach ($idList as $userId) {
$bigAvatar = SKADATE_BOL_Service::getInstance()->findAvatarByUserId($userId);
$avatarList[$userId] = $bigAvatar ? SKADATE_BOL_Service::getInstance()->getAvatarUrl($userId, $bigAvatar->hash) : BOL_AvatarService::getInstance()->getAvatarUrl($userId, 2);
$event = new OW_Event('photo.getMainAlbum', array('userId' => $userId));
OW::getEventManager()->trigger($event);
$album = $event->getData();
$photos = !empty($album['photoList']) ? $album['photoList'] : array();
foreach ($photos as $photo) {
$photoList[$userId][] = array("src" => $photo["url"]["main"]);
}
}
$bookmarksList = OW::getEventManager()->call("bookmarks.get_mark_list", array("userId" => OW::getUser()->getId(), "idList" => $idList));
$bookmarksList = empty($bookmarksList) ? array() : $bookmarksList;
$list = array();
foreach ($idList as $userId) {
$list[] = array("userId" => $userId, "photos" => empty($photoList[$userId]) ? array() : $photoList[$userId], "avatar" => $avatarList[$userId], "name" => empty($userData[$userId]["title"]) ? "" : $userData[$userId]["title"], "label" => $userData[$userId]["label"], "labelColor" => $userData[$userId]["labelColor"], "location" => empty($userData[$userId]["location"]) ? "" : $userData[$userId]["location"], "ages" => $userData[$userId]["ages"], "bookmarked" => !empty($bookmarksList[$userId]));
}
$this->assign("list", $list);
$this->assign("total", $total);
$allowSendMessage = OW::getPluginManager()->isPluginActive('mailbox');
$this->assign("actions", array("bookmark" => OW::getPluginManager()->isPluginActive('bookmarks'), "message" => $allowSendMessage, "wink" => OW::getPluginManager()->isPluginActive('winks')));
BOL_AuthorizationService::getInstance()->trackAction("base", "search_users");
$mailboxModes = OW::getEventManager()->call('mailbox.get_active_mode_list');
$this->assign("mailboxModes", empty($mailboxModes) ? array() : $mailboxModes);
}
开发者ID:hardikamutech,项目名称:loov,代码行数:60,代码来源:search.php
示例10: onNewsfeedItemRender
public function onNewsfeedItemRender(OW_Event $event)
{
$params = $event->getParams();
$content = $event->getData();
if (!empty($params['action']['entityType']) && !empty($params['action']['pluginKey']) && $params['action']['entityType'] == 'birthday' && $params['action']['pluginKey'] == 'birthdays') {
$html = '<div class="ow_user_list_data"></div>';
if (!empty($content['birthdate']) && !empty($content['userData'])) {
$date = UTIL_DateTime::parseDate($content['birthdate'], UTIL_DateTime::MYSQL_DATETIME_DATE_FORMAT);
$birthdate = UTIL_DateTime::formatBirthdate($date['year'], $date['month'], $date['day']);
if ($date['month'] == intval(date('m'))) {
if (intval(date('d')) + 1 == intval($date['day'])) {
$birthdate = '<span class="ow_green" style="font-weight: bold; text-transform: uppercase;">' . OW::getLanguage()->text('base', 'date_time_tomorrow') . '</a>';
} else {
if (intval(date('d')) == intval($date['day'])) {
$birthdate = '<span class="ow_green" style="font-weight: bold; text-transform: uppercase;">' . OW::getLanguage()->text('base', 'date_time_today') . '</span>';
}
}
}
$html = '<div class="ow_user_list_data">
<a href="' . $content['userData']["url"] . '">' . $content['userData']["title"] . '</a><br><span style="font-weight:normal;" class="ow_small">' . OW::getLanguage()->text('birthdays', 'birthday') . ' ' . $birthdate . '</span>
</div>';
}
$content['content'] .= $html;
$content['content'] = '<div class="clearfix">' . $content['content'] . '</div>';
$event->setData($content);
}
}
开发者ID:jorgemunoz8807,项目名称:havanabook,代码行数:27,代码来源:event_handler.php
示例11: getFields
public function getFields($userIdList)
{
$fields = array();
$qs = array();
$qBdate = BOL_QuestionService::getInstance()->findQuestionByName('birthdate');
if ($qBdate->onView) {
$qs[] = 'birthdate';
}
$qSex = BOL_QuestionService::getInstance()->findQuestionByName('sex');
if ($qSex->onView) {
$qs[] = 'sex';
}
$questionList = BOL_QuestionService::getInstance()->getQuestionData($userIdList, $qs);
foreach ($questionList as $uid => $q) {
$fields[$uid] = array();
$age = '';
if (!empty($q['birthdate'])) {
$date = UTIL_DateTime::parseDate($q['birthdate'], UTIL_DateTime::MYSQL_DATETIME_DATE_FORMAT);
$age = UTIL_DateTime::getAge($date['year'], $date['month'], $date['day']);
}
if (!empty($q['sex'])) {
$fields[$uid][] = array('label' => '', 'value' => BOL_QuestionService::getInstance()->getQuestionValueLang('sex', $q['sex']) . ' ' . $age);
}
if (!empty($q['birthdate'])) {
$dinfo = date_parse($q['birthdate']);
}
}
return $fields;
}
开发者ID:vazahat,项目名称:dudex,代码行数:29,代码来源:floatbox_user_list.php
示例12: __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))))));
}
开发者ID:vazahat,项目名称:dudex,代码行数:58,代码来源:user_links_widget.php
示例13: getFields
public function getFields($userIdList)
{
$fields = array();
$qs = array();
$qBdate = BOL_QuestionService::getInstance()->findQuestionByName('birthdate');
if ($qBdate->onView) {
$qs[] = 'birthdate';
}
$qSex = BOL_QuestionService::getInstance()->findQuestionByName('sex');
if ($qSex->onView) {
$qs[] = 'sex';
}
$questionList = BOL_QuestionService::getInstance()->getQuestionData($userIdList, $qs);
foreach ($questionList as $uid => $question) {
$fields[$uid] = array();
$age = '';
if (!empty($question['birthdate'])) {
$date = UTIL_DateTime::parseDate($question['birthdate'], UTIL_DateTime::MYSQL_DATETIME_DATE_FORMAT);
$age = UTIL_DateTime::getAge($date['year'], $date['month'], $date['day']);
}
$sexValue = '';
if (!empty($question['sex'])) {
$sex = $question['sex'];
for ($i = 0; $i < 31; $i++) {
$val = pow(2, $i);
if ((int) $sex & $val) {
$sexValue .= BOL_QuestionService::getInstance()->getQuestionValueLang('sex', $val) . ', ';
}
}
if (!empty($sexValue)) {
$sexValue = substr($sexValue, 0, -2);
}
}
if (!empty($sexValue) && !empty($age)) {
$fields[$uid][] = array('label' => '', 'value' => $sexValue . ' ' . $age);
}
if (!empty($question['birthdate'])) {
$dinfo = date_parse($question['birthdate']);
if ($this->listKey == 'birthdays') {
$birthdate = '';
if (intval(date('d')) + 1 == intval($dinfo['day'])) {
$questionList[$uid]['birthday'] = OW::getLanguage()->text('base', 'date_time_tomorrow');
$birthdate = '<a href="#" class="ow_lbutton ow_green">' . $questionList[$uid]['birthday'] . '</a>';
} else {
if (intval(date('d')) == intval($dinfo['day'])) {
$questionList[$uid]['birthday'] = OW::getLanguage()->text('base', 'date_time_today');
$birthdate = '<a href="#" class="ow_lbutton ow_green">' . $questionList[$uid]['birthday'] . '</a>';
} else {
$birthdate = UTIL_DateTime::formatBirthdate($dinfo['year'], $dinfo['month'], $dinfo['day']);
}
}
$fields[$uid][] = array('label' => 'Birthday: ', 'value' => $birthdate);
}
}
}
return $fields;
}
开发者ID:vazahat,项目名称:dudex,代码行数:57,代码来源:base_user_list.php
示例14: 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;
}
开发者ID:hardikamutech,项目名称:hammu,代码行数:17,代码来源:service_4_6_2015.php
示例15: 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();
}
开发者ID:vazahat,项目名称:dudex,代码行数:13,代码来源:rss_widget.php
示例16: __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);
}
}
}
开发者ID:vazahat,项目名称:dudex,代码行数:51,代码来源:blog_widget.php
示例17: __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);
}
}
}
开发者ID:vazahat,项目名称:dudex,代码行数:50,代码来源:links_widget.php
示例18: getList
public function getList($params)
{
$sort = empty($params["sort"]) ? "newest" : $params["sort"];
$matchList = OW::getEventManager()->call("matchmaking.get_list", array("userId" => OW::getUser()->getId(), "sort" => $sort, "first" => empty($params["first"]) ? 0 : $params["first"], "count" => empty($params["count"]) ? 0 : $params["count"]));
$idList = array();
$compatibilityList = array();
foreach ($matchList as $item) {
$idList[] = $item["id"];
$compatibilityList[$item["id"]] = $item["compatibility"];
}
$userData = BOL_AvatarService::getInstance()->getDataForUserAvatars($idList, false, false, true, true);
$questionsData = BOL_QuestionService::getInstance()->getQuestionData($id
|
请发表评论