00001 <?php
00002
00006 class Wishlist extends oxUBase
00007 {
00008
00013 protected $_sThisTemplate = 'wishlist.tpl';
00014
00020 protected $_oWishUser = null;
00021
00027 protected $_oWishList = null;
00028
00034 protected $_sSearchParam = null;
00035
00041 protected $_oWishListUsers = false;
00042
00056 public function render()
00057 {
00058 parent::render();
00059
00060
00061 $this->_loadActions();
00062
00063
00064 $this->_aViewData['wishuser'] = $this->getWishUser();
00065 $this->_aViewData['wishlist'] = $this->getWishList();
00066
00067 $this->_aViewData['wish_result'] = $this->getWishListUsers();
00068 $this->_aViewData['search'] = $this->getWishListSearchParam();
00069 return $this->_sThisTemplate;
00070 }
00071
00072
00078 public function getWishUser()
00079 {
00080
00081 if ( $this->_oWishUser === null) {
00082 $this->_oWishUser = false;
00083
00084 if ( $sUserID = oxConfig::getParameter( 'wishid' ) ) {
00085 $oUser = oxNew( 'oxuser' );
00086 if ( $oUser->load( $sUserID ) ) {
00087
00088
00089 $this->_oWishUser = $oUser;
00090
00091
00092 oxSession::setVar( 'wishid', $sUserID );
00093 }
00094 }
00095 }
00096 return $this->_oWishUser;
00097 }
00098
00104 public function getWishList()
00105 {
00106 if ( $this->_oWishList === null) {
00107 $this->_oWishList = false;
00108
00109
00110 if ( $oUser = $this->getWishUser() ) {
00111 $this->_oWishList = $oUser->getBasket( 'wishlist' )->getArticles();
00112 }
00113 }
00114 return $this->_oWishList;
00115 }
00116
00126 public function searchForWishList()
00127 {
00128 if ( $sSearch = oxConfig::getParameter( 'search' ) ) {
00129
00130
00131 $oUserList = oxNew( 'oxuserlist' );
00132 $oUserList->loadWishlistUsers( $sSearch );
00133 if ( $oUserList->count() ) {
00134 $this->_oWishListUsers = $oUserList;
00135 }
00136 $this->_sSearchParam = $sSearch;
00137 }
00138 }
00139
00146 public function getWishListUsers()
00147 {
00148 return $this->_oWishListUsers;
00149 }
00150
00156 public function getWishListSearchParam()
00157 {
00158 return $this->_sSearchParam;
00159 }
00160 }