/** * @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; }
/** * Unserializes the content object attribute from provided DOM node * * @param eZPackage $package * @param eZContentObjectAttribute $objectAttribute * @param DOMElement $attributeNode */ public function unserializeContentObjectAttribute($package, $objectAttribute, $attributeNode) { $idString = $attributeNode->getElementsByTagName('id-string')->item(0)->textContent; $keywordString = $attributeNode->getElementsByTagName('keyword-string')->item(0)->textContent; $parentString = $attributeNode->getElementsByTagName('parent-string')->item(0)->textContent; $localeString = $attributeNode->getElementsByTagName('locale-string')->item(0)->textContent; $validationResult = $this->validateObjectAttribute($objectAttribute, $idString, $keywordString, $parentString, $localeString); if ($validationResult == eZInputValidator::STATE_ACCEPTED) { $eZTags = eZTags::createFromStrings($objectAttribute, $idString, $keywordString, $parentString, $localeString); $objectAttribute->setContent($eZTags); } }
/** * @deprecated usare un client ad hoc * * @param eZModule $module * @param eZTemplate $tpl * @param $repositoryNodeID * @param $localParentNodeID * * @throws Exception */ protected function handleTagChooserImport(eZModule $module, eZTemplate $tpl, $repositoryNodeID, $localParentNodeID, &$Result) { if (isset($this->attributes['definition']['AskTagTematica']) && $this->attributes['definition']['AskTagTematica'] == true) { $http = eZHTTPTool::instance(); if (!$http->hasPostVariable('SelectTags')) { $tpl->setVariable('fromPage', '/repository/import/' . $this->attributes['definition']['Identifier'] . '/' . $repositoryNodeID); $tpl->setVariable('localParentNodeID', $localParentNodeID); $Result['content'] = $tpl->fetch('design:repository/eztagschooser.tpl'); $Result['path'] = array(array('url' => false, 'text' => 'Scegli Tag')); return; } else { $tagIDs = array(); $tagKeywords = array(); $tagParents = array(); foreach ($_POST as $key => $value) { if (substr($key, 0, 8) == 'tematica') { list($tagID, $tagKeyword, $tagParent) = explode(";", $value); $tagIDs[] = $tagID; $tagKeywords[] = $tagKeyword; $tagParents[] = $tagParent; } } } $newObject = $this->import($repositoryNodeID, $localParentNodeID); foreach ($newObject->contentObjectAttributes() as $attribute) { if ($attribute->contentClassAttributeIdentifier() == 'tematica') { $eZTags = new eZTags(); $eZTags->createFromStrings(implode('|#', $tagIDs), implode('|#', $tagKeywords), implode('|#', $tagParents)); $eZTags->store($attribute); break; } } $module->redirectTo($newObject->attribute('main_node')->attribute('url_alias')); } else { $newObject = $this->import($repositoryNodeID, $localParentNodeID); $module->redirectTo($newObject->attribute('main_node')->attribute('url_alias')); } }
/** * Deserializes the content object attribute from provided DOM node * * @param eZPackage $package * @param eZContentObjectAttribute $objectAttribute * @param DOMNode $attributeNode */ function unserializeContentObjectAttribute($package, $objectAttribute, $attributeNode) { $idString = $attributeNode->getElementsByTagName('id-string')->item(0)->textContent; $keywordString = $attributeNode->getElementsByTagName('keyword-string')->item(0)->textContent; $parentString = $attributeNode->getElementsByTagName('parent-string')->item(0)->textContent; $eztags = new eZTags(); $eztags->createFromStrings($idString, $keywordString, $parentString); $objectAttribute->setContent($eztags); }