Example #1
0
 protected function _fetchData(KViewContext $context)
 {
     $state = $this->getModel()->getState();
     $container = $this->getModel()->getContainer();
     $config = new KObjectConfig($state->config);
     $config->append(array('router' => array('defaults' => array('option' => 'com_' . substr($container->slug, 0, strpos($container->slug, '-')), 'routed' => '1')), 'initial_response' => true))->append($this->getConfig()->config);
     if ($config->initial_response === true) {
         $count = 0;
         $query = $state->getValues();
         unset($query['config']);
         $query['thumbnails'] = $this->getModel()->getContainer()->getParameters()->thumbnails;
         if (strpos($this->getLayout(), 'compact') !== false) {
             $query['limit'] = 0;
             $count = ComFilesIteratorDirectory::countNodes(array('path' => $this->getModel()->getPath()));
         }
         if ($count < 100) {
             $controller = $this->getObject('com:files.controller.node');
             $controller->getRequest()->setQuery($query);
             $config->initial_response = $controller->format('json')->render();
         } else {
             unset($config->initial_response);
         }
     }
     $state->config = $config->toArray();
     $context->data->sitebase = trim(JURI::root(), '/');
     $context->data->token = $this->getObject('user')->getSession()->getToken();
     $context->data->container = $container;
     $context->data->debug = KClassLoader::getInstance()->isDebug();
     parent::_fetchData($context);
     $context->parameters = $state->getValues();
     $context->parameters->config = $config;
 }
Example #2
0
 protected function _fetchData(KViewContext $context)
 {
     //Set the language information
     $language = JFactory::getApplication()->getCfg('language');
     $context->data->language = $language ? $language : 'en-GB';
     $context->data->direction = JFactory::getLanguage()->isRTL() ? 'rtl' : 'ltr';
     parent::_fetchData($context);
 }
Example #3
0
 protected function _fetchData(KViewContext $context)
 {
     parent::_fetchData($context);
     $context->data->gateways = $this->getObject('com://site/sales.model.gateways')->enabled(1)->fetch();
     //Load plugin translations
     foreach ($context->data->gateways as $gateway) {
         $this->getObject('translator')->load('plg://site/' . $gateway->folder . '.' . $gateway->element);
     }
 }
Example #4
0
 protected function _fetchData(KViewContext $context)
 {
     $state = $this->getModel()->getState();
     $container = $this->getObject('com:files.model.containers')->id($state->container)->fetch();
     $context->data->sitebase = trim(JURI::root(), '/');
     $context->data->token = $this->getObject('user')->getSession()->getToken();
     $context->data->container = $container->getIterator()->current();
     parent::_fetchData($context);
     $context->parameters->config = $this->getConfig()->config;
 }
Example #5
0
    /**
     * Create a route based on a query string.
     *
     * Automatically adds the menu item ID to links
     *
     * {@inheritdoc}
     */
    public function getRoute($route = '', $fqr = false, $escape = true)
    {
        if (is_string($route)) {
            parse_str(trim($route), $parts);
        } else {
            $parts = $route;
        }

        if (!isset($parts['Itemid'])) {
            $parts['Itemid'] = $this->getActiveMenu()->id;
        }

        // We don't add the category path to the documents view URLs
        if ($this->getActiveMenu()->query['view'] === 'filteredlist') {
            unset($parts['category_slug']);
        }

        return parent::getRoute($parts, $fqr, $escape);
    }
Example #6
0
 /**
  * Initializes the config for the object
  *
  * Called from {@link __construct()} as a first step of object instantiation.
  *
  * @param   KObjectConfig $config Configuration options
  * @return  void
  */
 protected function _initialize(KObjectConfig $config)
 {
     $config->append(array('template_functions' => array('translateComponentName' => array($this, 'translateComponentName'))));
     parent::_initialize($config);
 }