/**
  * Answer an element that represents the tags attached to a block.
  * 
  * @param BlockSiteComponent $siteComponent
  * @param DOMElement $element
  * @param optional string $pageId
  * @access protected
  */
 protected function recordTags(BlockSiteComponent $siteComponent, DOMElement $element, $pageId = null)
 {
     if (is_null($pageId)) {
         $pageId = $siteComponent->getId();
     }
     $tagManager = Services::getService("Tagging");
     $item = HarmoniNodeTaggedItem::forId($siteComponent->getId(), 'segue');
     $tagInfoIterator = $tagManager->getTagInfoForItem($item);
     while ($tagInfoIterator->hasNext()) {
         $tagInfo = $tagInfoIterator->next();
         // Record the tag in the channel.
         $this->recordTag($tagInfo);
         // Just add the tag once to our element
         $query = 'count(category[@domain = "post_tag" and @nicename = "' . $tagInfo->tag->getValue() . '"])';
         if (!$this->xpath->evaluate($query, $element)) {
             $tagElement = $element->appendChild($this->getCDATAElement('category', $tagInfo->tag->getValue()));
             $tagElement->setAttribute('domain', 'post_tag');
             $tagElement->setAttribute('nicename', $tagInfo->tag->getValue());
         }
     }
 }
Ejemplo n.º 2
0
 /**
  * Visit a Block and add to 
  * 
  * @param object BlockSiteComponent $siteComponent
  * @return object
  * @access public
  * @since 8/31/07
  */
 public function visitBlock(BlockSiteComponent $block)
 {
     $this->taggableItems[] = HarmoniNodeTaggedItem::forId($block->getId(), 'segue');
     return $this->taggableItems;
     //return visitTaggableComponents($block);
 }
 /**
  * Apply tags to a block
  * 
  * @param BlockSiteComponent $siteComponent
  * @param object DOMElement $element
  * @return void
  * @access protected
  * @since 4/18/08
  */
 protected function applyTags(BlockSiteComponent $siteComponent, DOMElement $element)
 {
     //$asset = $siteComponent->getAsset();
     $tagManager = Services::getService("Tagging");
     $idManager = Services::getService("Id");
     $item = HarmoniNodeTaggedItem::forId($siteComponent->getId(), 'segue');
     $tagElements = $this->xpath->query('./tags/tag', $element);
     foreach ($tagElements as $tagElement) {
         $tag = new Tag($tagElement->nodeValue);
         $date = DateAndTime::fromString($tagElement->getAttribute('create_date'));
         $agentId = $this->getAgentId($tagElement->getAttribute('agent_id'));
         $tag->tagItemForAgent($item, $agentId, $date);
     }
 }