<commit_before><?php
/**
 * @version		$Id$
 * @package		Profiles
 * @copyright	Copyright (C) 2009 Nooku. All rights reserved.
 * @license 	GNU GPLv2 <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>
 * @link     	http://www.nooku.org
 */

koowa::import('admin::com.koowa.models.view');

class ProfilesModelPeople extends KoowaModelView
{
	public function __construct(array $options = array())
	{
		parent::__construct($options);
		
		// Set the state
		$this->_state
		 	->insert('profile_department_id'   , 'int')
		 	->insert('profile_office_id'      	, 'int')
		 	->insert('letter_name'  		, 'word')
		 	->insert('enabled'   			, 'boolean', false);
	}
	
	public function getLetters()
	{
		$query = $this->_db->getQuery()
			->select('letter_name')
			->distinct()
			->from('profiles_view_people AS tbl')
			->order('tbl.letter_name');
		
		$result = (array) $this->_db->fetchResultList($query);
		return $result; 
	}
	
	protected function _buildQueryWhere(KDatabaseQuery $query)
	{
		$state = $this->_state;
		
		if($state->enabled) {
			$query->where('tbl.enabled','=', $state->enabled);
		}

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

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

		if ( $state->search) 
		{
			$search = '%'.$state->search.'%';

			$query->where('tbl.firstname', 'LIKE',  $search)
				  ->where('tbl.lastname', 'LIKE', $search, 'or')
				  ->where('tbl.bio', 'LIKE', $search, 'or');
		}
		
		if ( $state->letter_name) {
			$query->where('tbl.lastname', 'Like',  $state->letter_name.'%');	
		}
	}
}<commit_msg>Fixed typo<commit_after><?php
/**
 * @version		$Id$
 * @package		Profiles
 * @copyright	Copyright (C) 2009 Nooku. All rights reserved.
 * @license 	GNU GPLv2 <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>
 * @link     	http://www.nooku.org
 */

koowa::import('admin::com.koowa.models.view');

class ProfilesModelPeople extends KoowaModelView
{
	public function __construct(array $options = array())
	{
		parent::__construct($options);
		
		// Set the state
		$this->_state
		 	->insert('profiles_department_id'   , 'int')
		 	->insert('profiles_office_id'      	, 'int')
		 	->insert('letter_name'  			, 'word')
		 	->insert('enabled'   				, 'boolean', false);
	}
	
	public function getLetters()
	{
		$query = $this->_db->getQuery()
			->select('letter_name')
			->distinct()
			->from('profiles_view_people AS tbl')
			->order('tbl.letter_name');
		
		$result = (array) $this->_db->fetchResultList($query);
		return $result; 
	}
	
	protected function _buildQueryWhere(KDatabaseQuery $query)
	{
		$state = $this->_state;
		
		if($state->enabled) {
			$query->where('tbl.enabled','=', $state->enabled);
		}

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

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

		if ( $state->search) 
		{
			$search = '%'.$state->search.'%';

			$query->where('tbl.firstname', 'LIKE',  $search)
				  ->where('tbl.lastname', 'LIKE', $search, 'or')
				  ->where('tbl.bio', 'LIKE', $search, 'or');
		}
		
		if ( $state->letter_name) {
			$query->where('tbl.lastname', 'Like',  $state->letter_name.'%');	
		}
	}
}
{'fraction_non_alphanumeric': 0.2020618556701031, 'fraction_numerical': 0.004123711340206186, 'mean_word_length': 3.6906077348066297, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 67, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7247826', 'n_tokens_mistral': 1423, 'n_tokens_neox': 1231, 'n_words': 193}