00001 <?php
00002
00007 class oxActions extends oxBase
00008 {
00014 protected $_sClassName = "oxactions";
00015
00019 public function __construct()
00020 {
00021 parent::__construct();
00022 $this->init( "oxactions" );
00023 }
00024
00032 public function addArticle( $sOxId )
00033 {
00034 $oNewGroup = oxNew( 'oxbase' );
00035 $oNewGroup->init( 'oxactions2article' );
00036 $oNewGroup->oxactions2article__oxshopid = new oxField($this->getShopId());
00037 $oNewGroup->oxactions2article__oxactionid = new oxField($this->getId());
00038 $oNewGroup->oxactions2article__oxartid = new oxField($sOxId);
00039 $oNewGroup->oxactions2article__oxsort = new oxField(((int) oxDb::getDb(true)->getOne("select max(oxsort) from oxactions2article where oxactionid = '".$this->getId()."' and oxshopid = '".$this->getShopId()."'") + 1 ));
00040 $oNewGroup->save();
00041 }
00042
00050 public function removeArticle( $sOxId )
00051 {
00052
00053 $oDB = oxDb::getDb(true);
00054 $sDelete = "delete from oxactions2article where oxactionid = '".$this->getId()."' and oxartid = '$sOxId' and oxshopid = '" . $this->getShopId() . "'";
00055 $oDB->execute( $sDelete );
00056 }
00057
00067 public function delete( $sOxId = null )
00068 {
00069 if ( !$sOxId ) {
00070 $sOxId = $this->getId();
00071 }
00072 if ( !$sOxId ) {
00073 return false;
00074 }
00075
00076
00077
00078 $oDB = oxDb::getDb(true);
00079 $sDelete = "delete from oxactions2article where oxactionid = '$sOxId' and oxshopid = '" . $this->getShopId() . "'";
00080 $oDB->execute( $sDelete );
00081
00082 return parent::delete( $sOxId );
00083 }
00084 }