/** * $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; }
/** * constructor */ function ssCategory($id = null) { $this->db =& Database::getInstance(); $this->initVar("categoryid", XOBJ_DTYPE_INT, null, false); $this->initVar("parentid", XOBJ_DTYPE_INT, null, false); $this->initVar("name", XOBJ_DTYPE_TXTBOX, null, true, 100); $this->initVar("description", XOBJ_DTYPE_TXTAREA, null, false, 255); $this->initVar("image", XOBJ_DTYPE_TXTBOX, null, false, 255); $this->initVar("total", XOBJ_DTYPE_INT, 1, false); $this->initVar("weight", XOBJ_DTYPE_INT, 1, false); $this->initVar("created", XOBJ_DTYPE_INT, null, false); //not persistent values $this->initVar("itemcount", XOBJ_DTYPE_INT, 0, false); $this->initVar('last_itemid', XOBJ_DTYPE_INT); $this->initVar('last_title_link', XOBJ_DTYPE_TXTBOX); $this->initVar("dohtml", XOBJ_DTYPE_INT, 1, false); if (isset($id)) { if (is_array($id)) { $this->assignVars($id); } else { $smartsection_category_handler =& ss_gethandler('category'); $category =& $smartsection_category_handler->get($id); foreach ($category->vars as $k => $v) { $this->assignVar($k, $v['value']); } $this->assignOtherProperties(); } } }
/** * constructor */ function ssItem($id = null) { $this->db =& Database::getInstance(); $this->initVar("itemid", XOBJ_DTYPE_INT, -1, false); $this->initVar("categoryid", XOBJ_DTYPE_INT, 0, false); $this->initVar("title", XOBJ_DTYPE_TXTBOX, null, true, 255); $this->initVar("summary", XOBJ_DTYPE_TXTAREA, null, false); $this->initVar("display_summary", XOBJ_DTYPE_INT, 1, false); $this->initVar("body", XOBJ_DTYPE_TXTAREA, null, true); $this->initVar("uid", XOBJ_DTYPE_INT, 0, false); $this->initVar("datesub", XOBJ_DTYPE_INT, null, false); $this->initVar("status", XOBJ_DTYPE_INT, -1, false); $this->initVar("image", XOBJ_DTYPE_TXTBOX, 'blank.png', false, 255); $this->initVar("counter", XOBJ_DTYPE_INT, 0, false); $this->initVar("weight", XOBJ_DTYPE_INT, 0, false); $this->initVar("dohtml", XOBJ_DTYPE_INT, 1, false); $this->initVar("dosmiley", XOBJ_DTYPE_INT, 1, false); $this->initVar("doimage", XOBJ_DTYPE_INT, 1, false); $this->initVar("dobr", XOBJ_DTYPE_INT, 1, false); $this->initVar("doxcode", XOBJ_DTYPE_INT, 1, false); $this->initVar("cancomment", XOBJ_DTYPE_INT, 1, false); $this->initVar("comments", XOBJ_DTYPE_INT, 0, false); $this->initVar("notifypub", XOBJ_DTYPE_INT, 1, false); // Non consistent values $this->initVar("pagescount", XOBJ_DTYPE_INT, 0, false); if (isset($id)) { $smartsection_item_handler =& ss_gethandler('item'); $item =& $smartsection_item_handler->get($id); foreach ($item->vars as $k => $v) { $this->assignVar($k, $v['value']); } $this->assignOtherProperties(); } else { // it's a new item // Check to see if $smartlanguage_tag_handler is available // Hack by marcan for condolegal.smartfactory.ca /* $this->setVar('title', "[fr]entrez le texte en français[/fr][en]entrez le texte en anglais[/en]"); $this->setVar('summary', "[fr]entrez le texte en français[/fr][en]entrez le texte en anglais[/en]"); $this->setVar('body', "[fr]entrez le texte en français[/fr][en]entrez le texte en anglais[/en]"); // End of Hack by marcan for condolegal.smartfactory.ca global $smartlanguage_tag_handler; if (isset($smartlanguage_tag_handler)) { $theLanguageTags = $smartlanguage_tag_handler->getAllTagsForInput(); $this->setVar('title', $theLanguageTags); $this->setVar('summary', $theLanguageTags); $this->setVar('body', $theLanguageTags); } */ } }
/** * $Id: items_random_item.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_random_item_show() { include_once XOOPS_ROOT_PATH . "/modules/smartsection/include/common.php"; $block = array(); $smartsection_item_handler =& ss_gethandler('item'); // creating the ITEM object $itemsObj = $smartsection_item_handler->getRandomItem('summary', array(_SS_STATUS_PUBLISHED)); if ($itemsObj) { $block['content'] = $itemsObj->summary(); $block['id'] = $itemsObj->itemid(); $block['lang_fullitem'] = _MB_SS_FULLITEM; } 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; }
/** * $Id: items_spot.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_spot_show($options) { include_once XOOPS_ROOT_PATH . "/modules/smartsection/include/common.php"; $opt_display_last = $options[0]; $opt_items_count = $options[1]; $opt_categoryid = $options[2]; $sel_items = explode(',', $options[3]); $opt_display_poster = $options[4]; $opt_display_comment = $options[5]; $opt_display_type = $options[6]; if ($opt_categoryid == 0) { $opt_categoryid = -1; } $block = array(); $smartsection_item_handler =& ss_gethandler('item'); if ($opt_display_last == 1) { $itemsObj =& $smartsection_item_handler->getAllPublished($opt_items_count, 0, $opt_categoryid, $sort = 'datesub', $order = 'DESC', 'summary'); $i = 1; $itemsCount = count($itemsObj); if ($itemsObj) { foreach ($itemsObj as $key => $thisitem) { $item = array(); $item = $thisitem->toArray(); $item['who_when'] = sprintf(_MB_SS_WHO_WHEN, $thisitem->posterName(), $thisitem->datesub()); if ($i < $itemsCount) { $item['showline'] = true; } else { $item['showline'] = false; } $i++; $block['items'][] = $item; } } } else { $i = 1; $itemsCount = count($sel_items); foreach ($sel_items as $item_id) { $itemObj = new ssItem($item_id); if (!$itemObj->notLoaded()) { $categoryObj =& $itemObj->category(); $item = array(); $item = $itemObj->toArray(); $item['who_when'] = sprintf(_MB_SS_WHO_WHEN, $itemObj->posterName(), $itemObj->datesub()); if ($i < $itemsCount) { $item['showline'] = true; } else { $item['showline'] = false; } $i++; $block['items'][] = $item; } } } $block['lang_reads'] = _MB_SS_READS; $block['lang_comments'] = _MB_SS_COMMENTS; $block['lang_readmore'] = _MB_SS_READMORE; $block['display_whowhen_link'] = $opt_display_poster; $block['display_comment_link'] = $opt_display_comment; $block['display_type'] = $opt_display_type; return $block; }
function ss_createCategorySelect($selectedid = 0, $parentcategory = 0, $allCatOption = true) { $ret = "" . _MB_SS_SELECTCAT . " <select name='options[]'>"; if ($allCatOption) { $ret .= "<option value='0'"; $ret .= ">" . _MB_SS_ALLCAT . "</option>\n"; } // Creating the category handler object $category_handler =& ss_gethandler('category'); // Creating category objects $categoriesObj = $category_handler->getCategories(0, 0, $parentcategory); if (count($categoriesObj) > 0) { foreach ($categoriesObj as $catID => $categoryObj) { $ret .= ss_addCategoryOption($categoryObj, $selectedid); } } $ret .= "</select>\n"; return $ret; }