<?php

if (!defined('BASEPATH')) {
    exit('No direct script access allowed');
}

class Rtform_install extends \Ciext\Controller\AbstractInstallController
{

    public function __construct()
    {
        parent::__construct();

        // Set acl module name
        $this->module_config['module_acl_name'] = 'rtform';

        // Set title in english
        $this->module_config['module_title'] = 'Forms';

        // Set module image
        $this->module_config['module_image'] = 'fa-envelope';

        // Set actions
        $this->module_config['module_actions'] = [
            // 'acl_action' => 'description'
            'view_rtform' => $this->lang->line('View'),
            'edit_rtform' => $this->lang->line('Edit'),
        ];

        // Set menu items
        $this->module_config['module_menu_items'] = [
            ['index', $this->lang->line('Edit forms'), '', 'edit_rtform'],
            ['request', $this->lang->line('Requests'), '', 'view_rtform'],
        ];
    }

    public function install($options = [])
    {
        if (empty($options)) {
            $options = [
                'shemaFile' => dirname(__DIR__) . '/data/install.sql',
            ];
        }

        return parent::install($options);
    }

    public function uninstall($options = [])
    {
        if (empty($options)) {
            $options = [
                'dropTables' => [
                    'rtform_request',
                    'rtform',
                ],
            ];
        }

        return parent::uninstall($options);
    }

}
