classes/registration/RegistrationType.inc.php

Go to the documentation of this file.
00001 <?php
00002 
00016 //$Id$
00017 
00021 define('REGISTRATION_TYPE_ACCESS_ONLINE', 0x01); 
00022 define('REGISTRATION_TYPE_ACCESS_PHYSICAL', 0x10);
00023 define('REGISTRATION_TYPE_ACCESS_BOTH', 0x11);
00024 
00025 define('REGISTRATION_TYPE_YEAR_OFFSET_FUTURE',  '+10');
00026 
00027 class RegistrationType extends DataObject {
00028 
00029    function RegistrationType() {
00030       parent::DataObject();
00031    }
00032 
00033    //
00034    // Get/set methods
00035    //
00036 
00041    function getTypeId() {
00042       return $this->getData('typeId');
00043    }
00044 
00049    function setTypeId($typeId) {
00050       return $this->setData('typeId', $typeId);
00051    }
00052 
00057    function getSchedConfId() {
00058       return $this->getData('schedConfId');
00059    }
00060 
00065    function setSchedConfId($schedConfId) {
00066       return $this->setData('schedConfId', $schedConfId);
00067    }
00068 
00073    function getRegistrationTypeName() {
00074       return $this->getLocalizedData('name');
00075    }
00076 
00082    function getName($locale) {
00083       return $this->getData('name', $locale);
00084    }
00085 
00091    function setName($name, $locale) {
00092       return $this->setData('name', $name, $locale);
00093    }
00094 
00099    function getCode() {
00100       return $this->getData('code');
00101    }
00102 
00107    function setCode($code) {
00108       return $this->setData('code', $code);
00109    }
00110 
00115    function getRegistrationTypeDescription() {
00116       return $this->getLocalizedData('description');
00117    }
00118 
00124    function getDescription($locale) {
00125       return $this->getData('description', $locale);
00126    }
00127 
00133    function setDescription($description, $locale) {
00134       return $this->setData('description', $description, $locale);
00135    }
00136 
00141    function getCost() {
00142       return $this->getData('cost');
00143    }
00144 
00149    function setCost($cost) {
00150       return $this->setData('cost', $cost);
00151    }
00152 
00157    function getCurrencyCodeAlpha() {
00158       return $this->getData('currencyCodeAlpha');
00159    }
00160 
00165    function setCurrencyCodeAlpha($currencyCodeAlpha) {
00166       return $this->setData('currencyCodeAlpha', $currencyCodeAlpha);
00167    }
00168 
00173    function getCurrencyString() {
00174       $currencyDao =& DAORegistry::getDAO('CurrencyDAO');
00175       $currency =& $currencyDao->getCurrencyByAlphaCode($this->getData('currencyCodeAlpha'));
00176 
00177       if ($currency != null) {
00178          return $currency->getName();
00179       } else {
00180          return 'manager.registrationTypes.currency';
00181       }
00182    }
00183 
00188    function getCurrencyStringShort() {
00189       $currencyDao =& DAORegistry::getDAO('CurrencyDAO');
00190       $currency =& $currencyDao->getCurrencyByAlphaCode($this->getData('currencyCodeAlpha'));
00191 
00192       if ($currency != null) {
00193          return $currency->getCodeAlpha();
00194       } else {
00195          return 'manager.registrationTypes.currency';
00196       }
00197    }
00198 
00203    function getOpeningDate() {
00204       return $this->getData('openingDate');
00205    }
00206 
00211    function setOpeningDate($openingDate) {
00212       return $this->setData('openingDate', $openingDate);
00213    }
00214 
00219    function getClosingDate() {
00220       return $this->getData('closingDate');
00221    }
00222 
00227    function setClosingDate($closingDate) {
00228       return $this->setData('closingDate', $closingDate);
00229    }
00230 
00235    function getExpiryDate() {
00236       return $this->getData('expiryDate');
00237    }
00238 
00243    function setExpiryDate($expiryDate) {
00244       return $this->setData('expiryDate', $expiryDate);
00245    }
00246 
00251    function getDurationYearsMonths() {
00252       $years = (int)floor($this->getData('duration')/12);
00253       $months = (int)fmod($this->getData('duration'), 12);
00254       $yearsMonths = '';
00255 
00256       if ($years == 1) {
00257          $yearsMonths = '1 ' . AppLocale::Translate('manager.registrationTypes.year');
00258       } elseif ($years > 1) {
00259          $yearsMonths = $years . ' ' . AppLocale::Translate('manager.registrationTypes.years');
00260       }
00261 
00262       if ($months == 1) {
00263          $yearsMonths .= $yearsMonths == ''  ? '1 ' : ' 1 ';
00264          $yearsMonths .= AppLocale::Translate('manager.registrationTypes.month'); 
00265       } elseif ($months > 1){
00266          $yearsMonths .= $yearsMonths == ''  ? $months . ' ' : ' ' . $months . ' ';
00267          $yearsMonths .= AppLocale::Translate('manager.registrationTypes.months');
00268       }
00269 
00270       return $yearsMonths;
00271    }
00272 
00277    function getAccess() {
00278       return $this->getData('access');
00279    }
00280 
00285    function setAccess($access) {
00286       return $this->setData('access', $access);
00287    }
00288 
00293    function getAccessString() {
00294       switch ($this->getData('access')) {
00295          case REGISTRATION_TYPE_ACCESS_ONLINE:
00296             return 'manager.registrationTypes.access.online';
00297          case REGISTRATION_TYPE_ACCESS_PHYSICAL:
00298             return 'manager.registrationTypes.access.physical';
00299          case REGISTRATION_TYPE_ACCESS_BOTH:
00300             return 'manager.registrationTypes.access.both';
00301          default:
00302             return 'manager.registrationTypes.access';
00303       }
00304    }
00305 
00310    function getInstitutional() {
00311       return $this->getData('institutional');
00312    }
00313 
00318    function setInstitutional($institutional) {
00319       return $this->setData('institutional', $institutional);
00320    }
00321 
00326    function getMembership() {
00327       return $this->getData('membership');
00328    }
00329 
00334    function setMembership($membership) {
00335       return $this->setData('membership', $membership);
00336    }
00337 
00342    function getPublic() {
00343       return $this->getData('public');
00344    }
00345 
00350    function setPublic($public) {
00351       return $this->setData('public', $public);
00352    }
00353 
00358    function getSequence() {
00359       return $this->getData('sequence');
00360    }
00361 
00366    function setSequence($sequence) {
00367       return $this->setData('sequence', $sequence);
00368    }
00369 
00374    function getSummaryString() {
00375       return $this->getRegistrationTypeName() . ' - ' . $this->getDurationYearsMonths() . ' - ' . sprintf('%.2f', $this->getCost()) . ' ' . $this->getCurrencyStringShort();
00376    }
00377 }
00378 
00379 ?>

Generated on 25 Jul 2013 for Open Conference Systems by  doxygen 1.4.7