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 .= "
"; $return .= "
".$title."
"; $artURL="index.php?option=com_content&task=view&id="; if ($searchEnabled) $return .= $searchForm; $return .= "
 
"; $return .= ""; $return .= ""; $return .= ""; $return .= ""; if($_CB_framework->getCfg( 'hits' )) { $return .= ""; } $return .= ""; $i = 2; foreach($items as $item) { if ( isset( $mainframe ) && is_callable( array( $mainframe, "getItemid" ) ) ) { $itemid = $mainframe->getItemid( $item->id ); } elseif (is_callable( "JApplicationHelper::getItemid" ) ) { $itemid = JApplicationHelper::getItemid( $item->id ); } else { $itemid = null; } $itemidtxt = $itemid ? "&Itemid=" . (int) $itemid : ""; $i = ($i==1) ? 2 : 1; $return .= "" . ""; if($_CB_framework->getCfg( 'hits' )) $return.= "\n"; $return .= "\n"; } $return .= "
".$this->_writeSortByLink($pagingParams,"entries_","date",_UE_ARTICLEDATE,true)."".$this->_writeSortByLink($pagingParams,"entries_","title",_UE_ARTICLETITLE)."".$this->_writeSortByLink($pagingParams,"entries_","hits",_UE_ARTICLEHITS)."
" . cbFormatDate( $item->created ) . "id.$itemidtxt."\">".$item->title."".$item->hits."
"; if ($pagingEnabled && ($entriesNumber < $total)) { $return .= "
" .$this->_writePaging($pagingParams,"entries_",$entriesNumber,$total) ."
"; } } else { if ($pagingEnabled && $userHasPosts && $searchEnabled && $pagingParams["entries_search"]) { $return .= "
"; $return .= $searchForm; $return .= "
"; $return .= "
".sprintf(_UE_BLOG_FOUNDENTRIES, 0); } else { $return .= "

"; $return .= _UE_NOBLOGS; $return .= "
"; } } } return $return; } } // end class getBlogTab ?>