本文整理汇总了PHP中OW_Event::getData方法的典型用法代码示例。如果您正苦于以下问题:PHP OW_Event::getData方法的具体用法?PHP OW_Event::getData怎么用?PHP OW_Event::getData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OW_Event
的用法示例。
在下文中一共展示了OW_Event::getData方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
示例2: onDublicate
public function onDublicate(OW_Event $event)
{
$params = $event->getParams();
if (!in_array($params['entityType'], array(self::TYPE_COMMENT, self::TYPE_LIKE))) {
return;
}
$data = $event->getData();
$oldData = $params['oldData'];
if (in_array($data['userIds'][0], $oldData['userIds'])) {
$event->setData($oldData);
return;
}
$data['userIds'] = array_merge($oldData['userIds'], $data['userIds']);
$users = $oldData['users'];
array_unshift($users, $data['users'][0]);
$userCount = count($users);
if ($userCount == 2) {
$data['string']['key'] = $params['entityType'] == self::TYPE_COMMENT ? 'uheader+notifications_comment_2' : 'uheader+notifications_like_2';
$data['string']['vars'] = array('user1' => '<a href="' . $users[0]['userUrl'] . '">' . $users[0]['userName'] . '</a>', 'user2' => '<a href="' . $users[1]['userUrl'] . '">' . $users[1]['userName'] . '</a>');
}
if ($userCount > 2) {
$data['string']['key'] = 'uheader+notifications_comment_many';
$data['string']['key'] = $params['entityType'] == self::TYPE_COMMENT ? 'uheader+notifications_comment_many' : 'uheader+notifications_like_many';
$data['string']['vars'] = array('user1' => '<a href="' . $users[0]['userUrl'] . '">' . $users[0]['userName'] . '</a>', 'user2' => '<a href="' . $users[1]['userUrl'] . '">' . $users[1]['userName'] . '</a>', 'otherCount' => $userCount - 1);
}
$data['users'] = $users;
$event->setData($data);
}
示例3: onUpdateInfo
public function onUpdateInfo(OW_Event $event)
{
$params = $event->getParams();
$data = $event->getData();
if ($params["entityType"] != self::ENTITY_TYPE) {
return;
}
foreach ($data as $eventId => $info) {
$status = 0;
switch ($info['status']) {
case BOL_ContentService::STATUS_ACTIVE:
$status = EVENT_BOL_EventService::MODERATION_STATUS_ACTIVE;
break;
case BOL_ContentService::STATUS_APPROVAL:
$status = EVENT_BOL_EventService::MODERATION_STATUS_APPROVAL;
break;
case BOL_ContentService::STATUS_SUSPENDED:
$status = EVENT_BOL_EventService::MODERATION_STATUS_SUSPANDED;
break;
}
$eventDto = EVENT_BOL_EventService::getInstance()->findEvent($eventId);
if (!empty($eventDto)) {
$eventDto->status = $status;
EVENT_BOL_EventService::getInstance()->saveEvent($eventDto);
}
}
}
示例4: onAfterGetSKADATE_CLASS_JoinFormInstance
public function onAfterGetSKADATE_CLASS_JoinFormInstance(OW_Event $event)
{
$params = $event->getParams();
if (!empty($params['className'])) {
$event->setData(new FEMALEREGONLYMEN_CLASS_JoinForm($params['arguments'][0]));
return $event->getData();
}
}
示例5: onFeedItemRenderDisableActions
public function onFeedItemRenderDisableActions(OW_Event $event)
{
$params = $event->getParams();
if (!in_array($params["action"]["entityType"], array(GROUPS_BOL_Service::FEED_ENTITY_TYPE, "groups-join", "groups-status"))) {
return;
}
$data = $event->getData();
$data["disabled"] = true;
$event->setData($data);
}
示例6: onFeedItemRenderDisableActions
public function onFeedItemRenderDisableActions(OW_Event $event)
{
$params = $event->getParams();
if ($params["action"]["entityType"] != "ocsfundraising_project") {
return;
}
$data = $event->getData();
$data["disabled"] = true;
$event->setData($data);
}
示例7: onFeedItemRenderDisableActions
public function onFeedItemRenderDisableActions(OW_Event $event)
{
$params = $event->getParams();
if (!in_array($params["action"]["entityType"], array('link'))) {
return;
}
$data = $event->getData();
$data["disabled"] = true;
$event->setData($data);
}
示例8: gheader_disable_formats
function gheader_disable_formats(OW_Event $event)
{
$params = $event->getParams();
if (!in_array($params["action"]["entityType"], array(GHEADER_CLASS_CommentsBridge::ENTITY_TYPE))) {
return;
}
$data = $event->getData();
$data["disabled"] = true;
$event->setData($data);
}
示例9: isNotificationPermited
public function isNotificationPermited(OW_Event $event)
{
$params = $event->getParams();
if (!isset($params['userId'], $params['action'])) {
return;
}
$userId = (int) $params['userId'];
$action = $params['action'];
$event->setData($this->service->isNotificationPermited($userId, $action));
return $event->getData();
}
示例10: sendNotification
public function sendNotification(OW_Event $event)
{
$params = $event->getParams();
$data = $event->getData();
$userId = $params['userId'];
$itemEventParams = array_merge(array('data' => $data), $params);
$itemEvent = new OW_Event('notifications.on_item_send', $params, $data);
OW::getEventManager()->trigger($itemEvent);
$notificationItem = $itemEvent->getParams();
$notificationItem['data'] = $itemEvent->getData();
$this->service->sendPermittedNotifications($userId, array($notificationItem));
}
示例11: usearch_disable_fields_on_edit_profile_question
function usearch_disable_fields_on_edit_profile_question(OW_Event $event)
{
$params = $event->getParams();
$data = $event->getData();
if (!empty($params['questionDto']) && $params['questionDto'] instanceof BOL_Question) {
$dto = $params['questionDto'];
if (in_array($dto->name, array('sex', 'match_sex', 'match_age'))) {
$data['disable_on_search'] = true;
$event->setData($data);
}
}
}
示例12: onItemRender
public function onItemRender(OW_Event $event)
{
$params = $event->getParams();
$data = $event->getData();
if ($params['action']['entityType'] != 'avatar-change') {
return;
}
$userId = $params['action']['userId'];
$avatarId = $params['action']['entityId'];
$avatar = UAVATARS_BOL_Service::getInstance()->findLastByAvatarId($avatarId);
if ($avatar === null) {
return;
}
$staticUrl = OW::getPluginManager()->getPlugin('uavatars')->getStaticUrl();
OW::getDocument()->addStyleSheet($staticUrl . 'style.css');
OW::getDocument()->addScript($staticUrl . 'script.js');
$avatars = UAVATARS_BOL_Service::getInstance()->findByUserId($userId, array(0, 2));
UAVATARS_CLASS_PhotoBridge::getInstance()->initPhotoFloatBox();
$js = UTIL_JsGenerator::newInstance();
if (count($avatars) == 1) {
$avatarUrl = UAVATARS_BOL_Service::getInstance()->getAvatarUrl($avatars[0]);
$imgUniqId = uniqid('uavatar_');
$data['content'] = '<div class="ua-newsfeed-avatars-wrap">
<a id="' . $imgUniqId . '" class="ua-newsfeed-avatar ua-newsfeed-current-avatar ow_border" href="javascript://">
<img src="' . $avatarUrl . '" />
</a>
</div>';
if (UAVATARS_CLASS_PhotoBridge::getInstance()->isPhotoExists($avatars[0]->photoId)) {
$js->jQueryEvent('#' . $imgUniqId, 'click', 'UAVATARS.setPhoto(event.data.photoId);', array('event'), array('photoId' => $avatars[0]->photoId));
}
} else {
$currentAvatarUrl = UAVATARS_BOL_Service::getInstance()->getAvatarUrl($avatars[0]);
$prevAvatarUrl = UAVATARS_BOL_Service::getInstance()->getAvatarUrl($avatars[1]);
$currentUniqId = uniqid('uavatar_');
$prevUniqId = uniqid('uavatar_');
$data['content'] = '<div class="ua-newsfeed-avatars-wrap">
<a id="' . $prevUniqId . '" class="ua-newsfeed-avatar ua-newsfeed-prev-avatar ow_border" href="javascript://">
<img src="' . $prevAvatarUrl . '" />
</a>
<a id="' . $currentUniqId . '" class="ua-newsfeed-avatar ua-newsfeed-current-avatar ow_border" href="javascript://">
<img src="' . $currentAvatarUrl . '" />
</a>
</div>';
if (UAVATARS_CLASS_PhotoBridge::getInstance()->isPhotoExists($avatars[0]->photoId)) {
$js->jQueryEvent('#' . $currentUniqId, 'click', 'UAVATARS.setPhoto(event.data.photoId);', array('event'), array('photoId' => $avatars[0]->photoId));
}
if (UAVATARS_CLASS_PhotoBridge::getInstance()->isPhotoExists($avatars[1]->photoId)) {
$js->jQueryEvent('#' . $prevUniqId, 'click', 'UAVATARS.setPhoto(event.data.photoId);', array('event'), array('photoId' => $avatars[1]->photoId));
}
}
OW::getDocument()->addOnloadScript($js);
$event->setData($data);
}
示例13: onUpdateInfo
public function onUpdateInfo(OW_Event $event)
{
$params = $event->getParams();
$data = $event->getData();
if ($params["entityType"] != self::ENTITY_TYPE) {
return;
}
foreach ($data as $groupId => $info) {
$group = $this->service->findGroupById($groupId);
$group->status = $info["status"];
$this->service->saveGroup($group);
}
}
示例14: onBeforeRender
public function onBeforeRender()
{
parent::onBeforeRender();
$event = new BASE_CLASS_EventCollector(self::EVENT_NAME, array('userId' => $this->userId));
OW::getEventManager()->trigger($event);
$event = new OW_Event(self::EVENT_PROCESS_TOOLBAR, array('userId' => $this->userId), $event->getData());
OW::getEventManager()->trigger($event);
$addedData = $event->getData();
if (empty($addedData)) {
$this->setVisible(false);
return;
}
$this->initToolbar($addedData);
}
示例15: ping
public function ping($params)
{
$commands = json_decode($params["commands"], true);
$commandsResult = array();
foreach ($commands as $command) {
$event = new OW_Event(self::PING_EVENT . '.' . trim($command["name"]), $command["params"]);
OW::getEventManager()->trigger($event);
$event = new OW_Event(self::PING_EVENT, array("command" => $command["name"], "params" => $command["params"]), $event->getData());
OW::getEventManager()->trigger($event);
$data = $event->getData();
$data = empty($data) ? new stdClass() : $data;
$commandsResult[] = array('name' => $command["name"], 'data' => $data);
}
$this->assign("commands", $commandsResult);
}