dmBridge PHP API
DMTagForm.php
00001 <?php
00002 #
00003 # dmBridge: a data access framework for CONTENTdm(R)
00004 #
00005 # Copyright © 2009, 2010, 2011 Board of Regents of the Nevada System of Higher
00006 # Education, on behalf of the University of Nevada, Las Vegas
00007 #
00008 
00013 class DMTagForm extends DMAbstractForm {
00014 
00015    protected function init() {
00016       $f = new DMTextField('value');
00017       $f->addAttribute('id', 'dmTagValue');
00018       $f->setMinLength(2);
00019       $f->setMaxLength(30);
00020       $f->setLabel('Tag value');
00021       $this->addField($f);
00022 
00023       $f = new DMHiddenField('fauxtag');
00024       $f->setMaxLength(0);
00025       $f->setRequired(false);
00026       $this->addField($f);
00027 
00028       $f = new DMHiddenField('alias');
00029       $f->setMinLength(2);
00030       $f->setMaxLength(30);
00031       $f->setLabel('Alias');
00032       $this->addField($f);
00033 
00034       $f = new DMHiddenField('ptr');
00035       $f->setType(DMFormFieldType::INTEGER);
00036       $f->setMin(0);
00037       $f->setMax(9999999);
00038       $f->setLabel('Pointer');
00039       $this->addField($f);
00040    }
00041 
00045    public function doAction() {
00046       $col = DMCollectionFactory::getCollection(
00047             $this->getFieldByName('alias')->getValue());
00048       $obj = DMObjectFactory::getObject($col,
00049             $this->getFieldByName('ptr')->getValue());
00050 
00051       $tag = new DMTag();
00052       $tag->setValue($this->getFieldByName('value')->getValue());
00053 
00054       DMDataStoreFactory::getDataStore()->saveTag($tag);
00055    }
00056 
00057 }
 All Data Structures Functions Variables