本文整理匯總了PHP中JApplicationHelper::getItemid方法的典型用法代碼示例。如果您正苦於以下問題:PHP JApplicationHelper::getItemid方法的具體用法?PHP JApplicationHelper::getItemid怎麽用?PHP JApplicationHelper::getItemid使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類JApplicationHelper
的用法示例。
在下文中一共展示了JApplicationHelper::getItemid方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getDisplayTab
function getDisplayTab($tab, $user, $ui)
{
global $_CB_framework, $_CB_database, $mainframe;
$jVer = checkJversion();
$showHits = $_CB_framework->getCfg('hits');
$showRating = $_CB_framework->getCfg('vote');
$return = '';
if ($jVer >= 2) {
$curTz = date_default_timezone_get();
date_default_timezone_set('UTC');
$now = date('Y-m-d H:i:s');
date_default_timezone_set($curTz);
} else {
$now = date('Y-m-d H:i:s', $_CB_framework->now() + $_CB_framework->getCfg('offset') * 60 * 60);
}
$query = "SELECT a.id, a.catid, a.title, a.hits,a.created, ROUND( r.rating_sum / r.rating_count ) AS rating,r.rating_count";
if ($jVer >= 1) {
$query .= ', CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(\':\', a.id, a.alias) ELSE a.id END as slug,' . ' CASE WHEN CHAR_LENGTH(cc.alias) THEN CONCAT_WS(":", cc.id, cc.alias) ELSE cc.id END as catslug';
}
$query .= "\n FROM #__content AS a" . "\n LEFT JOIN #__content_rating AS r ON r.content_id=a.id";
if ($jVer < 2) {
$query .= "\n INNER JOIN #__sections AS s ON s.id=a.sectionid AND s.title != 'Mamblog'";
}
if ($jVer >= 1) {
$query .= "\n LEFT JOIN #__categories AS cc ON cc.id = a.catid";
}
$query .= "\n WHERE a.created_by=" . (int) $user->id . "" . "\n AND a.state = 1 " . "\n AND (publish_up = '0000-00-00 00:00:00' OR publish_up <= '{$now}')" . "\n AND (publish_down = '0000-00-00 00:00:00' OR publish_down >= '{$now}')" . "\n AND a.access IN (" . implode(',', CBuser::getMyInstance()->getAuthorisedViewLevelsIds($jVer >= 2 ? false : true)) . ')' . "\n ORDER BY a.created DESC";
$_CB_database->setQuery($query);
//print $_CB_database->getQuery();
$items = $_CB_database->loadObjectList();
if (!count($items) > 0) {
$return .= "<br /><br /><div class=\"cbNoArticles\" style=\"width:95%;\">";
$return .= _UE_NOARTICLES;
$return .= "</div>";
return $return;
}
$return .= $this->_writeTabDescription($tab, $user);
$return .= "<table cellpadding=\"5\" cellspacing=\"0\" border=\"0\" width=\"95%\">";
$return .= "<tr class=\"sectiontableheader\">";
$return .= "<th>" . _UE_ARTICLEDATE . "</th>";
$return .= "<th>" . _UE_ARTICLETITLE . "</th>";
if ($showHits) {
$return .= "<th>" . _UE_ARTICLEHITS . "</th>";
}
if ($showRating) {
$return .= "<th>" . _UE_ARTICLERATING . "</th>";
}
$return .= "</tr>";
$i = 1;
$hits = "";
$rating = "";
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;
if (is_callable(array("mosAdminMenus", "ImageCheck"))) {
$starImageOn = mosAdminMenus::ImageCheck('rating_star.png', '/images/M_images/');
$starImageOff = mosAdminMenus::ImageCheck('rating_star_blank.png', '/images/M_images/');
} else {
// Mambo 4.5.0:
$starImageOn = '<img src="' . $_CB_framework->getCfg('live_site') . '/images/M_images/rating_star.png" alt="" align="middle" style="border:0px;" />';
$starImageOff = '<img src="' . $_CB_framework->getCfg('live_site') . '/images/M_images/rating_star_blank.png" alt="" align="middle" style="border:0px;" />';
}
$img = "";
if ($showRating) {
for ($j = 0; $j < $item->rating; $j++) {
$img .= $starImageOn;
}
for ($j = $item->rating; $j < 5; $j++) {
$img .= $starImageOff;
}
$rating = '<td><span class="content_rating">';
$rating .= $img . ' / ';
$rating .= intval($item->rating_count);
$rating .= "</span></td>\n";
}
if ($showHits) {
$hits = "<td>" . $item->hits . "</td>";
}
if ($jVer == 2) {
require_once $_CB_framework->getCfg('absolute_path') . '/components/com_content/helpers/route.php';
$url = ContentHelperRoute::getArticleRoute($item->id, $item->catid);
if (!stristr($url, 'Itemid')) {
$url = $_CB_framework->getCfg('live_site') . '/' . $url;
} else {
$url = cbSef($url);
}
} elseif ($jVer == 1) {
$url = cbSef('index.php?option=com_content&view=article&id=' . $item->slug . '&catid=' . $item->catslug . $itemidtxt);
} else {
$url = cbSef('index.php?option=com_content&task=view&id=' . (int) $item->id . $itemidtxt);
}
$return .= "<tr class=\"sectiontableentry{$i}\"><td>" . cbFormatDate($item->created) . "</td><td><a href=\"" . $url . "\">" . $item->title . "</a></td>" . $hits . $rating . "</tr>\n";
}
//.........這裏部分代碼省略.........
示例2: getDisplayTab
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 .= "<br /><div class=\"cbMBlogDiv\" style=\"text-align:left;padding-left:0px;padding-right:0px;margin:0px 0px 10px 0px;height:auto;width:100%;\">";
$return .= "<div class=\"cbMBlogTitles\" style=\"float:left;\">".$title."</div> ";
$artURL="index.php?option=com_content&task=view&id=";
if ($searchEnabled) $return .= $searchForm;
$return .= "<br /><div style=\"clear:both;\"> </div>";
$return .= "<table cellpadding=\"5\" cellspacing=\"0\" border=\"0\" style=\"margin:0px;padding:0px;width:100%;\">";
$return .= "<tr class=\"sectiontableheader\">";
$return .= "<th>".$this->_writeSortByLink($pagingParams,"entries_","date",_UE_ARTICLEDATE,true)."</th>";
$return .= "<th>".$this->_writeSortByLink($pagingParams,"entries_","title",_UE_ARTICLETITLE)."</th>";
if($_CB_framework->getCfg( 'hits' )) {
$return .= "<th>".$this->_writeSortByLink($pagingParams,"entries_","hits",_UE_ARTICLEHITS)."</th>";
}
$return .= "</tr>";
$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 : "";
//.........這裏部分代碼省略.........