/** * Sets query to perform. * * @param KBIQuery | int | string Query */ function setQuery($value) { if ($value instanceof KBIQuery) { $this->query = $value; return $this; } if (is_numeric($value)) { if (!class_exists('KbiModelQueries')) { JLoader::import('queries', COM_KBI_ADMIN . DS . 'models'); } $queries = new KbiModelQueries(); $db = get_object_vars($queries->getQuery($value)); $query = new KBIQuery(); // TODO: implement all properties $query->setQuery($db['query']); $query->setDelimiter($db['delimiter']); $query->setXslt($db['paramsxsl']); $this->query = $query; } elseif (is_string($value)) { $query = new KBIQuery(); $query->setQuery($value); $this->query = $query; } if ($this->query != NULL) { $query->setOptions($this->getOptions, 'GET'); $query->setOptions($this->postOptions, 'POST'); return $this->query->setParameters($this->getParams()); } return $this; }