Exemplo n.º 1
0
 /**
  * SERVICE METHODS
  * 
  * Get View block for a separate page. Will return a block with "Empty" message if nothing found.
  */
 public function serviceGetBlockView($sType = '', $iStart = -1, $iPerPage = -1, $aModules = array())
 {
     $aBrowseTypes = array(BX_BASE_MOD_NTFS_TYPE_CONNECTIONS, BX_BASE_MOD_NTFS_TYPE_OBJECT_OWNER);
     if (empty($sType)) {
         $mType = bx_get('type');
         if ($mType !== false && in_array($mType, $aBrowseTypes)) {
             $sType = $mType;
         }
         if (empty($sType)) {
             $sType = BX_NTFS_TYPE_DEFAULT;
         }
     }
     $iOwnerId = $this->getUserId();
     if (!$iOwnerId) {
         return array('content' => MsgBox(_t('_bx_ntfs_txt_msg_no_results')));
     }
     $aParams = $this->_prepareParams($sType, $iOwnerId, $iStart, $iPerPage, $aModules);
     $sContent = $this->_oTemplate->getViewBlock($aParams);
     $aParams['browse'] = 'first';
     $aEvent = $this->_oDb->getEvents($aParams);
     if (!empty($aEvent)) {
         $this->_oDb->markAsRead($iOwnerId, $aEvent['id']);
     }
     $sModule = $this->_oConfig->getName();
     $sJsObject = $this->_oConfig->getJsObject('view');
     $aMenu = array();
     foreach ($aBrowseTypes as $sBrowseType) {
         $aMenu[] = array('id' => $sModule . '-' . $sBrowseType, 'name' => $sModule . '-' . $sBrowseType, 'class' => '', 'title' => '_bx_ntfs_menu_item_title_' . $sBrowseType, 'target' => '_self', 'onclick' => 'javascript:' . $sJsObject . '.changeType(this, \'' . $sBrowseType . '\');');
     }
     $oMenu = new BxTemplMenuInteractive(array('template' => 'menu_interactive_vertical.html', 'menu_id' => $sModule . '-browse-types', 'menu_items' => $aMenu), $this->_oTemplate);
     $oMenu->setSelected($sModule, $sModule . '-' . $sType);
     return array('content' => $sContent, 'menu' => $oMenu);
 }
Exemplo n.º 2
0
 protected function getCheckoutList()
 {
     $sJsObject = $this->getPageJsObject();
     $oTemplate = BxDolStudioTemplate::getInstance();
     //--- Empty cart by vendor if the payment was accepted.
     $mixedVendor = bx_get('vendor');
     $mixedProducts = bx_get('products');
     if ($mixedVendor !== false && $mixedProducts !== false) {
         $oCart = BxDolStudioCart::getInstance();
         $aProducts = explode(',', base64_decode($mixedProducts));
         foreach ($aProducts as $iId) {
             $oCart->delete($mixedVendor, $iId);
         }
         return $this->getMessage('_adm_block_cpt_checkout', '_adm_msg_modules_success_checkouted');
     }
     $aVendors = $this->loadCheckout();
     if (empty($aVendors)) {
         return $this->getMessage('_adm_block_cpt_checkout', '_Empty');
     }
     $sContent = '';
     foreach ($aVendors as $sName => $aInfo) {
         $fTotal = 0;
         $sCurrency = '';
         foreach ($aInfo['products'] as $aProduct) {
             $iCount = isset($aInfo['counts'][$aProduct['id']]) ? (int) $aInfo['counts'][$aProduct['id']] : 1;
             $fTotal += $iCount * $aProduct['price'];
             if ($sCurrency == '' && isset($aProduct['currency_sign'])) {
                 $sCurrency = $aProduct['currency_sign'];
             }
         }
         $aMenu = array(array('id' => 'checkout-' . $sName, 'name' => 'checkout-' . $sName, 'link' => 'javascript:void(0)', 'onclick' => $sJsObject . ".checkoutCart('" . $sName . "', this);", 'target' => '_self', 'title' => '_adm_action_cpt_checkout', 'active' => 1), array('id' => 'delete-all-' . $sName, 'name' => 'delete-all-' . $sName, 'link' => 'javascript:void(0)', 'onclick' => $sJsObject . ".deleteAllFromCart('" . $sName . "', this)", 'target' => '_self', 'title' => '_adm_action_cpt_delete_all', 'active' => 1));
         $oMenu = new BxTemplMenuInteractive(array('template' => 'menu_buttons_hor.html', 'menu_id' => 'timeline-view-all', 'menu_items' => $aMenu));
         $sContent .= $this->getBlockCode(array('caption' => _t('_adm_block_cpt_checkout_by_vendor_csign', $sName, $sCurrency, $fTotal), 'items' => $oTemplate->parseHtmlByName('str_products.html', array('list' => $this->displayProducts($aInfo['products'], array('is_shopping_cart' => true, 'counts' => $aInfo['counts'])), 'paginate' => '')), 'panel_bottom' => $oMenu->getCode()));
     }
     return $oTemplate->parseHtmlByName('store.html', array('js_object' => $sJsObject, 'content' => $sContent));
 }
Exemplo n.º 3
0
 public function serviceGetBlockViewProfile($sProfileModule = 'bx_persons', $iProfileId = 0, $iStart = -1, $iPerPage = -1, $sFilter = '', $aModules = array(), $iTimeline = -1)
 {
     if (empty($iProfileId) && !empty($sProfileModule) && bx_get('id') !== false) {
         $oProfile = BxDolProfile::getInstanceByContentAndType(bx_process_input(bx_get('id'), BX_DATA_INT), $sProfileModule);
         if (!empty($oProfile)) {
             $iProfileId = $oProfile->id();
         }
     }
     if (!$iProfileId) {
         return array();
     }
     $sJsObject = $this->_oConfig->getJsObject('view');
     $aParams = $this->_prepareParams(BX_BASE_MOD_NTFS_TYPE_OWNER, $iProfileId, $iStart, $iPerPage, $sFilter, $aModules, $iTimeline);
     $aParams['per_page'] = (int) $iPerPage > 0 ? $iPerPage : $this->_oConfig->getPerPage('profile');
     $this->_iOwnerId = $aParams['owner_id'];
     list($sUserName, $sUserUrl) = $this->getUserInfo($aParams['owner_id']);
     $aMenu = array(array('id' => 'timeline-view-all', 'name' => 'timeline-view-all', 'class' => '', 'link' => 'javascript:void(0)', 'onclick' => 'javascript:' . $sJsObject . '.changeFilter(this)', 'target' => '_self', 'title' => _t('_bx_timeline_menu_item_view_all'), 'active' => 1), array('id' => 'timeline-view-owner', 'name' => 'timeline-view-owner', 'class' => '', 'link' => 'javascript:void(0)', 'onclick' => 'javascript:' . $sJsObject . '.changeFilter(this)', 'target' => '_self', 'title' => _t('_bx_timeline_menu_item_view_owner', $sUserName)), array('id' => 'timeline-view-other', 'name' => 'timeline-view-other', 'class' => '', 'link' => 'javascript:void(0)', 'onclick' => 'javascript:' . $sJsObject . '.changeFilter(this)', 'target' => '_self', 'title' => _t('_bx_timeline_menu_item_view_other')), array('id' => 'timeline-get-rss', 'name' => 'timeline-get-rss', 'class' => '', 'link' => BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . 'rss/' . $iProfileId . '/', 'target' => '_blank', 'title' => _t('_bx_timeline_menu_item_get_rss')));
     bx_import('BxTemplMenuInteractive');
     $oMenu = new BxTemplMenuInteractive(array('template' => 'menu_interactive_vertical.html', 'menu_id' => 'timeline-view-all', 'menu_items' => $aMenu));
     $oMenu->setSelected('', 'timeline-view-all');
     $sContent = $this->_oTemplate->getViewBlock($aParams);
     return array('content' => $sContent, 'menu' => $oMenu);
 }
Exemplo n.º 4
0
 /**
  * private functions
  */
 protected function _getControlsBox()
 {
     $oTemplate = BxDolTemplate::getInstance();
     $sDisplay = '';
     $bDisplay = (int) $this->_aSystem['is_display_switch'] == 1;
     if ($bDisplay) {
         $aDisplayLinks = array(array('id' => $this->_sSystem . '-flat', 'name' => $this->_sSystem . '-flat', 'class' => '', 'title' => '_cmt_display_flat', 'target' => '_self', 'onclick' => 'javascript:' . $this->_sJsObjName . '.cmtChangeDisplay(this, \'flat\');'), array('id' => $this->_sSystem . '-threaded', 'name' => $this->_sSystem . '-threaded', 'class' => '', 'title' => '_cmt_display_threaded', 'target' => '_self', 'onclick' => 'javascript:' . $this->_sJsObjName . '.cmtChangeDisplay(this, \'threaded\');'));
         bx_import('BxTemplMenuInteractive');
         $oMenu = new BxTemplMenuInteractive(array('template' => 'menu_interactive_vertical.html', 'menu_id' => $this->_sSystem . '-display', 'menu_items' => $aDisplayLinks));
         $oMenu->setSelected('', $this->_sSystem . '-' . $this->_sDisplayType);
         $sDisplay = $oMenu->getCode();
     }
     $sBrowseType = '';
     $bBrowseType = (int) $this->_aSystem['is_browse_switch'] == 1;
     if ($bBrowseType) {
         $aBrowseLinks = array(array('id' => $this->_sSystem . '-tail', 'name' => $this->_sSystem . '-tail', 'class' => '', 'title' => '_cmt_browse_tail', 'target' => '_self', 'onclick' => 'javascript:' . $this->_sJsObjName . '.cmtChangeBrowse(this, \'tail\');'), array('id' => $this->_sSystem . '-head', 'name' => $this->_sSystem . '-head', 'class' => '', 'title' => '_cmt_browse_head', 'target' => '_self', 'onclick' => 'javascript:' . $this->_sJsObjName . '.cmtChangeBrowse(this, \'head\');'), array('id' => $this->_sSystem . '-popular', 'name' => $this->_sSystem . '-popular', 'class' => '', 'title' => '_cmt_browse_popular', 'target' => '_self', 'onclick' => 'javascript:' . $this->_sJsObjName . '.cmtChangeBrowse(this, \'popular\');'));
         bx_import('BxTemplMenuInteractive');
         $oMenu = new BxTemplMenuInteractive(array('template' => 'menu_interactive_vertical.html', 'menu_id' => $this->_sSystem . '-browse', 'menu_items' => $aBrowseLinks));
         $oMenu->setSelected('', $this->_sSystem . '-' . $this->_sBrowseType);
         $sBrowseType = $oMenu->getCode();
     }
     $sBrowseFilter = '';
     $bBrowseFilter = $bBrowseType;
     if ($bBrowseFilter) {
         $aFilterLinks = array(array('id' => $this->_sSystem . '-all', 'name' => $this->_sSystem . '-all', 'class' => '', 'title' => '_cmt_browse_all', 'target' => '_self', 'onclick' => 'javascript:' . $this->_sJsObjName . '.cmtChangeFilter(this, \'all\');'), array('id' => $this->_sSystem . '-friends', 'name' => $this->_sSystem . '-friends', 'class' => '', 'title' => '_cmt_browse_friends', 'target' => '_self', 'onclick' => 'javascript:' . $this->_sJsObjName . '.cmtChangeFilter(this, \'friends\');'), array('id' => $this->_sSystem . '-subscriptions', 'name' => $this->_sSystem . '-subscriptions', 'class' => '', 'title' => '_cmt_browse_subscriptions', 'target' => '_self', 'onclick' => 'javascript:' . $this->_sJsObjName . '.cmtChangeFilter(this, \'subscriptions\');'));
         $oMenu = new BxTemplMenuInteractive(array('template' => 'menu_interactive_vertical.html', 'menu_id' => $this->_sSystem . '-filter', 'menu_items' => $aFilterLinks));
         $oMenu->setSelected('', $this->_sSystem . '-' . $this->_sBrowseFilter);
         $sBrowseFilter = $oMenu->getCode();
     }
     return $oTemplate->parseHtmlByName('comments_controls.html', array('display_switcher' => $bDisplay ? $sDisplay : '', 'bx_if:is_divider_1' => array('condition' => $bDisplay && $bBrowseType, 'content' => array('style_prefix' => $this->_sStylePrefix)), 'browse_switcher' => $bBrowseType ? $sBrowseType : '', 'bx_if:is_divider_2' => array('condition' => $bBrowseType && $bBrowseFilter, 'content' => array('style_prefix' => $this->_sStylePrefix)), 'filter_switcher' => $bBrowseFilter ? $sBrowseFilter : ''));
 }