00001 <?php
00002
00016
00017 define('SPOTLIGHT_TYPE_BOOK', 3);
00018 define('SPOTLIGHT_TYPE_SERIES', 4);
00019 define('SPOTLIGHT_TYPE_AUTHOR', 5);
00020 define('MAX_SPOTLIGHTS_VISIBLE', 3);
00021
00022 class Spotlight extends DataObject {
00026 function Spotlight() {
00027 parent::DataObject();
00028 }
00029
00030
00031
00032
00033
00038 function getAssocId() {
00039 return $this->getData('assocId');
00040 }
00041
00046 function setAssocId($assocId) {
00047 return $this->setData('assocId', $assocId);
00048 }
00049
00054 function getAssocType() {
00055 return $this->getData('assocType');
00056 }
00057
00062 function setAssocType($assocType) {
00063 return $this->setData('assocType', $assocType);
00064 }
00065
00070 function getPressId() {
00071 return $this->getData('pressId');
00072 }
00073
00078 function setPressId($pressId) {
00079 return $this->setData('pressId', $pressId);
00080 }
00081
00086 function getLocalizedTitle() {
00087 return $this->getLocalizedData('title');
00088 }
00089
00095 function getTitle($locale) {
00096 return $this->getData('title', $locale);
00097 }
00098
00104 function setTitle($title, $locale) {
00105 return $this->setData('title', $title, $locale);
00106 }
00107
00112 function getLocalizedDescription() {
00113 return $this->getLocalizedData('description');
00114 }
00115
00121 function getDescription($locale) {
00122 return $this->getData('description', $locale);
00123 }
00124
00130 function setDescription($description, $locale) {
00131 return $this->setData('description', $description, $locale);
00132 }
00133
00138 function getLocalizedType() {
00139 $spotlightTypes = array(
00140 SPOTLIGHT_TYPE_BOOK => __('grid.content.spotlights.form.type.book'),
00141 SPOTLIGHT_TYPE_SERIES => __('series.series'),
00142 SPOTLIGHT_TYPE_AUTHOR => __('user.role.author')
00143 );
00144
00145 return $spotlightTypes[$this->getAssocType()];
00146 }
00147
00152 function getSpotlightItem() {
00153 switch ($this->getAssocType()) {
00154 case SPOTLIGHT_TYPE_BOOK:
00155 $publishedMonographDao =& DAORegistry::getDAO('PublishedMonographDAO');
00156 return $publishedMonographDao->getById($this->getAssocId(), $this->getPressId());
00157 break;
00158 case SPOTLIGHT_TYPE_SERIES:
00159 $seriesDao =& DAORegistry::getDAO('SeriesDAO');
00160 return $seriesDao->getById($this->getAssocId(), $this->getPressId());
00161 break;
00162 case SPOTLIGHT_TYPE_AUTHOR:
00163 $authorDao =& DAORegistry::getDAO('AuthorDAO');
00164 return $authorDao->getAuthor($this->getAssocId());
00165 break;
00166 default:
00167 assert(false);
00168 break;
00169 }
00170 }
00171 }
00172
00173 ?>