Ejemplo n.º 1
0
 /**
  * Метод для отображения формы вопроса
  * @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);
 }
Ejemplo n.º 2
0
 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;
 }
Ejemplo n.º 3
0
 /**
  * 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;
 }
Ejemplo n.º 4
0
 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;
 }
Ejemplo n.º 5
0
 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;
 }
Ejemplo n.º 6
0
 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;
 }
Ejemplo n.º 7
0
 /**
  * @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&amp;view=article&amp;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 .= '&amp;catid=' . $catid;
         }
     }
     if ($language && $language != "*" && JLanguageMultilang::isEnabled()) {
         self::buildLanguageLookup();
         if (isset(self::$lang_lookup[$language])) {
             $link .= '&amp;lang=' . self::$lang_lookup[$language];
             $needles['language'] = $language;
         }
     }
     if ($item = self::_findItem($needles)) {
         $link .= '&amp;Itemid=' . $item;
     } elseif ($item = self::_findItem()) {
         $link .= '&amp;Itemid=' . $item;
     }
     return $link;
 }
Ejemplo n.º 8
0
 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);
     }
 }
 /**
  * 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();
 }
Ejemplo n.º 10
0
 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;
 }
Ejemplo n.º 11
0
 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");
 }
Ejemplo n.º 12
0
 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;
 }
Ejemplo n.º 13
0
 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;
 }
Ejemplo n.º 14
0
Archivo: imc.php Proyecto: viru48/imc
 private static function getCategoriesUserGroups($recursive = false)
 {
     $_categories = JCategories::getInstance('Imc');
     $_parent = $_categories->get();
     if (is_object($_parent)) {
         $_items = $_parent->getChildren($recursive);
     } else {
         $_items = false;
     }
     return ImcHelper::loadCats($_items);
 }
Ejemplo n.º 15
0
 function getCategories($recursive = false)
 {
     $_categories = JCategories::getInstance('Improvemycity');
     $this->_parent = $_categories->get();
     if (is_object($this->_parent)) {
         $this->_items = $this->_parent->getChildren($recursive);
     } else {
         $this->_items = false;
     }
     return $this->loadCats($this->_items);
 }
Ejemplo n.º 16
0
 function display($tpl = NULL)
 {
     /**
      * @var JSite $app
      */
     $app = JFactory::getApplication();
     $this->params = $app->getParams();
     /* Default Page fallback*/
     $active = $app->getMenu()->getActive();
     if (NULL == $active) {
         $this->params->merge($app->getMenu()->getDefault()->params);
         $active = $app->getMenu()->getDefault();
     }
     $this->currentItemid = $active->id;
     $this->catid = JRequest::getInt('catid', 0);
     if ($this->catid == 0) {
         $this->catid = 'root';
     }
     $options = array();
     $options['countItems'] = $this->params->get('show_items_per_category_count', 0);
     /**
      * @var JCategories $categories
      */
     $categories = JCategories::getInstance('Eventgallery', $options);
     /**
      * @var JCategoryNode $root
      */
     if (null != $this->catid) {
         $this->category = $categories->get($this->catid);
     }
     if ($this->category == null || $this->category->published != 1) {
         return JError::raiseError(404, JText::_('JGLOBAL_CATEGORY_NOT_FOUND'));
     }
     $entriesPerPage = $this->params->get('max_events_per_page', 12);
     $model = $this->getModel('categories');
     $eventModel = JModelLegacy::getInstance('Event', 'EventgalleryModel');
     $user = JFactory::getUser();
     $usergroups = JUserHelper::getUserGroups($user->id);
     $entries = $model->getEntries(JRequest::getVar('start', 0), $entriesPerPage, $this->params->get('tags'), $this->params->get('sort_events_by'), $usergroups, $this->catid);
     $this->pageNav = $model->getPagination();
     $this->entries = $entries;
     $this->eventModel = $eventModel;
     $this->_prepareDocument();
     /**
      * @var JPathway $pathway
      */
     $pathway = $app->getPathway();
     $rootCategoryId = 0;
     if (isset($active->query['catid'])) {
         $rootCategoryId = $active->query['catid'];
     }
     EventgalleryHelpersCategories::addCategoryPathToPathway($pathway, $rootCategoryId, JRequest::getInt('catid', 0), $this->currentItemid);
     parent::display($tpl);
 }
Ejemplo n.º 17
0
 public static function getCategories($recursive = false)
 {
     $_categories = JCategories::getInstance('Imc');
     $_parent = $_categories->get();
     if (is_object($_parent)) {
         $_items = $_parent->getChildren($recursive);
     } else {
         $_items = false;
     }
     return ModImcfiltersHelper::loadCats($_items);
 }
Ejemplo n.º 18
0
 /**
  * Execute and display a template script.
  *
  * @param   string  $tpl  The name of the template file to parse; automatically searches through the template paths.
  *
  * @return  mixed  Exception object if there is any failure, otherwise nothing is returned.
  */
 public function display($tpl = null)
 {
     $this->app = JFactory::getApplication('site');
     $this->input = $this->app->input;
     $this->params = $this->app->getParams();
     $model = $this->getModel();
     $categories = JCategories::getInstance('Edashboard', array());
     $this->category = $categories->get($this->input->getInt('category_id', 0));
     $this->edashboards = $this->get('Items');
     $this->pagination = $this->get('Pagination');
     parent::display($tpl);
 }
Ejemplo n.º 19
0
 function display($tpl = null)
 {
     // parameters
     $app = JFactory::getApplication();
     $db = JFactory::getDbo();
     $document = JFactory::getDocument();
     $params = $app->getParams();
     $feedEmail = @$app->getCfg('feed_email') ? $app->getCfg('feed_email') : 'author';
     $siteEmail = $app->getCfg('mailfrom');
     $document->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));
         // strip html from feed item description text
         // TODO: Only pull fulltext if necessary (actually, just get the necessary fields).
         $description = $params->get('feed_summary', 0) ? $row->introtext : $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->description = $description;
         $item->date = $row->created;
         $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;
         } else {
             $item->authorEmail = $row->author_email;
         }
         // loads item info into rss array
         $document->addItem($item);
     }
 }
Ejemplo n.º 20
0
 /**
  * Метод для отображения формы вопроса
  * @param unknown_type $tpl
  */
 public function display($tpl = null)
 {
     $id = JRequest::getInt('id', null, 'POST');
     $catid = JRequest::getInt('catid', null, 'catid');
     $categories = JCategories::getInstance('SmFaq');
     $category = $categories->get($catid);
     $params = $category->getParams();
     if ($layout = $params->get('category_layout')) {
         $this->setLayout($layout);
     }
     $this->assignRef('id', $id);
     parent::display($tpl);
 }
Ejemplo n.º 21
0
 static function getTree($xmap, $parent, &$params)
 {
     self::initialize($params);
     $app = JFactory::getApplication();
     $weblinks_params = $app->getParams('com_weblinks');
     $link_query = parse_url($parent->link);
     parse_str(html_entity_decode($link_query['query']), $link_vars);
     $view = JArrayHelper::getValue($link_vars, 'view', 0);
     $app = JFactory::getApplication();
     $menu = $app->getMenu();
     $menuparams = $menu->getParams($parent->id);
     if ($view == 'category') {
         $catid = intval(JArrayHelper::getValue($link_vars, 'id', 0));
     } elseif ($view == 'categories') {
         $catid = 0;
     } else {
         // Only expand category menu items
         return;
     }
     $include_links = JArrayHelper::getValue($params, 'include_links', 1, '');
     $include_links = $include_links == 1 || $include_links == 2 && $xmap->view == 'xml' || $include_links == 3 && $xmap->view == 'html' || $xmap->view == 'navigator';
     $params['include_links'] = $include_links;
     $priority = JArrayHelper::getValue($params, 'cat_priority', $parent->priority, '');
     $changefreq = JArrayHelper::getValue($params, 'cat_changefreq', $parent->changefreq, '');
     if ($priority == '-1') {
         $priority = $parent->priority;
     }
     if ($changefreq == '-1') {
         $changefreq = $parent->changefreq;
     }
     $params['cat_priority'] = $priority;
     $params['cat_changefreq'] = $changefreq;
     $priority = JArrayHelper::getValue($params, 'link_priority', $parent->priority, '');
     $changefreq = JArrayHelper::getValue($params, 'link_changefreq', $parent->changefreq, '');
     if ($priority == '-1') {
         $priority = $parent->priority;
     }
     if ($changefreq == '-1') {
         $changefreq = $parent->changefreq;
     }
     $params['link_priority'] = $priority;
     $params['link_changefreq'] = $changefreq;
     $options = array();
     $options['countItems'] = false;
     $options['catid'] = rand();
     $categories = JCategories::getInstance('Weblinks', $options);
     $category = $categories->get($catid ? $catid : 'root', true);
     $params['count_clicks'] = $weblinks_params->get('count_clicks');
     xmap_com_weblinks::getCategoryTree($xmap, $parent, $params, $category);
 }
Ejemplo n.º 22
0
 /**
  * Get list of articles
  *
  * @param   JRegistry  &$params  module parameters
  *
  * @return array
  */
 public static function getList(&$params)
 {
     $options = array();
     $options['countItems'] = $params->get('numitems', 0);
     $categories = JCategories::getInstance('Content', $options);
     $category = $categories->get($params->get('parent', 'root'));
     if ($category != null) {
         $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;
     }
 }
Ejemplo n.º 23
0
 protected function populateState($ordering = null, $direction = null)
 {
     // Initialise variables.
     $app = JFactory::getApplication('site');
     $id = JRequest::getInt('id');
     $this->setState('question.id', $id);
     $catid = JRequest::getInt('catid');
     $this->setState('category.id', $id);
     $category = JCategories::getInstance('Smfaq')->get($catid);
     if (!$category) {
         throw new Exception(JText::_('COM_SMFAQ_ERROR_LOAD_CATEGORY'));
         return;
     }
     $params = $category->getParams();
     $this->setState('params', $params);
 }
Ejemplo n.º 24
0
 static function getList($params)
 {
     $app = JFactory::getApplication();
     $db = JFactory::getDbo();
     $result = array();
     $query = $db->getQuery(true);
     jimport('joomla.application.categories');
     $catObj = JCategories::getInstance('JNT_Hanhphuc');
     $categories = $catObj->get()->getChildren();
     foreach ($categories as &$cat) {
         $cat->subCategories = $cat->getChildren();
     }
     $result['categories'] = $categories;
     $result['provinces'] = FrontJntHanhphucHelper::getProvinces();
     return $result;
 }
Ejemplo n.º 25
0
 /**
  * Get the alternate title for the module
  *
  * @param	JObject	The module parameters.
  * @return	string	The alternate title for the module.
  */
 public static function getTitle($params)
 {
     $who = $params->get('user_id');
     $catid = (int) $params->get('catid');
     if ($catid) {
         $category = JCategories::getInstance('Content')->get($catid);
         if ($category) {
             $title = $category->title;
         } else {
             $title = JText::_('MOD_POPULAR_UNEXISTING');
         }
     } else {
         $title = '';
     }
     return JText::plural('MOD_POPULAR_TITLE' . ($catid ? "_CATEGORY" : '') . ($who != '0' ? "_{$who}" : ''), (int) $params->get('count'), $title);
 }
Ejemplo n.º 26
0
 public static function getCategoryRoute($catid, $language = 0)
 {
     if ($catid instanceof JCategoryNode) {
         $id = $catid->id;
         $category = $catid;
     } else {
         $id = (int) $catid;
         $category = JCategories::getInstance('Content')->get($id);
     }
     if ($id < 1) {
         $link = '';
     } else {
         $link = 'index.php?option=com_content&view=category&id=' . $id;
         $needles = array('category' => array($id));
         if ($language && $language != "*" && JLanguageMultilang::isEnabled()) {
             $db = JFactory::getDBO();
             $query = $db->getQuery(true);
             $query->select('a.sef AS sef');
             $query->select('a.lang_code AS lang_code');
             $query->from('#__languages AS a');
             $db->setQuery($query);
             $langs = $db->loadObjectList();
             foreach ($langs as $lang) {
                 if ($language == $lang->lang_code) {
                     $link .= '&lang=' . $lang->sef;
                     $needles['language'] = $language;
                 }
             }
         }
         if ($item = self::_findItem($needles)) {
             $link .= '&Itemid=' . $item;
         } else {
             //Create the link
             if ($category) {
                 $catids = array_reverse($category->getPath());
                 $needles['category'] = $catids;
                 $needles['categories'] = $catids;
                 if ($item = self::_findItem($needles)) {
                     $link .= '&Itemid=' . $item;
                 } elseif ($item = self::_findItem()) {
                     $link .= '&Itemid=' . $item;
                 }
             }
         }
     }
     return $link;
 }
 /**
  * Prepares the document.
  *
  * @return  void.
  */
 protected function _prepareDocument()
 {
     $app = JFactory::getApplication();
     $menus = $app->getMenu();
     $pathway = $app->getPathway();
     $title = null;
     $metadata = new JRegistry($this->state->get('item.metadata'));
     // Ссылка на активный пункт меню
     $menu = $menus->getActive();
     // Проверка привязана ли категория к меню
     $cid = (int) @$menu->query['cid'];
     $this->category = JCategories::getInstance('Catalogue')->get($cid);
     if ($menu && ($menu->query['option'] != 'com_catalogue' || $menu->query['view'] == 'category' || $cid != $this->category->id)) {
         $pathway->addItem($this->item->item_name, '');
     }
     if ($menu && $cid == $this->state->get('item.id')) {
         // Если привязана к меню то берем TITLE из меню
         $title = $menu->params->get('page_title');
     } else {
         // Если нет то берем TITLE из настрое категории (по умолчанию название категории)
         $title = $metadata->get('metatitle', $this->state->get('item.name'));
     }
     // Установка <TITLE>
     if (empty($title)) {
         $title = $app->getCfg('sitename');
     } elseif ($app->getCfg('sitename_pagetitles', 0) == 1) {
         $title = JText::sprintf('JPAGETITLE', $title, $app->getCfg('sitename'));
     } elseif ($app->getCfg('sitename_pagetitles', 0) == 2) {
         $title = JText::sprintf('JPAGETITLE', $title, $app->getCfg('sitename'));
     }
     $this->document->setTitle($title);
     // Устновка метаданных
     if ($metadesc = $metadata->get('metadesc', '')) {
         $this->document->setDescription($metadesc);
     } elseif (!$metadesc && $menu && $menu->params->get('menu-meta_description')) {
         $this->document->setDescription($menu->params->get('menu-meta_description'));
     }
     if ($metakey = $metadata->get('metakey', '')) {
         $this->document->setMetadata('keywords', $metakey);
     } elseif (!$metakey && $menu && $menu->params->get('menu-meta_keywords')) {
         $this->document->setMetadata('keywords', $menu->params->get('menu-meta_keywords'));
     }
     if ($robots = $metadata->get('robots', '')) {
         $this->document->setMetadata('robots', $robots);
     }
 }
 function display($tpl = null)
 {
     $toolbar = JToolBar::getInstance();
     JHtml::stylesheet('com_braftonarticles/media/css/admin/style.css', array('media/'), true);
     $document = JFactory::getDocument();
     $document->addstylesheet(JUri::root(true) . '/media/com_braftonarticles/media/css/admin/style.css');
     JToolBarHelper::title('Brafton Article Importer', 'logo');
     JToolBarHelper::apply('options.apply');
     JToolBarHelper::cancel('options.cancel');
     JToolBarHelper::divider();
     $toolbar->appendButton('Confirm', 'This will build the importing category structure.', 'refresh', 'Sync Categories', 'options.sync_categories', false);
     //$toolbar->appendButton('Confirm', 'This will attempt to rebuild the listing of loaded Brafton content. This may have severe consequences and is irreversible! Are you sure you want to do this?', 'purge', 'Rebuild Content Listing', 'devtools.rebuild_content_listing', false);
     $toolbar->appendButton('Confirm', 'This will run your article importer', 'refresh', 'Run Article Importer', 'cron.loadArticles', false);
     $this->api_key = $this->get('APIKey');
     $this->base_url = $this->get('BaseURL');
     $this->author = $this->get('Author');
     $this->authorList = $this->get('AuthorList');
     $this->importOrder = $this->get('ImportOrder');
     $this->publishedState = $this->get('PublishedState');
     $this->updateArticles = $this->get('UpdateArticles');
     $this->parentCategory = $this->get('ParentCategory');
     $this->categoryList = array();
     $cats = JCategories::getInstance('Content');
     $this->populateCategoryList($cats->get('root'), 0);
     //load video options
     $this->public_key = $this->get('PublicKey');
     $this->secret_key = $this->get('SecretKey');
     $this->feed_number = $this->get('FeedNumber');
     $this->pauseText = $this->get('PauseText');
     $this->pauseLink = $this->get('PauseLink');
     $this->pauseAssetId = $this->get('PauseAssetId');
     $this->endTitle = $this->get('EndTitle');
     $this->endSubtitle = $this->get('endSubtitle');
     $this->endText = $this->get('EndButtonText');
     $this->endLink = $this->get('EndButtonLink');
     $this->endAssetId = $this->get('EndAssetId');
     $this->endBackground = $this->get('EndBackground');
     $this->import_assets = $this->get('ImportAssets');
     $this->stopImporter = $this->get('StopImporter');
     if ($this->stopImporter == 'On') {
         $app = JFactory::getApplication();
         $app->enqueueMessage(JText::_('There was a vital failure when running your importer.  Please check the Log for errors.  Once you have solved the issue Turn Importer Error to Off under Advanced Options'), 'error');
     }
     $this->debug = $this->get('Debug');
     parent::display($tpl);
 }
Ejemplo n.º 29
0
 public function display($tpl = null)
 {
     // Initialise variables.
     $app = JFactory::getApplication();
     $user = JFactory::getUser();
     // Get model data.
     $this->state = $this->get('State');
     $this->item = $this->get('Item');
     $this->form = $this->get('Form');
     $this->return_page = $this->get('ReturnPage');
     if (empty($this->item->id)) {
         $authorised = $user->authorise('core.create', 'com_content') || count($user->getAuthorisedCategories('com_content', 'core.create'));
     } else {
         $authorised = $this->item->params->get('access-edit');
     }
     if ($authorised !== true) {
         JError::raiseError(403, JText::_('JERROR_ALERTNOAUTHOR'));
         return false;
     }
     if (!empty($this->item)) {
         $this->item->images = json_decode($this->item->images);
         $this->item->urls = json_decode($this->item->urls);
         $this->form->bind($this->item);
         $this->form->bind($this->item->urls);
         $this->form->bind($this->item->images);
     }
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseWarning(500, implode("\n", $errors));
         return false;
     }
     // Create a shortcut to the parameters.
     $params =& $this->state->params;
     //Escape strings for HTML output
     $this->pageclass_sfx = htmlspecialchars($params->get('pageclass_sfx'));
     $this->params = $params;
     $this->user = $user;
     if ($this->params->get('enable_category') == 1) {
         $catid = JRequest::getInt('catid');
         $category = JCategories::getInstance('Content')->get($this->params->get('catid', 1));
         $this->category_title = $category->title;
     }
     $this->_prepareDocument();
     parent::display($tpl);
 }
Ejemplo n.º 30
0
 /**
  * A method to get the route for a specific item
  *
  * @param   integer  $id         Value of the primary key for the item in its content table
  * @param   string   $typealias  The type_alias for the item being routed. Of the form extension.view.
  * @param   string   $link       The link to be routed
  * @param   string   $language   The language of the content for multilingual sites
  * @param   integer  $catid      Optional category id
  *
  * @return  string  The route of the item
  *
  * @since   3.1
  */
 public function getRoute($id, $typealias, $link = '', $language = null, $catid = null)
 {
     $typeExploded = explode('.', $typealias);
     $this->view = $typeExploded[1];
     $this->extension = $typeExploded[0];
     $name = ucfirst(substr_replace($this->extension, '', 0, 4));
     if (isset($this->view)) {
         $needles = array($this->view => array((int) $id));
     }
     if (empty($link)) {
         // Create the link
         $link = 'index.php?option=' . $this->extension . '&view=' . $this->view . '&id=' . $id;
     }
     if ($catid > 1) {
         $categories = JCategories::getInstance($name);
         if ($categories) {
             $category = $categories->get((int) $catid);
             if ($category) {
                 $needles['category'] = array_reverse($category->getPath());
                 $needles['categories'] = $needles['category'];
                 $link .= '&catid=' . $catid;
             }
         }
     }
     // Deal with languages only if needed
     if (!empty($language) && $language != '*' && JLanguageMultilang::isEnabled()) {
         $db = JFactory::getDbo();
         $query = $db->getQuery(true)->select('a.sef AS sef')->select('a.lang_code AS lang_code')->from('#__languages AS a');
         $db->setQuery($query);
         $langs = $db->loadObjectList();
         foreach ($langs as $lang) {
             if ($language == $lang->lang_code) {
                 $link .= '&lang=' . $lang->sef;
                 $needles['language'] = $language;
             }
         }
     }
     if ($item = self::findItem($needles)) {
         $link .= '&Itemid=' . $item;
     } elseif ($item = self::findItem()) {
         $link .= '&Itemid=' . $item;
     }
     return $link;
 }