Open Monograph Press  3.3.0
Market.inc.php
1 <?php
2 
17 class Market extends DataObject {
21  function __construct() {
22  parent::__construct();
23  }
24 
30  return $this->getData('publicationFormatId');
31  }
32 
37  function setPublicationFormatId($publicationFormatId) {
38  return $this->setData('publicationFormatId', $publicationFormatId);
39  }
40 
45  function getCountriesIncluded() {
46  return $this->getData('countriesIncluded');
47  }
48 
53  function setCountriesIncluded($countriesIncluded) {
54  $this->setData('countriesIncluded', array_filter($countriesIncluded, array(&$this, '_removeEmptyElements')));
55  }
56 
61  function getCountriesExcluded() {
62  return $this->getData('countriesExcluded');
63  }
64 
69  function setCountriesExcluded($countriesExcluded) {
70  $this->setData('countriesExcluded', array_filter($countriesExcluded, array(&$this, '_removeEmptyElements')));
71  }
72 
77  function getRegionsIncluded() {
78  return $this->getData('regionsIncluded');
79  }
80 
85  function setRegionsIncluded($regionsIncluded) {
86  $this->setData('regionsIncluded', array_filter($regionsIncluded, array(&$this, '_removeEmptyElements')));
87  }
88 
93  function getRegionsExcluded() {
94  return $this->getData('regionsExcluded');
95  }
96 
101  function setRegionsExcluded($regionsExcluded) {
102  $this->setData('regionsExcluded', array_filter($regionsExcluded, array(&$this, '_removeEmptyElements')));
103  }
104 
109  function getDateRole() {
110  return $this->getData('dateRole');
111  }
112 
117  function setDateRole($dateRole) {
118  $this->setData('dateRole', $dateRole);
119  }
120 
125  function getDateFormat() {
126  return $this->getData('dateFormat');
127  }
128 
133  function setDateFormat($dateFormat) {
134  $this->setData('dateFormat', $dateFormat);
135  }
136 
141  function getDate() {
142  return $this->getData('date');
143  }
144 
149  function setDate($date) {
150  $this->setData('date', $date);
151  }
152 
157  function getCurrencyCode() {
158  return $this->getData('currencyCode');
159  }
160 
165  function setCurrencyCode($currencyCode) {
166  return $this->setData('currencyCode', $currencyCode);
167  }
168 
173  function getPrice() {
174  return $this->getData('price');
175  }
176 
181  function setPrice($price) {
182  return $this->setData('price', $price);
183  }
184 
189  function getDiscount() {
190  return $this->getData('discount');
191  }
192 
197  function setDiscount($discount) {
198  return $this->setData('discount', $discount);
199  }
200 
201 
206  function getPriceTypeCode() {
207  return $this->getData('priceTypeCode');
208  }
209 
214  function setPriceTypeCode($priceTypeCode) {
215  return $this->setData('priceTypeCode', $priceTypeCode);
216  }
217 
222  function getTaxRateCode() {
223  return $this->getData('taxRateCode');
224  }
225 
230  function setTaxRateCode($taxRateCode) {
231  return $this->setData('taxRateCode', $taxRateCode);
232  }
233 
238  function getTaxTypeCode() {
239  return $this->getData('taxTypeCode');
240  }
241 
246  function setTaxTypeCode($taxTypeCode) {
247  return $this->setData('taxTypeCode', $taxTypeCode);
248  }
249 
254  function getAgentId() {
255  return $this->getData('agentId');
256  }
257 
262  function setAgentId($agentId) {
263  return $this->setData('agentId', $agentId);
264  }
265 
270  function getSupplierId() {
271  return $this->getData('supplierId');
272  }
273 
278  function setSupplierId($supplierId) {
279  return $this->setData('supplierId', $supplierId);
280  }
281 
287  $territories = __('grid.catalogEntry.included');
288  $territories .= ': ' . join(', ', array_merge($this->getCountriesIncluded(), $this->getRegionsIncluded()));
289  $territories .= ', ' . __('grid.catalogEntry.excluded');
290  $territories .= ': ' . join(', ', array_merge($this->getCountriesExcluded(), $this->getRegionsExcluded()));
291 
292  return $territories;
293  }
294 
300  $representativeDao = DAORegistry::getDAO('RepresentativeDAO'); /* @var $representativeDao RepresentativeDAO */
301  $agent = $representativeDao->getById($this->getAgentId());
302  $supplier = $representativeDao->getById($this->getSupplierId());
303 
304  $returner = '';
305 
306  if (isset($agent) && isset($supplier)) {
307  $returner = join(', ', array($agent->getName(), $supplier->getName()));
308  } else if (isset($agent) && !isset($supplier)) {
309  $returner = $agent->getName();
310  } else if (isset($supplier)) {
311  $returner = $supplier->getName();
312  }
313 
314  return $returner;
315  }
316 
324  function _removeEmptyElements($value) {
325  return (trim($value) != '') ? true : false;
326  }
327 }
328 
329 
Market\setDateFormat
setDateFormat($dateFormat)
Definition: Market.inc.php:133
DataObject\getData
& getData($key, $locale=null)
Definition: DataObject.inc.php:100
Market\setPublicationFormatId
setPublicationFormatId($publicationFormatId)
Definition: Market.inc.php:37
Market\getAgentId
getAgentId()
Definition: Market.inc.php:254
Market\setAgentId
setAgentId($agentId)
Definition: Market.inc.php:262
Market\setSupplierId
setSupplierId($supplierId)
Definition: Market.inc.php:278
Market\getTaxRateCode
getTaxRateCode()
Definition: Market.inc.php:222
Market\getTaxTypeCode
getTaxTypeCode()
Definition: Market.inc.php:238
Market\getCountriesExcluded
getCountriesExcluded()
Definition: Market.inc.php:61
DataObject
Any class with an associated DAO should extend this class.
Definition: DataObject.inc.php:18
Market\getPublicationFormatId
getPublicationFormatId()
Definition: Market.inc.php:29
DAORegistry\getDAO
static & getDAO($name, $dbconn=null)
Definition: DAORegistry.inc.php:57
Market\setRegionsExcluded
setRegionsExcluded($regionsExcluded)
Definition: Market.inc.php:101
Market\getRegionsIncluded
getRegionsIncluded()
Definition: Market.inc.php:77
Market\setDateRole
setDateRole($dateRole)
Definition: Market.inc.php:117
Market\setPrice
setPrice($price)
Definition: Market.inc.php:181
Market\setCountriesIncluded
setCountriesIncluded($countriesIncluded)
Definition: Market.inc.php:53
Market\getDiscount
getDiscount()
Definition: Market.inc.php:189
Market\setDate
setDate($date)
Definition: Market.inc.php:149
Market\setTaxRateCode
setTaxRateCode($taxRateCode)
Definition: Market.inc.php:230
Market\getRegionsExcluded
getRegionsExcluded()
Definition: Market.inc.php:93
Market\getDateFormat
getDateFormat()
Definition: Market.inc.php:125
Market\getDate
getDate()
Definition: Market.inc.php:141
Market\setPriceTypeCode
setPriceTypeCode($priceTypeCode)
Definition: Market.inc.php:214
Market
Basic class describing a Market composite type (used on the ONIX templates for publication formats)
Definition: Market.inc.php:17
Market\getCountriesIncluded
getCountriesIncluded()
Definition: Market.inc.php:45
Market\getPrice
getPrice()
Definition: Market.inc.php:173
Market\getSupplierId
getSupplierId()
Definition: Market.inc.php:270
Market\getTerritoriesAsString
getTerritoriesAsString()
Definition: Market.inc.php:286
Market\_removeEmptyElements
_removeEmptyElements($value)
Definition: Market.inc.php:324
Market\setRegionsIncluded
setRegionsIncluded($regionsIncluded)
Definition: Market.inc.php:85
Market\setDiscount
setDiscount($discount)
Definition: Market.inc.php:197
Market\__construct
__construct()
Definition: Market.inc.php:21
Market\getPriceTypeCode
getPriceTypeCode()
Definition: Market.inc.php:206
Market\setTaxTypeCode
setTaxTypeCode($taxTypeCode)
Definition: Market.inc.php:246
Market\getDateRole
getDateRole()
Definition: Market.inc.php:109
Market\getCurrencyCode
getCurrencyCode()
Definition: Market.inc.php:157
Market\getAssignedRepresentativeNames
getAssignedRepresentativeNames()
Definition: Market.inc.php:299
DataObject\setData
setData($key, $value, $locale=null)
Definition: DataObject.inc.php:132
Market\setCountriesExcluded
setCountriesExcluded($countriesExcluded)
Definition: Market.inc.php:69
Market\setCurrencyCode
setCurrencyCode($currencyCode)
Definition: Market.inc.php:165