00001 <?php
00002
00016 class SocialMedia extends DataObject {
00020 function SocialMedia() {
00021 parent::DataObject();
00022 }
00023
00028 function getPressId() {
00029 return $this->getData('pressId');
00030 }
00031
00036 function setPressId($pressId) {
00037 return $this->setData('pressId', $pressId);
00038 }
00039
00044 function getCode() {
00045 return $this->getData('code');
00046 }
00047
00052 function setCode($code) {
00053 return $this->setData('code', $code);
00054 }
00055
00060 function getIncludeInCatalog() {
00061 return $this->getData('includeInCatalog');
00062 }
00063
00068 function setIncludeInCatalog($includeInCatalog) {
00069 return $this->setData('includeInCatalog', $includeInCatalog);
00070 }
00071
00076 function getLocalizedPlatform() {
00077 return $this->getLocalizedData('platform');
00078 }
00079
00085 function getPlatform($locale) {
00086 return $this->getData('platform', $locale);
00087 }
00088
00094 function setPlatform($platform, $locale) {
00095 return $this->setData('platform', $platform, $locale);
00096 }
00097
00103 function replaceCodeVars($publishedMonograph = null) {
00104
00105 $application =& Application::getApplication();
00106 $request =& $application->getRequest();
00107 $router =& $request->getRouter();
00108 $press =& $request->getPress();
00109
00110 $code = $this->getCode();
00111
00112 $codeVariables = array(
00113 'pressUrl' => $router->url($request, null, 'index'),
00114 'pressName' => $press->getLocalizedName(),
00115 );
00116
00117 if (isset($publishedMonograph)) {
00118 $codeVariables = array_merge($codeVariables, array(
00119 'bookCatalogUrl' => $router->url($request, null, 'catalog', 'book', $publishedMonograph->getId()),
00120 'bookTitle' => $publishedMonograph->getLocalizedTitle(),
00121 ));
00122 }
00123
00124
00125 foreach ($codeVariables as $key => $value) {
00126 if (!is_object($value)) {
00127 $code = str_replace('{$' . $key . '}', $value, $code);
00128 }
00129 }
00130
00131 $this->setCode($code);
00132 }
00133 }
00134
00135 ?>