Пример #1
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;
 }
Пример #2
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);
 }
Пример #3
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, '');
 }
Пример #4
0
 function showPagination2($bAdmin = false, $sOverrideViewAllUrl = false, $bShort = true)
 {
     bx_import('BxDolPaginate');
     $aLinkAddon = $this->getLinkAddByPrams();
     $sAllUrl = $sOverrideViewAllUrl ? $sOverrideViewAllUrl : $this->getCurrentUrl('browseAll', 0, '');
     $sLink = bx_html_attribute($_SERVER['PHP_SELF']) . '?blogs_mode=' . $this->aCurrent['sorting'] . $aLinkAddon['params'];
     $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' => 'return !loadDynamicBlock({id}, \'' . $sLink . '&page={page}&per_page={per_page}\');', 'on_change_per_page' => 'return !loadDynamicBlock({id}, \'' . $sLink . '&page=1&per_page=\' + this.value);'));
     $sPaginate = $bShort ? $oPaginate->getSimplePaginate($sAllUrl) : $oPaginate->getPaginate();
     $sPaginate = '<div class="clear_both"></div>' . $sPaginate;
     return $sPaginate;
 }
Пример #5
0
 function showBlockMutualFriends($sCaption, $bNoDB = false)
 {
     $iViewer = getLoggedId();
     if ($this->_iProfileID == $iViewer) {
         return;
     }
     if ($this->iCountMutFriends > 0) {
         $sCode = $sPaginate = '';
         $iPerPage = $this->iFriendsPerPage;
         $iPage = (int) $_GET['page'] > 0 ? (int) $_GET['page'] : 1;
         $aTmplVars = array('bx_repeat:friends' => array());
         foreach ($this->aMutualFriends as $iKey => $sValue) {
             $aTmplVars['bx_repeat:friends'][] = array('content' => get_member_thumbnail($iKey, 'none', true));
         }
         $sCode = $GLOBALS['oSysTemplate']->parseHtmlByName('profile_friends.html', $aTmplVars);
         if ($this->iCountMutFriends > $iPerPage) {
             $oPaginate = new BxDolPaginate(array('page_url' => BX_DOL_URL_ROOT . 'profile.php', 'count' => $this->iCountMutFriends, 'per_page' => $iPerPage, 'page' => $iPage, 'on_change_page' => 'return !loadDynamicBlock({id}, \'' . getProfileLink($this->_iProfileID) . '?page={page}&per_page={per_page}\');'));
             $sPaginate = $oPaginate->getSimplePaginate('', -1, -1, false);
         }
         if ($bNoDB) {
             return array($sCode, array(), $sPaginate, true);
         } else {
             return DesignBoxContent(_t($sCaption), $sCode, 1);
         }
     }
 }
Пример #6
0
 function getMembers($sBlockName, $aParams = array(), $iLimit = 16, $sMode = 'last')
 {
     $aDefFields = array('ID', 'NickName', 'Couple', 'Sex');
     $sCode = '';
     $iOnlineTime = (int) getParam("member_online_time");
     //main fields
     $sqlMainFields = "";
     foreach ($aDefFields as $iKey => $sValue) {
         $sqlMainFields .= "`Profiles`. `{$sValue}`, ";
     }
     $sqlMainFields .= "if(`DateLastNav` > SUBDATE(NOW(), INTERVAL {$iOnlineTime} MINUTE ), 1, 0) AS `is_online`";
     // possible conditions
     $sqlCondition = "WHERE `Profiles`.`Status` = 'Active' and (`Profiles`.`Couple` = 0 or `Profiles`.`Couple` > `Profiles`.`ID`)";
     if (is_array($aParams)) {
         foreach ($aParams as $sField => $sValue) {
             $sqlCondition .= " AND `Profiles`.`{$sField}` = '{$sValue}'";
         }
     }
     // top menu and sorting
     $aModes = array('last', 'top', 'online');
     $aDBTopMenu = array();
     if (empty($_GET[$sBlockName . 'Mode'])) {
         $sMode = 'last';
     } else {
         $sMode = in_array($_GET[$sBlockName . 'Mode'], $aModes) ? $_GET[$sBlockName . 'Mode'] : ($sMode = 'last');
     }
     $sqlOrder = "";
     foreach ($aModes as $sMyMode) {
         switch ($sMyMode) {
             case 'online':
                 if ($sMode == $sMyMode) {
                     $sqlCondition .= " AND `Profiles`.`DateLastNav` > SUBDATE(NOW(), INTERVAL " . $iOnlineTime . " MINUTE)";
                     $sqlOrder = " ORDER BY `Profiles`.`Couple` ASC";
                 }
                 $sModeTitle = _t('_Online');
                 break;
             case 'last':
                 if ($sMode == $sMyMode) {
                     $sqlOrder = " ORDER BY `Profiles`.`Couple` ASC, `Profiles`.`DateReg` DESC";
                 }
                 $sModeTitle = _t('_Latest');
                 break;
             case 'top':
                 if ($sMode == $sMyMode) {
                     $oVotingView = new BxTemplVotingView('profile', 0, 0);
                     $aSql = $oVotingView->getSqlParts('`Profiles`', '`ID`');
                     $sqlOrder = $oVotingView->isEnabled() ? " ORDER BY `Profiles`.`Couple` ASC, (`pr_rating_sum`/`pr_rating_count`) DESC, `pr_rating_count` DESC, `Profiles`.`DateReg` DESC" : $sqlOrder;
                     $sqlMainFields .= $aSql['fields'];
                     $sqlLJoin = $aSql['join'];
                     $sqlCondition .= " AND `pr_rating_count` > 1";
                 }
                 $sModeTitle = _t('_Top');
                 break;
         }
         $aDBTopMenu[$sModeTitle] = array('href' => BX_DOL_URL_ROOT . "index.php?{$sBlockName}Mode={$sMyMode}", 'dynamic' => true, 'active' => $sMyMode == $sMode);
     }
     if (empty($sqlLJoin)) {
         $sqlLJoin = '';
     }
     $iCount = (int) db_value("SELECT COUNT(`Profiles`.`ID`) FROM `Profiles` {$sqlLJoin} {$sqlCondition}");
     $aData = array();
     $sPaginate = '';
     if ($iCount) {
         $iLimit = (int) $iLimit > 0 ? (int) $iLimit : 8;
         $iPages = ceil($iCount / $iLimit);
         $iPage = empty($_GET['page']) ? 1 : (int) $_GET['page'];
         if ($iPage > $iPages) {
             $iPage = $iPages;
         }
         if ($iPage < 1) {
             $iPage = 1;
         }
         $sqlFrom = ($iPage - 1) * $iLimit;
         $sqlLimit = "LIMIT {$sqlFrom}, {$iLimit}";
         $sqlQuery = "SELECT " . $sqlMainFields . " FROM `Profiles` {$sqlLJoin} {$sqlCondition} {$sqlOrder} {$sqlLimit}";
         $rData = db_res($sqlQuery);
         $iCurrCount = mysql_num_rows($rData);
         $aOnline = $aTmplVars = array();
         while ($aData = mysql_fetch_assoc($rData)) {
             $aOnline['is_online'] = $aData['is_online'];
             $aTmplVars[] = array('thumbnail' => get_member_thumbnail($aData['ID'], 'none', true, 'visitor', $aOnline));
         }
         $sCode = $GLOBALS['oSysTemplate']->parseHtmlByName('members_list.html', array('bx_repeat:list' => $aTmplVars));
         if ($iPages > 1) {
             $oPaginate = new BxDolPaginate(array('page_url' => BX_DOL_URL_ROOT . 'index.php', 'count' => $iCount, 'per_page' => $iLimit, 'page' => $iPage, 'on_change_page' => 'return !loadDynamicBlock({id}, \'index.php?' . $sBlockName . 'Mode=' . $sMode . '&page={page}&per_page={per_page}\');'));
             $sPaginate = $oPaginate->getSimplePaginate(BX_DOL_URL_ROOT . 'browse.php');
         }
     } else {
         $sCode = MsgBox(_t("_Empty"));
     }
     return array($sCode, $aDBTopMenu, $sPaginate, true);
 }
Пример #7
0
 /**
  * Generate spy block
  *
  * @param $aVars array
  *               $aVars[type] - string
  *               $aVars[page_url] - string
  *               $aVars[page] - integer
  *               $aVars[profile] - integer
  * @return array
  */
 function _getSpyBlock($aVars)
 {
     if (!isset($aVars['active'])) {
         $aVars['active'] = false;
     }
     if (!isset($aVars['dynamic'])) {
         $aVars['dynamic'] = bx_get('dynamic') !== false;
     }
     if (!isset($aVars['type'])) {
         $aVars['type'] = bx_get('type') !== false ? bx_get('type') : 'all';
     }
     if (!isset($aVars['page_ajax'])) {
         $aVars['page_ajax'] = true;
     }
     if (!isset($aVars['page'])) {
         $aVars['page'] = bx_get('page') !== false ? (int) bx_get('page') : 1;
     }
     $aVars['page'] = $aVars['page'] > 0 ? $aVars['page'] : 1;
     //-- set search filter --//
     $this->oSearch->aCurrent['restriction']['viewed']['value'] = '';
     if ($aVars['type'] != 'all') {
         $this->oSearch->aCurrent['restriction']['type']['value'] = process_db_input($aVars['type'], BX_TAGS_STRIP);
     }
     switch ($this->sSpyMode) {
         case 'friends_events':
             $this->oSearch->aCurrent['join']['friends_data'] = array('type' => 'INNER', 'table' => $this->_oDb->sTablePrefix . 'friends_data', 'mainField' => 'id', 'onField' => 'event_id', 'joinFields' => array());
             $this->oSearch->aCurrent['restriction']['friends']['value'] = $aVars['profile'];
             $this->oSearch->aCurrent['restriction']['no_my']['value'] = $aVars['profile'];
             break;
         default:
             //--- get only member's activity ---//
             if ($aVars['profile']) {
                 $this->oSearch->aCurrent['restriction']['only_me']['value'] = $aVars['profile'];
             }
     }
     //-- get data --//
     $aActivites = $this->oSearch->getSearchData();
     $sActivites = $this->_proccesActivites($aActivites);
     $sOutputCode = $this->_oTemplate->getWrapper($this->sEventsWrapper, $aActivites ? $sActivites : MsgBox(_t('_Empty')));
     //-- process pagination URL --//
     $sPaginate = '';
     if ($this->oSearch->aCurrent['paginate']['totalNum'] > $this->_oConfig->iPerPage) {
         $aVars['page_url'] .= (strpos($aVars['page_url'], '?') === false ? '?' : '&amp;') . 'type=' . $aVars['type'] . '&page={page}&per_page={per_page}';
         $sOnClick = '';
         if ($aVars['page_ajax']) {
             $sOnClick = 'return !loadDynamicBlock({id}, \'' . $aVars['page_url'] . '\')';
         }
         $oPaginate = new BxDolPaginate(array('page_url' => $aVars['page_url'], 'count' => $this->oSearch->aCurrent['paginate']['totalNum'], 'per_page' => $this->_oConfig->iPerPage, 'page' => $aVars['page'], 'on_change_page' => $sOnClick));
         $sPaginate = $oPaginate->getSimplePaginate(null, -1, -1, false);
     }
     if ($aVars['dynamic']) {
         header('Content-Type: text/html; charset=utf-8');
     } else {
         $this->_oTemplate->addCss('spy.css');
     }
     //-- check init part --//
     if ($aVars['page'] == 1) {
         $sOutputCode = $this->getInitPart($aVars['type'], $aVars['profile'], $aVars['active']) . $sOutputCode;
     }
     return array($sOutputCode, array(), $sPaginate, true);
 }
Пример #8
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);
 }
Пример #9
0
 function getBottomMenu($sAllLinkType = 'browseAll', $iId = 0, $sUri = '', $aExclude = array(), $bPgnSim = TRUE)
 {
     if (strpos($sAllLinkType, 'http') === false) {
         if (isset($this->aConstants['linksTempl'][$sAllLinkType])) {
             $sAllUrl = $this->getCurrentUrl($sAllLinkType, $iId, $sUri);
         } else {
             $sAllUrl = $this->getCurrentUrl('browseAll', 0, '');
         }
     } else {
         $sAllUrl = $sAllLinkType;
     }
     $sModeName = $this->aCurrent['name'] . '_mode';
     $sMode = isset($_GET[$sModeName]) ? '&' . $sModeName . '=' . rawurlencode($_GET[$sModeName]) : $sModeName . '=' . $this->aCurrent['sorting'];
     $aLinkAddon = $this->getLinkAddByPrams($aExclude);
     $sLink = bx_html_attribute($_SERVER['PHP_SELF']);
     $oPaginate = new BxDolPaginate(array('page_url' => $sAllUrl, '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' => 'return !loadDynamicBlock({id}, \'' . $sLink . '?' . $sMode . $aLinkAddon['params'] . $aLinkAddon['paginate'] . '\');', 'on_change_per_page' => 'return !loadDynamicBlock({id}, \'' . $sLink . '?' . $sMode . $aLinkAddon['params'] . '&page=1&per_page=\' + this.value);'));
     return $bPgnSim ? $oPaginate->getSimplePaginate($sAllUrl) : $oPaginate->getPaginate();
 }
Пример #10
0
function PageCodeLog($sMode)
{
    switch ($sMode) {
        case 'dnsbl':
        case 'dnsbluri':
        case 'akismet':
        case 'stopforumspam':
            break;
        default:
            $sMode = 'dnsbl';
    }
    $iPage = isset($_GET['page']) && (int) $_GET['page'] > 0 ? (int) $_GET['page'] : 1;
    $iPerPage = 12;
    $iStart = ($iPage - 1) * $iPerPage;
    $aLog = $GLOBALS['MySQL']->getAll("SELECT SQL_CALC_FOUND_ROWS * FROM `sys_antispam_block_log` WHERE `type` = ? ORDER BY `added` DESC LIMIT {$iStart}, {$iPerPage}", [$sMode]);
    $iCount = $GLOBALS['MySQL']->getOne("SELECT FOUND_ROWS()");
    foreach ($aLog as $k => $r) {
        $aLog[$k]['ip'] = long2ip($r['ip']);
        $aLog[$k]['member_url'] = $r['member_id'] ? getProfileLink($r['member_id']) : 'javascript:void(0);';
        $aLog[$k]['member_nickname'] = $r['member_id'] ? getNickName($r['member_id']) : _t('_Guest');
        $aLog[$k]['extra'] = bx_html_attribute($r['extra']);
        $aLog[$k]['ago'] = defineTimeInterval($r['added']);
    }
    $sPaginate = '';
    if ($iCount > $iPerPage) {
        $sUrlStart = BX_DOL_URL_ADMIN . 'antispam.php?action=log&type=' . $sMode;
        $oPaginate = new BxDolPaginate(array('page_url' => 'javascript:void(0);', 'count' => $iCount, 'per_page' => $iPerPage, 'page' => $iPage, 'on_change_page' => "getHtmlData('sys-adm-antispam-log', '{$sUrlStart}&page={page}');"));
        $sPaginate = $oPaginate->getSimplePaginate(false, -1, -1, false);
    }
    if (is_array($aLog) && !empty($aLog)) {
        return $GLOBALS['oAdmTemplate']->parseHtmlByName('antispam_log.html', array('bx_repeat:items' => $aLog, 'paginate' => $sPaginate));
    } else {
        return MsgBox(_t('_Empty'));
    }
}
Пример #11
0
 function showPagination2($bAdmin = false)
 {
     $aLinkAddon = $this->getLinkAddByPrams();
     $sAllUrl = $this->getCurrentUrl('browseAll', 0, '');
     $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, 'on_change_page' => 'return !loadDynamicBlock({id}, \'' . bx_html_attribute($_SERVER['PHP_SELF']) . '?ads_mode=' . $this->aCurrent['sorting'] . $aLinkAddon['params'] . '&page={page}&per_page={per_page}\');'));
     $sPaginate = '<div class="clear_both"></div>' . $oPaginate->getSimplePaginate($sAllUrl);
     return $sPaginate;
 }
Пример #12
0
 /**
  * Generate spy block
  * 
  * @param $aVars array
  * 		$aVars[type] - string
  * 		$aVars[page_url] - string
  * 		$aVars[page] - integer
  * 		$aVars[page_block] - integer
  * 		$aVars[profile] - integer
  * @return array
  */
 function _getSpyBlock($aVars)
 {
     $sPaginate = '';
     //-- Set search filter --//
     $this->oSearch->aCurrent['restriction']['viewed']['value'] = '';
     if ('all' != $aVars['type']) {
         $this->oSearch->aCurrent['restriction']['type']['value'] = process_db_input($aVars['type'], BX_TAGS_STRIP);
     }
     if ($aVars['profile']) {
         // get only member's activity;
         $this->oSearch->aCurrent['restriction']['only_me']['value'] = $aVars['profile'];
     }
     //--
     //-- get data --//
     $aActivites = $this->oSearch->getSearchData();
     $sActivites = $this->_proccesActivites($aActivites);
     //--
     $sOutputCode = $this->_oTemplate->getWrapper($this->sEventsWrapper, $aActivites ? $sActivites : MsgBox(_t('_Empty')));
     //-- process top block's links --//
     $aDBTopMenu = array();
     $aDBTopMenu[_t('_bx_spy_all_activity')] = array('href' => $aVars['page_url'] . '?type=all', 'dynamic' => true, 'active' => $aVars['type'] == 'all');
     $aDBTopMenu[_t('_bx_spy_content_updates')] = array('href' => $aVars['page_url'] . '?type=content_activity', 'dynamic' => true, 'active' => $aVars['type'] == 'content_activity');
     $aDBTopMenu[_t('_bx_spy_profiles_updates')] = array('href' => $aVars['page_url'] . '?type=profiles_activity', 'dynamic' => true, 'active' => $aVars['type'] == 'profiles_activity');
     //--
     //-- process pagination URL --//
     if ($this->oSearch->aCurrent['paginate']['totalNum'] > $this->_oConfig->iPerPage) {
         $sPaginationUrl = 'return !loadDynamicBlock({id}, \'' . $aVars['page_url'] . '?pageBlock=' . $aVars['page_block'] . '&amp;type=' . $aVars['type'] . '&page={page}&per_page={per_page}\');';
         $oPaginate = new BxDolPaginate(array('page_url' => $aVars['page_url'], 'count' => $this->oSearch->aCurrent['paginate']['totalNum'], 'per_page' => $this->_oConfig->iPerPage, 'page' => $aVars['page'], 'per_page_changer' => false, 'page_reloader' => false, 'on_change_page' => $sPaginationUrl, 'on_change_per_page' => ''));
         $sPaginate = $oPaginate->getSimplePaginate(null, -1, -1, false);
     }
     //--
     //-- check init part --//
     if ($aVars['page'] == 1) {
         $sOutputCode = $this->getInitPart($aVars['type'], $aVars['profile']) . $sOutputCode;
     }
     //--
     //concate stop notification code
     $sOutputCode = $this->_oTemplate->getStopNotificationCode() . $sOutputCode;
     return array($sOutputCode, $aDBTopMenu, $sPaginate);
 }
Пример #13
0
 function _blockFans($iPerPage, $sFuncIsAllowed = 'isAllowedViewFans', $sFuncGetFans = 'getFans')
 {
     if (!$this->_oMain->{$sFuncIsAllowed}($this->aDataEntry)) {
         return '';
     }
     $iPage = (int) $_GET['page'];
     if ($iPage < 1) {
         $iPage = 1;
     }
     $iStart = ($iPage - 1) * $iPerPage;
     $aProfiles = array();
     $iNum = $this->_oDb->{$sFuncGetFans}($aProfiles, $this->aDataEntry[$this->_oDb->_sFieldId], true, $iStart, $iPerPage);
     if (!$iNum || !$aProfiles) {
         return MsgBox(_t("_Empty"));
     }
     bx_import('BxTemplSearchProfile');
     $oBxTemplSearchProfile = new BxTemplSearchProfile();
     $sMainContent = '';
     foreach ($aProfiles as $aProfile) {
         $sMainContent .= $oBxTemplSearchProfile->displaySearchUnit($aProfile, array('ext_css_class' => 'bx-def-margin-sec-top-auto'));
     }
     $ret .= $sMainContent;
     $ret .= '<div class="clear_both"></div>';
     $oPaginate = new BxDolPaginate(array('page_url' => 'javascript:void(0);', 'count' => $iNum, 'per_page' => $iPerPage, 'page' => $iPage, 'on_change_page' => 'return !loadDynamicBlock({id}, \'' . bx_append_url_params(BX_DOL_URL_ROOT . $this->_oMain->_oConfig->getBaseUri() . "view/" . $this->aDataEntry[$this->_oDb->_sFieldUri], 'page={page}&per_page={per_page}') . '\');'));
     $sAjaxPaginate = $oPaginate->getSimplePaginate('', -1, -1, false);
     return array($ret, array(), $sAjaxPaginate);
 }
Пример #14
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);
 }
Пример #15
0
 function getBlockCode_Friends()
 {
     $iLimit = 10;
     $sAllFriends = 'viewFriends.php?iUser='******'';
     if ($iCount) {
         $iPages = ceil($iCount / $iLimit);
         $iPage = isset($_GET['page']) ? (int) $_GET['page'] : 1;
         if ($iPage < 1) {
             $iPage = 1;
         }
         if ($iPage > $iPages) {
             $iPage = $iPages;
         }
         $sqlFrom = ($iPage - 1) * $iLimit;
         $sqlLimit = "LIMIT {$sqlFrom}, {$iLimit}";
     } else {
         return;
     }
     $aAllFriends = getMyFriendsEx($this->iMember, '', 'image', $sqlLimit);
     $iCurrCount = count($aAllFriends);
     foreach ($aAllFriends as $iFriendID => $aFriendsPrm) {
         $sOutputHtml .= '<div class="member_block">';
         $sOutputHtml .= get_member_thumbnail($iFriendID, 'none', true, 'visitor', array('is_online' => $aFriendsPrm[5]));
         $sOutputHtml .= '</div>';
     }
     $sOutputHtml = $GLOBALS['oFunctions']->centerContent($sOutputHtml, '.member_block');
     $oPaginate = new BxDolPaginate(array('page_url' => BX_DOL_URL_ROOT . 'member.php', 'count' => $iCount, 'per_page' => $iLimit, 'page' => $iPage, 'per_page_changer' => true, 'page_reloader' => true, 'on_change_page' => 'return !loadDynamicBlock({id}, \'member.php?page={page}&per_page={per_page}\');', 'on_change_per_page' => ''));
     $sPaginate = $oPaginate->getSimplePaginate($sAllFriends);
     return array($sOutputHtml, array(), $sPaginate);
 }
 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 : '');
 }
Пример #17
0
 /**
  * Function will generate latest polls;
  */
 function getBlockCode_LatestHome()
 {
     // ** init some variables;
     $sPaginate = null;
     $iPage = isset($_GET['page']) ? (int) $_GET['page'] : 1;
     $iPerPage = isset($_GET['per_page']) ? (int) $_GET['per_page'] : $this->iHomePage_countLatest;
     if ($iPerPage <= 0) {
         $iPerPage = $this->iHomePage_countLatest;
     }
     if (!$iPage) {
         $iPage = 1;
     }
     // get only the member's polls ;
     $iTotalNum = $this->oModule->_oDb->getFeaturedCount(0, true);
     if (!$iTotalNum) {
         $sOutputCode = MsgBox(_t('_Empty'));
     } else {
         $sLimitFrom = ($iPage - 1) * $iPerPage;
         $sqlLimit = "LIMIT {$sLimitFrom}, {$iPerPage}";
         $aPolls = $this->oModule->_oDb->getAllFeaturedPolls($sqlLimit, 0, true);
         $sOutputCode = $this->oModule->genPollsList($aPolls);
         // define path to module;
         $sModulePath = $this->oModule->getModulePath();
         // build paginate block;
         $oPaginate = new BxDolPaginate(array('page_url' => $sModulePath, 'count' => $iTotalNum, 'per_page' => $iPerPage, 'page' => $iPage, 'on_change_page' => 'return !loadDynamicBlock({id}, \'' . $sModulePath . '&action=poll_home&page={page}&per_page={per_page}\');'));
         $sPaginate = $oPaginate->getSimplePaginate($sModulePath);
     }
     return array($sOutputCode, array(), $sPaginate);
 }
Пример #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_browse');
     $iPage = isset($_GET['page']) ? (int) $_GET['page'] : $this->oSearch->aCurrent['paginate']['page'];
     $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(0 => array('type' => 'submit', 'name' => 'action_delete', 'value' => _t('_Delete'), 'onclick' => 'onclick="return confirm(\'' . bx_js_string(_t('_Are_you_sure')) . '\');"'));
     $sPaginate = '';
     if ($iCount > $iPerPage) {
         $sSection = isset($aCustom['section']) ? strip_tags($aCustom['section']) : '';
         $iId = isset($aCustom['page_block_id']) ? (int) $aCustom['page_block_id'] : 1;
         $aLinkAddon = $this->oSearch->getLinkAddByPrams(array('r'));
         $sLink = $sLinkJs = $sViewAllUrl = BX_DOL_URL_ROOT . $this->oConfig->getBaseUri() . 'albums/my/' . $sSection;
         if ($this->oConfig->isPermalinkEnabled) {
             $sLinkJs .= '?';
             $sViewAllUrl .= '?';
         } else {
             $sViewAllUrl .= '&amp;';
         }
         $sLinkJs .= $aLinkAddon['params'];
         $sViewAllUrl .= 'per_page=' . $iCount;
         $oPaginate = new BxDolPaginate(array('page_url' => $sLink, 'count' => $iCount, 'per_page' => $iPerPage, 'page' => $iPage, '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($sViewAllUrl);
     }
     $sManage = $this->oSearch->showAdminActionsPanel($this->oSearch->aCurrent['name'] . '_admin_form', $aBtns);
     $aUnit = array('main_code' => $sCode, 'paginate' => $sPaginate, 'manage' => $sManage, 'bx_if:hidden' => '');
     return $this->oTemplate->parseHtmlByName('manage_form_albums.html', $aUnit);
 }
Пример #20
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;
 }
Пример #21
0
 function showBlockMutualFriends($sCaption, $bNoDB = false)
 {
     $iViewer = getLoggedId();
     if ($this->_iProfileID == $iViewer) {
         return;
     }
     if ($this->iCountMutFriends > 0) {
         $sCode = $sPaginate = '';
         $iPerPage = $this->iFriendsPerPage;
         $iPage = (int) $_GET['page'] > 0 ? (int) $_GET['page'] : 1;
         $sProfileLink = getProfileLink($this->_iProfileID);
         foreach ($this->aMutualFriends as $iKey => $sValue) {
             $sCode .= '<div class="member_block">' . get_member_thumbnail($iKey, 'none', true) . '</div>';
         }
         if ($this->iCountMutFriends > $iPerPage) {
             $oPaginate = new BxDolPaginate(array('page_url' => BX_DOL_URL_ROOT . 'profile.php', 'count' => $this->iCountMutFriends, 'per_page' => $iPerPage, 'page' => $iPage, 'per_page_changer' => true, 'page_reloader' => true, 'on_change_page' => 'return !loadDynamicBlock({id}, \'' . $sProfileLink . '?page={page}&per_page={per_page}\');', 'on_change_per_page' => ''));
             $sPaginate = $oPaginate->getSimplePaginate($sAllFriends, -1, -1, false);
         }
         $sCode = $GLOBALS['oFunctions']->centerContent($sCode, '.member_block');
         if ($bNoDB) {
             return array($sCode, array(), $sPaginate);
         } else {
             return DesignBoxContent(_t($sCaption), $ret, 1, $sFriendInfo);
         }
     }
 }