/** * @param eZTags $tags * * @return eZUser[] */ public static function fetchUserList(eZTags $tags) { $tagIds = $tags->attribute('tag_ids'); $roles = array(); if (is_array($tagIds) && !empty($tagIds)) { $roles = eZPersistentObject::fetchObjectList(ITNewsletterNotificationRule::definition(), array('user_id'), array('tag_id' => array($tagIds)), null, null, false); } $userIds = array(); foreach ($roles as $role) { $userIds[] = $role['user_id']; } $userIds = array_unique($userIds); $users = array(); if (!empty($userIds)) { $users = eZPersistentObject::fetchObjectList(eZUser::definition(), null, array('contentobject_id' => array($userIds))); } foreach ($users as $index => $user) { if (!$user->attribute('is_enabled')) { unset($users[$index]); } } return $users; }
/** * Returns the meta data used for storing search indeces * * @param eZContentObjectAttribute $attribute * @return string */ function metaData($attribute) { $ini = eZINI::instance('eztags.ini'); $eztags = new eZTags(); $eztags->createFromAttribute($attribute); if ($ini->variable('SearchSettings', 'IndexSynonyms') === 'enabled') { return $eztags->keywordString(', '); } $keywords = array(); $tags = $eztags->attribute('tags'); foreach ($tags as $tag) { if ($tag->isSynonym()) { $tag = $tag->attribute('main_tag'); } $keywords[] = $tag->attribute('keyword'); } return implode(', ', array_unique($keywords)); }