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

class Module_Events_manager extends Module {

	public $version = '0.9.0';

	public function info()
	{
		$info = array(
			'name' => array(
				'en' => 'Events Manager'
			),
			'description' => array(
				'en' => 'Create and manage calendar events'
			),
			'frontend' => true,
			'backend' => true,
			'skip_xss' => false,
			'menu' => 'content',
			'sections' => array(
				'events' => array(
					'name' => 'events_manager:events:title',
					'uri' => 'admin/events_manager',
					'class' => '',
					'shortcuts' => array(
						'create' => array(
							'name' 	=> 'events_manager:events:add',
							'uri' 	=> 'admin/events_manager/form',
							'class' => 'add'
						)
					)
				)
			),
			'roles' => array(
				'categories', 'custom_fields'
			)
		);
		
		// // Adding short cuts to specific sections
		// if ($this->controller == 'admin_simple' && $this->uri->segment(4) != 'other_conditions')
		// {
		// 	$info['sections']['simple']['shortcuts'] = array(
		// 					array(
		// 					    'name' => 'simple:shortcut',
		// 					    'uri' => '',
		// 					    'class' => ''
		// 					)
		// 			    );
		// }
		
		// Add section only if they have permission
		if (function_exists('group_has_role'))
		{
			if(group_has_role('events_manager', 'categories'))
			{
				$info['sections']['categories'] = array(
					'name' 	=> 'events_manager:categories:title',
					'uri' 	=> 'admin/events_manager/categories',
					'shortcuts' => array(
						'create' => array(
							'name' 	=> 'events_manager:categories:add',
							'uri' 	=> 'admin/events_manager/categories/form',
							'class' => 'add'
						)
					)
				);
			}
			
			if(group_has_role('events_manager', 'custom_fields'))
			{
				$info['sections']['custom_fields'] = array(
					'name' 	=> 'events_manager:custom_fields:title',
					'uri' 	=> 'admin/events_manager/fields',
					'shortcuts' => array(
						'create' => array(
							'name' 	=> 'events_manager:custom_fields:add',
							'uri' 	=> 'admin/events_manager/fields/form',
							'class' => 'add'
						)
					)
				);
			}
			
			if(group_has_role('events_manager', 'colors'))
			{
				$info['sections']['colors'] = array(
					'name' 	=> 'events_manager:colors:title',
					'uri' 	=> 'admin/events_manager/colors',
					'shortcuts' => array(
						'create' => array(
							'name' 	=> 'events_manager:colors:add',
							'uri' 	=> 'admin/events_manager/colors/form',
							'class' => 'add'
						)
					)
				);
			}
		}
		
		return $info;
	}

	public function install()
	{
		$this->load->driver('Streams');
		
		// Add Category colors
		if(!$this->streams->streams->add_stream('Category Colors', 'category_colors', 'events_manager', 'em_', 'Colors for Event Categories')) return false;
		
		$fields = array(
			array(
				'name' => 'Color',
				'slug' => 'color',
				'namespace' => 'events_manager',
				'type' => 'text',
				'extra' => array('max_length' => 20),
				'assign' => 'category_colors',
				'title_column' => true,
				'required' => true,
				'unique' => true
			),
			array(
				'name' => 'Hex',
				'slug' => 'hex',
				'namespace' => 'events_manager',
				'type' => 'text',
				'extra' => array('max_length' => 6),
				'assign' => 'category_colors',
				'title_column' => false,
				'required' => true,
				'unique' => true
			)
		);
		
		$this->streams->fields->add_fields($fields);
		
		$colors = array(
			array(
				'color' => 'Grey',
				'hex' => '999999'
			),
			array(
				'color' => 'Yellow',
				'hex' => 'ffff0'
			),
			array(
				'color' => 'Orange',
				'hex' => 'ff9900'
			),
			array(
				'color' => 'Purple',
				'hex' => '000066'
			),
			array(
				'color' => 'Red',
				'hex' => 'ff0000'
			),
			array(
				'color' => 'Green',
				'hex' => '006600'
			),
			array(
				'color' => 'Blue',
				'hex' => '0000ff'
			),
			array(
				'color' => 'Brown',
				'hex' => '663300'
			),<commit_msg>fixed bad hex color<commit_after><?php defined('BASEPATH') or exit('No direct script access allowed');

class Module_Events_manager extends Module {

	public $version = '0.9.0';

	public function info()
	{
		$info = array(
			'name' => array(
				'en' => 'Events Manager'
			),
			'description' => array(
				'en' => 'Create and manage calendar events'
			),
			'frontend' => true,
			'backend' => true,
			'skip_xss' => false,
			'menu' => 'content',
			'sections' => array(
				'events' => array(
					'name' => 'events_manager:events:title',
					'uri' => 'admin/events_manager',
					'class' => '',
					'shortcuts' => array(
						'create' => array(
							'name' 	=> 'events_manager:events:add',
							'uri' 	=> 'admin/events_manager/form',
							'class' => 'add'
						)
					)
				)
			),
			'roles' => array(
				'categories', 'custom_fields'
			)
		);
		
		// // Adding short cuts to specific sections
		// if ($this->controller == 'admin_simple' && $this->uri->segment(4) != 'other_conditions')
		// {
		// 	$info['sections']['simple']['shortcuts'] = array(
		// 					array(
		// 					    'name' => 'simple:shortcut',
		// 					    'uri' => '',
		// 					    'class' => ''
		// 					)
		// 			    );
		// }
		
		// Add section only if they have permission
		if (function_exists('group_has_role'))
		{
			if(group_has_role('events_manager', 'categories'))
			{
				$info['sections']['categories'] = array(
					'name' 	=> 'events_manager:categories:title',
					'uri' 	=> 'admin/events_manager/categories',
					'shortcuts' => array(
						'create' => array(
							'name' 	=> 'events_manager:categories:add',
							'uri' 	=> 'admin/events_manager/categories/form',
							'class' => 'add'
						)
					)
				);
			}
			
			if(group_has_role('events_manager', 'custom_fields'))
			{
				$info['sections']['custom_fields'] = array(
					'name' 	=> 'events_manager:custom_fields:title',
					'uri' 	=> 'admin/events_manager/fields',
					'shortcuts' => array(
						'create' => array(
							'name' 	=> 'events_manager:custom_fields:add',
							'uri' 	=> 'admin/events_manager/fields/form',
							'class' => 'add'
						)
					)
				);
			}
			
			if(group_has_role('events_manager', 'colors'))
			{
				$info['sections']['colors'] = array(
					'name' 	=> 'events_manager:colors:title',
					'uri' 	=> 'admin/events_manager/colors',
					'shortcuts' => array(
						'create' => array(
							'name' 	=> 'events_manager:colors:add',
							'uri' 	=> 'admin/events_manager/colors/form',
							'class' => 'add'
						)
					)
				);
			}
		}
		
		return $info;
	}

	public function install()
	{
		$this->load->driver('Streams');
		
		// Add Category colors
		if(!$this->streams->streams->add_stream('Category Colors', 'category_colors', 'events_manager', 'em_', 'Colors for Event Categories')) return false;
		
		$fields = array(
			array(
				'name' => 'Color',
				'slug' => 'color',
				'namespace' => 'events_manager',
				'type' => 'text',
				'extra' => array('max_length' => 20),
				'assign' => 'category_colors',
				'title_column' => true,
				'required' => true,
				'unique' => true
			),
			array(
				'name' => 'Hex',
				'slug' => 'hex',
				'namespace' => 'events_manager',
				'type' => 'text',
				'extra' => array('max_length' => 6),
				'assign' => 'category_colors',
				'title_column' => false,
				'required' => true,
				'unique' => true
			)
		);
		
		$this->streams->fields->add_fields($fields);
		
		$colors = array(
			array(
				'color' => 'Grey',
				'hex' => '999999'
			),
			array(
				'color' => 'Yellow',
				'hex' => 'ffff00'
			),
			array(
				'color' => 'Orange',
				'hex' => 'ff9900'
			),
			array(
				'color' => 'Purple',
				'hex' => '000066'
			),
			array(
				'color' => 'Red',
				'hex' => 'ff0000'
			),
			array(
				'color' => 'Green',
				'hex' => '006600'
			),
			array(
				'color' => 'Blue',
				'hex' => '0000ff'
			),
			array(
				'color' => 'Brown',
				'hex' => '663300'
			),
{'fraction_non_alphanumeric': 0.20625871024958825, 'fraction_numerical': 0.011275814012416065, 'mean_word_length': 2.496014171833481, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 183, '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': '1939395', 'n_tokens_mistral': 3815, 'n_tokens_neox': 2821, 'n_words': 503}