public function getItemsByAttAsAtom($attribute_ascii_id, $app_root) { $feed = $this->getBaseAtomFeed($app_root); $feed->setFeedType('items'); $att = Dase_DBO_Attribute::get($this->db, $this->ascii_id, $attribute_ascii_id); $vals = new Dase_DBO_Value($this->db); $vals->attribute_id = $att->id; foreach ($vals->find() as $val) { $item = new Dase_DBO_Item($this->db); $item->load($val->item_id); //use cached ??? $entry = $item->injectAtomEntryData($feed->addEntry(), $app_root); $entry->setSummary($item->getValue($attribute_ascii_id)); } return $feed->asXML($app_root); }
print "script needs work to delete item_atom and item_json and SOLR\n"; $dbh = $db->getDbh(); $sql = "SELECT count(value.id) from value,item WHERE item.collection_id = {$c->id} and value.item_id = item.id"; $sth = $dbh->prepare($sql); $sth->execute(); $count = $sth->fetchColumn(); print "values: {$count}\n"; if ('delete' == $action) { print "values\n"; $i = 0; $sql = "SELECT value.id from value,item WHERE item.collection_id = {$c->id} and value.item_id = item.id"; $sth = $dbh->prepare($sql); $sth->execute(); while ($id = $sth->fetchColumn()) { $i++; $v = new Dase_DBO_Value($db); $v->load($id); print "{$i} of {$count} deleting -- {$v->value_text}\n"; $v->delete(); } } if ('count' == $action) { $sql = "SELECT count(v.id) from defined_value v, attribute a\n\t\tWHERE v.attribute_id = a.id \n\t\tAND\ta.collection_id = {$c->id}\n\t\t"; $sth = $dbh->prepare($sql); $sth->execute(); $count = $sth->fetchColumn(); print "defined: {$count}\n"; } elseif ('delete' == $action) { print "defined values\n"; $sql = "SELECT v.id from defined_value v, attribute a\n\t\tWHERE v.attribute_id = a.id \n\t\tAND\ta.collection_id = {$c->id}\n\t\t"; $sth = $dbh->prepare($sql);
function getValues() { $vals = new Dase_DBO_Value($this->db); $vals->attribute_id = $this->id; return $vals->findAll(1); }
function deleteAdminValues() { $a = new Dase_DBO_Attribute($this->db); $a->collection_id = 0; foreach ($a->find() as $aa) { $v = new Dase_DBO_Value($this->db); $v->item_id = $this->id; $v->attribute_id = $aa->id; foreach ($v->find() as $doomed) { $doomed->delete(); } } return "deleted admin metadata for " . $this->serial_number . "\n"; }
public function getMetadataValue($r) { //$user = $r->getUser(); $user = $r->getUser('http'); if (!$user->can('read', $this->item)) { $r->renderError(401, 'cannot read metadata'); } if (!$r->has('value_id')) { $r->renderError(400, 'missing identifier'); } $value = new Dase_DBO_Value($this->db); $value->load($r->get('value_id')); if ($value) { $r->renderResponse($value->value_text); } else { $r->renderError(404); } }