function injectAtomEntryData(Dase_Atom_Entry $entry, $collection_ascii_id, $app_root) { $entry->setTitle($this->name); $entry->setId($this->getUrl($collection_ascii_id, $app_root)); $entry->setSummary($this->description); $entry->addLink($this->getUrl($collection_ascii_id, $app_root) . '.atom', 'edit'); $entry->addLink($this->getUrl($collection_ascii_id, $app_root) . '/attributes.atom', 'http://daseproject.org/relation/item_type/attributes', 'application/atom+xml', '', $this->name . ' Attributes'); $entry->addLink($this->getUrl($collection_ascii_id, $app_root) . '/attributes.json', 'http://daseproject.org/relation/item_type/attributes', 'application/json', '', $this->name . ' Attributes'); $entry->addCategory('item_type', 'http://daseproject.org/category/entrytype', 'Item Type'); if (is_numeric($this->updated)) { $updated = date(DATE_ATOM, $this->updated); } else { $updated = $this->updated; } $entry->setUpdated($updated); $entry->addAuthor(); return $entry; }
function injectAtomEntryData(Dase_Atom_Entry $entry, $app_root) { $url = $this->getUrl($this->ascii_id, $app_root); $entry->setTitle($this->collection_name); $entry->setId($url); $entry->setUpdated($this->updated); $entry->addAuthor(); $entry->addLink($url . '.atom'); $entry->addLink($url . '.atom', 'edit'); $entry->addCategory('collection', 'http://daseproject.org/category/entrytype'); if ($this->description) { $entry->setSummary($this->description); } else { $entry->setSummary(str_replace('_collection', '', $this->ascii_id)); } if ($this->admin_notes) { $entry->setContent($this->admin_notes); } foreach ($this->getAttributes() as $a) { $entry->addCategory($a->ascii_id, "http://daseproject.org/category/attribute", $a->attribute_name); } foreach ($this->getItemTypes() as $item_type) { $entry->addCategory($item_type->ascii_id, "http://daseproject.org/category/item_type", $item_type->name); } if ($this->is_public) { $pub = "public"; } else { $pub = "private"; } $entry->addCategory($pub, "http://daseproject.org/category/status"); if (!$this->visibility) { $this->visibility = 'user'; } $entry->addCategory($this->visibility, "http://daseproject.org/category/visibility"); $entry->addCategory($app_root, "http://daseproject.org/category/base_url"); $entry->addCategory($this->item_count, "http://daseproject.org/category/item_count"); return $entry; }
function injectAtomEntryData(Dase_Atom_Entry $entry, $user = null, $app_root) { if (!$user) { $user = $this->getUser(); } $entry->setTitle($this->name); if ($this->description) { $entry->setSummary($this->description); } $entry->setId($app_root . '/user/' . $user->eid . '/tag/' . $this->ascii_id); $updated = $this->updated ? $this->updated : '2005-01-01T00:00:01-06:00'; $entry->setUpdated($updated); $entry->addAuthor($user->eid); $entry->addLink($app_root . '/tag/' . $user->eid . '/' . $this->ascii_id . '.atom', 'self'); $entry->addLink($app_root . '/tag/' . $user->eid . '/' . $this->ascii_id . '/authorized.atom', 'http://daseproject.org/relation/authorized'); $entry->addLink($app_root . '/tag/' . $user->eid . '/' . $this->ascii_id . '/entry.atom', 'edit'); $entry->addLink($app_root . '/tag/' . $user->eid . '/' . $this->ascii_id . '/entry.json', 'http://daseproject.org/relation/edit', 'application/json'); $entry->addLink($app_root . '/tag/' . $user->eid . '/' . $this->ascii_id, 'alternate'); $tag_cat = new Dase_DBO_TagCategory($this->db); $tag_cat->tag_id = $this->id; foreach ($tag_cat->find() as $tc) { $entry->addCategory($tc->term, 'http://daseproject.org/category/' . $tc->scheme, $tc->label); } $entry->addCategory($app_root, "http://daseproject.org/category/base_url"); $entry->addCategory("set", "http://daseproject.org/category/entrytype"); $entry->addCategory($this->type, "http://daseproject.org/category/tag_type", $this->type); if ($this->is_public) { $pub = "public"; } else { $pub = "private"; } $entry->addCategory($pub, "http://daseproject.org/category/visibility"); $entry->addCategory($this->background, "http://daseproject.org/category/background"); return $entry; }
function injectAtomEntryData(Dase_Atom_Entry $entry, $app_root) { $d = "http://daseproject.org/ns/1.0"; //this function assumes p_collection_ascii_id & p_serial_number are set $entry->setId($this->getLink($app_root)); $entry->setTitle($this->filename); $entry->addAuthor(); $entry->setUpdated($this->updated); $entry->setSummary(''); //for AtomPub $entry->setEdited($this->updated); $edit_url = $app_root . '/media/' . $this->p_collection_ascii_id . '/' . $this->p_serial_number; $entry->addLink($edit_url, 'edit'); $ext = Dase_File::$types_map[$this->mime_type]['ext']; $edit_media_url = $app_root . '/media/' . $this->p_collection_ascii_id . '/' . $this->p_serial_number; $entry->addLink($edit_media_url, 'edit-media'); //to which we can post form-encoded or json metadata pairs: $entry->addLink($app_root . '/item/' . $this->p_collection_ascii_id . '/' . $this->p_serial_number . '/metadata', 'http://daseproject.org/relation/edit-metadata'); //link to the owning dase item using iana registered 'up' rel value $entry->addLink($app_root . '/item/' . $this->p_collection_ascii_id . '/' . $this->p_serial_number . '.atom', 'up'); $entry->setMediaContent($this->getLink($app_root), $this->mime_type); $media_group = $entry->addElement('media:group', null, Dase_Atom::$ns['media']); //todo: beef up w/ bitrate, samplingrate, etc. foreach ($this->getDerivatives() as $med) { if ($med->size == 'thumbnail') { //$media_thumbnail = $entry->addElement('media:thumbnail',null,Dase_Atom::$ns['media']); $media_thumbnail = $media_group->appendChild($entry->dom->createElementNS(Dase_Atom::$ns['media'], 'thumbnail')); $media_thumbnail->setAttribute('url', $med->getLink($app_root)); $media_thumbnail->setAttribute('width', $med->width); $media_thumbnail->setAttribute('height', $med->height); } if ($med->size == 'viewitem') { //$media_viewitem = $entry->addElement('media:content',null,Dase_Atom::$ns['media']); $media_viewitem = $media_group->appendChild($entry->dom->createElementNS(Dase_Atom::$ns['media'], 'content')); $media_viewitem->setAttribute('url', $med->getLink($app_root)); $media_viewitem->setAttribute('width', $med->width); $media_viewitem->setAttribute('height', $med->height); $media_viewitem->setAttribute('fileSize', $med->file_size); $media_viewitem->setAttribute('type', $med->mime_type); $media_category = $media_viewitem->appendChild($entry->dom->createElement('media:category')); $media_category->appendChild($entry->dom->createTextNode($med->size)); } if ($med->size != 'thumbnail' && $med->size != 'viewitem') { $media_content = $media_group->appendChild($entry->dom->createElementNS(Dase_Atom::$ns['media'], 'content')); $media_content->setAttribute('url', $med->getLink($app_root)); $media_content->setAttribute('width', $med->width); $media_content->setAttribute('height', $med->height); $media_content->setAttribute('fileSize', $med->file_size); $media_content->setAttribute('type', $med->mime_type); $media_category = $media_content->appendChild($entry->dom->createElement('media:category')); $media_category->appendChild($entry->dom->createTextNode($med->size)); } } return $entry->asXml(); }
function injectAtomEntryData(Dase_Atom_Entry $entry, $collection_ascii_id, $app_root) { $url = $this->getUrl($collection_ascii_id, $app_root); $entry->setTitle($this->attribute_name); $entry->setId($url); $entry->addLink($url . '.atom'); $entry->addLink($url . '.atom', 'edit'); $entry->addCategory('attribute', 'http://daseproject.org/category/entrytype'); $entry->addCategory($this->html_input_type, 'http://daseproject.org/category/html_input_type'); $entry->addCategory($this->is_repeatable, 'http://daseproject.org/category/repeatable'); $entry->addCategory($this->is_required, 'http://daseproject.org/category/required'); if (!$this->is_on_list_display) { $entry->addCategory('0', 'http://daseproject.org/category/list_display'); } else { $entry->addCategory('1', 'http://daseproject.org/category/list_display'); } foreach ($this->getItemTypes() as $type) { $entry->addCategory($type->ascii_id, 'http://daseproject.org/category/parent_item_type', $type->name); } //allows posting if (in_array($this->html_input_type, array('checkbox', 'select', 'radio'))) { $entry->addLink($url . '/defined', 'http://daseproject.org/relation/defined_values', 'application/atomcat+xml'); } if ($this->modifier_type) { $entry->addCategory($this->modifier_type, 'http://daseproject.org/category/modifier_type'); } if ($this->modifier_defined_list) { $entry->addCategory($this->modifier_defined_list, 'http://daseproject.org/category/modifier_defined_list'); } foreach ($this->getDefinedValues() as $val) { $entry->addCategory($val, 'http://daseproject.org/category/defined_value'); } $entry->setSummary($this->usage_notes); $entry->addCategory($this->sort_order, 'http://daseproject.org/category/sort_order'); //compat if (is_numeric($this->updated)) { $updated = date(DATE_ATOM, $this->updated); } else { $updated = $this->updated; } $entry->setUpdated($updated); $entry->addAuthor(); return $entry; }