Ejemplo n.º 1
0
 function hits()
 {
     $document =& JFactory::getDocument();
     $viewName = JRequest::getVar('view', 'hits');
     $viewType = $document->getType();
     $view =& $this->getView($viewName, $viewType);
     $data = JRequest::getVar('data', '', 'post', 'string', JREQUEST_ALLOWRAW);
     if ($viewType == 'raw' && $data != NULL) {
         $config = array('source' => JRequest::getVar('id_source', NULL, 'default', 'none', JREQUEST_ALLOWRAW), 'query' => NULL, 'xslt' => NULL, 'parameters' => NULL);
         try {
             $com_kbi = JComponentHelper::getComponent('com_kbi', true);
             if (!$com_kbi->enabled) {
                 throw new Exception('KBI component not intalled or enabled');
             }
             JLoader::import('transformator', JPATH_COMPONENT . DS . '..' . DS . $com_kbi->option . DS . 'models');
             $model = new KbiModelTransformator($config);
             $sr = self::createSerializeRules($model->getSource());
             $model->setQuery($sr->serializeRules($data));
             $dd = null;
             $fl = null;
             $er = $model->transform();
             $sr = new GetDataARBuilderQuery($dd, $fl, $er, 'en');
             $data = $sr->getData();
             $view->assignRef('value', $data);
             KBIDebug::log($er);
         } catch (Exception $e) {
             $view->assign('value', "<p class=\"kbierror\">Chyba dotazu: {$e->getMessage()}</p>");
         }
     }
     $view->display();
 }