Beispiel #1
0
 protected function _buildQueryWhere(KDatabaseQuery $query)
 {
     parent::_buildQueryWhere($query);
     if ($this->_state->id) {
         $query->where('tbl.joomla_user_id', 'in', $this->_state->id);
     }
 }
 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);
 }
 protected function _buildQueryJoins(KDatabaseQuery $query)
 {
     parent::_buildQueryJoins($query);
     if ($this->_state->source instanceof KDatabaseRowInterface || $this->_state->container) {
         $query->join('LEFT', 'files_containers AS c', 'c.files_container_id = tbl.files_container_id');
     }
 }
Beispiel #4
0
 protected function _buildQueryWhere(KDatabaseQuery $query)
 {
     parent::_buildQueryWhere($query);
     
     $state = $this->_state;
     
     if (is_numeric($state->enabled)) {
         $query->where('tbl.showbanner', '=', $state->enabled);
     }
     
     if ($state->category) {
         $query->where('tbl.catid', '=', $state->category);
     }
     
     if (is_numeric($state->sticky)) {
         $query->where('tbl.sticky', '=', $state->sticky);
     }
     
     if (!empty($state->search)) {
         $query->where('LOWER(tbl.name)', 'LIKE', '%'.strtolower($state->search).'%');
     }
     
     if (!empty($state->tags)) {
         $where = array();
         foreach ($state->tags as $tag) {
             $where[] = 'UPPER(tags) REGEXP \'[[:<:]]'.strtoupper(trim($tag)).'[[:>:]]\'';
         }
         $query->where('( '.implode(' OR ', $where).' )');
     }
 }
 protected function _buildQueryWhere(KDatabaseQuery $query)
 {
     parent::_buildQueryWhere($query);
     if (is_numeric($this->_state->enabled)) {
         $query->where('tbl.enabled', '=', $this->_state->enabled);
     }
 }
Beispiel #6
0
 protected function _buildQueryWhere(KDatabaseQuery $query)
 {
     parent::_buildQueryWhere($query);
     if ($this->_state->search) {
         $query->where('tbl.title', 'LIKE', '%' . $this->_state->search . '%');
     }
 }
Beispiel #7
0
 /**
  * Build where query
  *
  * @param KDatabaseQuery $query
  */
 public function _buildQueryWhere(KDatabaseQuery $query)
 {
     parent::_buildQueryWhere($query);
     if ($this->_state->search) {
         $query->where('name', 'LIKE', '%' . $this->_state->search . '%');
     }
 }
Beispiel #8
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 #9
0
 public function getList()
 {
     $state = $this->_state;
     $filter = $this->getService('koowa:filter.slug');
     //		$this->redis->flushall();
     //
     //		$this->_state->limit = 100;
     //
     //		parent::getList();
     //
     //
     //		foreach($this->_list as $key => $row) {
     //			$this->redis->set('event:'.$key, serialize($row->toArray()));
     //			$this->redis->rpush('events', $key);
     //			$this->redis->sadd('ctas_involvement:'. $filter->sanitize($row->ctas_involvement), $key);
     //		}
     if ($state->search) {
         parent::getList();
     } else {
         if ($state->ctas_involvement) {
             $list = $this->redis->smembers('ctas_involvement:' . $filter->sanitize($state->ctas_involvement));
         } else {
             $list = $this->redis->lrange('events', 0, 19);
         }
         foreach ($list as $item) {
             $rows[] = array_merge(unserialize($this->redis->get('event:' . $item)), array('cached' => 1));
         }
         $this->_list = $this->getTable()->getRowset()->addData($rows, false);
     }
     return $this->_list;
 }
 protected function _buildQueryWhere(KDatabaseQuery $query)
 {
     parent::_buildQueryWhere($query);
     $state = $this->_state;
     if (is_numeric($state->state)) {
         $query->where('tbl.state', '=', $state->state);
     } else {
         $query->where('tbl.state', '<>', -2);
     }
     if ($state->search) {
         $query->where('tbl.title', 'LIKE', '%' . $state->search . '%');
     }
     if (is_numeric($state->section)) {
         $query->where('tbl.sectionid', '=', $state->section);
     }
     if (is_numeric($state->category)) {
         $query->where('tbl.catid', '=', $state->category);
     }
     if ($state->created_by) {
         $query->where('tbl.created_by', '=', $state->created_by);
     }
     if (is_numeric($state->access)) {
         $query->where('tbl.access', '=', $state->access);
     }
     if ($this->getTable()->isRevisable() && $state->deleted) {
         $query->where('tbl.deleted', '=', 1);
     }
 }
Beispiel #11
0
 protected function _buildQueryWhere(KDatabaseQuery $query)
 {
     parent::_buildQueryWhere($query);
     $state = $this->_state;
     if ($state->search) {
         $query->where('tbl.name', 'LIKE', '%' . $state->search . '%')->where('tbl.email', 'LIKE', '%' . $state->search . '%', 'OR');
     }
 }
Beispiel #12
0
 protected function _buildQueryOrder(KDatabaseQuery $query)
 {
     if ($this->_state->distinct && !empty($this->_state->column)) {
         $query->order('package', 'asc');
     } else {
         parent::_buildQueryOrder($query);
     }
 }
Beispiel #13
0
 protected function _buildQueryJoins(KDatabaseQuery $query)
 {
     $state = $this->_state;
     parent::_buildQueryJoins($query);
     if ($state->sort) {
         $query->join('INNER', '#__cck_values AS cck', 'cck.cck_fieldset_id = tbl.cck_fieldset_id AND cck.row = tbl.tenders_tender_id AND cck.table = LOWER(\'' . strtoupper($this->getTable()->getName()) . '\')');
     }
 }
Beispiel #14
0
 /**
  * @param KDatabaseQuery $query
  */
 protected function _buildQueryWhere(KDatabaseQuery $query)
 {
     $state = $this->_state;
     parent::_buildQueryWhere($query);
     if (is_array($state->taxonomy_taxonomy_id)) {
         $query->where('taxonomy_taxonomy_id', 'IN', $state->taxonomy_taxonomy_id);
     }
 }
 protected function _buildQueryWhere(KDatabaseQuery $query)
 {
     parent::_buildQueryWhere($query);
     if (is_numeric($this->_state->enabled)) {
         $query->where('tbl.enabled', '=', $this->_state->enabled);
     }
     $query->where('(', null, null, 'AND')->where('tbl.date_start', '>=', date("Y-m-d"), '')->where('tbl.date_end', '>=', date("Y-m-d"), 'OR')->where(')', null, null, '');
 }
Beispiel #16
0
 public function getItem()
 {
     $item = parent::getItem();
     if ($item) {
         $item->source = $this->_state->source;
     }
     return $item;
 }
 /**
  * @param KDatabaseQuery $query
  */
 protected function _buildQueryWhere(KDatabaseQuery $query)
 {
     $state = $this->_state;
     parent::_buildQueryWhere($query);
     if ($state->row && $state->table) {
         $query->where('tbl.row', '=', $state->row);
         $query->where('tbl.table', '=', $state->table);
     }
 }
Beispiel #18
0
	protected function _buildQueryWhere(KDatabaseQuery $query)
    {
		parent::_buildQueryWhere($query);
		
		$query->where('tbl.section', '=', 'com_weblinks')
			  ->where('tbl.published', '=', '1')
			  ->where('weblinks.published', '=', '1')
			  ->where('tbl.access', '<=', KFactory::get('joomla:user')->get('aid', '0'));
    }
Beispiel #19
0
 /**
  * Query WHERE clause
  */
 protected function _buildQueryWhere(KDatabaseQuery $query)
 {
     parent::_buildQueryWhere($query);
     if ($search = $this->_state->search) {
         $query->where('tbl.title', 'LIKE', '%' . $search . '%');
     }
     if ($this->_state->enabled !== false && $this->_state->enabled !== '') {
         $query->where('tbl.enabled', '=', $this->_state->enabled);
     }
 }
Beispiel #20
0
 public function getItem()
 {
     if (!isset($this->_item)) {
         $this->_item = $this->getService('com://admin/files.database.row.config');
         $container = $this->getService('com://admin/files.model.containers')->slug((string) $this->_state->container)->getItem();
         $this->_item->setData(json_decode($container->parameters, true));
         $this->_item->container = $container;
     }
     return parent::getItem();
 }
 protected function _buildQueryWhere(KDatabaseQuery $query)
 {
     parent::_buildQueryWhere($query);
     if ($this->_state->top_level) {
         $query->where('tbl.parent_id = 0');
     }
     if ($this->_state->parent_id) {
         $query->where('tbl.parent_id', '=', $this->_state->parent_id);
     }
 }
Beispiel #22
0
 protected function _buildQueryColumns(KDatabaseQuery $query)
 {
     parent::_buildQueryColumns($query);
     $query->select('user.usertype')->select('person.posts AS person_posts')->select('tbl.ninjaboard_post_id AS id')->select("IFNULL(person.avatar, '/media/com_ninjaboard/images/avatar.png') AS avatar")->select("IF(topic.first_post_id = tbl.ninjaboard_post_id, tbl.subject, CONCAT('RE: ', first_post.subject)) AS subject")->select('person.signature')->select('(SELECT rank_file FROM #__ninjaboard_ranks WHERE person.posts >= min AND enabled = 1 ORDER BY min DESC LIMIT 1) AS rank_icon')->select('(SELECT title FROM #__ninjaboard_ranks WHERE person.posts >= min AND enabled = 1 ORDER BY min DESC LIMIT 1) AS rank_title');
     //Build query for the screen names
     KFactory::get('admin::com.ninjaboard.model.people')->buildScreenNameQuery($query, 'person', 'user', 'display_name', 'IFNULL(tbl.guest_name, \'' . JText::_('Anonymous') . '\')');
     if ($search = $this->_state->search) {
         $query->select(array('forum.title AS forum', 'topic.ninjaboard_topic_id AS topic', 'topic.hits'));
     }
 }
Beispiel #23
0
 /**
  * @param KDatabaseQuery $query
  */
 protected function _buildQueryWhere(KDatabaseQuery $query)
 {
     $state = $this->_state;
     parent::_buildQueryWhere($query);
     if (is_numeric($state->enabled)) {
         $query->where('tbl.enabled', '=', $state->enabled);
     }
     if ($state->carousel_category_id) {
         $query->where('tbl.carousel_category_id', '=', $state->carousel_category_id);
     }
 }
 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);
 }
Beispiel #26
0
 /**
  * Get a topic row object
  *
  * @return KDatabaseRowset
  */
 public function getItem()
 {
     if (!isset($this->_item)) {
         parent::getItem();
         //@TODO acl workaround
         if (!$this->_item->forum_id && $this->_state->forum) {
             $this->_item->forum_id = $this->_state->forum;
         }
     }
     return $this->_item;
 }
Beispiel #27
0
 protected function _buildQueryWhere(KDatabaseQuery $query)
 {
     parent::_buildQueryWhere($query);
     $state = $this->_state;
     if ($state->mimetype) {
         $query->where('mimetype', 'IN', $state->mimetype);
     }
     if ($state->extension) {
         $query->where('extension', 'IN', $state->extension);
     }
 }
Beispiel #28
0
 /**
  * @param KDatabaseQuery $query
  */
 protected function _buildQueryWhere(KDatabaseQuery $query)
 {
     $state = $this->_state;
     parent::_buildQueryWhere($query);
     if (is_numeric($state->enabled)) {
         $query->where('tbl.enabled', '=', $state->enabled);
     }
     if ($state->search) {
         $query->where('tbl.title', 'LIKE', '%' . $state->search . '%');
     }
 }
 protected function _buildQueryWhere(KDatabaseQuery $query)
 {
     parent::_buildQueryWhere($query);
     if (!$this->_state->isUnique()) {
         if ($this->_state->table) {
             $query->where('tbl.table', '=', $this->_state->table);
         }
         if ($this->_state->row) {
             $query->where('tbl.row', '=', $this->_state->row);
         }
     }
 }
Beispiel #30
0
 protected function _buildQueryWhere(KDatabaseQuery $query)
 {
     parent::_buildQueryWhere($query);
     //Build query for the screen names
     $me = KFactory::get('admin::com.ninjaboard.model.people')->getMe();
     $id = (int) $me->id;
     //Get sent messages by me
     $where[] = '(tbl.created_by = ' . $id . ' AND recipient.user_id != ' . $id . ')';
     //Get sent messages to me
     $where[] = '(tbl.created_by != ' . $id . ' AND recipient.user_id = ' . $id . ')';
     $query->where('(' . implode(' OR ', $where) . ')');
 }