-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathShortcuts.php
62 lines (55 loc) · 2.38 KB
/
Shortcuts.php
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
<?php
/*************************************************************************************/
/* This file is part of the Thelia package. */
/* */
/* Copyright (c) OpenStudio */
/* email : [email protected] */
/* web : http://www.thelia.net */
/* */
/* For the full copyright and license information, please view the LICENSE.txt */
/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Shortcuts;
use Thelia\Module\BaseModule;
use Propel\Runtime\Connection\ConnectionInterface;
use Propel\Runtime\Propel;
use Thelia\Install\Database;
use Shortcuts\Model\Shortcuts as Shortcut;
use Shortcuts\Model\ShortcutsQuery;
class Shortcuts extends BaseModule
{
/** @var string */
const DOMAIN_NAME = 'shortcuts';
const MODULE_DOMAIN = 'shortcuts';
/*
* You may now override BaseModuleInterface methods, such as:
* install, destroy, preActivation, postActivation, preDeactivation, postDeactivation
*
* Have fun !
*/
/**
* @param ConnectionInterface|null $con
* @throws \Propel\Runtime\Exception\PropelException
*/
public function postActivation(ConnectionInterface $con = null)
{
// Once activated, create the module schema in the Thelia database.
$database = new Database($con);
try {
ShortcutsQuery::create()->findOne();
} catch (\Exception $e) {
// Create modules' tables
$database->insertSql(null, array(
__DIR__ . DS . 'Config'.DS.'thelia.sql' // The module schema
));
// Add a default shortcut
$shortcut = new Shortcut();
$shortcut->setUrl('/admin/module/Shortcuts');
$shortcut->setLocale('en_US');
$shortcut->setTitle('Shortcuts settings');
$shortcut->setLocale('fr_FR');
$shortcut->setTitle('Configurtation des raccourcis');
$shortcut->save();
}
}
}