Beispiel #1
0
 protected function _buildQueryWhere(KDatabaseQuery $query)
 {
     if ($this->_state->source instanceof KDatabaseRowInterface) {
         $source = $this->_state->source;
         $query->where('tbl.files_container_id', '=', $source->container->id)->where('tbl.folder', '=', '/' . $source->relative_folder)->where('tbl.filename', '=', $source->name);
     } else {
         if ($this->_state->folder) {
             $query->where('tbl.folder', '=', $this->_state->folder);
         } else {
             if ($this->_state->files) {
                 $query->where('tbl.filename', 'IN', $this->_state->files);
             }
         }
     }
     $states = $this->_state->getData(true);
     /*
      * This is here so that parent method won't try to use the source row object when creating the query
      */
     if (!empty($states)) {
         $states = $this->getTable()->mapColumns($states);
         foreach ($states as $key => $value) {
             if ($key != 'source' && isset($value)) {
                 $query->where('tbl.' . $key, 'IN', $value);
             }
         }
     }
 }
Beispiel #2
0
    protected function _buildQueryWhere(KDatabaseQuery $query)
    {
        $state = $this->_state;

        if($state->search) {
            $query->where('tbl.title', 'LIKE',  '%'.$state->search.'%');
        }

        //select overall section
        if ($state->section)
        {
            if( $state->section == 'com_content' ) {
                $query->where('tbl.section', 'NOT LIKE', 'com%');
            } else {
                $query->where('tbl.section', 'IN', $state->section);
            }
        }

        //select parent section within com_content
        if ($state->parent) {
            $query->where('tbl.section', 'IN', $state->parent);
        }

        if (is_numeric($state->published)) {
            $query->where('tbl.published', '=', $state->published);
        }

        parent::_buildQueryWhere($query);
    }
Beispiel #3
0
	protected function _buildQueryWhere(KDatabaseQuery $query)
    {
		if ($this->_state->source instanceof KDatabaseRowInterface) {
			$source = $this->_state->source;

			$query->where('tbl.files_container_id', '=', $source->container->id)
				->where('tbl.folder', '=', '/'.$source->relative_folder)
				->where('tbl.filename', '=', $source->name)
				;

			/*
			 * This is here so that parent method won't try to use the source row object when creating the query
			 */
			$this->_source = $source;
			$this->_state->source = null;
		}
		else if ($this->_state->folder) {
			$query->where('tbl.folder', '=', $this->_state->folder);
		}
		else if ($this->_state->files) {
			$query->where('tbl.filename', 'IN', $this->_state->files);
		}

		parent::_buildQueryWhere($query);

	}
Beispiel #4
0
 protected function _buildQueryWhere(KDatabaseQuery $query)
 {
     if ($this->getState('tag_id')) {
         $query->where('rel.duuka_tag_id', '=', $this->getState('tag_id'));
     }
     $query->where('tbl.enabled', '=', 1);
 }
Beispiel #5
0
	protected function _buildQueryWhere(KDatabaseQuery $query)
	{
		$state = $this->_state;

		if($state->search) {
			$query->where('tbl.title', 'LIKE', '%'.$state->search.'%');
		}

		if($state->position) {
			$query->where('tbl.position', '=', $state->position);
		}
		
		if($state->type) {
			$query->where('tbl.module', '=', $state->type);
		}

		if($state->enabled !== '' && $state->enabled !== null) {
			$query->where('tbl.published', '=', $state->enabled);
		}
		
		if($state->application !== false)
		{
		    $client	= JApplicationHelper::getClientInfo($state->application, true);
	    	$query->where('tbl.client_id', '=', $client->id);
	    }

		parent::_buildQueryWhere($query);
	}
 protected function _buildQueryWhere(KDatabaseQuery $query)
 {
     $state = $this->_state;
     if ($state->extman_extension_id) {
         $query->where('tbl.extman_extension_id', '=', $state->extman_extension_id);
     }
     if ($state->dependent_id) {
         $query->where('tbl.dependent_id', '=', $state->dependent_id);
     }
 }
Beispiel #7
0
 protected function _buildQueryWhere(KDatabaseQuery $query)
 {
     if ($this->_state->task) {
         $query->where('tbl.jedi_task_id', '=', (int) $this->_state->task);
     }
     if ($this->_state->member) {
         $query->where('tbl.jedi_member_id', '=', (int) $this->_state->member);
     }
     parent::_buildQueryWhere($query);
 }
Beispiel #8
0
 protected function _buildQueryWhere(KDatabaseQuery $query)
 {
     $state = $this->getState();
     if ($state->search) {
         $search = '%' . $state->search . '%';
         $query->where('tbl.title', 'LIKE', $search);
         $query->where('tbl.text', 'LIKE', $search, 'OR');
     }
     parent::_buildQueryWhere($query);
 }
Beispiel #9
0
 protected function _buildQueryWhere(KDatabaseQuery $query)
 {
     if ($this->_state->search) {
         $query->where('tbl.title', 'LIKE', '%' . $this->_state->search . '%');
     }
     if (is_numeric($this->_state->enabled)) {
         $query->where('tbl.enabled', '=', $this->_state->enabled);
     }
     parent::_buildQueryWhere($query);
 }
 protected function _buildQueryWhere(KDatabaseQuery $query)
 {
     $state = $this->_state;
     if ($state->business) {
         $query->where('tbl.businesses_business_id', '=', $state->business);
     }
     if ($state->tag) {
         $query->where('tbl.businesses_tag_id', '=', $state->tag);
     }
     parent::_buildQueryWhere($query);
 }
 protected function _buildQueryWhere(KDatabaseQuery $query)
 {
     $state = $this->_state;
     if (!$state->isUnique()) {
         if ($state->search) {
             $query->where('title', 'LIKE', '%' . $state->search . '%');
             $query->where('description', 'LIKE', '%' . $state->search . '%', 'OR');
         }
     }
     parent::_buildQueryWhere($query);
 }
 protected function _buildQueryWhere(KDatabaseQuery $query)
 {
     if (!$this->_state->isUnique()) {
         if ($this->_state->table) {
             $query->where('relations.table', '=', $this->_state->table);
         }
         if ($this->_state->row) {
             $query->where('relations.row', 'IN', $this->_state->row);
         }
     }
     parent::_buildQueryWhere($query);
 }
Beispiel #13
0
 public function _buildQueryWhere(KDatabaseQuery $query)
 {
     if (is_array($this->_state->group_id)) {
         foreach ($this->_state->group_id as $group) {
             $query->where('FIND_IN_SET(' . $group . ', REPLACE(SUBSTRING_INDEX(SUBSTR(ANCESTORS,LOCATE(\'"GROUPS":[\',ANCESTORS)+CHAR_LENGTH(\'"GROUPS":[\')),\']\', 1),\'\', \'\'))', null, null, 'OR');
         }
     } else {
         if (is_int($this->_state->group_id)) {
             $query->where('FIND_IN_SET(' . $this->_state->group_id . ', REPLACE(SUBSTRING_INDEX(SUBSTR(ANCESTORS,LOCATE(\'"GROUPS":[\',ANCESTORS)+CHAR_LENGTH(\'"GROUPS":[\')),\']\', 1),\'\', \'\'))', null, null);
         }
     }
 }
Beispiel #14
0
 protected function _buildQueryWhere(KDatabaseQuery $query)
 {
     $state = $this->getState();
     if ($state->search) {
         $search = '%' . $state->search . '%';
         $query->where('tbl.target_type', 'LIKE', $search);
         $query->where('tbl.text', 'LIKE', $search, 'OR');
     }
     if ($state->controller) {
         $query->where('tbl.controller', '=', $state->controller);
     }
     if ($state->browse) {
         $query->where('tbl.browse', '=', 1);
     }
     if ($state->read) {
         $query->where('tbl.read', '=', 1);
     }
     if ($state->edit) {
         $query->where('tbl.edit', '=', 1);
     }
     if ($state->add) {
         $query->where('tbl.add', '=', 1);
     }
     if ($state->delete) {
         $query->where('tbl.delete', '=', 1);
     }
     parent::_buildQueryWhere($query);
 }
 protected function _buildQueryWhere(KDatabaseQuery $query)
 {
     $state = $this->_state;
     if (!$state->isUnique()) {
         if ($state->subscribed) {
             $user = JFactory::getUser();
             $query->where('subscription.user_id', '=', $user->id);
         }
         if ($state->category) {
             $query->where('tbl.news_category_id', '=', $state->category);
         }
     }
     parent::_buildQueryWhere($query);
 }
Beispiel #16
0
 protected function _buildQueryWhere(KDatabaseQuery $query)
 {
     $state = $this->_state;
     if ($state->search) {
         $query->where('tbl.title', 'LIKE', '%' . $state->search . '%');
     }
     if ($state->scope) {
         $query->where('tbl.scope', 'LIKE', $state->scope);
     }
     if (is_numeric($state->published)) {
         $query->where('tbl.published', '=', $state->published);
     }
     parent::_buildQueryWhere($query);
 }
Beispiel #17
0
 protected function _buildQueryWhere(KDatabaseQuery $query)
 {
     $state = $this->_state;
     if ($state->search) {
         $query->where('tbl.name', 'LIKE', '%' . $state->search . '%');
     }
     if (is_numeric($state->enabled)) {
         $query->where('tbl.enabled', '=', $state->enabled);
     }
     if (is_numeric($state->jedi_rank_id)) {
         $query->where('tbl.jedi_rank_id', '=', (int) $state->jedi_rank_id);
     }
     parent::_buildQueryWhere($query);
 }
 protected function _buildQueryWhere(KDatabaseQuery $query)
 {
     global $mainframe, $option;
     $filter_state = $this->getState('filter_state');
     if ($filter_state) {
         if ($filter_state == 'P') {
             $query->where('enabled', '=', 1);
         } else {
             if ($filter_state == 'U') {
                 $query->where('enabled', '=', 0);
             }
         }
     }
 }
 protected function _buildQueryWhere(KDatabaseQuery $query)
 {
     $state = $this->_state;
     if (is_bool($state->enabled)) {
         $query->where('tbl.published', '=', (int) $state->enabled);
     }
     if (is_numeric($state->category) && !empty($state->category)) {
         $query->where('tbl.catid', '=', $state->category);
     }
     if ($state->search) {
         $query->where('tbl.name', 'LIKE', '%' . $state->search . '%');
     }
     parent::_buildQueryWhere($query);
 }
 public function _buildQueryWhere(KDatabaseQuery $query)
 {
     if ($this->_parent_column) {
         $parent = $this->_parent ? $this->_parent : $this->{$this->_parent_column};
         $query->where($this->_table->mapColumns($this->_parent_column), '=', $parent);
     }
 }
Beispiel #21
0
 public function _buildQueryWhere(KDatabaseQuery $query)
 {
     if($this->getMixer()->getIdentifier()->name == 'article' && !isset($this->featured_order))
     {
         $query->where('catid', '=', $this->category_id)
               ->where('state', '>=', 0);
     }
 }
 protected function _buildQueryWhere(KDatabaseQuery $query)
 {
     $state = $this->_state;
     if ($state->search) {
         $query->where('tbl.name', 'LIKE', '%' . $state->search . '%');
     }
     if ($state->type) {
         $query->where('tbl.folder', '=', $state->type);
     }
     if (is_bool($state->enabled)) {
         $query->where('tbl.published', '=', (int) $state->enabled);
     }
     if (is_bool($state->hidden)) {
         $query->where('tbl.iscore', '=', (int) $state->hidden);
     }
     parent::_buildQueryWhere($query);
 }
 protected function _buildQueryJoins(KDatabaseQuery $query)
 {
     //Exclude joins if counting records
     if (!$query->count) {
         $query->join('', 'categories AS cc', array('cc.id = tbl.catid'));
         $query->where('cc.section', 'LIKE', 'com_banner');
     }
 }
Beispiel #24
0
 protected function _buildQueryWhere(KDatabaseQuery $query)
 {
     $state = $this->_state;
     if ($state->event) {
         $query->where('tbl.calendar_event_id', '=', $state->event);
     }
     if ($state->year) {
         $query->where('tbl.year', '=', $state->year);
     }
     if ($state->month) {
         $query->where('tbl.month', '=', $state->month);
     }
     if ($state->day) {
         $query->where('tbl.day', '=', $state->day);
     }
     parent::_buildQueryWhere($query);
 }
Beispiel #25
0
	protected function _buildQueryWhere(KDatabaseQuery $query)
	{
		$state = $this->_state;

		if($state->search) {
			$query->where('tbl.name', 'LIKE', '%'.$state->search.'%');
		}
		
		if($state->type) {
			$query->where('tbl.folder', '=', $state->type);
		}

		if($state->enabled !== '' && $state->enabled !== null) {
			$query->where('tbl.published', '=', $state->enabled);
		}

		parent::_buildQueryWhere($query);
	}
Beispiel #26
0
 protected function _buildQueryWhere(KDatabaseQuery $query)
 {
     $state = $this->_state;
     if ($state->search) {
         $query->where('tbl.name', 'LIKE', '%' . $state->search . '%');
     }
     if ($state->component) {
         $query->where('tbl.option', '=', $state->component);
     }
     if (is_integer($state->parent)) {
         $query->where('tbl.parent', '=', $state->parent);
     }
     if (is_bool($state->enabled)) {
         $query->where('tbl.enabled', '=', (int) $state->enabled);
     }
     if (is_bool($state->hidden)) {
         $query->where('tbl.iscore', '=', (int) $state->hidden);
     }
     parent::_buildQueryWhere($query);
 }
Beispiel #27
0
 /**
  * Filter list based on search keyword
  *
  * @author Stian Didriksen <*****@*****.**>
  * @param KDatabaseQuery $query
  * @return $this
  */
 protected function _buildQueryWhere(KDatabaseQuery $query)
 {
     if ($search = trim($this->_state->search)) {
         $parts = explode(' ', $search);
         $states = array();
         foreach ($parts as $i => $part) {
             if (strpos($part, ':') === false) {
                 continue;
             }
             $keys = explode(':', $part);
             $states[$keys[0]] = $keys[1];
             unset($parts[$i]);
         }
         if ($states) {
             $conditions = array();
             foreach (array('username', 'email') as $key) {
                 if (isset($states[$key])) {
                     $query->where('tbl.' . $key, 'LIKE', '%' . $states[$key] . '%');
                 }
             }
             if ($parts) {
                 $query->where('tbl.name', 'LIKE', '%' . implode($parts) . '%');
             }
         } else {
             //To avoid auto quoting, and also trim trailing whitespace
             $search = $this->getTable()->getDatabase()->quoteValue('%' . strtoupper($search) . '%');
             $query->where("(tbl.name LIKE {$search} OR tbl.username LIKE {$search} OR tbl.email LIKE {$search} OR person.alias LIKE {$search})");
         }
     }
     $group = $this->_state->usergroup;
     if ($group) {
         $query->where('tbl.gid', '=', (int) $group);
     }
     if (!$this->_state->me) {
         $me = KFactory::get('admin::com.ninjaboard.model.people')->getMe();
         $query->where('tbl.id', '!=', $me->id);
     }
     //Don't show blocked users
     $query->where('tbl.block', '=', 0);
     parent::_buildQueryWhere($query);
 }
 protected function _buildQueryWhere(KDatabaseQuery $query)
 {
     $state = $this->_state;
     if ($state->source instanceof KDatabaseRowInterface) {
         $source = $state->source;
         $query->where('tbl.files_container_id', '=', $source->container->id)->where('tbl.filename', '=', $source->name);
         if ($source->folder) {
             $query->where('tbl.folder', '=', $source->folder);
         }
     } else {
         if ($state->container) {
             $query->where('tbl.files_container_id', '=', $state->container->id);
         }
         if ($state->folder !== false) {
             $query->where('tbl.folder', '=', ltrim($state->folder, '/'));
         }
         // Need this for BC
         if (!empty($state->files)) {
             $query->where('tbl.filename', 'IN', $state->files);
         }
         if ($state->filename) {
             $query->where('tbl.filename', '=', $state->filename);
         }
     }
 }
 protected function _buildQueryWhere(KDatabaseQuery $query)
 {
     $state = $this->_state;
     if (!$state->isUnique()) {
         if ($state->subscribed) {
             $user = JFactory::getUser();
             $query->where('subscription.user_id', '=', $user->id);
         }
         if ($state->enabled) {
             $query->where('tbl.enabled', '=', (int) $state->enabled);
         }
         if ($state->category) {
             $query->where('tbl.news_category_id', '=', $state->category);
         }
         if ($state->search) {
             $query->where('(', null, null, 'AND')->where('tbl.title', 'LIKE', '%' . $state->search . '%', '')->where('tbl.text', 'LIKE', '%' . $state->search . '%', 'OR')->where(')', null, null, '');
         }
         if ($this->_state->start_date && $this->_state->start_date != '0000-00-00') {
             $start_date = $this->getService('koowa:date', array('date' => $this->_state->start_date));
             $end_date = $this->getService('koowa:date', array('date' => $this->_state->end_date));
             $start = $start_date->addDays(1)->addSeconds(-1)->getDate();
             $end = $end_date->addDays(1)->addSeconds(-1)->getDate();
             $query->where('tbl.created_on', '>', $start);
             $query->where('tbl.created_on', '<', $end);
         }
     }
     parent::_buildQueryWhere($query);
 }
Beispiel #30
0
	protected function _buildQueryWhere(KDatabaseQuery $query)
	{
		$state = $this->_state;

		if($state->search) {
			$query->where('tbl.name', 'LIKE', '%'.$state->search.'%');
		}
		
		if($state->option) {
			$query->where('tbl.option', '=', $state->option);
		}
		
	    if(is_integer($state->parent)) {
			$query->where('tbl.parent', '=', $state->parent);
		}

		if($state->enabled !== '' && $state->enabled !== null) {
			$query->where('tbl.enabled', '=', $state->enabled);
		}

		parent::_buildQueryWhere($query);
	}