function getBlockCode_Comments()
 {
     bx_store_import('Cmts');
     $o = new BxStoreCmts('bx_store', (int) $this->aDataEntry['id']);
     if (!$o->isEnabled()) {
         return '';
     }
     return $o->getCommentsFirst();
 }
 function getBlockCode_LatestFeaturedProduct()
 {
     $aDataEntry = $this->oDb->getLatestFeaturedItem();
     if (!$aDataEntry) {
         return false;
     }
     $aAuthor = getProfileInfo($aDataEntry['author_id']);
     $sImageUrl = '';
     $sImageTitle = '';
     $a = array('ID' => $aDataEntry['author_id'], 'Avatar' => $aDataEntry['thumb']);
     $aImage = BxDolService::call('photos', 'get_image', array($a, 'file'), 'Search');
     bx_store_import('Voting');
     $oRating = new BxStoreVoting('bx_store', $aDataEntry['id']);
     $aVars = array('bx_if:image' => array('condition' => !$aImage['no_image'] && $aImage['file'], 'content' => array('image_url' => !$aImage['no_image'] && $aImage['file'] ? $aImage['file'] : '', 'image_title' => !$aImage['no_image'] && $aImage['title'] ? $aImage['title'] : '', 'product_url' => BX_DOL_URL_ROOT . $this->oConfig->getBaseUri() . 'view/' . $aDataEntry['uri'])), 'product_url' => BX_DOL_URL_ROOT . $this->oConfig->getBaseUri() . 'view/' . $aDataEntry['uri'], 'product_title' => $aDataEntry['title'], 'author_title' => _t('_From'), 'author_username' => getNickName($aAuthor['ID']), 'author_url' => getProfileLink($aAuthor['ID']), 'rating' => $oRating->isEnabled() ? $oRating->getJustVotingElement(true, $aDataEntry['id']) : '', 'created' => defineTimeInterval($aDataEntry['created']), 'price_range' => $this->oMain->_formatPriceRange($aDataEntry));
     return $this->oTemplate->parseHtmlByName('latest_featured_product', $aVars);
 }
 function getBlockCode_Browse()
 {
     bx_store_import('SearchResult');
     $o = new BxStoreSearchResult('user', process_db_input($this->_aProfile['NickName'], BX_TAGS_NO_ACTION, BX_SLASHES_NO_ACTION));
     $o->aCurrent['rss'] = 0;
     $o->sBrowseUrl = "browse/my";
     $o->aCurrent['title'] = _t('_bx_store_page_title_my_store');
     if ($o->isError) {
         return DesignBoxContent(_t('_bx_store_block_users_products'), MsgBox(_t('_Empty')), 1);
     }
     if ($s = $o->processing()) {
         $this->_oTemplate->addCss(array('unit.css', 'twig.css', 'main.css'));
         return $s;
     } else {
         return DesignBoxContent(_t('_bx_store_block_users_products'), MsgBox(_t('_Empty')), 1);
     }
 }
Exemple #4
0
 function blockFields(&$aDataEntry)
 {
     $sRet = '<table class="bx_store_fields">';
     bx_store_import('FormAdd');
     $oForm = new BxStoreFormAdd($GLOBALS['oBxStoreModule'], getLoggedId());
     foreach ($oForm->aInputs as $k => $a) {
         if (!isset($a['display'])) {
             continue;
         }
         $sRet .= '<tr><td class="bx_store_field_name bx-def-font-grayed bx-def-padding-sec-right" valign="top">' . $a['caption'] . '</td><td class="bx_store_field_value">';
         if (is_string($a['display']) && is_callable(array($this, $a['display']))) {
             $sRet .= call_user_func_array(array($this, $a['display']), array($aDataEntry[$k]));
         } else {
             $sRet .= $aDataEntry[$k];
         }
         $sRet .= '</td></tr>';
     }
     $sRet .= '</table>';
     return $sRet;
 }
 function __construct($sMode = '', $sValue = '', $sValue2 = '', $sValue3 = '')
 {
     switch ($sMode) {
         case 'pending':
             if (false !== bx_get('bx_store_filter')) {
                 $this->aCurrent['restriction']['keyword'] = array('value' => process_db_input(bx_get('bx_store_filter'), BX_TAGS_STRIP), 'field' => '', 'operator' => 'against');
             }
             $this->aCurrent['restriction']['activeStatus']['value'] = 'pending';
             $this->sBrowseUrl = "administration";
             $this->aCurrent['title'] = _t('_bx_store_page_title_pending_approval');
             unset($this->aCurrent['rss']);
             break;
         case 'my_pending':
             $oMain = $this->getMain();
             $this->aCurrent['restriction']['owner']['value'] = $oMain->_iProfileId;
             $this->aCurrent['restriction']['activeStatus']['value'] = 'pending';
             $this->sBrowseUrl = "browse/user/" . getNickName($oMain->_iProfileId);
             $this->aCurrent['title'] = _t('_bx_store_page_title_pending_approval');
             unset($this->aCurrent['rss']);
             break;
         case 'search':
             if ($sValue) {
                 $this->aCurrent['restriction']['keyword'] = array('value' => $sValue, 'field' => '', 'operator' => 'against');
             }
             if ($sValue2) {
                 $this->aCurrent['join']['category'] = array('type' => 'inner', 'table' => 'sys_categories', 'mainField' => 'id', 'onField' => 'ID', 'joinFields' => '');
                 $this->aCurrent['restriction']['category_type']['value'] = $this->aCurrent['name'];
                 $this->aCurrent['restriction']['category']['value'] = $sValue2;
                 if (is_array($sValue2)) {
                     $this->aCurrent['restriction']['category']['operator'] = 'in';
                 }
             }
             $sValue = $GLOBALS['MySQL']->unescape($sValue);
             $sValue2 = $GLOBALS['MySQL']->unescape($sValue2);
             $this->sBrowseUrl = "search/{$sValue}/" . (is_array($sValue2) ? implode(',', $sValue2) : $sValue2);
             $this->aCurrent['title'] = _t('_bx_store_page_title_search_results') . ' ' . (is_array($sValue2) ? implode(', ', $sValue2) : $sValue2) . ' ' . $sValue;
             unset($this->aCurrent['rss']);
             break;
         case 'user':
             $iProfileId = $GLOBALS['oBxStoreModule']->_oDb->getProfileIdByNickName($sValue, false);
             $GLOBALS['oTopMenu']->setCurrentProfileID($iProfileId);
             // select profile subtab, instead of module tab
             if (!$iProfileId) {
                 $this->isError = true;
             } else {
                 $this->aCurrent['restriction']['owner']['value'] = $iProfileId;
             }
             $sValue = $GLOBALS['MySQL']->unescape($sValue);
             $this->sBrowseUrl = "browse/user/{$sValue}";
             $iProfileId = getID($sValue);
             $this->aCurrent['title'] = _t('_bx_store_page_title_browse_by_author', $iProfileId ? getNickName($iProfileId) : $sValue);
             if (bx_get('rss')) {
                 $aData = getProfileInfo($iProfileId);
                 if ($aData['Avatar']) {
                     $a = array('ID' => $aData['author_id'], 'Avatar' => $aData['thumb']);
                     $aImage = BxDolService::call('photos', 'get_image', array($a, 'browse'), 'Search');
                     if (!$aImage['no_image']) {
                         $this->aCurrent['rss']['image'] = $aImage['file'];
                     }
                 }
             }
             break;
         case 'admin':
             $this->aCurrent['restriction']['owner']['value'] = 0;
             $this->sBrowseUrl = "browse/admin";
             $this->aCurrent['title'] = _t('_bx_store_page_title_admin_products');
             break;
         case 'category':
             $this->aCurrent['join']['category'] = array('type' => 'inner', 'table' => 'sys_categories', 'mainField' => 'id', 'onField' => 'ID', 'joinFields' => '');
             $this->aCurrent['restriction']['category_type']['value'] = $this->aCurrent['name'];
             $this->aCurrent['restriction']['category']['value'] = $sValue;
             $sValue = $GLOBALS['MySQL']->unescape($sValue);
             $this->sBrowseUrl = "browse/category/" . title2uri($sValue);
             $this->aCurrent['title'] = _t('_bx_store_page_title_browse_by_category', $sValue);
             break;
         case 'tag':
             $this->aCurrent['restriction']['tag']['value'] = $sValue;
             $sValue = $GLOBALS['MySQL']->unescape($sValue);
             $this->sBrowseUrl = "browse/tag/" . title2uri($sValue);
             $this->aCurrent['title'] = _t('_bx_store_page_title_browse_by_tag', $sValue);
             break;
         case 'free':
             $this->aCurrent['restriction']['price'] = array('value' => 'Free', 'field' => 'price_range', 'operator' => '=');
             $this->sBrowseUrl = "browse/free";
             $this->aCurrent['title'] = _t('_bx_store_page_title_browse_free_products') . ' ' . $sValue;
             break;
         case 'recent':
             $this->sBrowseUrl = 'browse/recent';
             $this->aCurrent['title'] = _t('_bx_store_page_title_browse_recent');
             break;
         case 'top':
             $this->sBrowseUrl = 'browse/top';
             $this->aCurrent['sorting'] = 'top';
             $this->aCurrent['title'] = _t('_bx_store_page_title_browse_top_rated');
             break;
         case 'popular':
             $this->sBrowseUrl = 'browse/popular';
             $this->aCurrent['sorting'] = 'popular';
             $this->aCurrent['title'] = _t('_bx_store_page_title_browse_popular');
             break;
         case 'featured':
             $this->aCurrent['restriction']['featured'] = array('value' => 1, 'field' => 'featured', 'operator' => '=');
             $this->sBrowseUrl = 'browse/featured';
             $this->aCurrent['title'] = _t('_bx_store_page_title_browse_featured');
             break;
         case 'calendar':
             $this->aCurrent['restriction']['calendar-min'] = array('value' => "UNIX_TIMESTAMP('{$sValue}-{$sValue2}-{$sValue3} 00:00:00')", 'field' => 'created', 'operator' => '>=', 'no_quote_value' => true);
             $this->aCurrent['restriction']['calendar-max'] = array('value' => "UNIX_TIMESTAMP('{$sValue}-{$sValue2}-{$sValue3} 23:59:59')", 'field' => 'created', 'operator' => '<=', 'no_quote_value' => true);
             $this->sEventsBrowseUrl = "browse/calendar/{$sValue}/{$sValue2}/{$sValue3}";
             $this->aCurrent['title'] = _t('_bx_store_page_title_browse_by_day', getLocaleDate(strtotime("{$sValue}-{$sValue2}-{$sValue3}"), BX_DOL_LOCALE_DATE_SHORT));
             break;
         case '':
             $this->sBrowseUrl = 'browse/';
             $this->aCurrent['title'] = _t('_bx_store');
             unset($this->aCurrent['rss']);
             break;
         default:
             $this->isError = true;
     }
     $oMain = $this->getMain();
     $this->aCurrent['paginate']['perPage'] = $oMain->_oDb->getParam('bx_store_perpage_browse');
     if (isset($this->aCurrent['rss'])) {
         $this->aCurrent['rss']['link'] = BX_DOL_URL_ROOT . $oMain->_oConfig->getBaseUri() . $this->sBrowseUrl;
     }
     if (bx_get('rss')) {
         $this->aCurrent['ownFields'][] = 'desc';
         $this->aCurrent['ownFields'][] = 'created';
         $this->aCurrent['paginate']['perPage'] = $oMain->_oDb->getParam('bx_store_max_rss_num');
     }
     bx_store_import('Voting', $this->getModuleArray());
     $oVotingView = new BxStoreVoting('bx_store', 0);
     $this->oVotingView = $oVotingView->isEnabled() ? $oVotingView : null;
     $this->sFilterName = 'bx_store_filter';
     parent::__construct();
 }
*                              -------------------
*     begin                : Mon Mar 23 2006
*     copyright            : (C) 2007 BoonEx Group
*     website              : http://www.boonex.com
* This file is part of Dolphin - Smart Community Builder
*
* Dolphin is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the
* License, or  any later version.
*
* Dolphin is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
* You should have received a copy of the GNU General Public License along with Dolphin,
* see license.txt file; if not, write to marketing@boonex.com
***************************************************************************/
bx_store_import('FormAdd');
class BxStoreFormEdit extends BxStoreFormAdd
{
    function BxStoreFormEdit($oMain, $iProfileId, $iEntryId, &$aDataEntry)
    {
        parent::BxStoreFormAdd($oMain, $iProfileId, false, $iEntryId, $aDataEntry['thumb']);
        $aFormInputsId = array('id' => array('type' => 'hidden', 'name' => 'id', 'value' => $iEntryId));
        bx_import('BxDolCategories');
        $oCategories = new BxDolCategories();
        $oCategories->getTagObjectConfig();
        $this->aInputs['categories'] = $oCategories->getGroupChooser('bx_store', (int) $iProfileId, true, $aDataEntry['categories']);
        $this->aInputs = array_merge($this->aInputs, $aFormInputsId);
    }
}