23 $this->
init(
"oxactions");
34 $sQ =
"select max(oxsort) from oxactions2article where oxactionid = " . $oDb->quote($this->
getId()) .
" and oxshopid = '" . $this->
getShopId() .
"'";
35 $iSort = ((int) $oDb->getOne($sQ)) + 1;
37 $oNewGroup =
oxNew(
'oxbase');
38 $oNewGroup->init(
'oxactions2article');
40 $oNewGroup->oxactions2article__oxactionid =
new oxField($this->
getId());
41 $oNewGroup->oxactions2article__oxartid =
new oxField($sOxId);
42 $oNewGroup->oxactions2article__oxsort =
new oxField($iSort);
59 $sDelete =
"delete from oxactions2article where oxactionid = " . $oDb->quote($this->
getId()) .
" and oxartid = " . $oDb->quote($sOxId) .
" and oxshopid = '" . $this->
getShopId() .
"'";
60 $oDb->execute($sDelete);
61 $iRemovedArticles = $oDb->affected_Rows();
64 return (
bool) $iRemovedArticles;
76 public function delete($sOxId = null)
79 $sOxId = $this->
getId();
88 $sDelete =
"delete from oxactions2article where oxactionid = " . $oDb->quote($sOxId) .
" and oxshopid = '" . $this->
getShopId() .
"'";
89 $oDb->execute($sDelete);
102 $iFrom = strtotime($this->oxactions__oxactiveto->value);
104 return $iFrom - $iNow;
115 $iFrom = strtotime($this->oxactions__oxactivefrom->value);
117 return $iFrom - $iNow;
125 $this->oxactions__oxactivefrom =
new oxField(date(
'Y-m-d H:i:s',
oxRegistry::get(
"oxUtilsDate")->getTime()));
126 if ($this->oxactions__oxactiveto->value && ($this->oxactions__oxactiveto->value !=
'0000-00-00 00:00:00')) {
128 $iTo = strtotime($this->oxactions__oxactiveto->value);
130 $this->oxactions__oxactiveto =
new oxField(
'0000-00-00 00:00:00');
142 $this->oxactions__oxactiveto =
new oxField(date(
'Y-m-d H:i:s',
oxRegistry::get(
"oxUtilsDate")->getTime()));
153 if (!($this->oxactions__oxactive->value
154 && $this->oxactions__oxtype->value == 2
155 && $this->oxactions__oxactivefrom->value !=
'0000-00-00 00:00:00'
161 $iFrom = strtotime($this->oxactions__oxactivefrom->value);
162 if ($iNow < $iFrom) {
166 if ($this->oxactions__oxactiveto->value !=
'0000-00-00 00:00:00') {
167 $iTo = strtotime($this->oxactions__oxactiveto->value);
185 return $oUtilsView->parseThroughSmarty($this->oxactions__oxlongdesc->getRawValue(), $this->
getId() . $this->
getLanguage(), null,
true);
196 $sArtId = $oDb->getOne(
197 'select oxobjectid from oxobject2action '
198 .
'where oxactionid=' . $oDb->quote($this->getId())
199 .
' and oxclass="oxarticle"'
203 $oArticle =
oxNew(
'oxarticle');
209 if ($oArticle->load($sArtId)) {
225 if (isset($this->oxactions__oxpic) && $this->oxactions__oxpic->value) {
228 return $this->
getConfig()->getPictureUrl($sPromoDir . $this->oxactions__oxpic->value,
false);
242 if (isset($this->oxactions__oxlink) && $this->oxactions__oxlink->value) {
245 $sUrl = $oUtilsUlr->addShopHost($this->oxactions__oxlink->value);
246 $sUrl = $oUtilsUlr->processUrl($sUrl);
250 $sUrl = $oArticle->getLink();