public function onBeforeDecoratorRender(BASE_CLASS_PropertyEvent $e) { switch ($e->getProperty('decoratorName')) { case 'avatar_item': if ($e->getProperty('fullLabel') === null) { $e->setProperty('label', mb_substr($e->getProperty('label'), 0, 1)); } break; } }
public function beforeDecorator(BASE_CLASS_PropertyEvent $event) { if (!OW::getUser()->isAuthenticated()) { return; } $properties = $event->getProperties(); if (!empty($properties['name']) && $properties['name'] == 'user_big_list_item') { static $settings = NULL; if (empty($settings)) { $settings['bookmarkList'] = BOOKMARKS_BOL_MarkDao::getInstance()->findAllBookmarkIdList(OW::getUser()->getId()); $handler = OW::getRequestHandler()->getHandlerAttributes(); $settings['isMarkList'] = $handler[OW_RequestHandler::ATTRS_KEY_CTRL] == 'BOOKMARKS_CTRL_List'; } if ($isMarked = in_array($properties['id'], $settings['bookmarkList'])) { $label = OW::getLanguage()->text('bookmarks', 'unmark_toolbar_label'); } else { $label = OW::getLanguage()->text('bookmarks', 'mark_toolbar_label'); } if (!$settings['isMarkList']) { $event->setProperty('isMarked', $isMarked); } $event->setProperty('avatarAction', array('href' => 'javascript://', 'label' => $label, 'userId' => $properties['id'])); } }