public function loadContent($id) { $this->_columns = $this->_getProperties(); $this->_instance_core = JTable::getInstance($this->_columns['table_object'][0], $this->_columns['table_object'][1]); if (!isset($id)) { return; } $base = JCckDatabase::loadObject('SELECT id, cck, pk, storage_location FROM #__cck_core WHERE storage_location = "' . (string) $this->_object . '" AND pk = ' . (int) $id); $this->_type = $base->cck; $this->_pk = $base->pk; $this->_id = $base->id; if (!$this->_columns['table']) { return; } $this->_table = $this->_columns['table']; $this->_properties = JCckDatabase::loadObject('SELECT a.*, b.* FROM ' . $this->_table . ' AS a' . ' LEFT JOIN #__cck_store_form_' . $this->_type . ' AS b ON b.id = a.' . $this->_columns['key'] . ' WHERE a.' . $this->_columns['key'] . ' = ' . (int) $this->_pk); //look for fieldx $this->_fieldx = JCckDatabase::loadObjectlist('SELECT c.`name`, c.type, c.extended, c.storage_table, c.storage_field FROM aura_cck_core_types AS a Left Join aura_cck_core_type_field As b ON b.typeid = a.id Left Join aura_cck_core_fields As c ON c.id = b.fieldid WHERE a.`name` = \'' . $base->cck . '\' AND c.type = \'field_x\' '); if (is_array($this->_fieldx)) { //FOUND FIELD X foreach ($this->_fieldx as $key => $value) { $data = $this->_properties->{$value->storage_field}; $field_x = $value->name; $pattern = "/::" . $field_x . "::(.*)::\\/" . $field_x . "::/i"; preg_match($pattern, $data, $matches); if (count($matches) > 0) { $total_array = $matches[1]; if ($total_array > 0) { $this->_properties->{$field_x} = array(); for ($i = 0; $i < $total_array; $i++) { $pattern = "/::.*\\|{$i}\\|{$field_x}::(.*)::\\/.*\\|{$i}\\|{$field_x}::/i"; preg_match($pattern, $data, $matches); $this->_properties->{$field_x}[] = $matches[1]; } } } } } if ($this->_object == "joomla_user") { $db = JFactory::getDbo(); $query = $db->getQuery(true); $field = array('group_id'); $table = '#__user_usergroup_map'; $query->select($db->quoteName($field)); $query->from($db->quoteName($table)); $query->where($db->quoteName('user_id') . '= ' . $db->quote($id)); $db->setQuery($query); $result = $db->loadObject(); if ($result) { $this->_properties->usergroup = $result->group_id; } } return $this->_properties; }