<commit_before><?php defined('BASEPATH') or exit('No direct script access allowed');

/**
 * PyroStreams Page Field Type
 *
 * Choose a page and return page data
 *
 * @package		PyroStreams
 * @author		Parse19
 * @copyright	Copyright (c) 2011, Parse19
 */
class Field_page
{

	// --------------------------------------------------------------------------
	 
	public $field_type_slug			= 'page';
	
	public $db_col_type				= 'int';

	public $version					= '1.1';

	public $author					= array('name' => 'Parse19', 'url' => 'http://parse19.com');
	
	// --------------------------------------------------------------------------

	/**
	 * Output form input
	 *
	 * @param	array
	 * @param	array
	 * @return	string
	 */
	public function form_output($data)
	{
		$this->CI = get_instance();
	
		// Build a drop down of pages
		$this->CI->load->model('pages/page_m');
		
		$tree = $this->CI->page_m->get_page_tree();
		
		$dropdown = array();
		
		foreach($tree as $tree_item):
		
			$dropdown[$tree_item['id']] = $tree_item['title'];
		
		endforeach;
		
		return '<select name="'.$data['form_slug'].'" id="'.$data['form_slug'].'">'.$this->_build_tree_select(array('current_id' => $data['value'])).'</select>';<commit_msg>Cleaning up unneeded logic and making page field obey is_required.<commit_after><?php defined('BASEPATH') or exit('No direct script access allowed');

/**
 * PyroStreams Page Field Type
 *
 * Choose a page and return page data
 *
 * @package		PyroStreams
 * @author		Parse19
 * @copyright	Copyright (c) 2011, Parse19
 */
class Field_page
{

	// --------------------------------------------------------------------------
	 
	public $field_type_slug			= 'page';
	
	public $db_col_type				= 'int';

	public $version					= '1.1';

	public $author					= array('name' => 'Parse19', 'url' => 'http://parse19.com');
	
	// --------------------------------------------------------------------------

	/**
	 * Output form input
	 *
	 * @access	public
	 * @param	array
	 * @param	array
	 * @param	obj
	 * @return	string
	 */
	public function form_output($data, $params, $field)
	{
		$html = '<select name="'.$data['form_slug'].'" id="'.$data['form_slug'].'">';
		
		if($field->is_required == 'no'):
		
			$html .= '<option value="">'.get_instance()->config->item('dropdown_choose_null').'</option>';
		
		endif;
		
		return $html .= $this->_build_tree_select(array('current_id' => $data['value'])).'</select>';
{'fraction_non_alphanumeric': 0.2890916632102862, 'fraction_numerical': 0.011613438407299876, 'mean_word_length': 2.1447196870925684, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '1414687', 'n_tokens_mistral': 833, 'n_tokens_neox': 727, 'n_words': 166}