Go to the documentation of this file.00001 <?php
00002
00007 class GuestbookEntry extends GuestBook
00008 {
00013 protected $_sThisTemplate = 'page/guestbook/guestbookentry.tpl';
00014
00019 protected $_sGbFormId = null;
00020
00028 public function saveEntry()
00029 {
00030 $sReviewText = trim( ( string ) oxConfig::getParameter( 'rvw_txt', true ) );
00031 $sShopId = $this->getConfig()->getShopId();
00032 $sUserId = oxSession::getVar( 'usr' );
00033
00034
00035 if ( !$sUserId ) {
00036 oxRegistry::get("oxUtilsView")->addErrorToDisplay( 'EXCEPTION_GUESTBOOKENTRY_ERRLOGGINTOWRITEENTRY' );
00037
00038 return;
00039 }
00040
00041 if ( !$sShopId ) {
00042 oxRegistry::get("oxUtilsView")->addErrorToDisplay( 'EXCEPTION_GUESTBOOKENTRY_ERRUNDEFINEDSHOP' );
00043 return 'guestbookentry';
00044 }
00045
00046
00047 if ( '' == $sReviewText ) {
00048 oxRegistry::get("oxUtilsView")->addErrorToDisplay( 'EXCEPTION_GUESTBOOKENTRY_ERRREVIEWCONTAINSNOTEXT' );
00049 return 'guestbookentry';
00050 }
00051
00052
00053 $oEntrie = oxNew( 'oxgbentry' );
00054 if ( $oEntrie->floodProtection( $sShopId, $sUserId ) ) {
00055 oxRegistry::get("oxUtilsView")->addErrorToDisplay( 'EXCEPTION_GUESTBOOKENTRY_ERRMAXIMUMNOMBEREXCEEDED' );
00056 return 'guestbookentry';
00057 }
00058
00059
00060 if ( $this->canAcceptFormData() ) {
00061
00062 $oEntry = oxNew( 'oxgbentry' );
00063 $oEntry->oxgbentries__oxshopid = new oxField($sShopId);
00064 $oEntry->oxgbentries__oxuserid = new oxField($sUserId);
00065 $oEntry->oxgbentries__oxcontent = new oxField($sReviewText);
00066 $oEntry->save();
00067 }
00068
00069 return 'guestbook';
00070 }
00071 }