コード例 #1
0
 public function __construct()
 {
     $this->componentAdminService = BOL_ComponentAdminService::getInstance();
     $this->componentEntityService = BOL_ComponentEntityService::getInstance();
     $controllersTemplate = OW::getPluginManager()->getPlugin('BASE')->getCtrlViewDir() . 'component_panel.html';
     $this->setTemplate($controllersTemplate);
 }
コード例 #2
0
ファイル: base_bridge.php プロジェクト: vazahat/dudex
 public function onInfoRender(OW_Event $event)
 {
     $params = $event->getParams();
     $userId = $params["userId"];
     $out = null;
     switch ($params["key"]) {
         case "base-gender-age":
             $questionData = BOL_QuestionService::getInstance()->getQuestionData(array($userId), array("birthdate"));
             $ageStr = "";
             if (!empty($questionData[$userId]['birthdate'])) {
                 $date = UTIL_DateTime::parseDate($questionData[$userId]['birthdate'], UTIL_DateTime::MYSQL_DATETIME_DATE_FORMAT);
                 $age = UTIL_DateTime::getAge($date['year'], $date['month'], $date['day']);
                 $ageStr = $age . OW::getLanguage()->text('base', 'questions_age_year_old');
             }
             $sex = $this->renderQuestion($userId, "sex");
             $out = $sex . " " . $ageStr;
             break;
         case "base-about":
             $settings = BOL_ComponentEntityService::getInstance()->findSettingList("profile-BASE_CMP_AboutMeWidget", $userId, array('content'));
             $out = empty($settings['content']) ? null : $settings['content'];
             break;
         case "base-question":
             if (!empty($params["question"])) {
                 $out = $this->renderQuestion($userId, $params["question"]);
             }
             break;
     }
     $out = UTIL_String::truncate($out, 270, '...');
     $event->setData($out);
 }
コード例 #3
0
ファイル: profile_about.php プロジェクト: vazahat/dudex
 protected function getAboutMeContent()
 {
     $settings = BOL_ComponentEntityService::getInstance()->findSettingList('profile-BASE_CMP_AboutMeWidget', $this->user->id, array('content'));
     if (empty($settings['content'])) {
         return null;
     }
     return $this->length === null ? $settings['content'] : UTIL_String::truncate($settings['content'], $this->length, "...");
 }
コード例 #4
0
 /**
  * @see OW_ActionController::init()
  *
  */
 public function init()
 {
     parent::init();
     if (!OW::getUser()->isAuthenticated()) {
         throw new Redirect404Exception();
     }
     $this->registerAction('reset', array($this, 'resetCustomization'));
     $this->componentService = BOL_ComponentEntityService::getInstance();
 }
コード例 #5
0
ファイル: event_handler.php プロジェクト: vazahat/dudex
 public function onAfterGroupDelete(OW_Event $event)
 {
     $params = $event->getParams();
     $groupId = $params['groupId'];
     BOL_ComponentEntityService::getInstance()->onEntityDelete(GROUPS_BOL_Service::WIDGET_PANEL_NAME, $groupId);
     BOL_CommentService::getInstance()->deleteEntityComments(GROUPS_BOL_Service::ENTITY_TYPE_WAL, $groupId);
     BOL_FlagService::getInstance()->deleteByTypeAndEntityId(GROUPS_BOL_Service::ENTITY_TYPE_GROUP, $groupId);
     OW::getEventManager()->trigger(new OW_Event('feed.delete_item', array('entityType' => GROUPS_BOL_Service::FEED_ENTITY_TYPE, 'entityId' => $groupId)));
 }
コード例 #6
0
ファイル: brief_info.php プロジェクト: vazahat/dudex
 private function getBoxParmList($groupId)
 {
     $settings = GROUPS_CMP_BriefInfoWidget::getStandardSettingValueList();
     $defaultSettings = BOL_ComponentAdminService::getInstance()->findSettingList('group-GROUPS_CMP_BriefInfoWidget');
     $customSettings = BOL_ComponentEntityService::getInstance()->findSettingList('group-GROUPS_CMP_BriefInfoWidget', $groupId);
     $out = array_merge($settings, $defaultSettings, $customSettings);
     $out['type'] = $out['wrap_in_box'] ? '' : 'empty';
     return $out;
 }
コード例 #7
0
 public function onInfoRender(OW_Event $event)
 {
     $params = $event->getParams();
     $entityType = $params["entityType"];
     $entityId = $params["entityId"];
     switch ($params["key"]) {
         case "base-gender-age":
             $questionData = BOL_QuestionService::getInstance()->getQuestionData(array($entityId), array("birthdate"));
             $ageStr = "";
             if (!empty($questionData[$entityId]['birthdate'])) {
                 $date = UTIL_DateTime::parseDate($questionData[$entityId]['birthdate'], UTIL_DateTime::MYSQL_DATETIME_DATE_FORMAT);
                 $age = UTIL_DateTime::getAge($date['year'], $date['month'], $date['day']);
                 $ageStr = $age . " " . OW::getLanguage()->text('base', 'questions_age_year_old');
             }
             $sex = $this->renderQuestion($entityId, "sex");
             $event->setData($sex . " " . $ageStr);
             break;
         case "base-about":
             $settings = BOL_ComponentEntityService::getInstance()->findSettingList("profile-BASE_CMP_AboutMeWidget", $entityId, array('content'));
             $content = empty($settings['content']) ? null : UTIL_String::truncate($settings['content'], 100, '...');
             $event->setData('<span class="ow_remark ow_small">' . $content . '</span>');
             break;
         case "base-activity":
             // Check privacy permissions
             $eventParams = array('action' => 'base_view_my_presence_on_site', 'ownerId' => $entityId, 'viewerId' => OW::getUser()->getId());
             try {
                 OW::getEventManager()->getInstance()->call('privacy_check_permission', $eventParams);
             } catch (RedirectException $e) {
                 break;
             }
             $isOnline = BOL_UserService::getInstance()->findOnlineUserById($entityId);
             if ($isOnline) {
                 $event->setData(OW::getLanguage()->text("base", "activity_online"));
             } else {
                 $user = BOL_UserService::getInstance()->findUserById($entityId);
                 $activity = UTIL_DateTime::formatDate($user->activityStamp);
                 $event->setData(OW::getLanguage()->text("hint", "info-activity", array("activity" => $activity)));
             }
             break;
         case "base-question":
             if (!empty($params["question"])) {
                 $renderedQuestion = $this->renderQuestion($entityId, $params["question"]);
                 if ($params["line"] == HINT_BOL_Service::INFO_LINE2) {
                     $renderedQuestion = '<span class="ow_remark">' . $renderedQuestion . '</span>';
                 }
                 $event->setData($renderedQuestion);
             }
             break;
     }
 }
コード例 #8
0
ファイル: event_handler.php プロジェクト: ZyXelP/oxwall
 public function onDeleteUserContent(OW_Event $event)
 {
     $params = $event->getParams();
     $userId = (int) $params['userId'];
     if ($userId > 0) {
         $moderatorId = BOL_AuthorizationService::getInstance()->getModeratorIdByUserId($userId);
         if ($moderatorId !== null) {
             BOL_AuthorizationService::getInstance()->deleteModerator($moderatorId);
         }
         BOL_AuthorizationService::getInstance()->deleteUserRolesByUserId($userId);
         if (isset($params['deleteContent']) && (bool) $params['deleteContent']) {
             BOL_CommentService::getInstance()->deleteUserComments($userId);
             BOL_RateService::getInstance()->deleteUserRates($userId);
             BOL_VoteService::getInstance()->deleteUserVotes($userId);
         }
         //delete widgets
         BOL_ComponentEntityService::getInstance()->onEntityDelete(BOL_ComponentEntityService::PLACE_DASHBOARD, $userId);
         BOL_ComponentEntityService::getInstance()->onEntityDelete(BOL_ComponentEntityService::PLACE_PROFILE, $userId);
         // delete email verify
         BOL_EmailVerifyService::getInstance()->deleteByUserId($userId);
         // delete remote auth info
         BOL_RemoteAuthService::getInstance()->deleteByUserId($userId);
         // delete user auth token
         BOL_AuthTokenDao::getInstance()->deleteByUserId($userId);
     }
 }
コード例 #9
0
ファイル: groups.php プロジェクト: vazahat/dudex
 public function view($params)
 {
     $groupId = (int) $params['groupId'];
     if (empty($groupId)) {
         throw new Redirect404Exception();
     }
     $groupDto = $this->service->findGroupById($groupId);
     if ($groupDto === null) {
         throw new Redirect404Exception();
     }
     OW::getDocument()->addMetaInfo('og:title', htmlspecialchars($groupDto->title), 'property');
     OW::getDocument()->addMetaInfo('og:description', htmlspecialchars($groupDto->description), 'property');
     OW::getDocument()->addMetaInfo('og:url', OW_URL_HOME . OW::getRequest()->getRequestUri(), 'property');
     OW::getDocument()->addMetaInfo('og:site_name', OW::getConfig()->getValue('base', 'site_name'), 'property');
     $language = OW::getLanguage();
     if (!$this->service->isCurrentUserCanView($groupDto->userId)) {
         $this->assign('permissionMessage', $language->text('groups', 'view_no_permission'));
         return;
     }
     $invite = $this->service->findInvite($groupDto->id, OW::getUser()->getId());
     if ($invite !== null) {
         OW::getRegistry()->set('groups.hide_console_invite_item', true);
         $this->service->markInviteAsViewed($groupDto->id, OW::getUser()->getId());
     }
     if ($groupDto->whoCanView == GROUPS_BOL_Service::WCV_INVITE && !OW::getUser()->isAuthorized('groups')) {
         if (!OW::getUser()->isAuthenticated()) {
             $this->redirect(OW::getRouter()->urlForRoute('groups-private-group', array('groupId' => $groupDto->id)));
         }
         $user = $this->service->findUser($groupDto->id, OW::getUser()->getId());
         if ($groupDto->whoCanView == GROUPS_BOL_Service::WCV_INVITE && $invite === null && $user === null) {
             $this->redirect(OW::getRouter()->urlForRoute('groups-private-group', array('groupId' => $groupDto->id)));
         }
     }
     OW::getDocument()->setTitle($language->text('groups', 'view_page_title', array('group_name' => strip_tags($groupDto->title))));
     OW::getDocument()->setDescription($language->text('groups', 'view_page_description', array('description' => UTIL_String::truncate(strip_tags($groupDto->description), 200))));
     $place = 'group';
     $customizeUrls = array('customize' => OW::getRouter()->urlForRoute('groups-customize', array('mode' => 'customize', 'groupId' => $groupId)), 'normal' => OW::getRouter()->urlForRoute('groups-view', array('groupId' => $groupId)));
     $componentAdminService = BOL_ComponentAdminService::getInstance();
     $componentEntityService = BOL_ComponentEntityService::getInstance();
     $userCustomizeAllowed = $componentAdminService->findPlace($place)->editableByUser;
     $ownerMode = $groupDto->userId == OW::getUser()->getId();
     $customize = !empty($params['mode']) && $params['mode'] == 'customize';
     if (!($userCustomizeAllowed && $ownerMode) && $customize) {
         $this->redirect($customizeUrls['normal']);
     }
     $template = $customize ? 'drag_and_drop_entity_panel_customize' : 'drag_and_drop_entity_panel';
     $schemeList = $componentAdminService->findSchemeList();
     $defaultScheme = $componentAdminService->findSchemeByPlace($place);
     if (empty($defaultScheme) && !empty($schemeList)) {
         $defaultScheme = reset($schemeList);
     }
     if (!$componentAdminService->isCacheExists($place)) {
         $state = array();
         $state['defaultComponents'] = $componentAdminService->findPlaceComponentList($place);
         $state['defaultPositions'] = $componentAdminService->findAllPositionList($place);
         $state['defaultSettings'] = $componentAdminService->findAllSettingList();
         $state['defaultScheme'] = $defaultScheme;
         $componentAdminService->saveCache($place, $state);
     }
     $state = $componentAdminService->findCache($place);
     $defaultComponents = $state['defaultComponents'];
     $defaultPositions = $state['defaultPositions'];
     $defaultSettings = $state['defaultSettings'];
     $defaultScheme = $state['defaultScheme'];
     if ($userCustomizeAllowed) {
         if (!$componentEntityService->isEntityCacheExists($place, $groupId)) {
             $entityCache = array();
             $entityCache['entityComponents'] = $componentEntityService->findPlaceComponentList($place, $groupId);
             $entityCache['entitySettings'] = $componentEntityService->findAllSettingList($groupId);
             $entityCache['entityPositions'] = $componentEntityService->findAllPositionList($place, $groupId);
             $componentEntityService->saveEntityCache($place, $groupId, $entityCache);
         }
         $entityCache = $componentEntityService->findEntityCache($place, $groupId);
         $entityComponents = $entityCache['entityComponents'];
         $entitySettings = $entityCache['entitySettings'];
         $entityPositions = $entityCache['entityPositions'];
     } else {
         $entityComponents = array();
         $entitySettings = array();
         $entityPositions = array();
     }
     $componentPanel = new BASE_CMP_DragAndDropEntityPanel($place, $groupId, $defaultComponents, $customize, $template);
     $componentPanel->setAdditionalSettingList(array('entityId' => $groupId, 'entity' => 'groups'));
     if ($ownerMode) {
         $componentPanel->allowCustomize($userCustomizeAllowed);
         $componentPanel->customizeControlCunfigure($customizeUrls['customize'], $customizeUrls['normal']);
     }
     $componentPanel->setSchemeList($schemeList);
     $componentPanel->setPositionList($defaultPositions);
     $componentPanel->setSettingList($defaultSettings);
     $componentPanel->setScheme($defaultScheme);
     /*
              * This feature was disabled for users
              * if ( !empty($userScheme) )
               {
               $componentPanel->setUserScheme($userScheme);
               } */
     if (!empty($entityComponents)) {
         $componentPanel->setEntityComponentList($entityComponents);
     }
     if (!empty($entityPositions)) {
         $componentPanel->setEntityPositionList($entityPositions);
     }
     if (!empty($entitySettings)) {
         $componentPanel->setEntitySettingList($entitySettings);
     }
     $this->assign('componentPanel', $componentPanel->render());
 }
コード例 #10
0
ファイル: base_bridge.php プロジェクト: vazahat/dudex
 public function onInfoRender(OW_Event $event)
 {
     $params = $event->getParams();
     $entityType = $params["entityType"];
     $entityId = $params["entityId"];
     switch ($params["key"]) {
         case "base-gender-age":
             $questionData = BOL_QuestionService::getInstance()->getQuestionData(array($entityId), array("birthdate"));
             $ageStr = "";
             if (!empty($questionData[$entityId]['birthdate'])) {
                 $date = UTIL_DateTime::parseDate($questionData[$entityId]['birthdate'], UTIL_DateTime::MYSQL_DATETIME_DATE_FORMAT);
                 $age = UTIL_DateTime::getAge($date['year'], $date['month'], $date['day']);
                 $ageStr = $age . OW::getLanguage()->text('base', 'questions_age_year_old');
             }
             $sex = $this->renderQuestion($entityId, "sex");
             $event->setData($sex . " " . $ageStr);
             break;
         case "base-about":
             $settings = BOL_ComponentEntityService::getInstance()->findSettingList("profile-BASE_CMP_AboutMeWidget", $entityId, array('content'));
             $content = empty($settings['content']) ? null : UTIL_String::truncate($settings['content'], 100, '...');
             $event->setData('<span class="ow_remark ow_small">' . $content . '</span>');
             break;
         case "base-question":
             if (!empty($params["question"])) {
                 $renderedQuestion = $this->renderQuestion($entityId, $params["question"]);
                 if ($params["line"] == HINT_BOL_Service::INFO_LINE2) {
                     $renderedQuestion = '<span class="ow_remark">' . $renderedQuestion . '</span>';
                 }
                 $event->setData($renderedQuestion);
             }
             break;
     }
 }
コード例 #11
0
ファイル: about_me_widget.php プロジェクト: vazahat/dudex
 public function process($data)
 {
     if (!$this->isValid($data)) {
         return false;
     }
     $userId = OW::getUser()->getId();
     if (!$userId) {
         return false;
     }
     $content = htmlspecialchars($data['about_me']);
     BOL_ComponentEntityService::getInstance()->saveComponentSettingList($data['widget_uniq_name'], $userId, array('content' => $content));
     BOL_ComponentEntityService::getInstance()->clearEntityCache(BOL_ComponentEntityService::PLACE_PROFILE, $userId);
     return array('message' => OW::getLanguage()->text('base', 'about_me_widget_content_saved'));
 }
コード例 #12
0
ファイル: service.php プロジェクト: vazahat/dudex
 public function getConfigList($groupId)
 {
     static $configList = array();
     if (!empty($configList[$groupId])) {
         return $configList[$groupId];
     }
     $_userSettings = GHEADER_CMP_HeaderWidget::getSettingList();
     $userSettings = array();
     foreach ($_userSettings as $name => $options) {
         $userSettings[$name] = $options['value'];
     }
     $settings = GHEADER_CMP_HeaderWidget::getStandardSettingValueList();
     $defaultSettings = BOL_ComponentAdminService::getInstance()->findSettingList('group-GHEADER_CMP_HeaderWidget');
     $customSettings = BOL_ComponentEntityService::getInstance()->findSettingList('group-GHEADER_CMP_HeaderWidget', $groupId);
     $configList = array_merge($settings, $userSettings, $defaultSettings, $customSettings);
     return $configList;
 }