<commit_before><?php

$controller = '<?php if (!defined(\'BASEPATH\')) exit(\'No direct script access allowed\');

class '.ucfirst($controller_name).' extends ';
$controller .= $controller_name == $module_name_lower ? "Front_controller" : "Admin_Controller";
$controller .= ' {
               
	function __construct()
	{
 		parent::__construct();
		
		$this->auth->restrict(\''.ucfirst($module_name).'.'.ucfirst($controller_name).'.View\');
		
		$this->load->model(\''.$module_name_lower.'_model\');
		$this->lang->load(\''.$module_name_lower.'\');
		
		Assets::add_js($this->load->view(\''.$controller_name.'/js\', null, true), \'inline\');
		';
$date_included = FALSE;
$datetime_included = FALSE;
$textarea_included = FALSE;
for($counter=1; $field_total >= $counter; $counter++)
{
	$db_field_type = set_value("db_field_type$counter");
	$field_name = set_value("view_field_name$counter");
	$view_datepicker = '';
	if ($db_field_type != NULL)
	{
		if ($db_field_type == 'DATE' AND $date_included === FALSE)
		{
			$controller .= '
			Assets::add_css(\'flick/jquery-ui-1.8.13.custom.css\');
			Assets::add_js(\'jquery-ui-1.8.8.min.js\');';
			$date_included = TRUE;
		}
		elseif ($db_field_type == 'DATETIME' && $datetime_included === FALSE)
		{
			// if a date field hasn't been included already then add in the jquery ui files
			if ($date_included === FALSE)
			{
				$controller .= '
				Assets::add_css(\'flick/jquery-ui-1.8.13.custom.css\');
				Assets::add_js(\'jquery-ui-1.8.8.min.js\');';
			}
			$controller .= '
			Assets::add_css(\'jquery-ui-timepicker.css\');
			Assets::add_js(\'jquery-ui-timepicker-addon.js\');';
			$date_included = TRUE;
			$datetime_included = TRUE;
		}
		elseif ($db_field_type == 'TEXT' AND $textarea_included === FALSE AND !empty($textarea_editor) )
		{
			// if a date field hasn't been included already then add in the jquery ui files
			if ($textarea_editor == 'ckeditor') {
				$controller .= '
				Assets::add_js(Template::theme_url(\'js/editors/ckeditor/ckeditor.js\'));';
			}
			elseif ($textarea_editor == 'xinha') {
				$controller .= '
				Assets::add_js(Template::theme_url(\'js/editors/xinha_conf.js\'));
				Assets::add_js(Template::theme_url(\'js/editors/xinha/XinhaCore.js\'));';
			}
			$textarea_included = TRUE;
		}
	}
}
		
$controller .= '
		Template::set("toolbar_title", "Manage '.$module_name.'");
	}
	
	';

	if(in_array('index', $action_names) ) {

$controller .= '
	/** 
	 * function index
	 *
	 * list form data
	 */
	public function index()
	{
		$data = array();
		$data["records_array"] = $this->'.$module_name_lower.'_model->find_all();

		Template::set_view("'.$controller_name.'/index");
		Template::set("data", $data);
		Template::render();
	}
	
	//--------------------------------------------------------------------
	
	';
	}

	if(in_array('create', $action_names) ) {
		$controller .= '
	public function create() 
	{<commit_msg>Module Builder - fix issue with records list<commit_after><?php

$controller = '<?php if (!defined(\'BASEPATH\')) exit(\'No direct script access allowed\');

class '.ucfirst($controller_name).' extends ';
$controller .= $controller_name == $module_name_lower ? "Front_controller" : "Admin_Controller";
$controller .= ' {
               
	function __construct()
	{
 		parent::__construct();
		
		$this->auth->restrict(\''.ucfirst($module_name).'.'.ucfirst($controller_name).'.View\');
		
		$this->load->model(\''.$module_name_lower.'_model\');
		$this->lang->load(\''.$module_name_lower.'\');
		
		Assets::add_js($this->load->view(\''.$controller_name.'/js\', null, true), \'inline\');
		';
$date_included = FALSE;
$datetime_included = FALSE;
$textarea_included = FALSE;
for($counter=1; $field_total >= $counter; $counter++)
{
	$db_field_type = set_value("db_field_type$counter");
	$field_name = set_value("view_field_name$counter");
	$view_datepicker = '';
	if ($db_field_type != NULL)
	{
		if ($db_field_type == 'DATE' AND $date_included === FALSE)
		{
			$controller .= '
			Assets::add_css(\'flick/jquery-ui-1.8.13.custom.css\');
			Assets::add_js(\'jquery-ui-1.8.8.min.js\');';
			$date_included = TRUE;
		}
		elseif ($db_field_type == 'DATETIME' && $datetime_included === FALSE)
		{
			// if a date field hasn't been included already then add in the jquery ui files
			if ($date_included === FALSE)
			{
				$controller .= '
				Assets::add_css(\'flick/jquery-ui-1.8.13.custom.css\');
				Assets::add_js(\'jquery-ui-1.8.8.min.js\');';
			}
			$controller .= '
			Assets::add_css(\'jquery-ui-timepicker.css\');
			Assets::add_js(\'jquery-ui-timepicker-addon.js\');';
			$date_included = TRUE;
			$datetime_included = TRUE;
		}
		elseif ($db_field_type == 'TEXT' AND $textarea_included === FALSE AND !empty($textarea_editor) )
		{
			// if a date field hasn't been included already then add in the jquery ui files
			if ($textarea_editor == 'ckeditor') {
				$controller .= '
				Assets::add_js(Template::theme_url(\'js/editors/ckeditor/ckeditor.js\'));';
			}
			elseif ($textarea_editor == 'xinha') {
				$controller .= '
				Assets::add_js(Template::theme_url(\'js/editors/xinha_conf.js\'));
				Assets::add_js(Template::theme_url(\'js/editors/xinha/XinhaCore.js\'));';
			}
			$textarea_included = TRUE;
		}
	}
}
		
$controller .= '
		Template::set("toolbar_title", "Manage '.$module_name.'");
	}
	
	';

	if(in_array('index', $action_names) ) {

$controller .= '
	/** 
	 * function index
	 *
	 * list form data
	 */
	public function index()
	{
		$data = array();
		$data["records"] = $this->'.$module_name_lower.'_model->find_all();

		Template::set_view("'.$controller_name.'/index");
		Template::set("data", $data);
		Template::render();
	}
	
	//--------------------------------------------------------------------
	
	';
	}

	if(in_array('create', $action_names) ) {
		$controller .= '
	public function create() 
	{
{'fraction_non_alphanumeric': 0.2234243517087412, 'fraction_numerical': 0.005151983513652756, 'mean_word_length': 3.5042536736272236, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 25, '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': '2372254', 'n_tokens_mistral': 2292, 'n_tokens_neox': 2037, 'n_words': 318}