本文整理汇总了PHP中OW_Event类的典型用法代码示例。如果您正苦于以下问题:PHP OW_Event类的具体用法?PHP OW_Event怎么用?PHP OW_Event使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了OW_Event类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onUserUnregister
public function onUserUnregister(OW_Event $event)
{
$params = $event->getParams();
$userId = $params["userId"];
// Delete Questions
$questions = QUESTIONS_BOL_Service::getInstance()->findQuestionsByUserId($userId);
foreach ($questions as $question) {
QUESTIONS_BOL_Service::getInstance()->deleteQuestion($question->id);
}
// Delete Answers
$answers = QUESTIONS_BOL_Service::getInstance()->findAnswersByUserId($userId);
foreach ($answers as $answer) {
QUESTIONS_BOL_Service::getInstance()->removeAnswerById($answer->id);
}
// Delete Follows
$follows = QUESTIONS_BOL_Service::getInstance()->findFollowsByUserId($userId);
foreach ($follows as $follow) {
QUESTIONS_BOL_Service::getInstance()->removeFollow($follow->userId, $follow->questionId);
}
// Delete Activity
$activityList = QUESTIONS_BOL_FeedService::getInstance()->findActivityByUserId($userId);
foreach ($activityList as $activity) {
/* @var $activity QUESTIONS_BOL_Activity */
QUESTIONS_BOL_FeedService::getInstance()->deleteActivity($activity->questionId, $activity->activityType, $activity->activityId);
}
}
示例2: beforeContentAdd
public function beforeContentAdd(OW_Event $event)
{
$params = $event->getParams();
if ($params["type"] != "link") {
return;
}
if (empty($params["data"])) {
$event->setData(false);
return;
}
$creditsParams = array('pluginKey' => 'links', 'action' => 'add_link');
$credits = OW::getEventManager()->call('usercredits.check_balance', $creditsParams);
if ($credits === false) {
$event->setData(array("error" => OW::getEventManager()->call('usercredits.error_message', $creditsParams)));
return;
}
$attachment = $params["data"];
$thumbnailUrl = empty($attachment['thumbnail_url']) ? null : $attachment['thumbnail_url'];
$title = empty($attachment['title']) ? null : $attachment['title'];
$description = empty($attachment['description']) ? null : $attachment['description'];
$href = $attachment['href'];
$linkId = $this->addLink($params["userId"], $href, $title, $description, $thumbnailUrl, $params["status"]);
if (empty($linkId)) {
$event->setData(false);
return;
}
OW::getEventManager()->call('usercredits.track_action', $creditsParams);
$event->setData(array('entityType' => 'link', 'entityId' => $linkId));
}
示例3: onInfoRender
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);
}
示例4: onNotificationRender
public function onNotificationRender(OW_Event $e)
{
$params = $e->getParams();
if ($params['pluginKey'] != 'photo' || $params['entityType'] != 'photo_add_comment') {
return;
}
$data = $params['data'];
if (!isset($data['avatar']['urlInfo']['vars']['username'])) {
return;
}
$userService = BOL_UserService::getInstance();
$user = $userService->findByUsername($data['avatar']['urlInfo']['vars']['username']);
if (!$user) {
return;
}
$commentId = $params['entityId'];
$comment = BOL_CommentService::getInstance()->findComment($commentId);
if (!$comment) {
return;
}
$commEntity = BOL_CommentService::getInstance()->findCommentEntityById($comment->commentEntityId);
if (!$commEntity) {
return;
}
$langVars = array('userUrl' => $userService->getUserUrl($user->id), 'userName' => $userService->getDisplayName($user->id), 'photoUrl' => OW::getRouter()->urlForRoute('view_photo', array('id' => $commEntity->entityId)));
$data['string'] = array('key' => 'photo+email_notifications_comment', 'vars' => $langVars);
$e->setData($data);
}
示例5: beforeContentAdd
public function beforeContentAdd(OW_Event $event)
{
$params = $event->getParams();
$data = $event->getData();
if (!empty($data)) {
return;
}
if (empty($params["status"]) && empty($params["data"])) {
$event->setData(false);
return;
}
$attachId = null;
$content = array();
if (!empty($params["data"])) {
$content = $params["data"];
if ($content['type'] == 'photo' && !empty($content['genId'])) {
$content['url'] = $content['href'] = OW::getEventManager()->call('base.attachment_save_image', array('genId' => $content['genId']));
$attachId = $content['genId'];
}
if ($content['type'] == 'video') {
$content['html'] = BOL_TextFormatService::getInstance()->validateVideoCode($content['html']);
}
}
$status = UTIL_HtmlTag::autoLink($params["status"]);
$out = NEWSFEED_BOL_Service::getInstance()->addStatus(OW::getUser()->getId(), $params['feedType'], $params['feedId'], $params['visibility'], $status, array("content" => $content, "attachmentId" => $attachId));
$event->setData($out);
}
示例6: onUserUnregister
public function onUserUnregister(OW_Event $event)
{
$params = $event->getParams();
$userId = $params['userId'];
$service = OCSAFFILIATES_BOL_Service::getInstance();
$service->deleteAffiliateUserByUserId($userId);
}
示例7: triggerEvent
private function triggerEvent(OW_Event $event)
{
if (in_array($event->getName(), $this->disabledEvents)) {
return $event;
}
return OW::getEventManager()->trigger($event);
}
示例8: getMapItemListCmp
public function getMapItemListCmp(OW_Event $event)
{
$params = $event->getParams();
if (!empty($params['className']) && $params['className'] == 'GOOGLELOCATION_CMP_MapUserList') {
$event->setData(new GOOGLELOCATION_MCMP_MapUserList($params['arguments'][0], $params['arguments'][1], $params['arguments'][2], $params['arguments'][3]));
}
}
示例9: onItemRender
public function onItemRender(OW_Event $event)
{
$params = $event->getParams();
$data = $params["data"];
if (!in_array($params['entityType'], array(self::TYPE_COMMENT, self::TYPE_LIKE))) {
return;
}
$coverId = null;
if (empty($params["data"]["coverId"])) {
$cover = UHEADER_BOL_Service::getInstance()->findCoverByUserId(OW::getUser()->getId());
if (!empty($cover)) {
$coverId = $cover->id;
}
} else {
$coverId = $params["data"]["coverId"];
}
$url = null;
if (!empty($coverId)) {
$url = UHEADER_MCLASS_NewsfeedBridge::getInstance()->getCoverUrl($coverId);
}
if (!empty($url)) {
$data["url"] = $url;
}
$event->setData($data);
}
示例10: onAfterGetUSEARCH_CMP_QuickSearchInstance
public function onAfterGetUSEARCH_CMP_QuickSearchInstance(OW_Event $event)
{
$params = $event->getParams();
if (!empty($params['className'])) {
$event->setData(new FEMALEREGONLYMEN_CMP_QuickSearch());
}
}
示例11: onUserRegister
public function onUserRegister(OW_Event $event)
{
$params = $event->getParams();
if (empty($params['params']['code'])) {
return;
}
$userIds = array();
foreach ($this->providers as $provider) {
$inviters = $provider->getInviters($params['params']['code']);
if ($inviters && is_array($inviters)) {
$userIds = array_merge($userIds, $inviters);
}
}
$fService = FRIENDS_BOL_Service::getInstance();
$newId = $params['userId'];
foreach ($userIds as $uid) {
$event = new OW_Event('friends.add_friend', array('requesterId' => $uid, 'userId' => $newId));
OW::getEventManager()->trigger($event);
/*$eventParams = array('pluginKey' => 'contactimporter', 'action' => 'import_friend', 'userId' => $userId);
if ( OW::getEventManager()->call('usercredits.check_balance', $eventParams) === true )
{
OW::getEventManager()->call('usercredits.track_action', $eventParams);
}*/
}
}
示例12: onInputInit
public function onInputInit(OW_Event $event)
{
$params = $event->getParams();
$userId = $params["userId"];
/* @var $input UTAGS_CMP_Tags */
$input = $params["input"];
$input->setupGroup(OW::getLanguage()->text('utags', 'selector_group_other'), array('priority' => 9, 'alwaysVisible' => true, 'noMatchMessage' => false));
}
示例13: onOptionAdd
public function onOptionAdd(OW_Event $e)
{
$params = $e->getParams();
$question = EQUESTIONS_BOL_Service::getInstance()->findQuestion($params['questionId']);
if ($question->userId != OW::getUser()->getId()) {
$this->credits->trackUse(EQUESTIONS_CLASS_Credits::ACTION_ADD_ANSWER);
}
}
示例14: isUserAdded
public function isUserAdded(OW_Event $event)
{
$params = $event->getParams();
$userId = $params["userId"];
$userDto = $this->service->findUserById($userId);
$data = $userDto !== null;
$event->setData($data);
return $data;
}
示例15: deleteRole
public function deleteRole(OW_Event $event)
{
$params = $event->getParams();
$roleId = (int) $params['roleId'];
if ($roleId > 0) {
MEMBERSHIP_BOL_MembershipService::getInstance()->deleteUserMembershipsByRoleId($roleId);
MEMBERSHIP_BOL_MembershipService::getInstance()->deleteMembershipTypeByRoleId($roleId);
}
}