1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
<?php
class MagnalisterModuleCenterModule extends AbstractModuleCenterModule
{
protected function _init()
{
$this->title = $this->languageTextManager->get_text('magnalister_title');
$this->description = $this->languageTextManager->get_text('magnalister_description');
$this->sortOrder = 13490;
}
public function install()
{
parent::install();
$columnsQuery = $this->db->query('DESCRIBE `admin_access` \'magnalister\'');
if(!$columnsQuery->num_rows())
{
$this->db->query('ALTER TABLE `admin_access` ADD `magnalister` INT( 1 ) NOT NULL DEFAULT \'0\';');
}
$this->db->set('magnalister', '1')->where('customers_id', '1')->limit(1)->update('admin_access');
$this->db->set('magnalister', '1')
->where('customers_id', $_SESSION['customer_id'])
->limit(1)
->update('admin_access');
$this->db->insert('configuration', array(
'configuration_key' => 'MODULE_MAGNALISTER_STATUS',
'configuration_value' => 'True',
'configuration_group_id' => '6',
'sort_order' => '1',
'set_function' => '',
'date_added' => 'NOW()'
));
return xtc_href_link('admin.php', 'do=EmbeddedModule/magnalister&update=true');
}
public function uninstall()
{
parent::uninstall();
$this->db->query('ALTER TABLE `admin_access` DROP `magnalister`');
$this->db->where_in('configuration_key', 'MODULE_MAGNALISTER_STATUS')->delete('configuration');
}
}