Exemple #1
0
 public function postToItemTypes($r)
 {
     $type_ascii_id = Dase_Util::dirify($r->get('name'));
     //note if type_ascii_id MATCHES, we do not create a new type, we grab match
     $type = Dase_DBO_ItemType::findOrCreate($this->db, $this->collection->ascii_id, $type_ascii_id);
     $type->name = $r->get('name');
     $type->description = $r->get('description');
     $type->update();
     $params['msg'] = "{$type->name} created";
     $r->renderRedirect('manage/' . $this->collection->ascii_id . '/item_type/' . $type->ascii_id, $params);
 }
Exemple #2
0
 /** for now, PUT of a collection entry can only add, NOT delete item_types & attributes */
 function update($db, $r)
 {
     $coll = $this->getAsciiId();
     foreach ($this->getAttributes() as $att) {
         Dase_DBO_Attribute::findOrCreate($db, $coll, $att['term']);
     }
     foreach ($this->getItemTypes() as $type) {
         Dase_DBO_ItemType::findOrCreate($db, $coll, $type['term']);
     }
     $coll = Dase_DBO_Collection::get($db, $coll);
     $coll->updateVisibility($this->getVisibility());
     $r->renderResponse('updated collection');
 }