本文整理汇总了PHP中JCategories类的典型用法代码示例。如果您正苦于以下问题:PHP JCategories类的具体用法?PHP JCategories怎么用?PHP JCategories使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JCategories类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getItems
public function getItems($pk)
{
if (!count($this->_items)) {
$app = JFactory::getApplication();
$menu = $app->getMenu();
$active = $menu->getActive();
$this->params = $params = $this->getState('params');
if ($active) {
$params->loadString($active->params);
}
$options = array();
$options['countItems'] = $params->get('show_cat_items_cat', 1) || !$params->get('show_empty_categories_cat', 0);
$categories = JCategories::getInstance('Contact', $options);
$this->_parent = $categories->get($pk['id']);
$JSNConfig = JSNFactory::getConfig();
$JSNConfig->megreMenuParams($pk['Itemid'], $params, 'com_contact');
$JSNConfig->megreGlobalParams('com_contact', $this->params, true);
if (is_object($this->_parent)) {
$this->_items = $this->_parent->getChildren();
} else {
$this->_items = false;
}
}
return $this->_items;
}
示例2: getCategoryRoute
public static function getCategoryRoute($catid)
{
if ($catid instanceof JCategoryNode) {
$id = $catid->id;
$category = $catid;
} else {
$id = (int) $catid;
$category = JCategories::getInstance('Content')->get($id);
}
if ($id < 1) {
$link = '';
} else {
$needles = array('category' => array($id));
if ($item = self::_findItem($needles)) {
$link = 'index.php?Itemid=' . $item;
} else {
//Create the link
$link = 'index.php?option=com_content&view=category&id=' . $id;
if ($category) {
$catids = array_reverse($category->getPath());
$needles = array('category' => $catids, 'categories' => $catids);
if ($item = self::_findItem($needles)) {
$link .= '&Itemid=' . $item;
} elseif ($item = self::_findItem()) {
$link .= '&Itemid=' . $item;
}
}
}
}
return $link;
}
示例3: get_category
function get_category($catid)
{
if (!is_object($this->_item)) {
$app = JFactory::getApplication();
$menu = $app->getMenu();
$active = $menu->getActive();
$params = new JRegistry();
if ($active) {
$params->loadString($active->params);
}
$options = array();
$options['countItems'] = $params->get('show_cat_num_articles_cat', 1) || !$params->get('show_empty_categories_cat', 0);
$catid = $catid > 0 ? $catid : 'root';
$categories = JCategories::getInstance('CommunitySurveys', $options);
$this->_item = $categories->get($catid);
if (is_object($this->_item)) {
$user = JFactory::getUser();
$userId = $user->get('id');
$asset = 'com_content.category.' . $this->_item->id;
if ($user->authorise('core.create', $asset)) {
$this->_item->getParams()->set('access-create', true);
}
}
}
return $this->_item;
}
示例4: getArticleRoute
/**
* @param int The route of the content item
*/
public static function getArticleRoute($id, $catid = 0, $language = 0)
{
$needles = array('article' => array((int) $id));
//Create the link
$link = 'index.php?option=com_tz_portfolio_plus&view=article&id=' . $id;
if ((int) $catid > 1) {
$categories = JCategories::getInstance('TZ_Portfolio_Plus');
$category = $categories->get((int) $catid);
if ($category) {
$needles['portfolio'] = array_reverse($category->getPath());
$needles['categories'] = $needles['portfolio'];
$needles['date'] = $needles['portfolio'];
$link .= '&catid=' . $catid;
}
}
if ($language && $language != "*" && JLanguageMultilang::isEnabled()) {
self::buildLanguageLookup();
if (isset(self::$lang_lookup[$language])) {
$link .= '&lang=' . self::$lang_lookup[$language];
$needles['language'] = $language;
}
}
if ($item = self::_findItem($needles)) {
$link .= '&Itemid=' . $item;
} elseif ($item = self::_findItem()) {
$link .= '&Itemid=' . $item;
}
return $link;
}
示例5: getCategoryRoute
public static function getCategoryRoute($catid, $language = 0)
{
if ($catid instanceof JCategoryNode) {
$id = $catid->id;
$category = $catid;
} else {
$id = (int) $catid;
$category = JCategories::getInstance('Contact')->get($id);
}
if ($id < 1 || !$category instanceof JCategoryNode) {
$link = '';
} else {
$needles = array();
// Create the link
$link = 'index.php?option=com_contact&view=category&id=' . $id;
$catids = array_reverse($category->getPath());
$needles['category'] = $catids;
$needles['categories'] = $catids;
if ($language && $language != "*" && JLanguageMultilang::isEnabled()) {
self::buildLanguageLookup();
if (isset(self::$lang_lookup[$language])) {
$link .= '&lang=' . self::$lang_lookup[$language];
$needles['language'] = $language;
}
}
if ($item = self::_findItem($needles)) {
$link .= '&Itemid=' . $item;
}
}
return $link;
}
示例6: display
/**
* Метод для отображения формы вопроса
* @param unknown_type $tpl
*/
public function display($tpl = null)
{
$catid = JRequest::getInt('catid', null, 'GET');
if (!$catid) {
throw new Exception('Category id not set');
}
JForm::addFormPath('components/com_smfaq/models/forms');
JForm::addFieldPath('components/com_smfaq/models/fields');
$form = JForm::getInstance('question', 'question');
$categories = JCategories::getInstance('SmFaq');
$category = $categories->get($catid);
$params = $category->getParams();
if ($layout = $params->get('category_layout')) {
$this->setLayout($layout);
}
JPluginHelper::importPlugin('smfaq');
$dispatcher = JDispatcher::getInstance();
$results = $dispatcher->trigger('onPrepareForm', array($form));
// Check for errors encountered while preparing the form.
if (count($results) && in_array(false, $results, true)) {
// Get the last error.
$error = $dispatcher->getError();
if (!$error instanceof Exception) {
throw new Exception($error);
}
}
$this->assignRef('form', $form);
$this->assignRef('params', $params);
$this->assignRef('category', $category);
parent::display($tpl);
}
示例7: getCategoryRoute
/**
* Get the category route.
*
* @param integer $catid The category ID.
* @param integer $language The language code.
*
* @return string The product route.
*
* @since 1.5
*/
public static function getCategoryRoute($catid, $language = 0)
{
if ($catid instanceof JCategoryNode) {
$id = $catid->id;
$category = $catid;
} else {
$id = (int) $catid;
$category = JCategories::getInstance('DigiCom')->get($id);
}
if ($id < 1 || !$category instanceof JCategoryNode) {
$link = '';
} else {
$needles = array();
$link = 'index.php?option=com_digicom&view=category&id=' . $id;
$catids = array_reverse($category->getPath());
$needles['category'] = $catids;
$needles['categories'] = $catids;
if ($language && $language != "*" && JLanguageMultilang::isEnabled()) {
$link .= '&lang=' . $language;
$needles['language'] = $language;
}
if ($item = self::_findItem($needles)) {
$link .= '&Itemid=' . $item;
}
}
return $link;
}
示例8: display
function display($tpl = null)
{
// Parameters
$app = JFactory::getApplication();
$doc = JFactory::getDocument();
$params = $app->getParams();
$feedEmail = $app->getCfg('feed_email', 'author');
$siteEmail = $app->getCfg('mailfrom');
$doc->link = JRoute::_('index.php?option=com_content&view=featured');
// Get some data from the model
JRequest::setVar('limit', $app->getCfg('feed_limit'));
$categories = JCategories::getInstance('Content');
$rows = $this->get('Items');
foreach ($rows as $row) {
// strip html from feed item title
$title = $this->escape($row->title);
$title = html_entity_decode($title, ENT_COMPAT, 'UTF-8');
// Compute the article slug
$row->slug = $row->alias ? $row->id . ':' . $row->alias : $row->id;
// Url link to article
$link = JRoute::_(ContentHelperRoute::getArticleRoute($row->slug, $row->catid));
// Get row fulltext
$db = JFactory::getDBO();
$query = 'SELECT' . $db->quoteName('fulltext') . 'FROM #__content WHERE id =' . $row->id;
$db->setQuery($query);
$row->fulltext = $db->loadResult();
$description = $params->get('feed_summary', 0) ? $row->introtext . $row->fulltext : $row->introtext;
$author = $row->created_by_alias ? $row->created_by_alias : $row->author;
// Load individual item creator class
$item = new JFeedItem();
$item->title = $title;
$item->link = $link;
$item->date = $row->publish_up;
$item_category = $categories->get($row->catid);
$item->category = array();
$item->category[] = JText::_('JFEATURED');
// All featured articles are categorized as "Featured"
for ($item_category = $categories->get($row->catid); $item_category !== null; $item_category = $item_category->getParent()) {
if ($item_category->id > 1) {
// Only add non-root categories
$item->category[] = $item_category->title;
}
}
$item->author = $author;
if ($feedEmail == 'site') {
$item->authorEmail = $siteEmail;
} elseif ($feedEmail === 'author') {
$item->authorEmail = $row->author_email;
}
// Add readmore link to description if introtext is shown, show_readmore is true and fulltext exists
if (!$params->get('feed_summary', 0) && $params->get('feed_show_readmore', 0) && $row->fulltext) {
$description .= '<p class="feed-readmore"><a target="_blank" href ="' . $item->link . '">' . JText::_('COM_CONTENT_FEED_READMORE') . '</a></p>';
}
// Load item description and add div
$item->description = '<div class="feed-description">' . $description . '</div>';
// Loads item info into rss array
$doc->addItem($item);
}
}
示例9: getCategorySegment
/**
* Get content items of the type category
*
* @param int $id ID of the category to load
*
* @return array Categories path identified by $id
*
* @since 3.4
*/
public function getCategorySegment($id, $query)
{
$category = JCategories::getInstance($this->getName())->get($id);
if ($category) {
return array_reverse($category->getPath(), true);
}
return array();
}
示例10: getCategory
public function getCategory()
{
$id = $this->getState('filter.category_id');
jimport('joomla.application.categories');
$cat = JCategories::getInstance('Content', array('extension' => 'com_content', 'table' => ''));
$category = $cat->get($id);
return $category;
}
示例11: getListQuery
protected function getListQuery()
{
$id = JRequest::getUInt('id');
jimport('joomla.application.categories');
$catObj = JCategories::getInstance('JNT_Hanhphuc', array('extension' => 'com_jnt_hanhphuc', 'table' => ''));
$category = $catObj->get($id);
$query = FrontJntHanhphucHelper::getUsers($category->id, true);
return $query;
}
示例12: display
public function display($tpl = null)
{
$this->doc = JFactory::getDocument();
$this->app = JFactory::getApplication();
$this->user = JFactory::getUser();
$this->params = $this->app->getParams();
$this->menu = $this->app->getMenu()->getActive();
// Params
$this->showDate = $this->app->input->get('showDate', $this->params->get('showDate', 1));
$this->showIcon = $this->app->input->get('showIcon', $this->params->get('showIcon', 1));
$this->showDesc = $this->app->input->get('showDesc', $this->params->get('showDesc', 1));
$this->showAuth = $this->app->input->get('showAuth', $this->params->get('showAuth', 0));
$this->showLicence = $this->app->input->get('showLicence', $this->params->get('showLicence', 0));
$this->showSize = $this->app->input->get('showSize', $this->params->get('showSize', 1));
$this->showMD5 = $this->app->input->get('showMD5', $this->params->get('showMD5', 0));
$this->showNew = $this->app->input->get('showNew', $this->params->get('showNew', 1));
$this->newfiledays = $this->params->get('newfiledays', 7);
$this->show_page_heading = $this->app->input->get('show_page_heading', 1);
$this->subview = $this->app->input->get('subview', 'list');
$this->defIcon = $this->params->get('defaulticon', "./media/com_simplefilemanager/images/document.png");
$this->linkOnEntryTitle = $this->params->get('linkOnTitle', 1);
$this->enableOrderingSelect = $this->app->input->get('sortFieldSelection', 1);
// Permissions
$this->canCreate = $this->user->authorise('core.create', 'com_simplefilemanager');
$this->canEdit = $this->user->authorise('core.edit', 'com_simplefilemanager');
$this->canCheckin = $this->user->authorise('core.manage', 'com_simplefilemanager');
$this->canChange = $this->user->authorise('core.edit.state', 'com_simplefilemanager');
$this->canDelete = $this->user->authorise('core.delete', 'com_simplefilemanager');
// View data
$this->state = $this->get('State');
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
$this->params = $this->app->getParams('com_simplefilemanager');
$this->catID = $this->app->input->get('catid', 0);
$this->category = JCategories::getInstance('Simplefilemanager')->get($this->catID);
$this->sortDirection = $this->state->get('list.direction');
$this->sortColumn = $this->state->get('list.ordering');
$this->sortFields = $this->getSortFields();
// CSS and Libraries
$this->doc->addStyleSheet("./media/com_simplefilemanager/css/site.stylesheet.css");
foreach ($this->items as $item) {
$item->icon = $item->icon ?: $this->defIcon;
$item->canDownload = $item->visibility == 1 || $item->visibility == 3 && $item->reserved_user == $this->user->id || $item->visibility == 2 && $item->user->id || $item->visibility == 5 && $item->author == $this->user->id || $item->visibility == 4 && in_array($item->reserved_group, JAccess::getGroupsByUser($this->user->id));
}
if (!$this->catID or !$this->category) {
JError::raiseError(500);
}
// TODO: Check if user can view cateogry else throw a 403 error
$this->children = $this->category->getChildren();
// Check for errors.
if (count($errors = $this->get('Errors'))) {
throw new Exception(implode("\n", $errors));
}
$this->_prepareDocument();
parent::display($tpl);
echo JText::_("COM_SIMPLEFILEMANAGER_CREDITS");
}
示例13: getList
public static function getList(&$params)
{
$categories = JCategories::getInstance('Content');
$category = $categories->get($params->get('parent', 'root'));
$items = $category->getChildren();
if ($params->get('count', 0) > 0 && count($items) > $params->get('count', 0)) {
$items = array_slice($items, 0, $params->get('count', 0));
}
return $items;
}
示例14: __construct
public function __construct($options = array())
{
//echo 'EXTENDS JCATEGORIES';
$options['table'] = '#__imc_issues';
$options['extension'] = 'com_imc';
parent::__construct($options);
}
示例15: __construct
public function __construct($options = array())
{
$options['table'] = '#__agendadirigentes_cargos';
$options['extension'] = 'com_agendadirigentes';
$options['statefield'] = 'published';
parent::__construct($options);
}