function GenStoredMemIPs()
 {
     $sCntSQL = "SELECT COUNT(*) FROM `sys_ip_members_visits`";
     ////////////////////////////
     $iTotalNum = db_value($sCntSQL);
     if (!$iTotalNum) {
         return MsgBox(_t('_Empty'));
     }
     $iPerPage = (int) $_GET['per_page'];
     if (!$iPerPage) {
         $iPerPage = 10;
     }
     $iCurPage = (int) $_GET['page'];
     if ($iCurPage < 1) {
         $iCurPage = 1;
     }
     $sLimitFrom = ($iCurPage - 1) * $iPerPage;
     $sqlLimit = "LIMIT {$sLimitFrom}, {$iPerPage}";
     ////////////////////////////
     $sSQL = "SELECT *, UNIX_TIMESTAMP(`DateTime`) AS `DateTimeTS` FROM `sys_ip_members_visits` ORDER BY `DateTime` DESC {$sqlLimit}";
     $rIPList = db_res($sSQL);
     $aTmplVarsItems = array();
     while ($aIPList = mysql_fetch_assoc($rIPList)) {
         $iID = (int) $aIPList['ID'];
         $sFrom = long2ip($aIPList['From']);
         $sLastDT = getLocaleDate($aIPList['DateTimeTS'], BX_DOL_LOCALE_DATE);
         $sMember = $aIPList['MemberID'] ? '<a href="' . getProfileLink($aIPList['MemberID']) . '">' . getNickname($aIPList['MemberID']) . '</a>' : '';
         $aTmplVarsItems[] = array('from' => $sFrom, 'bx_if:show_profile_link' => array('condition' => !empty($aIPList['MemberID']), 'content' => array('href' => getProfileLink($aIPList['MemberID']), 'caption' => getNickname($aIPList['MemberID']))), 'date' => $sLastDT);
     }
     $oPaginate = new BxDolPaginate(array('page_url' => $GLOBALS['site']['url_admin'] . 'ip_blacklist.php?mode=list&page={page}&per_page={per_page}', 'count' => $iTotalNum, 'per_page' => $iPerPage, 'page' => $iCurPage));
     return $GLOBALS['oAdmTemplate']->parseHtmlByName('ip_blacklist_list_ips.html', array('bx_repeat:items' => $aTmplVarsItems, 'paginate' => $oPaginate->getPaginate()));
 }
Пример #2
0
 function getBlockCode_All($id)
 {
     $this->oSearch->clearFilters(array('activeStatus', 'allow_view', 'album_status', 'albumType', 'ownerStatus'), array('albumsObjects', 'albums'));
     $this->oSearch->aCurrent['paginate']['perPage'] = (int) $this->oConfig->getGlParam('number_all');
     $this->oSearch->aCurrent['view'] = 'full';
     if (isset($this->oSearch->aCurrent['rss'])) {
         $this->oSearch->aCurrent['rss']['link'] = $this->oSearch->getCurrentUrl('browseAll', 0, '');
     }
     $sCode = $this->oSearch->displayResultBlock();
     if ($this->oSearch->aCurrent['paginate']['totalNum'] > 0) {
         $sCode = $GLOBALS['oFunctions']->centerContent($sCode, '.sys_file_search_unit');
         $aExclude = array('r');
         $sMode = isset($_GET[$this->oConfig->getMainPrefix() . '_mode']) ? '&_' . $this->oConfig->getMainPrefix() . '_mode=' . $_GET['bx_' . $this->oConfig->getUri() . '_mode'] : '';
         $sLink = $this->oConfig->getBaseUri() . 'home/';
         $aLinkAddon = $this->oSearch->getLinkAddByPrams($aExclude);
         $oPaginate = new BxDolPaginate(array('page_url' => $sLink, 'count' => $this->oSearch->aCurrent['paginate']['totalNum'], 'per_page' => $this->oSearch->aCurrent['paginate']['perPage'], 'page' => $this->oSearch->aCurrent['paginate']['page'], 'per_page_changer' => true, 'page_reloader' => true, 'on_change_page' => 'return !loadDynamicBlock(' . $id . ', \'' . $sLink . $sMode . $aLinkAddon['params'] . '&page={page}&per_page={per_page}\');', 'on_change_per_page' => 'return !loadDynamicBlock(' . $id . ', \'' . $sLink . $sMode . $aLinkAddon['params'] . '&page=1&per_page=\' + this.value);'));
         $aTopMenu = $this->oSearch->getTopMenu(array($this->oConfig->getMainPrefix() . '_mode'));
         $sPaginate = $oPaginate->getPaginate();
     } else {
         $sCode = MsgBox(_t("_Empty"));
         $aTopMenu = array();
         $sPaginate = '';
     }
     return array($sCode, $aTopMenu, $sPaginate, '');
 }
Пример #3
0
 function showPagination($bAdmin = false)
 {
     require_once BX_DIRECTORY_PATH_CLASSES . 'BxDolPaginate.php';
     $aLinkAddon = $this->getLinkAddByPrams();
     $oPaginate = new BxDolPaginate(array('page_url' => $this->aCurrent['paginate']['page_url'], 'count' => $this->aCurrent['paginate']['totalNum'], 'per_page' => $this->aCurrent['paginate']['perPage'], 'page' => $this->aCurrent['paginate']['page'], 'per_page_changer' => true, 'page_reloader' => true));
     $sPaginate = '<div class="clear_both"></div>' . $oPaginate->getPaginate();
     return $sPaginate;
 }
Пример #4
0
function PageCodeSubscribers($oSubscription)
{
    $iStart = bx_get('start') !== false ? (int) bx_get('start') : 0;
    $iPerPage = 20;
    $oPaginate = new BxDolPaginate(array('start' => $iStart, 'per_page' => $iPerPage, 'count' => $oSubscription->getSubscribersCount(), 'page_url' => $GLOBALS['site']['url_admin'] . 'manage_subscribers.php?start={start}'));
    $sControls = BxTemplSearchResult::showAdminActionsPanel('adm-ms-form', array('adm-ms-delete' => _t('_adm_btn_ms_delete')), 'members');
    $aSubscribers = $oSubscription->getSubscribers(BX_DOL_SBS_TYPE_VISITOR, $iStart, $iPerPage);
    return $GLOBALS['oAdmTemplate']->parseHtmlByName('manage_subscribers.html', array('bx_repeat:items' => is_array($aSubscribers) && !empty($aSubscribers) ? $aSubscribers : MsgBox(_t('_Empty')), 'paginate' => $oPaginate->getPaginate(), 'controls' => $sControls));
}
Пример #5
0
 function showPaginationAjax($sBlockId)
 {
     $oMain = $this->getMain();
     $oConfig = $oMain->_oConfig;
     bx_import('BxDolPaginate');
     $sUrlStart = BX_DOL_URL_ROOT . $oConfig->getBaseUri() . $this->sBrowseUrl;
     $sUrlStart .= false === strpos($sUrlStart, '?') ? '?' : '&';
     $oPaginate = new BxDolPaginate(array('page_url' => 'javascript:void(0);', 'count' => $this->aCurrent['paginate']['totalNum'], 'per_page' => $this->aCurrent['paginate']['perPage'], 'page' => $this->aCurrent['paginate']['page'], 'on_change_page' => "getHtmlData('{$sBlockId}', '{$sUrlStart}page={page}&per_page={per_page}&block={$sBlockId}" . (false !== bx_get($this->sFilterName) ? '&' . $this->sFilterName . '=' . bx_get($this->sFilterName) : '') . "');"));
     return $oPaginate->getSimplePaginate(false, -1, -1, false);
 }
Пример #6
0
function PageCodeManageSubscribers($oSubscription)
{
    $iStart = bx_get('start') !== false ? (int) bx_get('start') : 0;
    $iPerPage = 20;
    $oPaginate = new BxDolPaginate(array('start' => $iStart, 'per_page' => $iPerPage, 'count' => $oSubscription->getSubscribersCount(), 'page_url' => BX_DOL_URL_ADMIN . 'notifies.php?mode=manage_subscribers&start={start}'));
    $sControls = BxTemplSearchResult::showAdminActionsPanel('adm-ms-form', array('adm-ms-delete' => _t('_adm_btn_ms_delete')), 'members');
    $aSubscribers = $oSubscription->getSubscribers(BX_DOL_SBS_TYPE_VISITOR, $iStart, $iPerPage);
    $s = $GLOBALS['oAdmTemplate']->parseHtmlByName('manage_subscribers.html', array('bx_repeat:items' => is_array($aSubscribers) && !empty($aSubscribers) ? $aSubscribers : MsgBox(_t('_Empty')), 'paginate' => $oPaginate->getPaginate(), 'controls' => $sControls));
    return array('page_main_code' => DesignBoxAdmin(_t('_adm_page_cpt_manage_subscribers'), $s, $GLOBALS['aTopItems'], '', 1));
}
Пример #7
0
 /**
  * Function will generate page's pagination;
  *
  * @param  : $sModulePath (string) - path to current module;
  * @return : (text) - html presentation data;
  */
 function showPagination($sModulePath, $sScript = null)
 {
     $aParameters['settings'] = array('count' => $this->aCurrent['paginate']['totalNum'], 'per_page' => $this->aCurrent['paginate']['perPage'], 'page' => $this->aCurrent['paginate']['page']);
     $aParameters['settings']['page_url'] = $sModulePath . '&page={page}&per_page={per_page}';
     $aParameters['settings']['on_change_page'] = $sScript ? $sScript : null;
     $aParameters['settings']['on_change_per_page'] = null;
     $oPaginate = new BxDolPaginate(array_shift($aParameters));
     $sPaginate = '<div class="clear_both"></div>' . $oPaginate->getSimplePaginate(null, -1, -1, false);
     return $sPaginate;
 }
Пример #8
0
    function GenStoredMemIPs()
    {
        $sFromC = _t('_From');
        $sMemberC = _t('_Member');
        $sDatatimeC = _t('_Date');
        $sCaptionC = _t('_adm_ipbl_Stored_members_caption');
        $sRes = '<br /><h2>' . $sCaptionC . '</h2>';
        $sTableRes .= <<<EOF
<table style="width:99%;" border="1" cellpadding="2" cellspacing="1" style="border-collapse: collapse">
\t<tr>
\t\t<td>{$sFromC}</td>
        <td>{$sMemberC}</td>
\t\t<td>{$sDatatimeC}</td>
\t</tr>
EOF;
        $sCntSQL = "SELECT COUNT(*) FROM `sys_ip_members_visits`";
        ////////////////////////////
        $iTotalNum = db_value($sCntSQL);
        if (!$iTotalNum) {
            return $sRes . MsgBox(_t('_Empty'));
        }
        $iPerPage = (int) $_GET['per_page'];
        if (!$iPerPage) {
            $iPerPage = 10;
        }
        $iCurPage = (int) $_GET['page'];
        if ($iCurPage < 1) {
            $iCurPage = 1;
        }
        $sLimitFrom = ($iCurPage - 1) * $iPerPage;
        $sqlLimit = "LIMIT {$sLimitFrom}, {$iPerPage}";
        ////////////////////////////
        $sSQL = "SELECT * FROM `sys_ip_members_visits` ORDER BY `DateTime` ASC {$sqlLimit}";
        $rIPList = db_res($sSQL);
        while ($aIPList = mysql_fetch_assoc($rIPList)) {
            $iID = (int) $aIPList['ID'];
            $sFrom = long2ip($aIPList['From']);
            $sLastDT = $aIPList['DateTime'];
            $sMember = $aIPList['MemberID'] ? '<a href="' . getProfileLink($aIPList['MemberID']) . '">' . getNickname($aIPList['MemberID']) . '</a>' : '';
            $sTableRes .= "<tr><td>{$sFrom}</td><td>{$sMember}</td><td>{$sLastDT}</td></tr>";
        }
        $sTableRes .= <<<EOF
</table>
<div class="clear_both"></div>
<br />
EOF;
        $sRequest = $GLOBALS['site']['url_admin'] . 'ip_blacklist.php?page={page}&per_page={per_page}';
        $oPaginate = new BxDolPaginate(array('page_url' => $sRequest, 'count' => $iTotalNum, 'per_page' => $iPerPage, 'page' => $iCurPage, 'per_page_changer' => true, 'page_reloader' => true, 'on_change_page' => null, 'on_change_per_page' => null));
        return $sRes . $sTableRes . $oPaginate->getPaginate();
    }
Пример #9
0
    function GenStoredMemIPs()
    {
        $sRes = '';
        $sFromC = _t('_From');
        $sMemberC = _t('_Member');
        $sDatatimeC = _t('_Date');
        $sTableRes .= <<<EOF
<table style="width:99%; border-collapse:collapse;" cellpadding="4" style="border-collapse: collapse">
    <tr>
        <td class="bx-def-border">{$sFromC}</td>
        <td class="bx-def-border">{$sMemberC}</td>
        <td class="bx-def-border">{$sDatatimeC}</td>
    </tr>
EOF;
        $sCntSQL = "SELECT COUNT(*) FROM `sys_ip_members_visits`";
        ////////////////////////////
        $iTotalNum = db_value($sCntSQL);
        if (!$iTotalNum) {
            return $sRes . MsgBox(_t('_Empty'));
        }
        $iPerPage = (int) $_GET['per_page'];
        if (!$iPerPage) {
            $iPerPage = 10;
        }
        $iCurPage = (int) $_GET['page'];
        if ($iCurPage < 1) {
            $iCurPage = 1;
        }
        $sLimitFrom = ($iCurPage - 1) * $iPerPage;
        $sqlLimit = "LIMIT {$sLimitFrom}, {$iPerPage}";
        ////////////////////////////
        $sSQL = "SELECT *, UNIX_TIMESTAMP(`DateTime`) AS `DateTimeTS` FROM `sys_ip_members_visits` ORDER BY `DateTime` DESC {$sqlLimit}";
        $rIPList = db_res($sSQL);
        while ($aIPList = mysql_fetch_assoc($rIPList)) {
            $iID = (int) $aIPList['ID'];
            $sFrom = long2ip($aIPList['From']);
            $sLastDT = getLocaleDate($aIPList['DateTimeTS'], BX_DOL_LOCALE_DATE);
            $sMember = $aIPList['MemberID'] ? '<a href="' . getProfileLink($aIPList['MemberID']) . '">' . getNickname($aIPList['MemberID']) . '</a>' : '';
            $sTableRes .= "<tr><td class='bx-def-border'>{$sFrom}</td><td class='bx-def-border'>{$sMember}</td><td class='bx-def-border'>{$sLastDT}</td></tr>";
        }
        $sTableRes .= <<<EOF
</table>
<div class="clear_both"></div>
EOF;
        $sRequest = $GLOBALS['site']['url_admin'] . 'ip_blacklist.php?mode=list&page={page}&per_page={per_page}';
        $oPaginate = new BxDolPaginate(array('page_url' => $sRequest, 'count' => $iTotalNum, 'per_page' => $iPerPage, 'page' => $iCurPage, 'per_page_changer' => true, 'page_reloader' => true, 'on_change_page' => null, 'on_change_per_page' => null));
        $sContent = $GLOBALS['oAdmTemplate']->parseHtmlByName('design_box_content.html', array('content' => $sRes . $sTableRes));
        return $sContent . $oPaginate->getPaginate();
    }
Пример #10
0
 function actionGetCurrentImage($iPicId)
 {
     $iPicId = (int) $iPicId;
     if ($iPicId > 0) {
         bx_import('Search', $this->_aModule);
         $oMedia = new BxPhotosSearch();
         $aInfo = $oMedia->serviceGetPhotoArray($iPicId, 'file');
         $aInfo['ownerUrl'] = getProfileLink($aInfo['owner']);
         $aInfo['ownerName'] = getNickName($aInfo['owner']);
         $aInfo['date'] = defineTimeInterval($aInfo['date']);
         $oMedia->getRatePart();
         $aInfo['rate'] = $oMedia->oRate->getJustVotingElement(0, 0, $aInfo['rate']);
         $aLinkAddon = $oMedia->getLinkAddByPrams();
         $oPaginate = new BxDolPaginate(array('count' => (int) $_GET['total'], 'per_page' => 1, 'page' => (int) $_GET['page'], 'on_change_page' => 'getCurrentImage({page})'));
         $aInfo['paginate'] = $oPaginate->getPaginate();
         header('Content-Type:text/javascript; charset=utf-8');
         echo json_encode($aInfo);
     }
 }
Пример #11
0
 function actionGetCurrentImage($iPicId)
 {
     $iPicId = (int) $iPicId;
     if ($iPicId > 0) {
         require_once 'BxPhotosSearch.php';
         $oMedia = new BxPhotosSearch();
         $aInfo = $oMedia->serviceGetPhotoArray($iPicId, 'file');
         $aInfo['ownerUrl'] = getProfileLink($aInfo['owner']);
         $aInfo['ownerName'] = getNickName($aInfo['owner']);
         $aInfo['date'] = defineTimeInterval($aInfo['date']);
         $oMedia->getRatePart();
         $aInfo['rate'] = $oMedia->oRate->getJustVotingElement(0, 0, $aInfo['rate']);
         $aLinkAddon = $oMedia->getLinkAddByPrams();
         $oPaginate = new BxDolPaginate(array('count' => (int) $_GET['total'], 'per_page' => 1, 'page' => (int) $_GET['page'], 'info' => false, 'per_page_changer' => false, 'page_reloader' => false, 'on_change_page' => 'getCurrentImage({page})'));
         $aInfo['paginate'] = $oPaginate->getPaginate();
         header('Content-Type:text/javascript');
         $oJSON = new Services_JSON();
         echo $oJSON->encode($aInfo);
     }
 }
Пример #12
0
 function ajaxBrowse($sMode, $iPerPage, $aMenu = array(), $sValue = '', $isDisableRss = false, $isPublicOnly = true)
 {
     bx_import('SearchResult', $this->oMain->_aModule);
     $sClassName = $this->sSearchResultClassName;
     $o = new $sClassName($sMode, $sValue);
     $o->aCurrent['paginate']['perPage'] = $iPerPage;
     $o->setPublicUnitsOnly($isPublicOnly);
     if (!$aMenu) {
         $aMenu = $isDisableRss ? '' : array(_t('_RSS') => array('href' => $o->aCurrent['rss']['link'] . (false === strpos($o->aCurrent['rss']['link'], '?') ? '?' : '&') . 'rss=1', 'icon' => 'rss'));
     }
     if ($o->isError) {
         return array(MsgBox(_t('_Error Occured')), $aMenu);
     }
     if (!($s = $o->displayResultBlock())) {
         return $isPublicOnly ? array(MsgBox(_t('_Empty')), $aMenu) : '';
     }
     $sFilter = false !== bx_get($this->sFilterName) ? $this->sFilterName . '=' . bx_get($this->sFilterName) . '&' : '';
     $oPaginate = new BxDolPaginate(array('page_url' => 'javascript:void(0);', 'count' => $o->aCurrent['paginate']['totalNum'], 'per_page' => $o->aCurrent['paginate']['perPage'], 'page' => $o->aCurrent['paginate']['page'], 'on_change_page' => 'return !loadDynamicBlock({id}, \'' . $this->sUrlStart . $sFilter . 'page={page}&per_page={per_page}\');'));
     $sAjaxPaginate = $oPaginate->getSimplePaginate($this->oConfig->getBaseUri() . $o->sBrowseUrl);
     return array($s, $aMenu, $sAjaxPaginate, '');
 }
Пример #13
0
 function getSearchContent($aRestrictions, $sUri, $iPage = 1, $iPerPage = 0)
 {
     $iPerPage = !empty($iPerPage) ? $iPerPage : $this->_oConfig->getPerPage();
     $sClassName = $this->_oConfig->getClassPrefix() . 'SearchResult';
     $oSearchResult = new $sClassName($this);
     foreach ($aRestrictions as $sKey => $mixedValue) {
         if (is_array($mixedValue)) {
             $oSearchResult->aCurrent['restriction'][$sKey] = $mixedValue;
         } else {
             if (is_string($mixedValue)) {
                 $oSearchResult->aCurrent['restriction'][$sKey]['value'] = $mixedValue;
             }
         }
     }
     $oSearchResult->aCurrent['paginate']['forcePage'] = $iPage;
     $oSearchResult->aCurrent['paginate']['perPage'] = $iPerPage;
     $sCode = $oSearchResult->displayResultBlock();
     if (!empty($sCode)) {
         $oPaginate = new BxDolPaginate(array('page_url' => BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . $sUri . '{page}/{per_page}', 'count' => $oSearchResult->aCurrent['paginate']['totalNum'], 'per_page' => $iPerPage, 'page' => $iPage, 'per_page_changer' => true, 'page_reloader' => false, 'on_change_page' => '', 'on_change_per_page' => ''));
         $sCode .= $oPaginate->getPaginate();
     }
     return $sCode;
 }
Пример #14
0
 function getBlockCode_Objects($iBlockId)
 {
     if (!empty($this->sBrowseCode)) {
         return $this->sBrowseCode;
     }
     $sClassName = $this->oConfig->getClassPrefix() . 'Search';
     bx_import('Search', $this->oModule->_aModule);
     $oSearch = new $sClassName('album');
     $aParams = array('album' => $this->aInfo['Uri'], 'owner' => getUsername($this->aInfo['Owner']));
     $aCustom = array('enable_center' => true, 'per_page' => $this->oConfig->getGlParam('number_top'), 'sorting' => 'album_order');
     $aHtml = $oSearch->getBrowseBlock($aParams, $aCustom);
     $iCount = $oSearch->aCurrent['paginate']['totalNum'];
     $sPaginate = '';
     if ($iCount > $oSearch->aCurrent['paginate']['perPage']) {
         $sLink = $this->oConfig->getBaseUri() . 'browse/album/' . $aParams['album'] . '/owner/' . $aParams['owner'];
         $oPaginate = new BxDolPaginate(array('page_url' => $sLink . '&page={page}&per_page={per_page}', 'count' => $iCount, 'per_page' => $oSearch->aCurrent['paginate']['perPage'], 'page' => $oSearch->aCurrent['paginate']['page'], 'on_change_per_page' => 'document.location=\'' . BX_DOL_URL_ROOT . $sLink . '&page=1&per_page=\' + this.value;'));
         $sPaginate = $oPaginate->getPaginate();
     }
     if (empty($aHtml['code'])) {
         $aHtml['code'] = MsgBox(_t('_Empty'));
     }
     return DesignBoxContent(_t('_' . $this->oConfig->getMainPrefix() . '_browse_by_album', $this->aInfo['Caption']), $aHtml['code'], 1, '', $sPaginate);
 }
Пример #15
0
 function getAdminPart($aCondition = array(), $aCustom = array())
 {
     $this->oSearch->clearFilters(array('allow_view', 'album_status'), array('albumsObjects', 'albums'));
     $iPerPage = isset($_GET['per_page']) ? (int) $_GET['per_page'] : (int) $this->oConfig->getGlParam('number_albums_home');
     $iPage = isset($_GET['page']) ? (int) $_GET['page'] : $this->oSearch->aCurrent['paginate']['page'];
     $this->oSearch->bAdminMode = true;
     $aCondition['show_empty'] = true;
     $aCondition['hide_default'] = true;
     $aCondition['owner'] = $this->iOwnerId;
     $sCode = $this->oSearch->getAlbumList($iPage, $iPerPage, $aCondition);
     $iCount = $this->oSearch->aCurrent['paginate']['totalAlbumNum'];
     $aBtns = array('action_delete' => _t('_Delete'));
     $sPaginate = '';
     if ($iCount > $iPerPage) {
         $sSection = isset($aCustom['section']) ? strip_tags($aCustom['section']) : '';
         if ($this->oConfig->isPermalinkEnabled) {
             $sSection .= '?';
         }
         $iId = isset($aCustom['page_block_id']) ? (int) $aCustom['page_block_id'] : 1;
         $aLinkAddon = $this->oSearch->getLinkAddByPrams();
         $sLink = BX_DOL_URL_ROOT . $this->oConfig->getBaseUri() . 'albums/my/';
         $sLinkJs = $sLink . $sSection . $aLinkAddon['params'];
         $oPaginate = new BxDolPaginate(array('page_url' => $sLink, 'count' => $iCount, 'per_page' => $iPerPage, 'page' => $iPage, 'per_page_changer' => true, 'page_reloader' => true, 'on_change_page' => 'return !loadDynamicBlock(' . $iId . ', \'' . $sLinkJs . '&page={page}&per_page={per_page}\');', 'on_change_per_page' => 'return !loadDynamicBlock(' . $iId . ', \'' . $sLinkJs . '&page=1&per_page=\' + this.value);'));
         $sPaginate = $oPaginate->getSimplePaginate(BX_DOL_URL_ROOT . $this->oConfig->getBaseUri() . 'albums/browse/owner/' . getUsername($this->iOwnerId));
     }
     $sManage = $this->oSearch->showAdminActionsPanel($this->oSearch->aCurrent['name'] . '_admin_form', $aBtns);
     $aUnit = array('main_code' => $sCode, 'paginate' => $sPaginate, 'manage' => $sManage);
     return $this->oTemplate->parseHtmlByName('manage_form_albums.html', $aUnit);
 }
Пример #16
0
 public function addCssJs()
 {
     if (self::$_isCssAdded) {
         return false;
     }
     $this->_oTemplate->addCss('paginate.css');
     self::$_isCssAdded = true;
     return true;
 }
Пример #17
0
 function displayOrders($sType, $aParams)
 {
     if (empty($aParams['per_page'])) {
         $aParams['per_page'] = $this->_oConfig->getPerPage('orders');
     }
     $sJsObject = $this->_oConfig->getJsObject('orders');
     $sMethodNameInfo = 'get' . ucfirst($sType) . 'Orders';
     $aOrders = $this->_oDb->{$sMethodNameInfo}($aParams);
     if (empty($aOrders)) {
         return MsgBox(_t($this->_sLangsPrefix . 'msg_no_results'));
     }
     $aAdministrator = $this->_oDb->getVendorInfoProfile(BX_PMT_ADMINISTRATOR_ID);
     $sTxtMoreProducts = _t($this->_sLangsPrefix . 'txt_more_products');
     $sTxtMoreItems = _t($this->_sLangsPrefix . 'txt_more_items');
     $sTxtActionMore = _t($this->_sLangsPrefix . 'txt_action_more');
     //--- Get Orders ---//
     $aResultOrders = array();
     foreach ($aOrders as $aOrder) {
         if (empty($aOrder['user_id'])) {
             $aOrder['user_name'] = $aAdministrator['profile_name'];
             $aOrder['user_url'] = $aAdministrator['profile_url'];
         } else {
             $aOrder['user_name'] = getNickName($aOrder['user_id']);
             $aOrder['user_url'] = getProfileLink($aOrder['user_id']);
             if (!$aOrder['user_name']) {
                 $aOrder['user_name'] = _t('_undefined');
                 $aOrder['user_url'] = '';
             }
         }
         $aResultOrders[] = array_merge($aOrder, array('js_object' => $sJsObject, 'type' => $sType, 'txt_more_products' => $sTxtMoreProducts, 'txt_more_items' => $sTxtMoreItems, 'txt_action_more' => $sTxtActionMore, 'bx_if:show_link' => array('condition' => !empty($aOrder['user_url']), 'content' => array('user_name' => $aOrder['user_name'], 'user_url' => $aOrder['user_url'])), 'bx_if:show_text' => array('condition' => empty($aOrder['user_url']), 'content' => array('user_name' => $aOrder['user_name'])), 'bx_if:pending' => array('condition' => $sType == BX_PMT_ORDERS_TYPE_PENDING, 'content' => array('id' => $aOrder['id'], 'order' => $aOrder['order'])), 'bx_if:processed' => array('condition' => $sType == BX_PMT_ORDERS_TYPE_PROCESSED || BX_PMT_ORDERS_TYPE_SUBSCRIPTION || $sType == BX_PMT_ORDERS_TYPE_HISTORY, 'content' => array('order' => $aOrder['order'])), 'products' => $aOrder['products'], 'items' => $aOrder['items'], 'subscription' => $this->_isSubscription($aOrder)));
     }
     //--- Get Paginate Panel ---//
     $sPaginatePanel = "";
     $sMethodNameCount = 'get' . ucfirst($sType) . 'OrdersCount';
     if (($iCount = $this->_oDb->{$sMethodNameCount}($aParams)) > $aParams['per_page']) {
         $oPaginate = new BxDolPaginate(array('start' => $aParams['start'], 'count' => $iCount, 'per_page' => $aParams['per_page'], 'per_page_step' => 2, 'per_page_interval' => 3, 'page_url' => BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . ($sType == BX_PMT_ORDERS_TYPE_HISTORY ? 'history' : 'orders') . '/', 'on_change_page' => $sJsObject . ".changePage('" . $sType . "', {start}, {per_page}, " . $aParams['seller_id'] . ")"));
         $sPaginatePanel = $oPaginate->getPaginate();
     }
     return $this->parseHtmlByName($sType . '_orders.html', array('bx_repeat:orders' => $aResultOrders, 'paginate_panel' => $sPaginatePanel));
 }
Пример #18
0
 function getBlockCode_Friends()
 {
     $iLimit = 10;
     $sContent = $sPaginate = '';
     $sAllFriends = 'viewFriends.php?iUser='******'page']) ? (int) $_GET['page'] : 1;
     if ($iPage < 1) {
         $iPage = 1;
     }
     if ($iPage > $iPages) {
         $iPage = $iPages;
     }
     $sSqlFrom = ($iPage - 1) * $iLimit;
     $sSqlLimit = "LIMIT {$sSqlFrom}, {$iLimit}";
     $aFriends = getMyFriendsEx($this->iMember, '', 'image', $sSqlLimit);
     $aTmplParams['bx_repeat:friends'] = array();
     foreach ($aFriends as $iId => $aFriend) {
         $aTmplParams['bx_repeat:friends'][] = array('content' => get_member_thumbnail($iId, 'none', true, 'visitor', array('is_online' => $aFriend[5])));
     }
     $sContent = $GLOBALS['oSysTemplate']->parseHtmlByName('member_friends.html', $aTmplParams);
     $oPaginate = new BxDolPaginate(array('page_url' => BX_DOL_URL_ROOT . 'member.php', 'count' => $iCount, 'per_page' => $iLimit, 'page' => $iPage, 'on_change_page' => 'return !loadDynamicBlock({id}, \'member.php?page={page}&per_page={per_page}\');'));
     $sPaginate = $oPaginate->getSimplePaginate($sAllFriends);
     return array($sContent, array(), $sPaginate);
 }
Пример #19
0
 function getAdminPart($aCondition = array(), $aCustom = array())
 {
     $this->oSearch->bAdminMode = true;
     $iPerPage = isset($_GET['per_page']) ? (int) $_GET['per_page'] : (int) $this->oConfig->getGlParam('number_albums_home');
     $iPage = isset($_GET['page']) ? (int) $_GET['page'] : $this->oSearch->aCurrent['paginate']['page'];
     $this->oSearch->aCurrent['restriction']['owner']['value'] = $this->iOwnerId;
     $aCondition['show_empty'] = true;
     $sCode = $this->oSearch->getAlbumList($iPage, $iPerPage, $aCondition);
     $aBtns = array('action_delete' => _t('_Delete'));
     $sSection = isset($aCustom['section']) ? strip_tags($aCustom['section']) : '';
     $iId = isset($aCustom['page_block_id']) ? (int) $aCustom['page_block_id'] : 1;
     $aLinkAddon = $this->oSearch->getLinkAddByPrams();
     $sLink = BX_DOL_URL_ROOT . $this->oConfig->getBaseUri() . 'albums/my/' . $sSection;
     $this->oSearch->aCurrent['paginate']['perPage'] = 2;
     $oPaginate = new BxDolPaginate(array('page_url' => $sLink, 'count' => $this->oSearch->aCurrent['paginate']['totalAlbumNum'], 'per_page' => $iPerPage, 'page' => $iPage, 'per_page_changer' => true, 'page_reloader' => true, 'on_change_page' => 'return !loadDynamicBlock(' . $iId . ', \'' . $sLink . $aLinkAddon['params'] . '&page={page}&per_page={per_page}\');', 'on_change_per_page' => 'return !loadDynamicBlock(' . $iId . ', \'' . $sLink . $aLinkAddon['params'] . '&page=1&per_page=\' + this.value);'));
     $sPaginate = $oPaginate->getSimplePaginate(BX_DOL_URL_ROOT . $this->oConfig->getBaseUri() . 'albums/browse/owner/' . getNickName($this->iOwnerId));
     $sManage = $this->oSearch->showAdminActionsPanel($this->oSearch->aCurrent['name'] . '_admin_form', $aBtns);
     $aUnit = array('main_code' => $GLOBALS['oFunctions']->centerContent($sCode, '.sys_album_unit') . $sPaginate . $sManage, 'bx_if:hidden' => '');
     return $this->oTemplate->parseHtmlByName('manage_form.html', $aUnit);
 }
Пример #20
0
 function showPaginationAjax()
 {
     bx_import('BxDolPaginate');
     $oConfig = $this->_oMain->_oConfig;
     $sUrlStart = BX_DOL_URL_ROOT . $oConfig->getBaseUri() . $this->sSitesBrowseUrl;
     $sUrlStart .= false === strpos($sUrlStart, '?') ? '?' : '&';
     $sUrlStart .= 'page={page}&per_page={per_page}';
     $oPaginate = new BxDolPaginate(array('page_url' => 'javascript:void(0);', 'count' => $this->aCurrent['paginate']['totalNum'], 'per_page' => $this->aCurrent['paginate']['perPage'], 'page' => $this->aCurrent['paginate']['page'], 'view_all_url' => BX_DOL_URL_ROOT . $oConfig->getBaseUri() . $this->sSitesBrowseAll, 'info' => false, 'view_all' => true, 'page_links' => false, 'on_change_page' => "getHtmlData('search_result_block_{$this->sMode}', '{$sUrlStart}')"));
     return '<div class="clear_both"></div>' . $oPaginate->getPaginate();
 }
Пример #21
0
 /**
  * Generate List of Posts for mobile frontend
  *
  * @param $iAuthor - display posts of provided user only
  * @param $sMode - display all latest[default], featured or top posts
  * @return HTML presentation of data
  */
 function GenPostListMobile($iAuthor = 0, $sMode = false)
 {
     if ($this->_iVisitorID) {
         // some workaround for mobile apps, to force login
         bx_login($this->_iVisitorID);
     }
     bx_import('BxDolMobileTemplate');
     $oMobileTemplate = new BxDolMobileTemplate($this->_oConfig, $this->_oDb);
     $oMobileTemplate->pageStart();
     echo $oMobileTemplate->addCss('blogs_common.css', 1);
     $iPerPage = 10;
     $iPage = (int) bx_get('page');
     if ($iPage < 1) {
         $iPage = 1;
     }
     $this->iPostViewType = 4;
     $sOrder = 'last';
     $sMobileWrapper = 'mobile_row.html';
     $aParams = array();
     switch ($sMode) {
         case 'post':
             $aViewingPostInfo = $this->_oDb->getPostInfo((int) bx_get('id'));
             if (!$this->oPrivacy->check('view', (int) bx_get('id'), $this->_iVisitorID) || !$this->isAllowedBlogPostView($aViewingPostInfo['OwnerID'], true)) {
                 $oMobileTemplate->displayAccessDenied($sCaption);
                 return;
             }
             $this->iPostViewType = 3;
             $aParams = array('id' => (int) bx_get('id'));
             $sCaption = _t('_bx_blog_post_view');
             $sMobileWrapper = 'mobile_box.html';
             echo $oMobileTemplate->addCss('blogs.css', 1);
             break;
         case 'user':
             $aParams = array('id' => (int) bx_get('id'));
             $sCaption = _t('_bx_blog_Members_blog', getNickName((int) bx_get('id')));
             break;
         case 'featured':
             $sCaption = _t('_bx_blog_Featured_Posts');
             break;
         case 'top':
             $sOrder = 'top';
             $sCaption = _t('_bx_blog_Top_Posts');
             break;
         case 'popular':
             $sOrder = 'popular';
             $sCaption = _t('_bx_blog_Popular_Posts');
             break;
         case 'last':
         default:
             $sMode = 'last';
             $sCaption = _t('_bx_blog_Latest_posts');
     }
     if ('post' != $sMode && !$this->isAllowedBlogsPostsBrowse()) {
         $oMobileTemplate->displayAccessDenied($sCaption);
         return;
     }
     $oTmpBlogSearch = false;
     $sCode = $this->_GenPosts($this->iPostViewType, $iPerPage, $sMode, $aParams, $sOrder, $oBlogSearchResults, $sMobileWrapper);
     if (!$sCode || $oBlogSearchResults->aCurrent['paginate']['totalNum'] == 0) {
         $oMobileTemplate->displayNoData($sCaption);
         return;
     }
     echo $sCode;
     if ($sMode != 'post') {
         bx_import('BxDolPaginate');
         $oPaginate = new BxDolPaginate(array('page_url' => $this->genBlogSubUrl() . '?action=mobile&mode=' . $sMode . '&page={page}', 'count' => $oBlogSearchResults->aCurrent['paginate']['totalNum'], 'per_page' => $iPerPage, 'page' => $iPage));
         echo $oPaginate->getMobilePaginate();
     }
     $oMobileTemplate->pageCode($sCaption, false);
 }
 function getAlbumsBlock($aSectionParams = array(), $aAlbumParams = array(), $aCustom = array())
 {
     $aCustomTmpl = array('caption' => _t('_' . $this->oModule->_oConfig->getMainPrefix() . '_albums'), 'enable_center' => true, 'unit_css_class' => '.sys_album_unit', 'page' => isset($_GET['page']) ? (int) $_GET['page'] : 1, 'per_page' => isset($_GET['per_page']) ? (int) $_GET['per_page'] : (int) $this->oModule->_oConfig->getGlParam('number_albums_home'), 'simple_paginate' => true, 'menu_top' => '', 'menu_bottom' => '', 'paginate_url' => '', 'simple_paginate_url' => BX_DOL_URL_ROOT . $this->oModule->_oConfig->getUri() . '/albums/browse', 'simple_paginate_view_all' => true);
     $aCustom = array_merge($aCustomTmpl, $aCustom);
     $this->aCurrent['paginate']['perPage'] = $aCustom['per_page'];
     $this->aCurrent['paginate']['page'] = $aCustom['page'];
     $this->fillFilters($aSectionParams);
     $sCode = $this->getAlbumList($this->aCurrent['paginate']['page'], $this->aCurrent['paginate']['perPage'], $aAlbumParams);
     if ($this->aCurrent['paginate']['totalAlbumNum'] > 0) {
         if ($aCustom['enable_center']) {
             $sCode = $GLOBALS['oFunctions']->centerContent($sCode, $aCustom['unit_css_class']);
         }
         if (empty($aCustom['menu_bottom'])) {
             $aLinkAddon = $this->getLinkAddByPrams(array('r'));
             $oPaginate = new BxDolPaginate(array('page_url' => $aCustom['paginate_url'], 'count' => $this->aCurrent['paginate']['totalAlbumNum'], 'per_page' => $this->aCurrent['paginate']['perPage'], 'page' => $this->aCurrent['paginate']['page'], 'on_change_page' => 'return !loadDynamicBlock({id}, \'' . $aCustom['paginate_url'] . $aLinkAddon['params'] . '&page={page}&per_page={per_page}\');'));
             $aCode['menu_bottom'] = $aCustom['simple_paginate'] ? $oPaginate->getSimplePaginate($aCustom['simple_paginate_url'], -1, -1, $aCustom['simple_paginate_view_all']) : $oPaginate->getPaginate();
         } else {
             $aCode['menu_bottom'] = $aCustom['menu_bottom'];
         }
         $aCode['code'] = DesignBoxContent($aCustom['caption'], $sCode);
     }
     $aCode['menu_top'] = $aCustom['menu_top'];
     return array($aCode['code'], $aCode['menu_top'], $aCode['menu_bottom'], !empty($aCode['code']) ? false : '');
 }
Пример #23
0
    <div class="bx_sys_unit_checkbox bx-def-round-corners">
        <input id="ch{$iRssID}" type="checkbox" value="{$iRssID}" name="crsss[]" />
    </div>
    <div class="bx-def-font-h3" >
        {$sRssUrl}
    </div>
    <div>
        <span style="color:{$sStatusColor};">{$sRssStatus}</span> <span class="sys-bullet"></span> {$sRssDesc}
    </div>
</div>
EOF;
    }
    $sRequest = bx_html_attribute($_SERVER['PHP_SELF']) . '?page={page}&per_page={per_page}';
    ///////////////pagination/////////////////////
    // gen pagination block ;
    $oPaginate = new BxDolPaginate(array('page_url' => $sRequest, 'count' => $iTotalNum, 'per_page' => $iPerPage, 'page' => $iCurPage));
    $sPagination = $oPaginate->getPaginate();
    ///////////////eof pagination/////////////////////
    bx_import('BxTemplSearchResult');
    $oSearchResult = new BxTemplSearchResult();
    $sAdmPanel = $oSearchResult->showAdminActionsPanel('crss_box', array('action_approve' => '_Approve', 'action_disapprove' => '_Disapprove', 'action_delete' => '_Delete'), 'crsss');
    $sUrl = bx_html_attribute($_SERVER['PHP_SELF']);
    $sCode .= <<<EOF
<form action="{$sUrl}" method="post" name="ads_moderation">
    <div id="crss_box" class="bx-def-bc-padding">
        {$sRSSs}
    </div>
    {$sPagination}
    {$sAdmPanel}
</form>
EOF;
Пример #24
0
 function display($aParam, $iBoxId, $sAction = '', $bOrderPanel = false, $iColumns, $sUrl = '')
 {
     if (!isset($aParam['type']) || !$aParam['type']) {
         return MsgBox(_t('_Empty'));
     }
     $sPaginate = '';
     $sCode = '';
     $sPageUrl = $sUrl ? $sUrl : bx_html_attribute($_SERVER['PHP_SELF']);
     $sPageUrl .= '?tags_mode=' . $aParam['type'];
     if (!isset($aParam['orderby']) && isset($_REQUEST['orderby']) && $_REQUEST['orderby'] && isset($this->_aOrderValues[$_REQUEST['orderby']])) {
         $aParam['orderby'] = $_REQUEST['orderby'];
     }
     if (isset($aParam['filter']) && $aParam['filter']) {
         $sPageUrl .= '&filter=' . $aParam['filter'];
     }
     if (isset($aParam['orderby']) && $aParam['orderby']) {
         $sPageUrl .= '&orderby=' . $aParam['orderby'];
     }
     if ($sAction) {
         $sPageUrl .= '&action=' . $sAction;
     }
     if (isset($aParam['date']) && $aParam['date']) {
         $sPageUrl .= '&year=' . $aParam['date']['year'] . '&month=' . $aParam['date']['month'] . '&day=' . $aParam['date']['day'];
     }
     if (isset($aParam['pagination']) && $aParam['pagination']) {
         bx_import('BxDolPaginate');
         $aPaginate = array('page_url' => $sPageUrl . '&page={page}&per_page={per_page}', 'info' => true, 'page_links' => true, 'on_change_page' => "!loadDynamicBlock({$iBoxId}, this.href)");
         $aParam['limit'] = $aPaginate['per_page'] = $aParam['pagination'];
         $aPaginate['count'] = $this->getTagsCount($aParam);
         $aPaginate['page'] = isset($_REQUEST['page']) ? (int) $_REQUEST['page'] : 1;
         $aParam['start'] = $aParam['limit'] * ($aPaginate['page'] - 1);
         if ($aParam['start'] <= 0) {
             $aParam['start'] = 0;
         }
         $oPaginate = new BxDolPaginate($aPaginate);
         $sPaginate = '<div class="clear_both"></div>' . $oPaginate->getPaginate();
     }
     $sHrefTmpl = $this->getHrefWithType($aParam['type']);
     $aTotalTags = $this->getTagList($aParam);
     if ($aTotalTags) {
         if ($bOrderPanel) {
             $sCode .= $this->_getTopBox($aParam, $iBoxId, $sPageUrl);
         }
         $sCode .= $this->getCategoriesView($aTotalTags, $sHrefTmpl, $iColumns) . $sPaginate;
     } else {
         return MsgBox(_t('_Empty'));
     }
     return $sCode;
 }
Пример #25
0
 function showPaginationAjax($sContainerId, $sBaseUrl = false)
 {
     bx_import('BxDolPaginate');
     $sLink = BX_DOL_URL_ROOT . ($sBaseUrl ? $sBaseUrl : $this->aCurrent['paginate']['page_url']);
     $sLink = bx_append_url_params($sLink, 'ajax=1');
     $oPaginate = new BxDolPaginate(array('page_url' => $sLink, 'count' => $this->aCurrent['paginate']['totalNum'], 'per_page' => $this->aCurrent['paginate']['perPage'], 'page' => $this->aCurrent['paginate']['page'], 'per_page_changer' => true, 'page_reloader' => true, 'on_change_page' => 'getHtmlData(\'' . bx_html_attribute($sContainerId) . '\', \'' . bx_html_attribute($sLink) . '&page={page}&per_page={per_page}\'); return false;', 'on_change_per_page' => 'getHtmlData(\'' . bx_html_attribute($sContainerId) . '\', \'' . bx_html_attribute($sLink) . '&page=1&per_page=\' + this.value); return false;'));
     $sPaginate = '<div class="clear_both"></div>' . $oPaginate->getPaginate();
     return $sPaginate;
 }
Пример #26
0
 /**
  * Function will generate the messages rows ;
  *
  * @return         : Html presentation data ;
  */
 function genMessagesRows()
 {
     global $oSysTemplate;
     global $oFunctions;
     global $site;
     // init some needed variables ;
     $sOutputHtml = null;
     $sMessageBoxActions = null;
     $sMessagesTypesList = null;
     $sPerPageBlock = null;
     $aSortToglleElements = array('date_sort_toggle', 'subject_sort_toggle', 'type_sort_toggle', 'author_sort_toggle');
     $aMessageRows = array();
     // language keys ;
     $aLanguageKeys = array('author' => _t('_Author'), 'type' => _t('_Type'), 'subject' => _t('_Subject'), 'date' => _t('_Date'), 'new' => _t('_new'), 'select' => _t('_Select'), 'all' => _t('_All'), 'none' => _t('_None'), 'read' => _t('_Read'), 'unread' => _t('_Unread'), 'delete' => _t('_Delete'), 'spam' => _t('_Spam report'), 'more' => _t('_More actions'), 'mark_read' => _t('_Mark as old'), 'mark_unread' => _t('_Mark as New'), 'restore' => _t('_Restore'), 'click_sort' => _t('_Click to sort'), 'recipient' => _t('_Recipient'));
     // get messages array ;
     $aMessages =& $this->getMessages();
     // generate list of messages types
     if (is_array($this->aRegisteredMessageTypes) and !empty($this->aRegisteredMessageTypes)) {
         foreach ($this->aRegisteredMessageTypes as $iKey => $sRegisteredType) {
             $sChecked = null;
             if (!empty($this->aReceivedMessagesTypes) and in_array($sRegisteredType, $this->aReceivedMessagesTypes)) {
                 $sChecked = ' checked="checked" ';
             }
             $aTemplateKeys = array('letters_type' => $sRegisteredType, 'letters_type_caption' => _t('_' . $sRegisteredType), 'checked' => $sChecked);
             $sMessagesTypesList .= $oSysTemplate->parseHtmlByName($this->aUsedTemplates['messages_types_list'], $aTemplateKeys);
         }
         unset($aTemplateKeys);
     }
     // processing all messages ;
     if (is_array($aMessages) and !empty($aMessages)) {
         // need for row devide ;
         $iIndex = 1;
         foreach ($aMessages as $iKey => $aItems) {
             // generate image and keyword for type of message ;
             $sTypeIcon = getTemplateIcon($this->sMessageIconPrefix . $aItems['Type'] . $this->sMessageIconExtension);
             $sTypeLang = _t('_' . $aItems['Type']);
             // get message's subject ;
             $sSubject = mb_strlen($aItems['Subject']) > $this->iMessageSubjectLength ? mb_substr($aItems['Subject'], 0, $this->iMessageSubjectLength) . '...' : $aItems['Subject'];
             // get message's description ;
             $sDescription = strip_tags($aItems['Text']);
             mb_strlen($sDescription) > $this->iMessageDescrLength ? $sDescription = mb_substr($sDescription, 0, $this->iMessageDescrLength) . '...' : null;
             // generate the `new` message's icon ;
             $sNewMessageImg = $aItems['New'] ? getTemplateIcon('new_message.png') : getTemplateIcon(null);
             // color devider ;
             $sFiledCss = !($iIndex % 2) ? 'filled' : 'not_filled';
             $aProfileInfo = $this->aMailBoxSettings['mailbox_mode'] != 'outbox' ? getProfileInfo($aItems['Sender']) : getProfileInfo($aItems['Recipient']);
             $sMemberIcon = $this->aMailBoxSettings['mailbox_mode'] != 'outbox' ? get_member_icon($aItems['Sender'], 'left') : get_member_icon($aItems['Recipient'], 'left');
             $sMemberLocation = $this->aMailBoxSettings['mailbox_mode'] != 'outbox' ? getProfileLink($aItems['Sender']) : getProfileLink($aItems['Recipient']);
             $sMemberNickName = $aProfileInfo['NickName'];
             $sMemberAge = $aProfileInfo['DateOfBirth'] != "0000-00-00" ? _t("_y/o", age($aProfileInfo['DateOfBirth'])) : null;
             $sMemberCountry = $aProfileInfo['Country'];
             $sMemberFlag = $site['flags'] . strtolower($sMemberCountry) . $this->sMembersFlagExtension;
             $sMemberSexImg = $oFunctions->genSexIcon($aProfileInfo['Sex']);
             if ($sMemberCountry) {
                 $sMemberCountryFlag = '<img src="' . $sMemberFlag . '" alt="' . $sMemberCountry . '" />';
             }
             // generate the message status ;
             $sMessageStatus = $aItems['New'] ? 'unread' : 'read';
             $aMessageRows[] = array('message_id' => $aItems['ID'], 'message_status' => $sMessageStatus, 'message_owner' => $aItems['Sender'], 'message_link' => $aItems['ID'], 'message_page' => 'mail.php', 'member_icon' => $sMemberIcon, 'member_location' => $sMemberLocation, 'member_nickname' => $sMemberNickName, 'member_sex_img' => $sMemberSexImg, 'member_sex' => $aProfileInfo['Sex'], 'member_age' => $sMemberAge, 'member_flag' => $sMemberCountryFlag, 'member_country' => $sMemberCountry, 'message_type' => $sTypeLang, 'message_type_icon' => $sTypeIcon, 'message_subject' => $sSubject, 'message_new_img' => $sNewMessageImg, 'message_new' => $aLanguageKeys['new'], 'message_descr' => $sDescription, 'message_date' => $aItems['Date'], 'filled_class' => $sFiledCss);
             $iIndex++;
         }
     }
     // init sort toggle ellements ;
     switch ($this->aMailBoxSettings['sort_mode']) {
         case 'date':
             $aSortToglleElements['date_sort_toggle'] = 'toggle_up';
             break;
         case 'date_desc':
             $aSortToglleElements['date_sort_toggle'] = 'toggle_down';
             break;
         case 'subject':
             $aSortToglleElements['subject_sort_toggle'] = 'toggle_up';
             break;
         case 'subject_desc':
             $aSortToglleElements['subject_sort_toggle'] = 'toggle_down';
             break;
         case 'type':
             $aSortToglleElements['type_sort_toggle'] = 'toggle_up';
             break;
         case 'type_desc':
             $aSortToglleElements['type_sort_toggle'] = 'toggle_down';
             break;
         case 'author':
             $aSortToglleElements['author_sort_toggle'] = 'toggle_up';
             break;
         case 'author_desc':
             $aSortToglleElements['author_sort_toggle'] = 'toggle_down';
             break;
     }
     // generate the pagination ;
     $sRequest = BX_DOL_URL_ROOT . 'mail.php?';
     // need for additional parameters ;
     $aGetParams = array('mode', 'sorting', 'messages_types');
     if (is_array($aGetParams) and !empty($aGetParams)) {
         foreach ($aGetParams as $sValue) {
             if (isset($_GET[$sValue])) {
                 $sRequest .= '&amp;' . $sValue . '=' . $_GET[$sValue];
             }
         }
     }
     $sCuttedUrl = $sRequest;
     $sRequest = $sRequest . '&amp;page={page}&amp;per_page={per_page}';
     $oPaginate = new BxDolPaginate(array('page_url' => $sRequest, 'count' => $this->iTotalMessageCount, 'per_page' => $this->aMailBoxSettings['per_page'], 'sorting' => $this->aMailBoxSettings['sort_mode'], 'page' => $this->aMailBoxSettings['page'], 'per_page_changer' => false, 'page_reloader' => true, 'on_change_page' => "oMailBoxMessages.getPaginatePage('{$sRequest}')", 'on_change_per_page' => "oMailBoxMessages.getPage(this.value, '{$sCuttedUrl}')"));
     $sPagination = $oPaginate->getPaginate();
     // generate messages section
     if (!empty($aMessageRows)) {
         $aTemplateKeys = array('per_page' => $this->aMailBoxSettings['per_page'], 'page_number' => $this->aMailBoxSettings['page'], 'page_mode' => $this->aMailBoxSettings['mailbox_mode'], 'messages_types' => $this->aMailBoxSettings['messages_types'], 'messages_types_list' => $sMessagesTypesList, 'per_page_block' => $oPaginate->getPages(), 'author' => $this->aMailBoxSettings['mailbox_mode'] != 'outbox' ? $aLanguageKeys['author'] : $aLanguageKeys['recipient'], 'type' => $aLanguageKeys['type'], 'subject' => $aLanguageKeys['subject'], 'date' => $aLanguageKeys['date'], 'click_sort' => $aLanguageKeys['click_sort'], 'bx_repeat:messages' => $aMessageRows, 'sort_date' => $this->aMailBoxSettings['sort_mode'] == 'date' ? 'date_desc' : 'date', 'sort_subject' => $this->aMailBoxSettings['sort_mode'] == 'subject' ? 'subject_desc' : 'subject', 'sort_type' => $this->aMailBoxSettings['sort_mode'] == 'type' ? 'type_desc' : 'type', 'sort_author' => $this->aMailBoxSettings['sort_mode'] == 'author' ? 'author_desc' : 'author', 'date_sort_toggle_ellement' => $aSortToglleElements['date_sort_toggle'], 'subject_sort_toggle_ellement' => $aSortToglleElements['subject_sort_toggle'], 'type_sort_toggle_ellement' => $aSortToglleElements['type_sort_toggle'], 'author_sort_toggle_ellement' => $aSortToglleElements['author_sort_toggle'], 'select' => $aLanguageKeys['select'], 'current_page' => 'mail.php', 'all_messages' => $aLanguageKeys['all'], 'none_messages' => $aLanguageKeys['none'], 'read_messages' => $aLanguageKeys['read'], 'unread_messages' => $aLanguageKeys['unread'], 'pagination_block' => $sPagination);
         // generate extended mailbox actions
         switch ($this->aMailBoxSettings['mailbox_mode']) {
             case 'inbox':
                 $aForm = array('form_attrs' => array('action' => null, 'method' => 'post'), 'params' => array('remove_form' => true, 'db' => array('submit_name' => 'do_submit')), 'inputs' => array('actions' => array('type' => 'input_set', 'colspan' => 'true', 0 => array('type' => 'button', 'value' => $aLanguageKeys['spam'], 'attrs' => array('onclick' => 'if (typeof oMailBoxMessages != \'undefined\') oMailBoxMessages.spamMessages(\'messages_container\')')), 1 => array('type' => 'button', 'value' => $aLanguageKeys['delete'], 'attrs' => array('onclick' => 'if ( typeof oMailBoxMessages != \'undefined\' ) oMailBoxMessages.deleteMessages(\'messages_container\', \'genMessagesRows\')')), 2 => array('type' => 'select', 'values' => array('' => $aLanguageKeys['more'], 'unread' => $aLanguageKeys['mark_unread'], 'read' => $aLanguageKeys['mark_read']), 'attrs' => array('onchange' => 'if ( typeof oMailBoxMessages != \'undefined\' ) oMailBoxMessages.markMessages(this.value, \'genMessagesRows\')')))));
                 $oForm = new BxTemplFormView($aForm);
                 $sMessageBoxActions = $oForm->getCode();
                 break;
             case 'outbox':
                 $aForm = array('form_attrs' => array('action' => null, 'method' => 'post'), 'params' => array('remove_form' => true, 'db' => array('submit_name' => 'do_submit')), 'inputs' => array('actions' => array('type' => 'input_set', 'colspan' => 'true', 0 => array('type' => 'button', 'value' => $aLanguageKeys['delete'], 'attrs' => array('onclick' => 'if ( typeof oMailBoxMessages != \'undefined\' ) oMailBoxMessages.deleteMessages(\'messages_container\', \'genMessagesRows\')')))));
                 $oForm = new BxTemplFormView($aForm);
                 $sMessageBoxActions = $oForm->getCode();
                 break;
             case 'trash':
                 $aForm = array('form_attrs' => array('action' => null, 'method' => 'post'), 'params' => array('remove_form' => true, 'db' => array('submit_name' => 'do_submit')), 'inputs' => array('actions' => array('type' => 'input_set', 'colspan' => 'true', 0 => array('type' => 'button', 'value' => $aLanguageKeys['restore'], 'attrs' => array('onclick' => 'if ( typeof oMailBoxMessages != \'undefined\' ) oMailBoxMessages.restoreMessages(\'messages_container\', \'genMessagesRows\')')), 1 => array('type' => 'button', 'value' => $aLanguageKeys['delete'], 'attrs' => array('onclick' => 'if ( typeof oMailBoxMessages != \'undefined\' ) oMailBoxMessages.hideDeletedMessages(\'messages_container\', \'genMessagesRows\')')))));
                 $oForm = new BxTemplFormView($aForm);
                 $sMessageBoxActions = $oForm->getCode();
                 break;
         }
         $aTemplateKeys['messages_actions_block'] = $sMessageBoxActions;
         //return builded rows ;
         $sMessagesSection = $oSysTemplate->parseHtmlByName($this->aUsedTemplates['messages_box'], $aTemplateKeys);
         $sPerPageBlock = $oPaginate->getPages();
     } else {
         $sMessagesSection = MsgBox(_t('_Empty'));
     }
     // generate mailboxe's top section ;
     $aTemplateKeys = array('per_page' => $this->aMailBoxSettings['per_page'], 'page_number' => $this->aMailBoxSettings['page'], 'page_mode' => $this->aMailBoxSettings['mailbox_mode'], 'messages_types' => $this->aMailBoxSettings['messages_types'], 'messages_sort' => $this->aMailBoxSettings['sort_mode'], 'messages_section' => $sMessagesSection, 'messages_types_list' => $sMessagesTypesList, 'per_page_block' => $sPerPageBlock);
     $sOutputHtml = $oSysTemplate->parseHtmlByName($this->aUsedTemplates['messages_top_section'], $aTemplateKeys);
     // return all builded data ;
     return $sOutputHtml;
 }
Пример #27
0
 function getPhotoBlock($aParams = array())
 {
     $aShowParams = array('showRate' => 1, 'showPaginate' => 0, 'showViews' => 0, 'showDate' => 0, 'showLink' => 0, 'showFrom' => 0);
     if (count($aParams) > 0) {
         foreach ($aParams as $sKeyName => $sKeyValue) {
             switch ($sKeyName) {
                 case 'PID':
                     $this->aCurrent['restriction']['owner']['value'] = (int) $sKeyValue;
                     break;
                 case 'Category':
                     $this->aCurrent['restriction']['category']['value'] = strip_tags($sKeyValue);
                     break;
                 case 'Tag':
                     $this->aCurrent['restriction']['tag']['value'] = strip_tags($sKeyValue);
                     break;
                 case 'Limit':
                     $this->aCurrent['paginate']['perPage'] = (int) $sKeyValue;
                     break;
                 case 'DisplayPagination':
                     if ($sKeyValue == 1) {
                         $aShowParams['showPaginate'] = 1;
                     }
                     break;
                 case 'DisplayViews':
                     if ($sKeyValue == 1) {
                         $aShowParams['showViews'] = 1;
                     }
                     break;
                 case 'DisplayWhenAgo':
                     if ($sKeyValue == 1) {
                         $aShowParams['showDate'] = 1;
                     }
                     break;
                 case 'DisplayLink':
                     if ($sKeyValue == 1) {
                         $aShowParams['showLink'] = 1;
                     }
                     break;
                 case 'DisplayProfile':
                     if ($sKeyValue == 1) {
                         $aShowParams['showFrom'] = 1;
                     }
                     break;
             }
         }
     }
     $this->aCurrent['paginate']['perPage'] = 20;
     $aFilesList = $this->getSearchData();
     $iCnt = $this->aCurrent['paginate']['totalNum'];
     if ($iCnt) {
         $aUnit = array();
         $aUnits = array();
         if (defined('BX_PROFILE_PAGE') || defined('BX_MEMBER_PAGE')) {
             $iPhotoWidth = 294;
             $sImgWidth = 'style="width:' . $iPhotoWidth . 'px;"';
         } else {
             $iPhotoWidth = (int) $this->oModule->_oConfig->getGlParam('file_width');
             $iPhotoWidth = $iPhotoWidth > 1 ? $iPhotoWidth : 600;
             $sImgWidth = '';
         }
         foreach ($aFilesList as $iKey => $aData) {
             $sPicUrl = $this->getImgUrl($aData['Hash'], 'icon');
             $aUnits[] = array('imageId' => $iKey + 1, 'picUrl' => $sPicUrl);
             $sPicLinkElements .= 'aPicLink[' . ($iKey + 1) . '] = ' . $aData['id'] . ';';
             if ($iKey == 0) {
                 $aAdd = array('switchWidth' => $iPhotoWidth + 2, 'imgWidth' => $sImgWidth);
                 $aUnit['switcherUnit'] = $this->getSwitcherUnit($aData, $aShowParams, $aAdd);
             }
         }
         $aUnit['moduleUrl'] = BX_DOL_URL_ROOT . $this->oModule->_oConfig->getBaseUri();
         $aUnit['bx_repeat:iconBlock'] = $aUnits;
         $aUnit['count'] = $iCnt;
         $aUnit['contWidth'] = $iCnt * 40;
         $aUnit['picWidth'] = $iPhotoWidth;
         $aUnit['picBoxWidth'] = $aUnit['switchWidth'] = $iPhotoWidth + 2;
         $aUnit['switchWidthOut'] = $aUnit['switchWidth'] + 4;
         if ($aUnit['contWidth'] > $aUnit['picWidth']) {
             $bScroller = true;
             $aUnit['containerWidth'] = $aUnit['picBoxWidth'] - 72;
         } else {
             $bScroller = false;
             $aUnit['containerWidth'] = $aUnit['contWidth'];
         }
         $aUnit['bx_if:scrollerBack'] = array('condition' => $bScroller, 'content' => array(1));
         $aUnit['bx_if:scrollerNext'] = array('condition' => $bScroller, 'content' => array(1));
         $aUnit['picLinkElements'] = $sPicLinkElements;
         if ($aShowParams['showPaginate'] == 1) {
             $aLinkAddon = $this->getLinkAddByPrams();
             $oPaginate = new BxDolPaginate(array('page_url' => $aUnit['changeUrl'], 'count' => $iCnt, 'info' => false, 'per_page' => 1, 'page' => $this->aCurrent['paginate']['page'], 'per_page_changer' => false, 'page_reloader' => false, 'on_change_page' => 'getCurrentImage({page})'));
             $aUnit['paginate'] = $oPaginate->getPaginate();
         } else {
             $aUnit['paginate'] = '';
         }
         $this->oTemplate->addCss('search.css');
         return $this->oTemplate->parseHtmlByName('photo_switcher.html', $aUnit);
     } elseif ($this->oModule->_iProfileId != 0 && $this->oModule->_iProfileId == (int) $this->aCurrent['restriction']['owner']['value']) {
         ob_start();
         ?>
         <div class="paginate">
             <div class="view_all" style="background-image:url(__img_src__)">            
                 <a href="__lnk_url__" title="__lnk_title__">__lnk_content__</a>
             </div>
          </div>
         <?php 
         $sCode = ob_get_clean();
         $sLinkTitle = _t('_bx_photos_add');
         $sNickName = getNickName($this->oModule->_iProfileId);
         $sCaption = uriFilter(str_replace('{nickname}', $sNickName, $this->oModule->_oConfig->getGlParam('profile_album_name')));
         $aUnit = array('img_src' => $this->oTemplate->getIconUrl('more.png'), 'lnk_url' => $this->oModule->_oConfig->getBaseUri() . 'albums/my/add_objects/' . $sCaption . '/owner/' . $sNickName, 'lnk_title' => $sLinkTitle, 'lnk_content' => $sLinkTitle);
         return MsgBox(_t('_Empty')) . $this->oTemplate->parseHtmlByContent($sCode, $aUnit);
     }
     return MsgBox(_t('_Empty'));
 }
Пример #28
0
    /**
     * Ads block for profile page (as PHP function). List of latest ads of member.
     *
     * @param $_iProfileID - member id
     *
     * @return html of last ads units
     */
    function serviceAdsProfilePage($_iProfileID)
    {
        $GLOBALS['oTopMenu']->setCurrentProfileID($_iProfileID);
        bx_import('SearchUnit', $this->_aModule);
        $oTmpAdsSearch = new BxAdsSearchUnit();
        $oTmpAdsSearch->aCurrent['paginate']['perPage'] = 10;
        $oTmpAdsSearch->aCurrent['sorting'] = 'last';
        $oTmpAdsSearch->aCurrent['restriction']['owner']['value'] = $_iProfileID;
        $sMemberAds = $oTmpAdsSearch->displayResultBlock();
        if ($oTmpAdsSearch->aCurrent['paginate']['totalNum'] > 0) {
            $sClr = '<div class="clear_both"></div>';
            if ($oTmpAdsSearch->aCurrent['paginate']['perPage'] < $oTmpAdsSearch->aCurrent['paginate']['totalNum']) {
                $sAjLink = BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . 'get_list/';
                bx_import('BxDolPaginate');
                $sBoxId = 'ads_' . $_iProfileID . '_view';
                $oPgn = new BxDolPaginate(array('page_url' => 'javascript:void();', 'count' => $oTmpAdsSearch->aCurrent['paginate']['totalNum'], 'per_page' => $oTmpAdsSearch->aCurrent['paginate']['perPage'], 'page' => $oTmpAdsSearch->aCurrent['paginate']['page'], 'on_change_page' => "getHtmlData('{$sBoxId}', '{$sAjLink}view/{$_iProfileID}&page={page}&per_page={per_page}');", 'on_change_per_page' => "getHtmlData('{$sBoxId}', '{$sAjLink}view/{$_iProfileID}&page=1&per_page=' + this.value);"));
                $sMemberAds = '<div id="' . $sBoxId . '">' . $sMemberAds . $sClr . $oPgn->getPaginate() . '</div>';
            }
            return <<<EOF
<div class="clear_both"></div>
<div class="dbContent">
    {$sMemberAds}
    {$sClr}
</div>
EOF;
        }
    }
Пример #29
0
 /**
  * Site avatars html
  * @param $iPage - current page in site avatars
  * @return html with site avatars
  */
 function serviceGetSiteAvatars($iPage)
 {
     $iPage = (int) $iPage ? (int) $iPage : 1;
     $iPerPage = 12;
     $iCounter = 0;
     $iStart = ($iPage - 1) * $iPerPage;
     $aFiles = array();
     if ($h = opendir(BX_AVA_DIR_SITE_AVATARS)) {
         while (($sFile = readdir($h)) !== false) {
             if ('.' == $sFile[0]) {
                 continue;
             }
             if ($iCounter++ < $iStart) {
                 continue;
             }
             if ($iCounter - $iStart <= $iPerPage) {
                 $aFiles[] = array('url' => BX_AVA_URL_SITE_AVATARS . $sFile, 'name' => $sFile);
             }
         }
         closedir($h);
     }
     bx_import('BxDolPaginate');
     $oPaginate = new BxDolPaginate(array('page_url' => 'javascript:void(0);', 'count' => $iCounter, 'per_page' => $iPerPage, 'page' => $iPage, 'on_change_page' => "getHtmlData('bx_ava_site_avatars', '" . $this->_oConfig->getBaseUri() . "get_site_avatars/{page}');"));
     $sAjaxPaginate = $oPaginate->getSimplePaginate('', -1, -1, false);
     $sScript = "<script>\n            \$(document).ready(function() {\n                \$('#bx_ava_site_avatars .bx_ava_tar .bx_ava_actions a').bind('click', function (e) {\n                    var e = \$(this);\n                    getHtmlData('bx_ava_my_avatars', '" . $this->_oConfig->getBaseUri() . "set_site_avatar/' + \$(this).attr('alt'), function () {\n                        e.html('" . bx_js_string(_t('_bx_ava_ok'), BX_ESCAPE_STR_APOS) . "');\n                    }, 'post');\n                });\n            });\n        </script>";
     $aVars = array('bx_repeat:avatars' => $aFiles);
     return $sAjaxPaginate . '<div class="bx-def-padding-thd">' . $GLOBALS['oFunctions']->centerContent($this->_oTemplate->parseHtmlByName('avatars_site', $aVars), '.bx_ava_tar') . '</div>' . $sAjaxPaginate . $sScript;
 }
Пример #30
0
 function getResultCodeArray(&$oSearch, $sCode)
 {
     $aCode = array('code' => MsgBox(_t('_Empty')), 'paginate' => '');
     $iCount = $oSearch->aCurrent['paginate']['totalNum'];
     if ($iCount > 0) {
         $aCode['code'] = $GLOBALS['oFunctions']->centerContent($sCode, '.sys_file_search_unit');
         $sLink = BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . 'administration/home/' . $oSearch->aCurrent['restriction']['activeStatus']['value'];
         $sKeyWord = bx_get('keyword');
         if ($sKeyWord !== false) {
             $sLink .= '&keyword=' . clear_xss($sKeyWord);
         }
         $aExclude = array('r');
         $aLinkAddon = $oSearch->getLinkAddByPrams($aExclude);
         $oPaginate = new BxDolPaginate(array('page_url' => $sLink, 'count' => $iCount, 'per_page' => $oSearch->aCurrent['paginate']['perPage'], 'page' => $oSearch->aCurrent['paginate']['page'], 'on_change_page' => 'return !loadDynamicBlock(' . $oSearch->id . ', \'' . $sLink . $aLinkAddon['params'] . $aLinkAddon['paginate'] . '\');', 'on_change_per_page' => 'return !loadDynamicBlock(' . $oSearch->id . ', \'' . $sLink . $aLinkAddon['params'] . '&page=1&per_page=\' + this.value);'));
         $aCode['paginate'] = $oPaginate->getPaginate();
     }
     return $aCode;
 }