/** * Unset the post data. * * {@see BlogHelper::unsetData} for more information */ function unsetData() { return parent::unsetData(); }
function transformRSS($data) { $view = new View(); $blogHelper = new BlogHelper($view); return array('title' => $data['BlogPost']['name'], 'link' => Router::url('/' . $this->request->params['Site']['alias'] . '/' . $view->request->params['Content']['name'] . '/archives/' . $data['BlogPost']['no']), 'guid' => Router::url('/' . $this->request->params['Site']['alias'] . '/' . $view->request->params['Content']['name'] . '/archives/' . $data['BlogPost']['no']), 'category' => $data['BlogCategory']['title'], 'description' => $blogHelper->removeCtrlChars($data['BlogPost']['content']), 'pubDate' => $data['BlogPost']['posts_date']); }
$id = $blogContent['BlogContent']['id']; } else { $id = $blog_content_id; } if (empty($depth)) { $depth = 1; } $actionUrl = '/blog/blog/get_categories/' . $id . '/' . $limit . '/' . $view_count . '/' . $depth; if ($by_year) { $actionUrl .= '/year'; } $data = $this->requestAction($actionUrl); $categories = $data['categories']; $this->viewVars['blogContent'] = $data['blogContent']; App::import('Helper', 'Blog.Blog'); $blog = new BlogHelper(); ?> <div class="widget widget-blog-categories-archives widget-blog-categories-archives-<?php echo $id; ?> blog-widget"> <?php if ($name && $use_title) { ?> <h2><?php echo $name; ?> </h2> <?php
/** * Get a list of articles from a specific category * * @param \Joomla\Registry\Registry &$params object holding the models parameters * * @return mixed * * @since 1.6 */ public static function getList($start, $limit, $catid, $menuparans, $menu_limit) { // Get an instance of the generic articles model $articles = JModelLegacy::getInstance('Articles', 'ContentModel', array('ignore_request' => true)); // Set application parameters in model $app = JFactory::getApplication(); $appParams = $app->getParams(); $articles->setState('params', $appParams); // Set the filters based on the module params $articles->setState('list.start', (int) $start); $articles->setState('list.limit', (int) $limit); $articles->setState('filter.published', 1); // Access filter $access = !JComponentHelper::getParams('com_content')->get('show_noauth'); $authorised = JAccess::getAuthorisedViewLevels(JFactory::getUser()->get('id')); $articles->setState('filter.access', $access); $catids = $catid; $items = 'nao'; // Category filter if ($catids) { if ($menuparans['show_subcategory_content'] > 0 || $menuparans['show_subcategory_content'] == '-1') { $categories = JModelLegacy::getInstance('Categories', 'ContentModel', array('ignore_request' => true)); $categories->setState('params', $appParams); $levels = $menuparans['show_subcategory_content'] != '-1' ? $menuparans['show_subcategory_content'] : 99999; $categories->setState('filter.subcategories', $levels); $categories->setState('filter.max_category_levels', true); //$categories->setState('filter.get_children', $levels); $categories->setState('filter.published', 1); $categories->setState('filter.access', $access); $additional_catids = array(); $categories->setState('filter.parentId', $catids); $recursive = true; $items = $categories->getItems($recursive); $testes = array(); if ($items) { foreach ($items as $category) { ///$additional_catids[] = $category->id; $condition = $category->level - $categories->getParent()->level <= $levels; //$testes[] = $category->level.' - '.$categories->getParent()->level.'<= '.$levels; if ($condition) { $additional_catids[] = $category->id; } } } $catids = array($catids); $catids = array_unique(array_merge($catids, $additional_catids)); $items = $catids; } $articles->setState('filter.category_id', $catids); } $items = $articles->getItems(); $testes['menuparans'] = array('orderby_sec' => $menuparans['orderby_sec'], 'order_date' => $menuparans['order_date'], 'orderby_pri' => $menuparans['orderby_pri']); $testes['buildContentOrderBy'] = BlogHelper::_buildContentOrderBy($menuparans); // Ordering $articles->setState('list.ordering', BlogHelper::_buildContentOrderBy($menuparans)); $listOrder = $app->getUserStateFromRequest('com_content.category.list.' . $catid . '.filter_order_Dir', 'filter_order_Dir', '', 'cmd'); if (!in_array(strtoupper($listOrder), array('ASC', 'DESC', ''))) { $listOrder = 'ASC'; } $articles->setState('list.direction', $listOrder); $items = $articles->getItems(); // Find current Article ID if on an article page $option = $app->input->get('option'); $view = $app->input->get('view'); if ($option === 'com_content' && $view === 'article') { $active_article_id = $app->input->getInt('id'); } else { $active_article_id = 0; } // Prepare data for display using display options foreach ($items as &$item) { $item->slug = $item->id . ':' . $item->alias; $item->catslug = $item->catid . ':' . $item->category_alias; if ($access || in_array($item->access, $authorised)) { // We know that user has the privilege to view the article $item->link = JRoute::_(ContentHelperRoute::getArticleRoute($item->slug, $item->catid, $item->language)); } else { $app = JFactory::getApplication(); $menu = $app->getMenu(); $menuitems = $menu->getItems('link', 'index.php?option=com_users&view=login'); if (isset($menuitems[0])) { $Itemid = $menuitems[0]->id; } elseif ($app->input->getInt('Itemid') > 0) { // Use Itemid from requesting page only if there is no existing menu $Itemid = $app->input->getInt('Itemid'); } $item->link = JRoute::_('index.php?option=com_users&view=login&Itemid=' . $Itemid); } // Used for styling the active article $item->active = $item->id == $active_article_id ? 'active' : ''; $item->displayDate = ''; if ($item->catid) { $item->displayCategoryLink = JRoute::_(ContentHelperRoute::getCategoryRoute($item->catid)); //$item->displayCategoryTitle = $show_category ? '<a href="' . $item->displayCategoryLink . '">' . $item->category_title . '</a>' : ''; } else { //$item->displayCategoryTitle = $show_category ? $item->category_title : ''; } } return $items; }
/** * コンストラクタ * * @param View $View ビュークラス * @param array $settings ヘルパ設定値(BcBaserHelper では利用していない) */ public function __construct(View $View, $settings = array()) { parent::__construct($View, $settings); }
/** * Update an existing blog article */ public function article_update() { $view = $this->getView(); $request = $this->getPageRequest(); $article = new BlogArticleModel($request->getParameter(0)); if (!$article->exists()) { return View::ERROR_NOTFOUND; } $blog = $article->getLink('Blog'); if (!$blog->exists()) { return View::ERROR_NOTFOUND; } $manager = \Core\user()->checkAccess('p:/blog/manage_all'); $editor = \Core\user()->checkAccess($blog->get('manage_articles_permission ')) || $manager; if (!$editor) { return View::ERROR_ACCESSDENIED; } $form = BlogHelper::GetArticleForm($article); $view->mastertemplate = 'admin'; $view->templatename = 'pages/blog/article_create_update.tpl'; $view->addBreadcrumb($blog->get('title'), $blog->get('rewriteurl')); $view->addBreadcrumb($article->get('title'), $article->get('rewriteurl')); $view->title = 'Update Blog Article'; $view->assign('form', $form); $view->assign('article', $article); }
public function onAfterRoute() { $app = JFactory::getApplication(); $doc = JFactory::getDocument(); $retorno = array('total' => 0, 'layout' => ''); if ($app->isAdmin()) { return; } if ($app->get('droide-ajax', 0, 'STRING')) { if ($app->get('droide-ajax', 0, 'STRING') == 'json') { $items = array(); $retorno = array(); if ($app->get('cat_id', 0, 'INT') && $app->get('limit', 0, 'INT') && $app->get('menu_limit', 0, 'INT')) { $catid = $app->get('cat_id', 0, 'INT'); $start = $app->get('start', 0, 'INT'); $limit = $app->get('limit', 0, 'INT'); $menu_limit = $app->get('menu_limit', 0, 'INT'); $colunas = $app->get('colunas', 1, 'INT'); $menuparans = $app->get('menuparans', 0, 'STRING'); require_once __DIR__ . '/helper.php'; $items = BlogHelper::getList($start, $limit, $catid, $menuparans, $menu_limit); } $retorno['total'] = count($items); $retorno['layout'] = JLayoutHelper::render($this->params->get('layoutbloco'), array('data' => $items, 'col' => $colunas), JPATH_SITE . '/plugins/system/droideajaxscroll/tmpl/'); $doc->setMimeEncoding('application/json'); JResponse::setHeader('Content-Disposition', 'attachment;filename="progress-report-results.json"'); echo json_encode($retorno); $app->close(); } else { $items = array(); if ($app->get('cat_id', 0) && $app->get('limit', 0)) { $catid = $app->get('cat_id', 0, 'INT'); $limit = $app->get('limit', 0, 'INT'); $start = $app->get('start', 0, 'INT'); $colunas = $app->get('colunas', 1, 'INT'); $menuparans = $app->get('menuparans', 0, 'STRING'); require_once __DIR__ . '/helper.php'; $items = BlogHelper::getList($start, $limit, $catid, $menuparans); } echo $items; $app->close(); } } }