<commit_before><?php
class ControllerExtensionThemeMaterialize extends Controller {
	private $error = array();

	public function install() {
		$this->db->query("ALTER TABLE `" . DB_PREFIX . "product_description` ADD `size_chart` TEXT NOT NULL;");
		$this->db->query("ALTER TABLE `" . DB_PREFIX . "product_option_value` ADD `default_option` TINYINT(1) NOT NULL DEFAULT '0';");

		/* Custom Tabs */

		$this->db->query("
			CREATE TABLE IF NOT EXISTS `" . DB_PREFIX . "product_customtab` (
				`product_customtab_id` INT(11) NOT NULL AUTO_INCREMENT,
				`product_id` INT(11) NOT NULL,
				`sort_order` INT(11) NOT NULL,
				`status` TINYINT(1) NOT NULL,
				PRIMARY KEY (`product_customtab_id`)
			) ENGINE=MyISAM;
		");

		$this->db->query("
			CREATE TABLE IF NOT EXISTS `" . DB_PREFIX . "product_customtab_description` (
				`product_customtab_id` INT(11) NOT NULL,
				`language_id` INT(11) NOT NULL,
				`product_id` INT(11) NOT NULL,
				`title` VARCHAR(255) CHARACTER SET utf8 NOT NULL,
				`description` TEXT CHARACTER SET utf8 NOT NULL
			) ENGINE=MyISAM;
		");

		/* Additional Fields */

		$this->db->query("
			CREATE TABLE IF NOT EXISTS `" . DB_PREFIX . "product_additionalfield` (
				`product_additionalfield_id` INT(11) NOT NULL AUTO_INCREMENT,
				`product_id` INT(11) NOT NULL,
				`sort_order` INT(11) NOT NULL,
				`status` TINYINT(1) NOT NULL,
				PRIMARY KEY (`product_additionalfield_id`)
			) ENGINE=MyISAM;
		");

		$this->db->query("
			CREATE TABLE IF NOT EXISTS `" . DB_PREFIX . "product_additionalfield_text` (
				`product_additionalfield_id` INT(11) NOT NULL,
				`language_id` INT(11) NOT NULL,
				`product_id` INT(11) NOT NULL,
				`title` VARCHAR(255) CHARACTER SET utf8 NOT NULL,
				`text` VARCHAR(255) CHARACTER SET utf8 NOT NULL
			) ENGINE=MyISAM;
		");

		/* Install Materialize Modules */

		$this->load->model('extension/materialize/callback');
		$this->load->model('extension/materialize/label');
		$this->load->model('extension/materialize/materialize');

		$this->model_extension_materialize_callback->install();
		$this->model_extension_materialize_label->install();
		$this->model_extension_materialize_materialize->install();

		$this->load->model('setting/extension');

		$this->model_setting_extension->install('dashboard', 'callback');
		$this->model_setting_extension->install('module', 'callback');
		$this->model_setting_extension->install('module', 'map');

		/* Add permission */

		$this->load->model('user/user_group');

		$this->model_user_user_group->addPermission($this->user->getGroupId(), 'access', 'extension/dashboard/callback');
		$this->model_user_user_group->addPermission($this->user->getGroupId(), 'modify', 'extension/dashboard/callback');

		$this->model_user_user_group->addPermission($this->user->getGroupId(), 'access', 'extension/module/callback');
		$this->model_user_user_group->addPermission($this->user->getGroupId(), 'modify', 'extension/module/callback');

		$this->model_user_user_group->addPermission($this->user->getGroupId(), 'access', 'extension/module/map');
		$this->model_user_user_group->addPermission($this->user->getGroupId(), 'modify', 'extension/module/map');

		$this->model_user_user_group->addPermission($this->user->getGroupId(), 'access', 'extension/materialize');
		$this->model_user_user_group->addPermission($this->user->getGroupId(), 'modify', 'extension/materialize');

		$this->model_user_user_group->addPermission($this->user->getGroupId(), 'access', 'extension/materialize/callback/callback');
		$this->model_user_user_group->addPermission($this->user->getGroupId(), 'modify', 'extension/materialize/callback/callback');

		$this->model_user_user_group->addPermission($this->user->getGroupId(), 'access', 'extension/materialize/label/label');
		$this->model_user_user_group->addPermission($this->user->getGroupId(), 'modify', 'extension/materialize/label/label');
	}

	public function uninstall() {
		$this->db->query("ALTER TABLE `" . DB_PREFIX . "product_description` DROP `size_chart`;");
		$this->db->query("ALTER TABLE `" . DB_PREFIX . "product_option_value` DROP `default_option`;");

		$this->db->query("
			DROP TABLE IF EXISTS
				`" . DB_PREFIX . "product_customtab`,
				`" . DB_PREFIX . "product_customtab_description`,
				`" . DB_PREFIX . "product_additionalfield`,
				`" . DB_PREFIX . "product_additionalfield_text`
			;
		");

		/* Uninstall Materialize Modules */

		$this->load->model('extension/materialize/callback');
		$this->load->model('extension/materialize/label');
		$this->load->model('extension/materialize/materialize');

		$this->model_extension_materialize_callback->uninstall();
		$this->model_extension_materialize_label->uninstall();
		$this->model_extension_materialize_materialize->uninstall();

		$this->load->model('setting/extension');

		$this->model_setting_extension->uninstall('dashboard', 'callback');
		$this->model_setting_extension->uninstall('module', 'callback');
		$this->model_setting_extension->uninstall('module', 'map');

		/* Remove permission */

		$this->load->model('user/user_group');

		$this->model_user_user_group->removePermission($this->user->getGroupId(), 'access', 'extension/dashboard/callback');
		$this->model_user_user_group->removePermission($this->user->getGroupId(), 'modify', 'extension/dashboard/callback');

		$this->model_user_user_group->removePermission($this->user->getGroupId(), 'access', 'extension/module/callback');
		$this->model_user_user_group->removePermission($this->user->getGroupId(), 'modify', 'extension/module/callback');

		$this->model_user_user_group->removePermission($this->user->getGroupId(), 'access', 'extension/module/map');
		$this->model_user_user_group->removePermission($this->user->getGroupId(), 'modify', 'extension/module/map');

		$this->model_user_user_group->removePermission($this->user->getGroupId(), 'access', 'extension/materialize');
		$this->model_user_user_group->removePermission($this->user->getGroupId(), 'modify', 'extension/materialize');

		$this->model_user_user_group->removePermission($this->user->getGroupId(), 'access', 'extension/materialize/callback/callback');
		$this->model_user_user_group->removePermission($this->user->getGroupId(), 'modify', 'extension/materialize/callback/callback');

		$this->model_user_user_group->removePermission($this->user->getGroupId(), 'access', 'extension/materialize/label/label');
		$this->model_user_user_group->removePermission($this->user->getGroupId(), 'modify', 'extension/materialize/label/label');
	}

	public function index() {
		$this->load->language('extension/theme/materialize');
		$this->load->language('extension/materialize/materialize');

		$this->document->setTitle($this->language->get('materialize_title'));
		$this->document->addScript('view/javascript/codemirror/lib/codemirror.js');<commit_msg>Map module is included in version 0.80<commit_after><?php
class ControllerExtensionThemeMaterialize extends Controller {
	private $error = array();

	public function install() {
		$this->db->query("ALTER TABLE `" . DB_PREFIX . "product_description` ADD `size_chart` TEXT NOT NULL;");
		$this->db->query("ALTER TABLE `" . DB_PREFIX . "product_option_value` ADD `default_option` TINYINT(1) NOT NULL DEFAULT '0';");

		/* Custom Tabs */

		$this->db->query("
			CREATE TABLE IF NOT EXISTS `" . DB_PREFIX . "product_customtab` (
				`product_customtab_id` INT(11) NOT NULL AUTO_INCREMENT,
				`product_id` INT(11) NOT NULL,
				`sort_order` INT(11) NOT NULL,
				`status` TINYINT(1) NOT NULL,
				PRIMARY KEY (`product_customtab_id`)
			) ENGINE=MyISAM;
		");

		$this->db->query("
			CREATE TABLE IF NOT EXISTS `" . DB_PREFIX . "product_customtab_description` (
				`product_customtab_id` INT(11) NOT NULL,
				`language_id` INT(11) NOT NULL,
				`product_id` INT(11) NOT NULL,
				`title` VARCHAR(255) CHARACTER SET utf8 NOT NULL,
				`description` TEXT CHARACTER SET utf8 NOT NULL
			) ENGINE=MyISAM;
		");

		/* Additional Fields */

		$this->db->query("
			CREATE TABLE IF NOT EXISTS `" . DB_PREFIX . "product_additionalfield` (
				`product_additionalfield_id` INT(11) NOT NULL AUTO_INCREMENT,
				`product_id` INT(11) NOT NULL,
				`sort_order` INT(11) NOT NULL,
				`status` TINYINT(1) NOT NULL,
				PRIMARY KEY (`product_additionalfield_id`)
			) ENGINE=MyISAM;
		");

		$this->db->query("
			CREATE TABLE IF NOT EXISTS `" . DB_PREFIX . "product_additionalfield_text` (
				`product_additionalfield_id` INT(11) NOT NULL,
				`language_id` INT(11) NOT NULL,
				`product_id` INT(11) NOT NULL,
				`title` VARCHAR(255) CHARACTER SET utf8 NOT NULL,
				`text` VARCHAR(255) CHARACTER SET utf8 NOT NULL
			) ENGINE=MyISAM;
		");

		/* Install Materialize Modules */

		$this->load->model('extension/materialize/materialize');

		$this->model_extension_materialize_materialize->install();

		$this->load->model('extension/materialize/callback');
		$this->load->model('extension/materialize/label');

		$this->model_extension_materialize_callback->install();
		$this->model_extension_materialize_label->install();

		$this->load->model('setting/extension');

		$this->model_setting_extension->install('dashboard', 'callback');
		$this->model_setting_extension->install('module', 'callback');

		/* Add permission */

		$this->load->model('user/user_group');

		$this->model_user_user_group->addPermission($this->user->getGroupId(), 'access', 'extension/dashboard/callback');
		$this->model_user_user_group->addPermission($this->user->getGroupId(), 'modify', 'extension/dashboard/callback');

		$this->model_user_user_group->addPermission($this->user->getGroupId(), 'access', 'extension/module/callback');
		$this->model_user_user_group->addPermission($this->user->getGroupId(), 'modify', 'extension/module/callback');

		$this->model_user_user_group->addPermission($this->user->getGroupId(), 'access', 'extension/materialize');
		$this->model_user_user_group->addPermission($this->user->getGroupId(), 'modify', 'extension/materialize');

		$this->model_user_user_group->addPermission($this->user->getGroupId(), 'access', 'extension/materialize/callback/callback');
		$this->model_user_user_group->addPermission($this->user->getGroupId(), 'modify', 'extension/materialize/callback/callback');

		$this->model_user_user_group->addPermission($this->user->getGroupId(), 'access', 'extension/materialize/label/label');
		$this->model_user_user_group->addPermission($this->user->getGroupId(), 'modify', 'extension/materialize/label/label');
	}

	public function uninstall() {
		$this->db->query("ALTER TABLE `" . DB_PREFIX . "product_description` DROP `size_chart`;");
		$this->db->query("ALTER TABLE `" . DB_PREFIX . "product_option_value` DROP `default_option`;");

		$this->db->query("
			DROP TABLE IF EXISTS
				`" . DB_PREFIX . "product_customtab`,
				`" . DB_PREFIX . "product_customtab_description`,
				`" . DB_PREFIX . "product_additionalfield`,
				`" . DB_PREFIX . "product_additionalfield_text`
			;
		");

		/* Uninstall Materialize Modules */

		$this->load->model('extension/materialize/materialize');

		$this->model_extension_materialize_materialize->uninstall();

		$this->load->model('extension/materialize/callback');
		$this->load->model('extension/materialize/label');

		$this->model_extension_materialize_callback->uninstall();
		$this->model_extension_materialize_label->uninstall();

		$this->load->model('setting/extension');

		$this->model_setting_extension->uninstall('dashboard', 'callback');
		$this->model_setting_extension->uninstall('module', 'callback');

		/* Remove permission */

		$this->load->model('user/user_group');

		$this->model_user_user_group->removePermission($this->user->getGroupId(), 'access', 'extension/dashboard/callback');
		$this->model_user_user_group->removePermission($this->user->getGroupId(), 'modify', 'extension/dashboard/callback');

		$this->model_user_user_group->removePermission($this->user->getGroupId(), 'access', 'extension/module/callback');
		$this->model_user_user_group->removePermission($this->user->getGroupId(), 'modify', 'extension/module/callback');

		$this->model_user_user_group->removePermission($this->user->getGroupId(), 'access', 'extension/materialize');
		$this->model_user_user_group->removePermission($this->user->getGroupId(), 'modify', 'extension/materialize');

		$this->model_user_user_group->removePermission($this->user->getGroupId(), 'access', 'extension/materialize/callback/callback');
		$this->model_user_user_group->removePermission($this->user->getGroupId(), 'modify', 'extension/materialize/callback/callback');

		$this->model_user_user_group->removePermission($this->user->getGroupId(), 'access', 'extension/materialize/label/label');
		$this->model_user_user_group->removePermission($this->user->getGroupId(), 'modify', 'extension/materialize/label/label');
	}

	public function index() {
		$this->load->language('extension/theme/materialize');
		$this->load->language('extension/materialize/materialize');

		$this->document->setTitle($this->language->get('materialize_title'));
		$this->document->addScript('view/javascript/codemirror/lib/codemirror.js');
{'fraction_non_alphanumeric': 0.1736765494522332, 'fraction_numerical': 0.0065119129701984215, 'mean_word_length': 5.92152704135737, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 319, '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': '19262', 'n_tokens_mistral': 4588, 'n_tokens_neox': 4113, 'n_words': 605}