dmBridge PHP API
DMCPRatingSettingsForm.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 DMCPRatingSettingsForm extends DMAbstractForm {
00014 
00015    protected function init() {
00016       $f = new DMSelectField('enable');
00017       $f->addAttribute('id', 'enable');
00018       $f->addOption(1, 'Enable Rating');
00019       $f->addOption(0, 'Disable Rating');
00020       $f->setLabel('Enable');
00021       $this->addField($f);
00022    }
00023 
00024    protected function loadFromDataStore() {
00025       $this->getFieldByName('enable')->setValue(
00026          (int) DMConfigXML::getInstance()->isRatingEnabled());
00027    }
00028 
00029    public function doAction() {
00030       DMConfigXML::getInstance()->setRatingEnabled(
00031             (bool) $this->getFieldByName('enable')->getValue());
00032       DMConfigXML::getInstance()->save();
00033    }
00034 
00035 }
 All Data Structures Functions Variables