コード例 #1
0
ファイル: html.php プロジェクト: nooku/nooku-files
 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;
 }
コード例 #2
0
ファイル: route.php プロジェクト: kosmosby/medicine-prof
 /**
  * Convert an array to a URL
  *
  * @param KObjectConfig $config
  * @param bool          $fqr
  * @param bool          $escape
  * @return string Routed URL
  */
 protected function _getRoute(KObjectConfig $config, $fqr = false, $escape = true)
 {
     unset($config->entity);
     return call_user_func_array($this->_router, array($config->toArray(), $fqr, $escape));
 }
コード例 #3
0
 /**
  * Return the data
  *
  * If the data being passed is an instance of KObjectConfig the data will be transformed to an associative array.
  *
  * @param mixed|KObjectConfig $data
  * @return mixed|array
  */
 public static function unbox($data)
 {
     return $data instanceof KObjectConfig ? $data->toArray() : $data;
 }