cbTabHandler();
}
function getDisplayTab($tab,$user,$ui) {
global $_CB_database, $_CB_framework, $mainframe;
if(!file_exists( $_CB_framework->getCfg('absolute_path') . '/components/com_mamblog/configuration.php' )){
$return = _UE_MAMBLOGNOTINSTALLED;
} else {
include_once ( $_CB_framework->getCfg('absolute_path') . '/components/com_mamblog/configuration.php' );
$return="";
$return .= $this->_writeTabDescription( $tab, $user );
$params = $this->params;
$entriesNumber = $params->get('entriesNumber', '10');
$pagingEnabled = $params->get('pagingEnabled', 0);
$searchEnabled = $params->get('searchEnabled', 0);
$pagingParams = $this->_getPaging(array(),array("entries_"));
if (!$searchEnabled) $pagingParams["entries_search"]=null;
$sectid="";
$catid="";
if(ISSET($cfg_mamblog['sectionid'])) $sectid="\n AND a.sectionid=" . (int) $cfg_mamblog['sectionid'];
if(ISSET($cfg_mamblog['categoryid'])) $catid="\n AND a.categoryid=" . (int) $cfg_mamblog['categoryid'];
$where = "\n WHERE a.created_by = ". (int) $user->id .""
. "\n AND a.state = 1"
. $sectid
. $catid
. ($pagingParams["entries_search"]? "\n AND (a.title LIKE '%".cbEscapeSQLsearch($pagingParams["entries_search"])."%'"
." OR a.introtext LIKE '%".cbEscapeSQLsearch($pagingParams["entries_search"])."%'"
." OR a.fulltext LIKE '%".cbEscapeSQLsearch($pagingParams["entries_search"])."%')"
: "");
if ($pagingEnabled) {
$query="SELECT COUNT(*)"
. "\n FROM #__content AS a"
. $where;
$_CB_database->setQuery($query);
$total = $_CB_database->loadResult();
if (!is_numeric($total)) $total = 0;
$userHasPosts = ($total > 0 || ($pagingParams["entries_search"]));
if ($pagingParams["entries_limitstart"] === null) $pagingParams["entries_limitstart"] = "0";
if ($entriesNumber > $total) $pagingParams["entries_limitstart"] = "0";
} else {
$pagingParams["entries_limitstart"] = "0";
$pagingParams["entries_search"] = null;
}
switch ($pagingParams["entries_sortby"]) {
case "title":
$order = "a.title ASC, a.created DESC";
break;
case "hits":
$order = "a.hits DESC, a.created DESC";
break;
case "date":
default:
$order = "a.created DESC";
break;
}
$query = "SELECT a.id, a.title, a.hits, a.created"
// For the article plugin?
//. "\n ROUND( r.rating_sum / r.rating_count ) AS rating,r.rating_count"
. "\n FROM #__content AS a"
//. "\n LEFT JOIN #__content_rating AS r ON r.content_id = a.id"
. $where
. "\n ORDER BY ".$order
. "\n LIMIT " . (int) ( $pagingParams["entries_limitstart"] ? $pagingParams["entries_limitstart"] : 0 ) . "," . (int) $entriesNumber;
$_CB_database->setQuery( $query );
$items = $_CB_database->loadObjectList();
if ($searchEnabled) {
$searchForm = $this->_writeSearchBox($pagingParams,"entries_", "style=\"float:right;\"", "class=\"inputbox\"");
}
if(count($items) > 0) {
if ($pagingParams["entries_search"]) $title = sprintf(_UE_BLOG_FOUNDENTRIES,$total);
elseif ($pagingEnabled) $title = sprintf(_UE_BLOG_ENTRIES,$entriesNumber);
else $title = sprintf(_UE_BLOG_LASTENTRIES,$entriesNumber);
$return .= "
| ".$this->_writeSortByLink($pagingParams,"entries_","date",_UE_ARTICLEDATE,true)." | "; $return .= "".$this->_writeSortByLink($pagingParams,"entries_","title",_UE_ARTICLETITLE)." | "; if($_CB_framework->getCfg( 'hits' )) { $return .= "".$this->_writeSortByLink($pagingParams,"entries_","hits",_UE_ARTICLEHITS)." | "; } $return .= "
|---|---|---|
| " . cbFormatDate( $item->created ) . " | " . "id.$itemidtxt."\">".$item->title." | "; if($_CB_framework->getCfg( 'hits' )) $return.= "".$item->hits." | \n"; $return .= "