Example #1
0
 /**
  * Prepare data hook.
  *
  * @return  void
  */
 protected function prepareData()
 {
     require_once JPATH_SITE . '/components/com_content/helpers/route.php';
     $app = JFactory::getApplication();
     $data = $this->getData();
     $data->params = JComponentHelper::getParams('com_content');
     $data->user = $user = JUser::getInstance($app->input->getUsername('username'));
     JModelLegacy::addIncludePath(\Windwalker\Helper\PathHelper::getSite('com_content') . '/models');
     $model = JModelLegacy::getInstance('Articles', 'ContentModel', array('ignore_request' => true));
     $model->setState('params', $data->params);
     $access = !JComponentHelper::getParams('com_content')->get('show_noauth');
     $authorised = JAccess::getAuthorisedViewLevels(JFactory::getUser()->get('id'));
     $model->setState('filter.published', 1);
     $model->setState('filter.access', $access);
     $model->setState('filter.author_id', (int) $user->id);
     $model->setState('list.ordering', 'a.created');
     $model->setState('list.direction', 'DESC');
     $model->setState('list.limit', 10);
     $data->items = $model->getItems();
     $data->pagination = $model->getPagination();
     foreach ($data->items as &$item) {
         $item->slug = $item->id . ':' . $item->alias;
         $item->catslug = $item->catid . ':' . $item->category_alias;
         $item->params = $data->params;
         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 {
             $item->link = JRoute::_('index.php?option=com_users&view=login');
         }
         $item->parent_slug = $item->parent_alias ? $item->parent_id . ':' . $item->parent_alias : $item->parent_id;
         // No link for ROOT category
         if ($item->parent_alias == 'root') {
             $item->parent_slug = null;
         }
         $item->event = new stdClass();
         $dispatcher = JEventDispatcher::getInstance();
         // Old plugins: Ensure that text property is available
         if (!isset($item->text)) {
             $item->text = $item->introtext;
         }
         $app->input->set('option', 'com_content');
         $app->input->set('view', 'category');
         $app->input->set('layout', 'blog');
         JPluginHelper::importPlugin('content');
         $dispatcher->trigger('onContentPrepare', array('com_content.category', &$item, &$item->params, 0));
         // Old plugins: Use processed text as introtext
         $item->introtext = $item->text;
         $results = $dispatcher->trigger('onContentAfterTitle', array('com_content.category', &$item, &$item->params, 0));
         $item->event->afterDisplayTitle = trim(implode("\n", $results));
         $results = $dispatcher->trigger('onContentBeforeDisplay', array('com_content.category', &$item, &$item->params, 0));
         $item->event->beforeDisplayContent = trim(implode("\n", $results));
         $results = $dispatcher->trigger('onContentAfterDisplay', array('com_content.category', &$item, &$item->params, 0));
         $item->event->afterDisplayContent = trim(implode("\n", $results));
         $app->input->set('option', 'com_userxtd');
         $app->input->set('view', 'content');
         $app->input->set('layout', 'default');
     }
     $this->setTitle();
 }
 /**
  * Get routing config.
  *
  * @param string $option The component option name.
  *
  * @return  mixed
  */
 public static function getRouting($option)
 {
     if (self::$routing) {
         return self::$routing;
     }
     $path = PathHelper::getSite($option);
     return self::$routing = json_decode(file_get_contents($path . '/routing.json'));
 }
Example #3
0
 /**
  * Method to get the record form.
  *
  * @param	array	$data		An optional array of data for the form to interogate.
  * @param	boolean	$loadData	True if the form is to load its own data (default case), false if not.
  *
  * @return	JForm	A JForm object on success, false on failure
  */
 public function getForm($data = array(), $loadData = true)
 {
     // Get Registration Form from om_users
     JForm::addFormPath(\Windwalker\Helper\PathHelper::getSite('com_users') . '/models/forms');
     $form = $this->loadForm("{$this->option}.{$this->viewItem}", 'registration', array('control' => 'jform', 'load_data' => $loadData));
     if (empty($form)) {
         return false;
     }
     return $form;
 }
 /**
  * Get routing config.
  *
  * @param string $option The component option name.
  * @param string $type   The routing file type.
  *
  * @return  mixed
  */
 public static function getRouting($option, $type = self::TYPE_YAML)
 {
     if (self::$routing) {
         return self::$routing;
     }
     $path = PathHelper::getSite($option);
     $fileType = $type == static::TYPE_YAML ? 'yml' : $type;
     $data = new Registry();
     $data->loadFile($path . '/routing.' . $fileType, $type);
     return self::$routing = $data->toArray();
 }
Example #5
0
 *
 * @copyright  Copyright (C) 2015 {ORGANIZATION}. All rights reserved.
 * @license    GNU General Public License version 2 or later;
 */
/**
 * @var \Windwalker\View\Engine\PhpEngine $this
 */
$params = $this->params = $data->params;
foreach ($data as $k => $v) {
    $this->{$k} = $v;
}
// Templates
$app = JFactory::getApplication();
$layout = JPATH_THEMES . '/' . $app->getTemplate() . '/html/com_content/category/blog_item.php';
if (!is_file($layout)) {
    $layout = \Windwalker\Helper\PathHelper::getSite('com_content') . '/views/category/tmpl/blog_item.php';
}
?>
<div class="row-fluid">
	<div class="span12">
		<?php 
$article = new stdClass();
$article->created_by = $data->user->id;
echo \Userxtd\Content\UserInfo::createInfoBox(\Windwalker\DI\Container::getInstance('com_userxtd'), $article);
?>

		<?php 
foreach ($data->items as $item) {
    ?>
			<?php 
    $this->item = $item;