Пример #1
0
 protected function _buildQueryWhere(Library\DatabaseQuerySelect $query)
 {
     parent::_buildQueryWhere($query);
     $state = $this->getState();
     if (!$state->isUnique()) {
         if ($state->search) {
             $query->where('tbl.title LIKE :search')->bind(array('search' => '%' . $state->search . '%'));
         }
         if ($state->table) {
             $query->where('tbl.table = :table')->bind(array('table' => $state->table));
         }
         if ($state->row) {
             $query->where('tbl.row = :row')->bind(array('row' => $state->row));
         }
         if ($state->slug) {
             $query->where('tbl.slug = :slug')->bind(array('slug' => $state->slug));
         }
         if ($state->iso_code) {
             $query->where('tbl.iso_code = :iso_code')->bind(array('iso_code' => $state->iso_code));
         }
         if (!is_null($state->status)) {
             $query->where('tbl.status = :status')->bind(array('status' => $state->status));
         }
         if (!is_null($state->deleted)) {
             $query->where('tbl.deleted = :deleted')->bind(array('deleted' => (int) $state->deleted));
         }
     }
 }
Пример #2
0
 protected function _buildQueryWhere(Library\DatabaseQuerySelect $query)
 {
     parent::_buildQueryWhere($query);
     $state = $this->getState();
     if ($state->search) {
         $query->where('tbl.title LIKE %:search%')->bind(array('search' => $state->search));
     }
     if ($state->table) {
         $query->where('tbl.table ' . (is_array($state->table) ? 'IN' : '=') . ' :table')->bind(array('table' => $state->table));
     }
     if (is_numeric($state->parent)) {
         $query->where('tbl.parent_id ' . (is_array($state->parent) ? 'IN' : '=') . ' :parent')->bind(array('parent' => $state->parent));
     }
     if (is_numeric($state->category)) {
         $query->where('tbl.parent_id ' . (is_array($state->category) ? 'IN' : '=') . ' :parent')->bind(array('parent' => $state->category));
     }
     if (is_bool($state->published)) {
         $query->where('tbl.published = :published');
         if ($state->table) {
             //@TODO : com_articles doesn't have a published column need to fix this
             //$query->where('content.published = :published');
         }
         $query->bind(array('published' => (int) $state->published));
     }
     if (is_bool($state->access)) {
         $query->where('tbl.access <= :access')->bind(array('access' => (int) $state->access));
     }
 }
Пример #3
0
 protected function _buildQueryWhere(Library\DatabaseQuerySelect $query)
 {
     parent::_buildQueryWhere($query);
     $state = $this->getState();
     if (is_numeric($state->published)) {
         $query->where('tbl.published = :published')->bind(array('published' => (int) $state->published));
     }
     if ($state->search) {
         $query->where('(tbl.title LIKE :search)')->bind(array('search' => '%' . $state->search . '%'));
     }
     if ($state->searchword) {
         $query->where('(tbl.title LIKE :search OR tbl.introtext LIKE :search OR tbl.fulltext LIKE :search)')->bind(array('search' => '%' . $state->searchword . '%'));
     }
     if (is_numeric($state->category) || $state->category) {
         if (is_numeric($state->category)) {
             $query->where('tbl.categories_category_id IN :categories_category_id');
             if ($state->category_recurse === true) {
                 $query->where('categories.parent_id IN :categories_category_id', 'OR');
             }
             $query->bind(array('categories_category_id' => (array) $state->category));
         } else {
             $query->where('tbl.categories_category_id IS NULL');
         }
     }
     if ($state->created_by) {
         $query->where('tbl.created_by = :created_by')->bind(array('created_by' => $state->created_by));
     }
     if ($this->getTable()->isRevisable() && $state->trashed) {
         $query->bind(array('deleted' => 1));
     }
     if (is_numeric($state->access)) {
         $query->where('tbl.access <= :access')->bind(array('access' => $state->access));
     }
 }
Пример #4
0
 protected function _buildQueryWhere(Library\DatabaseQuerySelect $query)
 {
     parent::_buildQueryWhere($query);
     $state = $this->getState();
     if ($state->home) {
         $query->where('tbl.home = :home')->bind(array('home' => (int) $state->home));
     }
     if ($state->menu) {
         $query->where('tbl.pages_menu_id = :menu_id')->bind(array('menu_id' => $state->menu));
     }
     if (is_bool($state->published)) {
         $query->where('tbl.published = :published')->bind(array('published' => (int) $state->published));
     }
     if (is_numeric($state->access)) {
         $query->where('tbl.access <= :access')->bind(array('access' => $state->access));
     }
     if (is_bool($state->hidden)) {
         $query->where('tbl.hidden = :hidden')->bind(array('hidden' => (int) $state->hidden));
     }
     //if(is_numeric($state->trashed)) {
     //  $query->where('tbl.trashed','=', $state->trashed);
     //}
     if (is_numeric($state->group_id)) {
         $query->where('tbl.group_id', '=', $state->group_id);
     }
     if ($state->search) {
         $query->where('tbl.title LIKE :search')->bind(array('search' => '%' . $state->search . '%'));
     }
     if ($state->application) {
         $query->where('menus.application = :application')->bind(array('application' => $state->application));
     }
 }
Пример #5
0
 protected function _buildQueryWhere(Library\DatabaseQuerySelect $query)
 {
     parent::_buildQueryWhere($query);
     $state = $this->getState();
     if ($state->search) {
         $query->where('tbl.title LIKE :search')->bind(array('search' => '%' . $state->search . '%'));
     }
 }
Пример #6
0
 protected function _buildQueryOrder(Library\DatabaseQuerySelect $query)
 {
     if ($this->getState()->distinct && !empty($this->getState()->column)) {
         $query->order('package', 'asc');
     } else {
         parent::_buildQueryOrder($query);
     }
 }
Пример #7
0
 protected function _buildQueryJoins(Library\DatabaseQuerySelect $query)
 {
     parent::_buildQueryJoins($query);
     $state = $this->getState();
     if ($state->container) {
         $query->join(array('containers' => 'files_containers'), 'containers.files_container_id = tbl.files_container_id');
     }
 }
Пример #8
0
 protected function _buildQueryWhere(Library\DatabaseQuerySelect $query)
 {
     parent::_buildQueryWhere($query);
     $state = $this->getState();
     if ($user_id = $state->user_id) {
         $query->where('tbl.users_user_id = :user_id')->bind(array('user_id' => $user_id));
     }
     if ($group_id = $state->group_id) {
         $query->where('tbl.users_group_id = :group_id')->bind(array('group_id' => $group_id));
     }
 }
Пример #9
0
 /**
  * Builds a WHERE clause for the query.
  *
  * @param   Library\DatabaseQuerySelect  A query object.
  * @return  void
  */
 protected function _buildQueryWhere(Library\DatabaseQuerySelect $query)
 {
     parent::_buildQueryWhere($query);
     $state = $this->getState();
     if ($state->application) {
         $query->where('application IN :application')->bind(array('application' => (array) $state->application));
     }
     if ($state->email) {
         $query->where('tbl.email IN :email')->bind(array('email' => (array) $state->email));
     }
 }
Пример #10
0
 protected function _buildQueryWhere(Library\DatabaseQuerySelect $query)
 {
     parent::_buildQueryWhere($query);
     if (!$this->getState()->isUnique()) {
         if ($this->getState()->table) {
             $query->where('tbl.table = :table')->bind(array('table' => $this->getState()->table));
         }
         if ($this->getState()->row) {
             $query->where('tbl.row = :row')->bind(array('row' => $this->getState()->row));
         }
     }
 }
Пример #11
0
 protected function _buildQueryWhere(Library\DatabaseQuerySelect $query)
 {
     parent::_buildQueryWhere($query);
     $state = $this->getState();
     if (!$state->isUnique()) {
         if (!is_null($state->enabled)) {
             $query->where('tbl.enabled = :enabled')->bind(array('enabled' => (int) $state->enabled));
         }
         if ($state->extension) {
             $query->where('tbl.extensions_extension_id IN :extension')->bind(array('extension' => (array) $state->extension));
         }
     }
 }
Пример #12
0
 protected function _buildQueryWhere(Library\DatabaseQuerySelect $query)
 {
     parent::_buildQueryWhere($query);
     $state = $this->getState();
     if (!$state->isUnique()) {
         if ($state->search) {
             $query->where('tbl.title LIKE :search')->bind(array('search' => '%' . $state->search . '%'));
         }
         if ($state->application) {
             $query->where('tbl.application = :application')->bind(array('application' => $state->application));
         }
     }
 }
Пример #13
0
 protected function _buildQueryWhere(Library\DatabaseQuerySelect $query)
 {
     parent::_buildQueryWhere($query);
     $state = $this->getState();
     if ($state->search) {
         $query->where('tbl.name LIKE :search')->bind(array('search' => '%' . $state->search . '%'));
     }
     if ($state->name) {
         $query->where('tbl.name = :name')->bind(array('name' => $state->name));
     }
     if (is_bool($state->enabled)) {
         $query->where('tbl.enabled = :enabled')->bind(array('enabled' => (int) $state->enabled));
     }
 }
Пример #14
0
 protected function _buildQueryWhere(Library\DatabaseQuerySelect $query)
 {
     parent::_buildQueryWhere($query);
     $state = $this->getState();
     if (!$state->isUnique()) {
         if (!is_null($state->primary)) {
             $query->where('tbl.primary = :primary')->bind(array('primary' => (int) $state->primary));
         }
         if (!is_null($state->enabled)) {
             $query->where('tbl.enabled = :enabled')->bind(array('enabled' => (int) $state->enabled));
         }
         if ($state->application) {
             $query->where('tbl.application = :application')->bind(array('application' => $state->application));
         }
     }
 }
Пример #15
0
 /**
  * Build where part of query
  *
  * When getting a revision X > 1, we need to get all revisions from 1 to X, and combine the data from these into
  * one row.
  *
  * @param Library\DatabaseQuerySelect $query
  */
 protected function _buildQueryWhere(Library\DatabaseQuerySelect $query)
 {
     parent::_buildQueryWhere($query);
     $state = $this->getState();
     if ($state->revision > 1) {
         $state->revision = range(1, $state->revision);
     }
     if ($state->status) {
         $query->where('tbl.status', '=', $state->status);
     }
     if ($state->row) {
         $query->where('tbl.row', 'IN', array($state->row));
     }
     if ($state->table && !$state->isUnique()) {
         $query->where('tbl.table', '=', $state->table);
     }
 }
Пример #16
0
 protected function _buildQueryWhere(Library\DatabaseQuerySelect $query)
 {
     parent::_buildQueryWhere($query);
     $state = $this->getState();
     if (is_bool($state->published)) {
         $query->where('tbl.published = :published')->bind(array('published' => (int) $state->published));
     }
     if ($state->category) {
         $query->where('tbl.categories_category_id = :category')->bind(array('category' => (int) $state->category));
     }
     if ($state->search) {
         $query->where('tbl.name LIKE :search')->bind(array('search' => '%' . $state->search . '%'));
     }
     if (is_numeric($state->access)) {
         $query->where('tbl.access <= :access')->bind(array('access' => $state->access));
     }
 }
Пример #17
0
 /**
  * Builds a WHERE clause for the query.
  *
  * @param   Library\DatabaseQuerySelect  A query object.
  * @return  void
  */
 protected function _buildQueryWhere(Library\DatabaseQuerySelect $query)
 {
     parent::_buildQueryWhere($query);
     $state = $this->getState();
     if ($state->group) {
         $query->where('group.users_group_id = :group_id')->bind(array('group_id' => $state->group));
     }
     if ($state->role) {
         $query->where('tbl.users_role_id ' . ($state->group_tree ? '>=' : '=') . ' :role_id')->bind(array('role_id' => $state->role));
     }
     if (is_bool($state->enabled)) {
         $query->where('tbl.enabled = :enabled')->bind(array('enabled' => $state->enabled));
     }
     if ($state->loggedin === false) {
         $query->where('loggedin IS NULL');
     }
     if (is_bool($state->visited)) {
         $query->where('last_visited_on ' . ($state->visited ? '!=' : '=') . ' :last_visited_on')->bind(array('last_visited_on', '0000-00-00 00:00:00'));
     }
     if ($state->search) {
         $query->where('tbl.name LIKE :search')->bind(array('search' => '%' . $state->search . '%'));
     }
 }
Пример #18
0
 protected function _buildQueryWhere(Library\DatabaseQuerySelect $query)
 {
     parent::_buildQueryWhere($query);
     $state = $this->getState();
     if ($state->products_brand_id) {
         $query->where('tbl.products_brand_id = :products_brand_id')->bind(array('products_brand_id' => $state->products_brand_id));
     }
     if ($state->products_condition_id) {
         $query->where('tbl.products_condition_id = :products_condition_id')->bind(array('products_condition_id' => $state->products_condition_id));
     }
     if ($state->products_category_id) {
         $query->where('category.products_category_id = :products_category_id')->bind(array('products_category_id' => $state->products_category_id));
     }
     if ($state->products_group_id) {
         $query->where('tbl.products_group_id = :products_group_id')->bind(array('products_group_id' => $state->products_group_id));
     }
     if ($state->published) {
         $query->where('tbl.published = :published')->bind(array('published' => $state->published));
     }
     if ($state->featured) {
         $query->where('tbl.featured = :featured')->bind(array('featured' => $state->featured));
     }
 }
Пример #19
0
 public function getRow()
 {
     return parent::getRow();
     // TODO: Change the autogenerated stub
 }
Пример #20
0
 protected function _buildQueryGroup(Library\DatabaseQuerySelect $query)
 {
     parent::_buildQueryGroup($query);
     $query->group('tbl.products_brand_id');
 }
Пример #21
0
 /**
  * Get a list of items
  *
  * If the installed state is TRUE this function will return a list of the installed modules.
  *
  * @return Library\DatabaseRowsetInterface
  */
 public function getRowset()
 {
     if (!isset($this->_rowset)) {
         $state = $this->getState();
         if ($state->installed) {
             $table = $this->getObject('com:extensions.database.table.extensions');
             $query = $this->getObject('lib:database.query.select')->order('name');
             $extension = $table->select($query);
             // Iterate through the extension
             $modules = array();
             foreach ($extension as $extension) {
                 $path = Library\ClassLoader::getInstance()->getApplication('site');
                 $path .= '/component/' . substr($extension->name, 4) . '/modules';
                 if (!is_dir($path)) {
                     continue;
                 }
                 foreach (new \DirectoryIterator($path) as $folder) {
                     if ($folder->isDir()) {
                         if (file_exists($folder->getRealPath() . '/' . $folder->getFilename() . '.xml')) {
                             $modules[] = array('id' => $folder->getFilename(), 'name' => 'mod_' . $folder->getFilename(), 'application' => 'site', 'extensions_extension_id' => $extension->id, 'title' => null);
                         }
                     }
                 }
             }
             //Set the total
             $this->_total = count($modules);
             //Apply limit and offset
             if ($this->getState()->limit) {
                 $modules = array_slice($modules, $state->offset, $state->limit ? $state->limit : $this->_total);
             }
             //Apply direction
             if (strtolower($state->direction) == 'desc') {
                 $modules = array_reverse($modules);
             }
             $this->_rowset = $this->getTable()->getRowset()->addRow($modules);
         } else {
             $this->_rowset = parent::getRowset();
         }
     }
     return $this->_rowset;
 }
Пример #22
0
 public function __construct(Library\ObjectConfig $config)
 {
     parent::__construct($config);
     $this->getState()->insert('client', 'int')->insert('email', 'string')->insert('distinct', 'boolean');
 }