Пример #1
0
 /**
  * Get Data With Alias
  * 
  * @param   string   $n_ame  The alias name
  * @param   string   $table  The table where to find the alias
  * @param   string   $view  The view code name
  *
  * @return  array The data found with the alias
  * 
  */
 public function getDataWithAlias($n_ame, $table, $view)
 {
     // Get a db connection.
     $db = JFactory::getDbo();
     // Create a new query object.
     $query = $db->getQuery(true);
     $query->select('a.*');
     $query->from('#__componentbuilder_' . $table . ' AS a');
     $db->setQuery($query);
     $rows = $db->loadObjectList();
     foreach ($rows as $row) {
         $k_ey = ComponentbuilderHelper::safeString($row->alias);
         $key = preg_replace("/[^A-Za-z]/", '', $k_ey);
         $name = preg_replace("/[^A-Za-z]/", '', $n_ame);
         if ($k_ey == $n_ame || $key == $name) {
             $php_view = '';
             if ($row->add_php_view == 1) {
                 $php_view = base64_decode($row->php_view);
                 $php_view = $this->setCustomContentLang($php_view);
             }
             $contnent = base64_decode($row->{$table});
             $contnent = $this->setCustomContentLang($contnent);
             // set uikit to views
             $this->uikitComp[$view] = ComponentbuilderHelper::getUikitComp($contnent, $this->uikitComp[$view]);
             // set footable to views and turn it on
             if (!isset($this->footableScripts[$this->target][$view]) || !$this->footableScripts[$this->target][$view]) {
                 $foundFoo = $this->getFootableScripts($contnent);
                 if ($foundFoo) {
                     $this->footableScripts[$this->target][$view] = true;
                 }
                 if ($foundFoo && !$this->footable) {
                     $this->footable = true;
                 }
             }
             // set google charts to views and turn it on
             if (!isset($this->googleChart[$this->target][$view]) || !$this->googleChart[$this->target][$view]) {
                 $foundA = $this->getGoogleChart($php_view);
                 $foundB = $this->getGoogleChart($contnent);
                 if ($foundA || $foundB) {
                     $this->googleChart[$this->target][$view] = true;
                 }
                 if ($foundA || $foundB && !$this->googlechart) {
                     $this->googlechart = true;
                 }
             }
             // check for get module
             if (!isset($this->getModule[$this->target][$view]) || !$this->getModule[$this->target][$view]) {
                 $foundA = $this->getGetModule($php_view);
                 $foundB = $this->getGetModule($contnent);
                 if ($foundA || $foundB) {
                     $this->getModule[$this->target][$view] = true;
                 }
             }
             return array('id' => $row->id, 'html' => $contnent, 'php_view' => $php_view);
         }
     }
     return false;
 }