Esempio n. 1
0
 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));
 }
Esempio n. 2
0
 public function __construct()
 {
     //parent::__construct();
     $this->questionService = BOL_QuestionService::getInstance();
     $this->setPageHeading(OW::getLanguage()->text('base', 'complete_your_profile_page_heading'));
     $this->setPageHeadingIconClass('ow_ic_user');
 }
Esempio n. 3
0
 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;
 }
Esempio n. 4
0
 public function __construct($providerName)
 {
     parent::__construct();
     $providerConfigForm = new YNSOCIALCONNECT_CLASS_ConfigFieldsForm($providerName);
     $this->addForm($providerConfigForm);
     $service = YNSOCIALCONNECT_BOL_ServicesService::getInstance();
     $provider = $service->getProvider($providerName);
     $this->assign('provider', $provider->getTitle());
     $questionDtoList = $service->getOWQuestionDtoList($providerName);
     $questionList = array();
     foreach ($questionDtoList as $dto) {
         $questionList[$dto->sectionName][(int) $dto->sortOrder] = array('name' => $dto->name, 'el_name' => 'alias[' . $dto->name . ']');
     }
     $questionSectionDtoList = BOL_QuestionService::getInstance()->findAllSections();
     $tplQuestionList = array();
     foreach ($questionSectionDtoList as $sectionDto) {
         if (empty($questionList[$sectionDto->name])) {
             continue;
         }
         /* @var $sectionDto BOL_QuestionSection */
         $tplQuestionList[(int) $sectionDto->sortOrder] = array('name' => $sectionDto->name, 'items' => $questionList[$sectionDto->name]);
     }
     ksort($tplQuestionList);
     $this->assign('questionList', $tplQuestionList);
 }
Esempio n. 5
0
 public static function presentationToCssClass()
 {
     $result = array();
     $presentations = BOL_QuestionService::getInstance()->getPresentations();
     foreach ($presentations as $presentation => $dataType) {
         switch ($presentation) {
             case BOL_QuestionService::QUESTION_PRESENTATION_CHECKBOX:
                 $result[$presentation] = 'owm_checkbox_wrap owm_simple_checkbox';
                 break;
             case BOL_QuestionService::QUESTION_PRESENTATION_MULTICHECKBOX:
                 $result[$presentation] = 'owm_checkbox_wrap';
                 break;
             case BOL_QuestionService::QUESTION_PRESENTATION_SELECT:
                 $result[$presentation] = 'owm_field_wrap owm_select_wrap';
                 break;
             case BOL_QuestionService::QUESTION_PRESENTATION_RADIO:
                 $result[$presentation] = 'owm_radio_wrap';
                 break;
             case BOL_QuestionService::QUESTION_PRESENTATION_BIRTHDATE:
             case BOL_QuestionService::QUESTION_PRESENTATION_DATE:
             case BOL_QuestionService::QUESTION_PRESENTATION_AGE:
                 $result[$presentation] = 'owm_field_wrap owm_select_wrap';
                 break;
             case BOL_QuestionService::QUESTION_PRESENTATION_TEXTAREA:
                 $result[$presentation] = 'owm_field_wrap owm_box_padding';
                 break;
             default:
                 $result[$presentation] = 'owm_field_wrap';
                 break;
         }
     }
     return $result;
 }
Esempio n. 6
0
 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);
     }
 }
Esempio n. 7
0
 public function onBeforeRender()
 {
     parent::onBeforeRender();
     $questionNames = array();
     if ($this->previewMode) {
         $questions = BOL_QuestionService::getInstance()->findViewQuestionsForAccountType($this->user->accountType);
         foreach ($questions as $question) {
             if ($question["name"] == OW::getConfig()->getValue('base', 'display_name_question')) {
                 continue;
             }
             $questionNames[$question['sectionName']][] = $question["name"];
         }
     }
     $questions = BASE_CMP_UserViewWidget::getUserViewQuestions($this->user->id, OW::getUser()->isAdmin(), reset($questionNames));
     $data = array();
     foreach ($questions['data'][$this->user->id] as $key => $value) {
         $data[$key] = $value;
         if (is_array($value)) {
             $data[$key] = implode(', ', $value);
         }
     }
     $this->assign("displaySections", !$this->previewMode);
     $this->assign('questionArray', $questions['questions']);
     $this->assign('questionData', $data);
     $this->assign('questionLabelList', $questions['labels']);
 }
Esempio n. 8
0
 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;
 }
Esempio n. 9
0
 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; }');
 }
Esempio n. 10
0
 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);
 }
Esempio n. 11
0
 public function onBeforeRender()
 {
     parent::onBeforeRender();
     $userList = array();
     $userDtoList = array();
     $userService = BOL_UserService::getInstance();
     $questionService = BOL_QuestionService::getInstance();
     $userIdList = array_keys($this->userList);
     $userDataList = BOL_QuestionService::getInstance()->getQuestionData($userIdList, $this->fieldList);
     foreach ($userService->findUserListByIdList($userIdList) as $userDto) {
         $userDtoList[$userDto->id] = $userDto;
     }
     foreach ($this->userList as $userId => $fieldList) {
         $fields = array_diff(array_keys($fieldList), $this->fieldList);
         $fieldsData = $questionService->getQuestionData(array($userId), $fields);
         $userList[$userId]['fields'] = array_merge(!empty($userDataList[$userId]) ? $userDataList[$userId] : array(), !empty($fieldsData[$userId]) ? $fieldsData[$userId] : array(), $fieldList);
         $userList[$userId]['dto'] = $userDtoList[$userId];
     }
     $this->assign('userList', $userList);
     $this->assign('avatars', BOL_AvatarService::getInstance()->getAvatarsUrlList($userIdList, 2));
     $this->assign('onlineList', !empty($userIdList) ? $userService->findOnlineStatusForUserList($userIdList) : array());
     $this->assign('usernameList', $userService->getUserNamesForList($userIdList));
     $this->assign('displaynameList', $userService->getDisplayNamesForList($userIdList));
     $this->assign('displayActivity', $this->displayActivity);
 }
Esempio n. 12
0
 public function __construct()
 {
     parent::__construct();
     $this->questionService = BOL_QuestionService::getInstance();
     $this->emailVerifyService = BOL_EmailVerifyService::getInstance();
     $this->userService = BOL_UserService::getInstance();
 }
Esempio n. 13
0
 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;
 }
Esempio n. 14
0
 public function getProgressbarData($userId, $isOwner = false)
 {
     if (empty($userId)) {
         return NULL;
     }
     $user = BOL_UserService::getInstance()->findUserById($userId);
     if (empty($user)) {
         return NULL;
     }
     $questions = BOL_QuestionService::getInstance()->findAllQuestionsForAccountType($user->getAccountType());
     $questionNameList = array();
     foreach ($questions as $question) {
         $questionNameList[] = $question['name'];
     }
     $questionData = BOL_QuestionService::getInstance()->getQuestionData(array($userId), $questionNameList);
     $data = array(self::KEY_PROGRESSBAR => array(self::COUNT_QUESTION => count($questions), self::COUNT_COMPLETED_QUESTION => count(array_filter($questionData[$userId]))));
     $authService = BOL_AuthorizationService::getInstance();
     $defaultFeatures = self::getEntityTypes();
     $features = array_filter(get_object_vars(json_decode(OW::getConfig()->getValue('profileprogressbar', 'features'))));
     $_features = array();
     $actions = array('blogs' => 'add', 'event' => 'add_event', 'forum' => 'edit', 'friends' => 'add_friend', 'groups' => 'create', 'links' => 'add', 'photo' => 'upload', 'video' => 'add', 'virtualgifts' => 'send_gift');
     foreach ($features as $feature => $count) {
         if (isset($actions[$feature]) && $authService->isActionAuthorizedForUser($userId, $feature, $actions[$feature])) {
             $data[self::KEY_PROGRESSBAR][self::COUNT_QUESTION] += $count;
             $_features[$defaultFeatures[$feature]] = $count;
         }
     }
     $data[self::KEY_PROGRESSBAR][self::COUNT_COMPLETED_QUESTION] += (int) $this->getCompletedFeaturesCount($userId, array_keys($_features));
     if ($isOwner) {
         $langFeatures = array();
         $completedFeatures = $this->getCompletedFeatures($userId, array_keys($_features));
         foreach ($_features as $feature => $count) {
             $need = NULL;
             if (!isset($completedFeatures[$feature]) || ($need = $count - $completedFeatures[$feature]) > 0) {
                 $_feature = array_search($feature, $defaultFeatures);
                 $langFeatures[$_feature] = OW::getLanguage()->text('profileprogressbar', $_feature . '_desc');
                 $langFeatures[$_feature . 'Count'] = $need === NULL ? $count : $need;
             }
         }
         if (count($langFeatures) > 0) {
             $vars = array();
             foreach ($langFeatures as $key => $value) {
                 $vars['{$' . $key . '}'] = $value;
             }
             $hintText = explode('#', OW::getLanguage()->text('profileprogressbar', 'hint_text'));
             foreach ($hintText as $key => $hint) {
                 $hintText[$key] = str_replace(array_keys($vars), array_values($vars), $hint);
             }
             function unsetUnusedHint($val)
             {
                 return strpos($val, '{$') === FALSE;
             }
             $hintText = array_filter($hintText, 'unsetUnusedHint');
             $data[self::KEY_HINT] = trim(implode('', $hintText));
         }
     }
     return $data;
 }
Esempio n. 15
0
 public function __construct()
 {
     parent::__construct('MATCHMAKING_PreferencesForm');
     $this->questionService = BOL_QuestionService::getInstance();
     $language = OW::getLanguage();
     $save = new Submit('save');
     $save->setValue($language->text('matchmaking', 'btn_label_save'));
     $this->addElement($save);
 }
Esempio n. 16
0
 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;
 }
Esempio n. 17
0
 public function __construct()
 {
     $accountType = new BOL_QuestionAccountType();
     $accountType->name = md5(uniqid());
     $accountType->roleId = 0;
     $form = new ADMIN_CLASS_AddAccountTypeForm($accountType);
     $this->addForm($form);
     $list = BOL_LanguageService::getInstance()->findActiveList();
     $this->assign('langs', $list);
     $this->assign('prefix', 'base');
     $this->assign('key', BOL_QuestionService::getInstance()->getQuestionLangKeyName(BOL_QuestionService::LANG_KEY_TYPE_ACCOUNT_TYPE, $accountType->name));
     $this->assign('form', $form);
 }
Esempio n. 18
0
 protected function loovListingResult($listId)
 {
     $questionList = BOL_QuestionService::getInstance()->getQuestionData($listId, array('username', 'sex', 'birthdate', 'email', 'realname', 'birthdate', 'googlemap_location'));
     $flag = "1";
     $avatar = BOL_AvatarService::getInstance()->getDataForUserAvatars($listId, true, true, true, true, $flag);
     //$onlineStatus = $Userservice->findOnlineStatusForUserList($user_ids);
     $dob = "";
     $age = "";
     foreach ($questionList as $key => $user) {
         $dob = date("Y/m/d", strtotime($user["birthdate"]));
         $age = $this->ageCalculate($dob);
         $user_data[] = array("user_id" => $key, "user_name" => $user["username"], "realname" => $user["realname"], "profile_picture" => $avatar[$key]["src"], "age" => $age);
     }
     return $user_data;
 }
Esempio n. 19
0
 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);
 }
Esempio n. 20
0
 public function __construct()
 {
     parent::__construct('acc-type-select-form');
     $this->setMethod(Form::METHOD_GET);
     $accountType = new Selectbox('accountType');
     $accountType->addAttribute('id', 'account-type-select');
     $accTypes = BOL_QuestionService::getInstance()->findAllAccountTypesWithLabels();
     $accountType->setOptions($accTypes);
     $accountType->setHasInvitation(false);
     $this->addElement($accountType);
     $script = '$("#account-type-select").change( function(){
          $(this).parents("form:eq(0)").submit();
      });
      ';
     OW::getDocument()->addOnloadScript($script);
 }
Esempio n. 21
0
 public function __construct($accountTypeName = '')
 {
     $accountType = BOL_QuestionService::getInstance()->findAccountTypeByName($accountTypeName);
     if (empty($accountType)) {
         $this->setVisible(false);
     }
     $form = new ADMIN_CLASS_AddAccountTypeForm($accountType, 'editAccountType');
     $form->setAjaxResetOnSuccess(false);
     $this->addForm($form);
     $list = BOL_LanguageService::getInstance()->findActiveList();
     $key = BOL_QuestionService::getInstance()->getQuestionLangKeyName(BOL_QuestionService::LANG_KEY_TYPE_ACCOUNT_TYPE, $accountType->name);
     $this->assign('langs', $list);
     $this->assign('prefix', 'base');
     $this->assign('key', $key);
     $this->assign('form', $form);
     $this->setTemplate(OW::getPluginManager()->getPlugin('admin')->getCmpViewDir() . 'add_account_type.html');
 }
Esempio n. 22
0
 /**
  * Class constructor
  */
 public function __construct($userId)
 {
     parent::__construct();
     if (!OW::getUser()->isAuthorized('membership')) {
         $this->setVisible(false);
         return;
     }
     $user = BOL_UserService::getInstance()->findUserById($userId);
     if (!$user) {
         $this->setVisible(false);
         return;
     }
     $accTypeName = $user->getAccountType();
     $accType = BOL_QuestionService::getInstance()->findAccountTypeByName($accTypeName);
     $service = MEMBERSHIP_BOL_MembershipService::getInstance();
     $authService = BOL_AuthorizationService::getInstance();
     $types = $service->getTypeList($accType->id);
     /* @var $defaultRole BOL_AuthorizationRole */
     $defaultRole = $authService->getDefaultRole();
     $default = array('value' => 'default', 'label' => $authService->getRoleLabel($defaultRole->name));
     $this->assign('default', $default);
     $memberships = array();
     foreach ($types as &$ms) {
         $memberships[$ms->id] = $service->getMembershipTitle($ms->roleId);
     }
     $this->assign('memberships', $memberships);
     $current = $service->getUserMembership($userId);
     $this->assign('current', $current);
     if ($current) {
         $this->assign('remaining', $service->getRemainingPeriod($current->expirationStamp));
     }
     $form = new MEMBERSHIP_CLASS_SetMembershipForm();
     $this->addForm($form);
     $form->getElement('userId')->setValue($userId);
     $form->bindJsFunction(Form::BIND_SUCCESS, "function(data){\n                if ( data.result ) {\n                    OW.info(data.msg);\n                    document.setMembershipFloatBox.close();\n                }\n                else {\n                    OW.error(data.msg);\n                }\n             }");
     $script = '$("input[name=type]").change(function(){
         if ( $(this).val() == "default" ) {
             $("#period-cont").css("display", "none");
         }
         else {
             $("#period-cont").css("display", "table-row");
         }
     });';
     OW::getDocument()->addOnloadScript($script);
 }
 /**
  * @param OW_ActionController $controller
  */
 public function __construct($controller)
 {
     parent::__construct('DisplayNameSearchForm');
     $this->controller = $controller;
     $questionService = BOL_QuestionService::getInstance();
     $this->setId('DisplayNameSearchForm');
     $submit = new Submit(self::SUBMIT_NAME);
     $submit->setValue(OW::getLanguage()->text('base', 'user_search_submit_button_label'));
     $this->addElement($submit);
     $questionName = OW::getConfig()->getValue('base', 'display_name_question');
     $question = $questionService->findQuestionByName($questionName);
     $questionPropertyList = array();
     foreach ($question as $property => $value) {
         $questionPropertyList[$property] = $value;
     }
     $this->addQuestions(array($questionName => $questionPropertyList), array(), array());
     $controller->assign('displayNameQuestion', $questionPropertyList);
 }
 protected function addFieldValidator($formField, $question)
 {
     if ((string) $question['base'] === '1') {
         if ($question['name'] === 'email') {
             $formField->addValidator(new joinEmailValidator());
         }
         if ($question['name'] === 'username') {
             $formField->addValidator(new UserNameValidator());
         }
         if ($question['name'] === 'password') {
             $passwordRepeat = BOL_QuestionService::getInstance()->getPresentationClass($question['presentation'], 'repeatPassword');
             $passwordRepeat->setLabel(OW::getLanguage()->text('base', 'questions_question_repeat_password_label'));
             $passwordRepeat->setRequired((string) $question['required'] === '1');
             $this->addElement($passwordRepeat);
             $formField->addValidator(new PasswordValidator());
         }
     }
 }
Esempio n. 25
0
 function questionsFieldInit(OW_Event $e)
 {
     $params = $e->getParams();
     if ($params['fieldName'] == 'googlemap_location') {
         $formElement = new GOOGLELOCATION_CLASS_Location($params['fieldName']);
         if ($params['type'] == 'search') {
             $formElement = new GOOGLELOCATION_CLASS_LocationSearch($params['fieldName']);
             $formElement->setInvitation(OW::getLanguage()->text('googlelocation', 'googlemap_location_search_invitation'));
             $formElement->setHasInvitation(true);
             if (OW::getUser()->isAuthenticated() && OW::getConfig()->getValue('googlelocation', 'auto_fill_location_on_search')) {
                 $data = BOL_QuestionService::getInstance()->getQuestionData(array(OW::getUser()->getId()), array('googlemap_location'));
                 if (!empty($data[OW::getUser()->getId()]['googlemap_location']['json'])) {
                     $formElement->setValue($data[OW::getUser()->getId()]['googlemap_location']);
                 }
             }
         }
         $e->setData($formElement);
     }
 }
Esempio n. 26
0
 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;
 }
Esempio n. 27
0
function usearch_set_presentation(OW_Event $event)
{
    $params = $event->getParams();
    if ($params['type'] != 'search' || !in_array($params['fieldName'], array('sex', 'birthdate'))) {
        return;
    }
    $lang = OW::getLanguage();
    $sessionData = OW::getSession()->get(USEARCH_CLASS_QuickSearchForm::FORM_SESSEION_VAR);
    switch ($params['fieldName']) {
        case 'sex':
            $field = new Selectbox('sex');
            $field->setLabel($lang->text('usearch', 'search_label_sex'));
            $field->setHasInvitation(false);
            if (!empty($sessionData['sex'])) {
                $field->setValue($sessionData['sex']);
            }
            break;
        case 'birthdate':
            $field = new USEARCH_CLASS_AgeRangeField('birthdate');
            $field->setLabel($lang->text('usearch', 'age'));
            if (!empty($sessionData['birthdate']['from']) && !empty($sessionData['birthdate']['to'])) {
                $field->setValue($sessionData['birthdate']);
            }
            $configs = !empty($params['configs']) ? BOL_QuestionService::getInstance()->getQuestionConfig($params['configs'], 'year_range') : null;
            $max = !empty($configs['from']) ? date("Y") - (int) $configs['from'] : null;
            $min = !empty($configs['to']) ? date("Y") - (int) $configs['to'] : null;
            $field->setMaxAge($max);
            $field->setMinAge($min);
            $validator = new USEARCH_CLASS_AgeRangeValidator($min, $max);
            $errorMsg = $lang->text('usearch', 'age_range_incorrect_values', array('min' => $min, 'max' => $max));
            $validator->setErrorMessage($errorMsg);
            $field->addValidator($validator);
            break;
    }
    if (!empty($field)) {
        $event->setData($field);
    }
}
Esempio n. 28
0
 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);
 }
Esempio n. 29
0
 public function onTodayBirthday(OW_Event $e)
 {
     $params = $e->getParams();
     $userIds = $params['userIdList'];
     $usersData = BOL_AvatarService::getInstance()->getDataForUserAvatars($userIds);
     $actionParams = array('entityType' => 'birthday', 'pluginKey' => 'birthdays', 'replace' => true);
     $actionData = array('time' => time());
     $birthdays = BOL_QuestionService::getInstance()->getQuestionData($userIds, array('birthdate'));
     foreach ($userIds as $userId) {
         $userEmbed = '<a href="' . $usersData[$userId]['url'] . '">' . $usersData[$userId]['title'] . '</a>';
         $actionParams['userId'] = $userId;
         $actionParams['entityId'] = $userId;
         $actionData['line'] = OW::getLanguage()->text('birthdays', 'feed_item_line', array('user' => $userEmbed));
         $actionData['content'] = '<div class="ow_user_list_picture">' . OW::getThemeManager()->processDecorator('avatar_item', $usersData[$userId]) . '</div>';
         if (!empty($birthdays[$userId]['birthdate'])) {
             $actionData['birthdate'] = $birthdays[$userId]['birthdate'];
             $actionData['userData'] = $usersData[$userId];
         }
         $event = new OW_Event('feed.action', $actionParams, $actionData);
         OW::getEventManager()->trigger($event);
         BOL_AuthorizationService::getInstance()->trackActionForUser($userId, 'birthdays', 'birthday');
     }
 }
Esempio n. 30
0
 public function __construct()
 {
     parent::__construct();
     $form = OW::getClassInstance('SELECTGENDER_CLASS_QuickSearchForm', $this);
     $this->addForm($form);
     $config = OW::getConfig();
     $opositeMatchSexSearch = $config->getValue('selectgender', 'opositeMatchSexSearch');
     $sameMatchSexSearch = $config->getValue('selectgender', 'sameMatchSexSearch');
     $isUserRegister = OW::getUser()->isAuthenticated();
     if (OW::getUser()->isAuthenticated()) {
         $userId = OW::getUser()->getId();
         $userSex = BOL_QuestionService::getInstance()->getQuestionData(array($userId), array('sex'));
         $jsParams = array('isUserRegister' => $isUserRegister, 'opositeMatchSexSearch' => $opositeMatchSexSearch, 'sameMatchSexSearch' => $sameMatchSexSearch, 'userSex' => $userSex[$userId]['sex']);
         $script = ' var quickSearch = new SELECTGENDER_QuickSearch(); quickSearch.init(' . json_encode($jsParams) . '); ';
         OW::getDocument()->addOnloadScript($script);
         OW::getDocument()->addScript(OW::getPluginManager()->getPlugin('selectgender')->getStaticJsUrl() . 'quickSearch.js');
     }
     $this->assign('form', $form);
     $this->assign('advancedUrl', OW::getRouter()->urlForRoute('users-search'));
     $this->assign('questions', USEARCH_BOL_Service::getInstance()->getQuickSerchQuestionNames());
     if (OW::getUser()->isAuthenticated()) {
         $this->assign('userId', OW::getUser()->getId());
     }
 }