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