22 $this->
init(
"oxactions" );
35 $sQ =
"select max(oxsort) from oxactions2article where oxactionid = ".$oDb->quote( $this->
getId() ).
" and oxshopid = '".$this->
getShopId().
"'";
36 $iSort = ( (int) $oDb->getOne( $sQ ) ) + 1;
38 $oNewGroup =
oxNew(
'oxbase' );
39 $oNewGroup->init(
'oxactions2article' );
41 $oNewGroup->oxactions2article__oxactionid =
new oxField( $this->
getId() );
42 $oNewGroup->oxactions2article__oxartid =
new oxField( $sOxId );
43 $oNewGroup->oxactions2article__oxsort =
new oxField( $iSort );
60 $sDelete =
"delete from oxactions2article where oxactionid = ".$oDb->quote( $this->
getId() ).
" and oxartid = ".$oDb->quote($sOxId).
" and oxshopid = '" . $this->
getShopId() .
"'";
61 $oDb->execute( $sDelete );
64 return (
bool ) $oDb->affected_Rows();
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);
114 $iFrom = strtotime($this->oxactions__oxactivefrom->value);
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');
144 $this->oxactions__oxactiveto =
new oxField(date(
'Y-m-d H:i:s',
oxRegistry::get(
"oxUtilsDate")->getTime() ));
155 if (!($this->oxactions__oxactive->value
156 && $this->oxactions__oxtype->value == 2
157 && $this->oxactions__oxactivefrom->value !=
'0000-00-00 00:00:00'
162 $iFrom = strtotime($this->oxactions__oxactivefrom->value);
163 if ($iNow < $iFrom) {
167 if ($this->oxactions__oxactiveto->value !=
'0000-00-00 00:00:00') {
168 $iTo = strtotime($this->oxactions__oxactiveto->value);
184 return oxRegistry::get(
"oxUtilsView")->parseThroughSmarty( $this->oxactions__oxlongdesc->getRawValue(), $this->
getId().$this->getLanguage(), null, true );
195 $sArtId = $oDb->getOne(
196 'select oxobjectid from oxobject2action '
197 .
'where oxactionid='.$oDb->quote($this->getId())
198 .
' and oxclass="oxarticle"'
202 $oArticle =
oxNew(
'oxarticle' );
208 if ( $oArticle->load($sArtId) ) {
223 if ( isset( $this->oxactions__oxpic ) && $this->oxactions__oxpic->value ) {
225 return $this->
getConfig()->getPictureUrl( $sPromoDir.$this->oxactions__oxpic->value,
false );
237 if ( isset( $this->oxactions__oxlink ) && $this->oxactions__oxlink->value ) {
238 $sUrl = $this->oxactions__oxlink->value ;
239 if ( !preg_match(
"#^https?://#i", $sUrl) ) {
240 $sUrl = $this->
getConfig()->getShopUrl() . $sUrl ;
246 return $oArticle->getLink();