/** * $Id: notification.inc.php 331 2007-12-23 16:01:11Z malanciault $ * Module: SmartSection * Author: The SmartFactory <www.smartfactory.ca> * Licence: GNU */ function smartsection_notify_iteminfo($category, $item_id) { global $xoopsModule, $xoopsModuleConfig, $xoopsConfig; include_once XOOPS_ROOT_PATH . "/modules/smartsection/include/seo_functions.php"; if (empty($xoopsModule) || $xoopsModule->getVar('dirname') != 'smartsection') { $module_handler =& xoops_gethandler('module'); $module =& $module_handler->getByDirname('smartsection'); $config_handler =& xoops_gethandler('config'); $config =& $config_handler->getConfigsByCat(0, $module->getVar('mid')); } else { $module =& $xoopsModule; $config =& $xoopsModuleConfig; } if ($category == 'global') { $item['name'] = ''; $item['url'] = ''; return $item; } global $xoopsDB; if ($category == 'category') { // Assume we have a valid category id $sql = 'SELECT name, short_url FROM ' . $xoopsDB->prefix('smartsection_categories') . ' WHERE categoryid = ' . $item_id; $result = $xoopsDB->query($sql); // TODO: error check $result_array = $xoopsDB->fetchArray($result); $item['name'] = $result_array['name']; $item['url'] = smartsection_seo_genUrl('category', $item_id, $result_array['short_url']); return $item; } if ($category == 'item') { // Assume we have a valid story id $sql = 'SELECT title, short_url FROM ' . $xoopsDB->prefix('smartsection_item') . ' WHERE itemid = ' . $item_id; $result = $xoopsDB->query($sql); // TODO: error check $result_array = $xoopsDB->fetchArray($result); $item['name'] = $result_array['title']; $item['url'] = smartsection_seo_genUrl('item', $item_id, $result_array['short_url']); return $item; } }
function getItemUrl() { return smartsection_seo_genUrl('item', $this->itemid(), $this->short_url()); }
$category['total'] = $thiscategory_itemcount; if (count($itemsObj) > 0) { $userids = array(); if ($itemsObj) { foreach ($itemsObj as $key => $thisitem) { $itemids[] = $thisitem->getVar('itemid'); $userids[$thisitem->uid()] = 1; } } $member_handler =& xoops_gethandler('member'); $users = $member_handler->getUsers(new Criteria('uid', "(" . implode(',', array_keys($userids)) . ")", "IN"), true); // Adding the items of the selected category for ($i = 0; $i < $totalItemOnPage; $i++) { $item = $itemsObj[$i]->toArray(-1, $xoopsModuleConfig['titlesize']); $item['categoryname'] = $categoryObj->name(); $item['categorylink'] = "<a href='" . smartsection_seo_genUrl('category', $itemsObj[$i]->categoryid(), $categoryObj->short_url()) . "'>" . $categoryObj->name() . "</a>"; $item['who_when'] = $itemsObj[$i]->getWhoAndWhen($users); $xoopsTpl->append('items', $item); } //var_dump( $last_itemObj[$categoryObj->getVar('categoryid')]); if (isset($last_itemObj[$categoryObj->getVar('categoryid')]) && $last_itemObj[$categoryObj->getVar('categoryid')]) { $category['last_itemid'] = $last_itemObj[$categoryObj->getVar('categoryid')]->getVar('itemid'); $category['last_title_link'] = $last_itemObj[$categoryObj->getVar('categoryid')]->getItemLink(false, $lastitemsize); } } $categories = array(); $categories[] = $category; $xoopsTpl->assign('category', $category); $xoopsTpl->assign('categories', $categories); // Language constants $xoopsTpl->assign(array('lang_on' => _MD_SSECTION_ON, 'lang_postedby' => _MD_SSECTION_POSTEDBY, 'lang_total' => $totalItemOnPage, 'lang_title' => _MD_SSECTION_TITLE, 'lang_datesub' => _MD_SSECTION_DATESUB, 'lang_hits' => _MD_SSECTION_HITS));
function getCategoryUrl() { return smartsection_seo_genUrl('category', $this->categoryid(), $this->short_url()); }