/** * Load all uploaded items in this gallery * * @param array $pListHash ListHash is passed on to TreasuryItem::getList(); * @access public * @return TRUE on success, FALSE on failure - populates $this->mItems */ function loadItems(&$pListHash) { $ret = FALSE; if ($this->isValid()) { require_once TREASURY_PKG_PATH . 'TreasuryItem.php'; $treasuryItem = new TreasuryItem(); if (empty($pListHash['gallery_content_id'])) { $pListHash['gallery_content_id'] = $this->mContentId; } if ($this->mItems = $treasuryItem->getList($pListHash, $this->mStructureId)) { $ret = TRUE; } elseif (!empty($treasuryItem->mErrors)) { error_log("Error loading treasury items: " . vc($treasuryItem->mErrors)); } } return $ret; }
if (!$gBitUser->hasPermission('p_treasury_view_item')) { require_once RSS_PKG_PATH . "rss_error.php"; } else { $listHash = array('max_records' => $gBitSystem->getConfig('treasury_rss_max_records', 10), 'sort_mode' => 'last_modified_desc', 'gallery_content_id' => !empty($_REQUEST['gallery_content_id']) ? $_REQUEST['gallery_content_id'] : NULL, 'user_id' => !empty($_REQUEST['user_id']) ? $_REQUEST['user_id'] : NULL); // check if we want to use the cache file // we'll use groups to cache rss feeds with different permissions $cacheFile = TEMP_PKG_PATH . RSS_PKG_NAME . '/' . TREASURY_PKG_NAME . '/' . "g{$listHash['gallery_content_id']}u{$listHash['user_id']}" . $cacheFileTail; $rss->useCached($rss_version_name, $cacheFile, $gBitSystem->getConfig('rssfeed_cache_time')); // if we have a gallery we can work with - load it if (@BitBase::verifyId($_REQUEST['gallery_content_id'])) { $gallery = new TreasuryGallery(NULL, $_REQUEST['gallery_content_id']); $gallery->load(); $rss->title .= " - {$gallery->getTitle()}"; } $treasury = new TreasuryItem(); $feeds = $treasury->getList($listHash); // set the rss link $rss->link = TREASURY_PKG_URI; $gBitSmarty->loadPlugin('smarty_modifier_display_bytes'); // get all the data ready for the feed creator foreach ($feeds as $feed) { $item = new FeedItem(); $item->title = $feed->getTitle(); $item->link = $feed->getField('display_url'); $item->date = (int) $feed->getField('last_modified'); $item->source = BIT_ROOT_URI; if (!empty($feed->mInfo['thumbnail_url']['medium'])) { $item->description = '<a href="' . $feed->getField('display_url') . '"><img src="' . $feed->mInfo['thumbnail_url']['medium'] . '" /></a>'; } $item->description .= "<ul>"; if ($feed->getField('parsed_data')) {
<?php global $gQueryUser, $moduleParams; require_once TREASURY_PKG_PATH . 'TreasuryItem.php'; $ti = new TreasuryItem(); $listHash = $_REQUEST; if (!empty($moduleParams['module_rows'])) { $listHash['max_records'] = $moduleParams['module_rows']; } if (empty($listHash['sort_mode'])) { $listHash['sort_mode'] = 'random'; } /* Get a list of user items */ if (!empty($gQueryUser) && $gQueryUser->mUserId) { $listHash['user_id'] = $gQueryUser->mUserId; } $centerItemList = $ti->getList($listHash); $gBitSmarty->assign('centerItemList', $centerItemList); $gBitSmarty->assign('treasury_center_params', $moduleParams['module_params']);
if ($gQueryUserId) { $listHash['user_id'] = $gQueryUserId; } elseif (!empty($_REQUEST['user_id'])) { $listHash['user_id'] = $_REQUEST['user_id']; } elseif (!empty($module_params['recent_users'])) { $listHash['recent_users'] = TRUE; } // this is needed to avoid wrong sort_modes entered resulting in db errors $sort_options = array('hits', 'created', 'last_modified'); if (!empty($module_params['sort_mode']) && in_array($module_params['sort_mode'], $sort_options)) { $sort_mode = $module_params['sort_mode'] . '_desc'; } else { $sort_mode = 'random'; } $listHash['sort_mode'] = $sort_mode; $items = $item->getList($listHash); // vd( $moduleParams ); if (empty($moduleParams['title']) && $items) { $moduleTitle = ''; if (!empty($module_params['sort_mode'])) { if ($module_params['sort_mode'] == 'random') { $moduleTitle = 'Random'; } elseif ($module_params['sort_mode'] == 'created') { $moduleTitle = 'Recent'; } elseif ($module_params['sort_mode'] == 'hits') { $moduleTitle = 'Popular'; } elseif ($module_params['sort_mode'] == 'last_modified') { $moduleTitle = 'Updated'; } } else { $moduleTitle = 'Random';