function asAtom($app_root, $authorized_links = false) { $this->user || $this->getUser(); $feed = new Dase_Atom_Feed(); $feed->setTitle($this->name); if ($this->description) { $feed->setSubtitle($this->description); } $feed->setId($app_root . '/tag/' . $this->user->eid . '/' . $this->ascii_id); $feed->setUpdated($this->updated); $feed->addAuthor($this->user->eid); $feed->setFeedType('tag'); $feed->addLink($app_root . '/tag/' . $this->user->eid . '/' . $this->ascii_id . '.atom', 'self'); $feed->addLink($app_root . '/tag/' . $this->user->eid . '/' . $this->ascii_id, 'alternate'); $feed->addLink($app_root . '/tag/' . $this->user->eid . '/' . $this->ascii_id . '/list', 'alternate', 'text/html', '', 'list'); $feed->addLink($app_root . '/tag/' . $this->user->eid . '/' . $this->ascii_id . '/grid', 'alternate', 'text/html', '', 'grid'); $feed->addLink($app_root . '/tag/' . $this->user->eid . '/' . $this->ascii_id . '.json', 'alternate', 'application/json', '', 'slideshow'); $feed->addCategory($this->type, "http://daseproject.org/category/tag_type", $this->type); if ($this->is_public) { $pub = "public"; } else { $pub = "private"; } $feed->addCategory($pub, "http://daseproject.org/category/visibility"); $feed->addCategory($this->background, "http://daseproject.org/category/background"); /* TO DO categories: admin_coll_id, updated, created, master_item, etc */ $setnum = 0; $collections_array = array(); foreach ($this->getTagItems() as $tag_item) { $tag_item->persist(true); $item_unique = $tag_item->p_collection_ascii_id . '/' . $tag_item->p_serial_number; //lets us determine if tag includes items in only one collection $collections_array[$tag_item->p_collection_ascii_id] = 1; if ($authorized_links) { //fresh, not from cache $item = $tag_item->getItem(); $entry = $feed->addEntry(); $entry = $item->injectAtomEntryData($entry, $app_root, true); } else { $entry = $feed->addItemEntryByItemUnique($this->db, $item_unique, $app_root); } if ($entry) { $setnum++; $entry->addCategory($setnum, 'http://daseproject.org/category/position'); $entry->addCategory($tag_item->id, 'http://daseproject.org/category/tag_item_id'); $entry->addLink($app_root . '/tag/' . $this->user->eid . '/' . $this->ascii_id . '/' . $tag_item->id, "http://daseproject.org/relation/search-item"); $entry->addLink($app_root . '/tag/' . $this->user->eid . '/' . $this->ascii_id . '/' . $tag_item->id . '/annotation', "http://daseproject.org/relation/edit-annotation"); if ($tag_item->annotation) { $entry->setSummary($tag_item->annotation); } } else { //remove tag_item $log_text = "SMOKING GUN Ann Johns mystery: tried removing {$item_unique} from set {$this->eid}/{$this->ascii_id}"; Dase_Log::info(LOG_FILE, $log_text); //$tag_item->delete();; //$this->resortTagItems(); //$this->updateItemCount(); } } if (1 == count($collections_array)) { $coll = array_pop(array_keys($collections_array)); $feed->addCategory($coll, "http://daseproject.org/category/collection"); } return $feed->asXml(); }