Example #1
0
<?php

/**
 * @version $Header$
 * @package blogs
 * @subpackage modules
 */
/**
 * required setup
 */
include_once BLOGS_PKG_PATH . 'BitBlog.php';
//require_once( USERS_PKG_PATH.'BitUser.php' );
global $gQueryUserId, $module_rows, $moduleParams;
$listHash['max_records'] = $module_rows;
$listHash['sort_mode'] = !empty($moduleParams['module_params']['sort_mode']) ? $moduleParams['module_params']['sort_mode'] : 'created_desc';
BitUser::userCollection($moduleParams['module_params'], $listHash);
$blog = new BitBlog();
if ($modBlogs = $blog->getList($listHash)) {
    foreach (array_keys($modBlogs) as $b) {
        $modBlogs[$b]['post'] = $blog->getPost(array('blog_id' => $modBlogs[$b]['blog_id']));
    }
    $_template->tpl_vars['modBlogs'] = new Smarty_variable($modBlogs);
}
$moduleTitle = !empty($moduleParams['title']) ? $moduleParams['title'] : 'Blog Roll';
$_template->tpl_vars['moduleTitle'] = new Smarty_variable($moduleTitle);
    $_REQUEST['topic_id'] = !empty($_REQUEST['topic_id']) ? $_REQUEST['topic_id'] : NULL;
    $_REQUEST['type_id'] = !empty($_REQUEST['type_id']) ? $_REQUEST['type_id'] : NULL;
    $_template->tpl_vars['futures'] = new Smarty_variable($gContent->getFutureList($listHash));
} else {
    $_REQUEST['status_id'] = ARTICLE_STATUS_APPROVED;
    $_REQUEST['max_records'] = $gBitSystem->getConfig('articles_max_list');
}
if (!empty($_REQUEST['topic'])) {
    $_template->tpl_vars['topic'] = new Smarty_variable($_REQUEST['topic']);
}
if (!empty($moduleParams)) {
    $listHash = array_merge($_REQUEST, $moduleParams['module_params']);
    $listHash['max_records'] = $module_rows;
    //$listHash['parse_data'] = TRUE;
    //$listHash['load_comments'] = TRUE;
} else {
    $listHash = $_REQUEST;
}
BitUser::userCollection($_REQUEST, $listHash);
$articles = $gContent->getList($listHash);
$_template->tpl_vars['gContent'] = new Smarty_variable($gContent);
$_template->tpl_vars['articles'] = new Smarty_variable($articles);
$_template->tpl_vars['listInfo'] = new Smarty_variable($listHash['listInfo']);
// show only descriptions on listing page
$_template->tpl_vars['showDescriptionsOnly'] = new Smarty_variable(TRUE);
// display submissions if we have the perm to approve them
if ($gBitUser->hasPermission('p_articles_approve_submission') || $gBitSystem->isFeatureActive('articles_auto_approve') && $gBitUser->isRegistered()) {
    $listHash = array('status_id' => ARTICLE_STATUS_PENDING);
    $submissions = $gContent->getList($listHash);
    $_template->tpl_vars['submissions'] = new Smarty_variable($submissions);
}
<?php

/**
 * @version $Header$
 * @package blogs
 * @subpackage modules
 */
/**
 * required setup
 */
include_once BLOGS_PKG_PATH . 'BitBlog.php';
//require_once( USERS_PKG_PATH.'BitUser.php' );
global $gQueryUserId, $moduleParams;
//$params = $moduleParams['module_params'];
$listHash['max_records'] = $moduleParams['module_rows'];
$listHash['sort_mode'] = 'last_modified_desc';
BitUser::userCollection($moduleParams, $listHash);
$blog = new BitBlog();
$ranking = $blog->getList($listHash);
$_template->tpl_vars['modLastModifiedBlogs'] = new Smarty_variable($ranking);