本文整理汇总了PHP中UTIL_DateTime::parseDate方法的典型用法代码示例。如果您正苦于以下问题:PHP UTIL_DateTime::parseDate方法的具体用法?PHP UTIL_DateTime::parseDate怎么用?PHP UTIL_DateTime::parseDate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UTIL_DateTime
的用法示例。
在下文中一共展示了UTIL_DateTime::parseDate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
示例2: __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);
}
}
示例3: 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;
}
示例4: 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);
}
}
示例5: 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;
}
示例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;
}
示例7: __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; }');
}
示例8: 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));
}
示例9: 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);
}
}
示例10: 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;
}
示例11: 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($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();
$photoList[$userId] = 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" => $photoList[$userId], "avatar" => $avatarList[$userId], "name" => empty($userData[$userId]["title"]) ? "" : $userData[$userId]["title"], "label" => $userData[$userId]["label"], "labelColor" => $userData[$userId]["labelColor"], "compatibility" => $compatibilityList[$userId], "location" => empty($userData[$userId]["location"]) ? "" : $userData[$userId]["location"], "ages" => $userData[$userId]["ages"], "bookmarked" => !empty($bookmarksList[$userId]));
}
$this->assign("list", $list);
$total = OW::getEventManager()->call("matchmaking.get_list_count", array("userId" => OW::getUser()->getId()));
$this->assign("total", $total);
$service = SKADATEIOS_ABOL_Service::getInstance();
$auth = array('photo.view' => $service->getAuthorizationActionStatus('photo', 'view'));
$this->assign('auth', $auth);
$allowSendMessage = OW::getPluginManager()->isPluginActive('mailbox');
$this->assign("actions", array("bookmark" => OW::getPluginManager()->isPluginActive('bookmarks'), "message" => $allowSendMessage, "wink" => OW::getPluginManager()->isPluginActive('winks')));
$mailboxModes = OW::getEventManager()->call('mailbox.get_active_mode_list');
$this->assign("mailboxModes", empty($mailboxModes) ? array() : $mailboxModes);
}
示例12: getFields
public function getFields($userIdList)
{
$lang = OW::getLanguage();
$fields = array();
$qs = array();
$qBdate = BOL_QuestionService::getInstance()->findQuestionByName('birthdate', 'sex');
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);
}
$fields[$uid][] = array('label' => ' ', 'value' => $this->guests[$uid]['last_visit']);
}
return $fields;
}
示例13: __construct
public function __construct(BASE_CLASS_WidgetParameter $params)
{
parent::__construct();
$service = BIRTHDAYS_BOL_Service::getInstance();
$user = BOL_UserService::getInstance()->findUserById($params->additionalParamList['entityId']);
if ($user === null) {
$this->setVisible(false);
return;
}
$eventParams = array('action' => 'birthdays_view_my_birthdays', 'ownerId' => $user->getId(), 'viewerId' => OW::getUser()->getId());
try {
OW::getEventManager()->getInstance()->call('privacy_check_permission', $eventParams);
} catch (RedirectException $e) {
$this->setVisible(false);
return;
}
$result = $service->findListByBirthdayPeriod(date('Y-m-d'), date('Y-m-d', strtotime('+7 day')), 0, 1, array($user->getId()));
$isComingSoon = !empty($result);
$this->assign('ballonGreenSrc', OW::getPluginManager()->getPlugin('birthdays')->getStaticUrl() . 'img/' . 'ballon-lime-green.png');
$data = BOL_QuestionService::getInstance()->getQuestionData(array($user->getId()), array('birthdate'));
if (!$isComingSoon && !$params->customizeMode || !array_key_exists('birthdate', $data[$user->getId()])) {
$this->setVisible(false);
return;
}
$birtdate = $data[$user->getId()]['birthdate'];
$dateInfo = UTIL_DateTime::parseDate($birtdate, UTIL_DateTime::MYSQL_DATETIME_DATE_FORMAT);
$label = '';
if ($dateInfo['day'] == date('d')) {
$label = '<span class="ow_lbutton ow_green">' . OW::getLanguage()->text('base', 'date_time_today') . '</span>';
} else {
if ($dateInfo['day'] == date('d') + 1) {
$label = '<span class="ow_lbutton ow_green">' . OW::getLanguage()->text('base', 'date_time_tomorrow') . '</span>';
} else {
$label = '<span class="ow_small">' . UTIL_DateTime::formatBirthdate($dateInfo['year'], $dateInfo['month'], $dateInfo['day']) . '</span>';
}
}
$this->assign('label', $label);
}
示例14: renderQuestion
private function renderQuestion($userId, $questionName)
{
$language = OW::getLanguage();
$questionData = BOL_QuestionService::getInstance()->getQuestionData(array($userId), array($questionName));
if (!isset($questionData[$userId][$questionName])) {
return null;
}
$question = BOL_QuestionService::getInstance()->findQuestionByName($questionName);
switch ($question->presentation) {
/*case BOL_QuestionService::QUESTION_PRESENTATION_CHECKBOX:
if ( (int) $questionData[$userId][$question->name] === 1 )
{
$questionData[$userId][$question['name']] = $language->text('base', 'questions_checkbox_value_true');
}
else
{
$questionData[$userId][$question['name']] = $language->text('base', 'questions_checkbox_value_false');
}
break;*/
case BOL_QuestionService::QUESTION_PRESENTATION_DATE:
$format = OW::getConfig()->getValue('base', 'date_field_format');
$value = 0;
switch ($question->type) {
case BOL_QuestionService::QUESTION_VALUE_TYPE_DATETIME:
$date = UTIL_DateTime::parseDate($questionData[$userId][$question->name], UTIL_DateTime::MYSQL_DATETIME_DATE_FORMAT);
if (isset($date)) {
$format = OW::getConfig()->getValue('base', 'date_field_format');
$value = mktime(0, 0, 0, $date['month'], $date['day'], $date['year']);
}
break;
case BOL_QuestionService::QUESTION_VALUE_TYPE_SELECT:
$value = (int) $questionData[$userId][$question->name];
break;
}
if ($format === 'dmy') {
$questionData[$userId][$question->name] = date("d/m/Y", $value);
} else {
$questionData[$userId][$question->name] = date("m/d/Y", $value);
}
break;
case BOL_QuestionService::QUESTION_PRESENTATION_BIRTHDATE:
$date = UTIL_DateTime::parseDate($questionData[$userId][$question->name], UTIL_DateTime::MYSQL_DATETIME_DATE_FORMAT);
$questionData[$userId][$question->name] = UTIL_DateTime::formatBirthdate($date['year'], $date['month'], $date['day']);
break;
case BOL_QuestionService::QUESTION_PRESENTATION_AGE:
$date = UTIL_DateTime::parseDate($questionData[$userId][$question->name], UTIL_DateTime::MYSQL_DATETIME_DATE_FORMAT);
$questionData[$userId][$question->name] = UTIL_DateTime::getAge($date['year'], $date['month'], $date['day']) . " " . $language->text('base', 'questions_age_year_old');
break;
case BOL_QuestionService::QUESTION_PRESENTATION_RANGE:
$range = explode('-', $questionData[$userId][$question->name]);
$questionData[$userId][$question->name] = $language->text('base', 'form_element_from') . " " . $range[0] . " " . $language->text('base', 'form_element_to') . " " . $range[1];
break;
case BOL_QuestionService::QUESTION_PRESENTATION_SELECT:
case BOL_QuestionService::QUESTION_PRESENTATION_RADIO:
case BOL_QuestionService::QUESTION_PRESENTATION_MULTICHECKBOX:
$value = "";
$multicheckboxValue = (int) $questionData[$userId][$question->name];
$questionValues = BOL_QuestionService::getInstance()->findQuestionValues($question->name);
foreach ($questionValues as $val) {
/* @var $val BOL_QuestionValue */
if ((int) $val->value & $multicheckboxValue) {
if (strlen($value) > 0) {
$value .= ', ';
}
$value .= $language->text('base', 'questions_question_' . $question->name . '_value_' . $val->value);
}
}
if (strlen($value) > 0) {
$questionData[$userId][$question->name] = $value;
}
break;
case BOL_QuestionService::QUESTION_PRESENTATION_URL:
case BOL_QuestionService::QUESTION_PRESENTATION_TEXT:
case BOL_QuestionService::QUESTION_PRESENTATION_TEXTAREA:
// googlemap_location shortcut
if ($question->name == "googlemap_location" && !empty($questionData[$userId][$question->name]) && is_array($questionData[$userId][$question->name])) {
$mapData = $questionData[$userId][$question->name];
$value = trim($mapData["address"]);
} else {
$value = trim($questionData[$userId][$question->name]);
}
if (strlen($value) > 0) {
$questionData[$userId][$question->name] = UTIL_HtmlTag::autoLink(nl2br($value));
}
break;
default:
$questionData[$userId][$question->name] = null;
}
return $questionData[$userId][$question->name];
}
示例15: getFields
public function getFields($userIdList)
{
$fields = array();
foreach ($userIdList as $userId) {
$fields[$userId] = '';
}
$qs = array();
$qs[] = 'username';
$questionName = OW::getConfig()->getValue('base', 'display_name_question');
$qs[] = $questionName;
$qBdate = BOL_QuestionService::getInstance()->findQuestionByName('birthdate');
if ($qBdate->onView) {
$qs[] = 'birthdate';
}
$qSex = BOL_QuestionService::getInstance()->findQuestionByName('sex');
if ($qSex->onView) {
$qs[] = 'sex';
}
$qLocation = BOL_QuestionService::getInstance()->findQuestionByName('googlemap_location');
if ($qLocation) {
if ($qLocation->onView) {
$qs[] = 'googlemap_location';
}
}
$questionList = BOL_QuestionService::getInstance()->getQuestionData($userIdList, $qs);
foreach ($questionList as $userId => $question) {
$userFields = array();
$fields[$userId] = isset($question[$questionName]) ? "<b>" . $question[$questionName] . "</b>" : "<b>" . $question['username'] . "</b>";
$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)) {
$userFields['sex'] = substr($sexValue, 0, -2);
$fields[$userId] .= "<br/>" . $userFields['sex'];
}
}
if (!empty($question['birthdate'])) {
$date = UTIL_DateTime::parseDate($question['birthdate'], UTIL_DateTime::MYSQL_DATETIME_DATE_FORMAT);
$userFields['age'] = UTIL_DateTime::getAge($date['year'], $date['month'], $date['day']);
$fields[$userId] .= "<br/>" . $userFields['age'];
}
if (!empty($question['googlemap_location'])) {
$userFields['googlemap_location'] = !empty($question['googlemap_location']['address']) ? $question['googlemap_location']['address'] : '';
$fields[$userId] .= "<br/>" . $userFields['googlemap_location'];
}
}
return $fields;
}