Beispiel #1
0
function smartsection_latest_files_show($options)
{
    include_once XOOPS_ROOT_PATH . "/modules/smartsection/include/common.php";
    /**
     * $options[0] : Sort order - datesub | counter
     * $options[1] : Number of files to display
     * $oprions[2] : bool TRUE to link to the file download, FALSE to link to the article
     */
    $block = array();
    $sort = $options[0];
    $order = smartsection_getOrderBy($sort);
    $limit = $options[1];
    $directDownload = $options[2];
    $smartsection_file_handler =& smartsection_gethandler('file', 'smartsection');
    // creating the files objects
    $filesObj = $smartsection_file_handler->getAllFiles(0, _SSECTION_STATUS_FILE_ACTIVE, $limit, 0, $sort, $order);
    foreach ($filesObj as $fileObj) {
        $aFile = array();
        $aFile['link'] = $directDownload ? $fileObj->getFileLink() : $fileObj->getItemLink();
        if ($sort == "datesub") {
            $aFile['new'] = $fileObj->datesub();
        } elseif ($sort == "counter") {
            $aFile['new'] = $fileObj->counter();
        } elseif ($sort == "weight") {
            $aFile['new'] = $fileObj->weight();
        }
        $block['files'][] = $aFile;
    }
    return $block;
}
Beispiel #2
0
/**
* $Id: items_new.php,v 1.2 2005/08/02 03:47:51 mauriciodelima Exp $
* Module: SmartSection
* Author: The SmartFactory <www.smartfactory.ca>
* Licence: GNU
*/
function b_items_new_show($options)
{
    include_once XOOPS_ROOT_PATH . "/modules/smartsection/include/common.php";
    $block = array();
    if ($options[0] == 0) {
        $categoryid = -1;
    } else {
        $categoryid = $options[0];
    }
    $sort = $options[1];
    $order = smartsection_getOrderBy($sort);
    $limit = $options[2];
    $smartsection_item_handler =& ss_gethandler('item');
    // creating the ITEM objects that belong to the selected category
    $itemsObj = $smartsection_item_handler->getAllPublished($limit, 0, $categoryid, $sort, $order);
    $totalitems = count($itemsObj);
    if ($itemsObj) {
        for ($i = 0; $i < $totalitems; $i++) {
            $newitems = array();
            $newitems['linktext'] = $itemsObj[$i]->title();
            $newitems['id'] = $itemsObj[$i]->itemid();
            if ($sort == "datesub") {
                $newitems['new'] = $itemsObj[$i]->datesub();
            } elseif ($sort == "counter") {
                $newitems['new'] = $itemsObj[$i]->counter();
            } elseif ($sort == "weight") {
                $newitems['new'] = $itemsObj[$i]->weight();
            }
            $block['newitems'][] = $newitems;
        }
    }
    return $block;
}
Beispiel #3
0
function smartsection_items_recent_show($options)
{
    include_once XOOPS_ROOT_PATH . "/modules/smartsection/include/common.php";
    $myts =& MyTextSanitizer::getInstance();
    $smartModule =& smartsection_getModuleInfo();
    $block = array();
    $selectedcatids = explode(',', $options[0]);
    if (in_array(0, $selectedcatids)) {
        $allcats = true;
    } else {
        $allcats = false;
    }
    $sort = $options[1];
    $order = smartsection_getOrderBy($sort);
    $limit = $options[2];
    $smartsection_item_handler =& smartsection_gethandler('item');
    // creating the ITEM objects that belong to the selected category
    if ($allcats) {
        $criteria = null;
    } else {
        $criteria = new CriteriaCompo();
        $criteria->add(new Criteria('categoryid', '(' . $options[0] . ')', 'IN'));
    }
    $itemsObj = $smartsection_item_handler->getItems($limit, $start, array(_SSECTION_STATUS_PUBLISHED), -1, $sort, $order, '', true, $criteria, true);
    $totalItems = count($itemsObj);
    if ($itemsObj) {
        for ($i = 0; $i < $totalItems; $i++) {
            $newItems['itemid'] = $itemsObj[$i]->itemid();
            $newItems['title'] = $itemsObj[$i]->title();
            $newItems['categoryname'] = $itemsObj[$i]->getCategoryName();
            $newItems['categoryid'] = $itemsObj[$i]->categoryid();
            $newItems['date'] = $itemsObj[$i]->datesub();
            $newItems['poster'] = xoops_getLinkedUnameFromId($itemsObj[$i]->uid());
            $newItems['itemlink'] = $itemsObj[$i]->getItemLink(false, isset($options[3]) ? $options[3] : 65);
            $newItems['categorylink'] = $itemsObj[$i]->getCategoryLink();
            $block['items'][] = $newItems;
        }
        $block['lang_title'] = _MB_SSECTION_ITEMS;
        $block['lang_category'] = _MB_SSECTION_CATEGORY;
        $block['lang_poster'] = _MB_SSECTION_POSTEDBY;
        $block['lang_date'] = _MB_SSECTION_DATE;
        $modulename = $myts->makeTboxData4Show($smartModule->getVar('name'));
        $block['lang_visitItem'] = _MB_SSECTION_VISITITEM . " " . $modulename;
    }
    return $block;
}
/**
* $Id: items_recent.php,v 1.2 2005/08/02 03:47:51 mauriciodelima Exp $
* Module: SmartSection
* Author: The SmartFactory <www.smartfactory.ca>
* Licence: GNU
*/
function b_items_recent_show($options)
{
    include_once XOOPS_ROOT_PATH . "/modules/smartsection/include/common.php";
    $myts =& MyTextSanitizer::getInstance();
    $smartModule =& ss_getModuleInfo();
    $block = array();
    if ($options[0] == 0) {
        $categoryid = -1;
    } else {
        $categoryid = $options[0];
    }
    $sort = $options[1];
    $order = smartsection_getOrderBy($sort);
    $limit = $options[2];
    $smartsection_item_handler =& ss_gethandler('item');
    // creating the ITEM objects that belong to the selected category
    $itemsObj = $smartsection_item_handler->getAllPublished($limit, 0, $categoryid, $sort, $order);
    $totalItems = count($itemsObj);
    if ($itemsObj) {
        for ($i = 0; $i < $totalItems; $i++) {
            $newItems['itemid'] = $itemsObj[$i]->itemid();
            $newItems['title'] = $itemsObj[$i]->title();
            $newItems['categoryname'] = $itemsObj[$i]->getCategoryName();
            $newItems['categoryid'] = $itemsObj[$i]->categoryid();
            $newItems['date'] = $itemsObj[$i]->datesub();
            $newItems['poster'] = xoops_getLinkedUnameFromId($itemsObj[$i]->uid());
            $block['items'][] = $newItems;
        }
        $block['lang_title'] = _MB_SS_ITEMS;
        $block['lang_category'] = _MB_SS_CATEGORY;
        $block['lang_poster'] = _MB_SS_POSTEDBY;
        $block['lang_date'] = _MB_SS_DATE;
        $modulename = $myts->makeTboxData4Show($smartModule->getVar('name'));
        $block['lang_visitItem'] = _MB_SS_VISITITEM . " " . $modulename;
    }
    return $block;
}
function b_marquee_smartsection($limit, $dateformat, $itemssize)
{
    include_once XOOPS_ROOT_PATH . '/modules/smartsection/include/common.php';
    $myts =& MyTextSanitizer::getInstance();
    $smartModule =& smartsection_getModuleInfo();
    $block = array();
    $categoryid = -1;
    $sort = 'datesub';
    $order = smartsection_getOrderBy($sort);
    $smartsection_item_handler =& smartsection_gethandler('item');
    $itemsObj = $smartsection_item_handler->getAllPublished($limit, 0, $categoryid, $sort, $order);
    $totalItems = count($itemsObj);
    if ($itemsObj) {
        for ($i = 0; $i < $totalItems; $i++) {
            if ($itemssize > 0) {
                $title = xoops_substr($itemsObj[$i]->title(), 0, $itemssize + 3);
            } else {
                $title = $itemsObj[$i]->title();
            }
            $block[] = array('date' => $itemsObj[$i]->datesub(), 'category' => $itemsObj[$i]->getCategoryName(), 'author' => xoops_getLinkedUnameFromId($itemsObj[$i]->uid()), 'title' => $title, 'link' => "<a href='" . XOOPS_URL . '/modules/smartsection/item.php?itemid=' . $itemsObj[$i]->itemid() . "'>" . $title . '</a>');
        }
    }
    return $block;
}