本文整理汇总了PHP中Module::install方法的典型用法代码示例。如果您正苦于以下问题:PHP Module::install方法的具体用法?PHP Module::install怎么用?PHP Module::install使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Module
的用法示例。
在下文中一共展示了Module::install方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: install
public function install()
{
Configuration::updateValue('PS_DASHGOALS_CURRENT_YEAR', date('Y'));
for ($month = '01'; $month <= 12; $month = sprintf('%02d', $month + 1)) {
$key = Tools::strtoupper('dashgoals_traffic_' . $month . '_' . date('Y'));
if (!ConfigurationKPI::get($key)) {
ConfigurationKPI::updateValue($key, 600);
}
$key = Tools::strtoupper('dashgoals_conversion_' . $month . '_' . date('Y'));
if (!ConfigurationKPI::get($key)) {
ConfigurationKPI::updateValue($key, 2);
}
$key = Tools::strtoupper('dashgoals_avg_cart_value_' . $month . '_' . date('Y'));
if (!ConfigurationKPI::get($key)) {
ConfigurationKPI::updateValue($key, 80);
}
}
// Prepare tab
$tab = new Tab();
$tab->active = 1;
$tab->class_name = 'AdminDashgoals';
$tab->name = array();
foreach (Language::getLanguages(true) as $lang) {
$tab->name[$lang['id_lang']] = 'Dashgoals';
}
$tab->id_parent = -1;
$tab->module = $this->name;
return $tab->add() && parent::install() && $this->registerHook('dashboardZoneTwo') && $this->registerHook('dashboardData') && $this->registerHook('actionAdminControllerSetMedia');
}
示例2: install
function install()
{
if (!parent::install()) {
return false;
}
return $this->registerHook('home');
}
示例3: install
/**
* @see Module::install()
*/
public function install()
{
/* Adds Module */
if (parent::install() && $this->registerHook('displayHeader') && $this->registerHook('displayBackOfficeHeader') && $this->registerHook('displayCategorySlider') && $this->registerHook('actionShopDataDuplication')) {
/* Sets up configuration */
$res = Configuration::updateValue('CATESLIDER_WIDTH', '1170');
$res &= Configuration::updateValue('CATESLIDER_HEIGHT', '370');
$res &= Configuration::updateValue('CATESLIDER_SPEED', '1500');
$res &= Configuration::updateValue('CATESLIDER_PAUSE', '3000');
$res &= Configuration::updateValue('CATESLIDER_LOOP', '1');
/* Creates tables */
$res &= $this->createTables();
/* Adds samples */
// if ($res)
// $this->installSamples()
$root_cate = Category::getRootCategories($this->context->cookie->id_lang);
foreach ($root_cate as $cate) {
if ($cate['name'] == 'Home') {
Configuration::updateValue('ROOT_CATEGORY', $cate['id_category']);
break;
}
}
return $res;
}
return false;
}
示例4: install
function install()
{
if (parent::install() == false or $this->registerHook('rightColumn') == false or Configuration::updateValue('NEW_PRODUCTS_NBR', 5) == false) {
return false;
}
return true;
}
示例5: install
public function install()
{
if (!parent::install()) {
return false;
}
return true;
}
示例6: install
public function install()
{
if (!parent::install() || !$this->registerHook('displayHome') || !$this->registerHook('displayHeader')) {
return false;
}
$res = Db::getInstance()->execute('
CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'editorial` (
`id_editorial` int(10) unsigned NOT NULL auto_increment,
`id_shop` int(10) unsigned NOT NULL ,
`body_home_logo_link` varchar(255) NOT NULL,
PRIMARY KEY (`id_editorial`))
ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8');
if ($res) {
$res &= Db::getInstance()->execute('
CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'editorial_lang` (
`id_editorial` int(10) unsigned NOT NULL,
`id_lang` int(10) unsigned NOT NULL,
`body_title` varchar(255) NOT NULL,
`body_subheading` varchar(255) NOT NULL,
`body_paragraph` text NOT NULL,
`body_logo_subheading` varchar(255) NOT NULL,
PRIMARY KEY (`id_editorial`, `id_lang`))
ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8');
}
if ($res) {
foreach (Shop::getShops(false) as $shop) {
$res &= $this->createExampleEditorial($shop['id_shop']);
}
}
if (!$res) {
$res &= $this->uninstall();
}
return $res;
}
示例7: install
public function install()
{
if (!file_exists(dirname(__FILE__) . '/' . self::INSTALL_SQL_FILE)) {
return false;
} else {
if (!($sql = file_get_contents(dirname(__FILE__) . '/' . self::INSTALL_SQL_FILE))) {
return false;
}
}
$sql = str_replace(array('PREFIX_', 'ENGINE_TYPE'), array(_DB_PREFIX_, _MYSQL_ENGINE_), $sql);
$sql = preg_split("/;\\s*[\r\n]+/", $sql);
foreach ($sql as $query) {
if ($query) {
if (!Db::getInstance()->execute(trim($query))) {
return false;
}
}
}
if (!parent::install() or !$this->registerHook('rightColumn') or !$this->registerHook('productActions') or !$this->registerHook('cart') or !$this->registerHook('customerAccount') or !$this->registerHook('header') or !$this->registerHook('adminCustomers')) {
return false;
}
/* This hook is optional */
$this->registerHook('displayMyAccountBlock');
return true;
}
示例8: install
function install()
{
if (parent::install() == false or $this->registerHook('leftColumn') == false or Configuration::updateValue('BLOCK_CATEG_MAX_DEPTH', 3) == false or Configuration::updateValue('BLOCK_CATEG_DHTML', 1) == false) {
return false;
}
return true;
}
示例9: install
public function install()
{
$result = true;
// We need CURL to function correctly
if (!$this->curlExists()) {
$this->context->controller->errors[] = $this->l('Riskified require CURL to be installed and enabled.');
$result = false;
}
if (!file_exists(dirname(__FILE__) . '/' . self::INSTALL_SQL_FILE)) {
return false;
} else {
if (!($sql = Tools::file_get_contents(dirname(__FILE__) . '/' . self::INSTALL_SQL_FILE))) {
return false;
}
}
$sql = str_replace(array('PREFIX_', 'ENGINE_TYPE'), array(_DB_PREFIX_, _MYSQL_ENGINE_), $sql);
$sql = preg_split("/;\\s*[\r\n]+/", trim($sql));
foreach ($sql as $query) {
if (!Db::getInstance()->execute(trim($query))) {
return false;
}
}
if (!parent::install() || !$this->registerHook('displayAdminOrder') || !$this->registerHook('displayBackOfficeHeader') || !$this->registerHook('displayBackOfficeTop') || !$this->registerHook('actionValidateOrder') || !$this->registerHook('header')) {
$result = false;
}
RiskifiedLogger::insertLog(__METHOD__ . ' : ' . __LINE__, 'Riskified::install() = ' . $result);
return $result;
}
示例10: install
function install()
{
$countries = array('AT' => array('x' => 294, 'y' => 68), 'AU' => array('x' => 534, 'y' => 228), 'BE' => array('x' => 276, 'y' => 62), 'BO' => array('x' => 135, 'y' => 210), 'CA' => array('x' => 84, 'y' => 45), 'CH' => array('x' => 281, 'y' => 69), 'CI' => array('x' => 253, 'y' => 156), 'CN' => array('x' => 470, 'y' => 99), 'CZ' => array('x' => 293, 'y' => 63), 'DE' => array('x' => 285, 'y' => 61), 'DK' => array('x' => 284, 'y' => 51), 'ES' => array('x' => 260, 'y' => 85), 'FI' => array('x' => 310, 'y' => 35), 'FR' => array('x' => 271, 'y' => 69), 'GB' => array('x' => 265, 'y' => 55), 'GR' => array('x' => 308, 'y' => 87), 'HK' => array('x' => 491, 'y' => 123), 'IE' => array('x' => 253, 'y' => 58), 'IL' => array('x' => 334, 'y' => 106), 'IT' => array('x' => 292, 'y' => 80), 'JP' => array('x' => 531, 'y' => 92), 'KR' => array('x' => 509, 'y' => 93), 'LU' => array('x' => 277, 'y' => 63), 'NG' => array('x' => 282, 'y' => 153), 'NL' => array('x' => 278, 'y' => 58), 'NO' => array('x' => 283, 'y' => 41), 'NZ' => array('x' => 590, 'y' => 264), 'PL' => array('x' => 300, 'y' => 59), 'PT' => array('x' => 251, 'y' => 86), 'TG' => array('x' => 267, 'y' => 154), 'SE' => array('x' => 294, 'y' => 40), 'SG' => array('x' => 475, 'y' => 169), 'US' => array('x' => 71, 'y' => 87), 'ZA' => array('x' => 311, 'y' => 239));
if (!parent::install() or !$this->registerHook('AdminStatsModules')) {
return false;
}
if (!Db::getInstance()->Execute('
CREATE TABLE `' . _DB_PREFIX_ . 'location_coords` (
`id_location_coords` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
`x` int(4) NOT NULL,
`y` int(4) NOT NULL,
`id_country` INTEGER UNSIGNED NOT NULL,
PRIMARY KEY(`id_location_coords`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8')) {
return false;
}
$flag = 0;
$query = 'INSERT INTO `' . _DB_PREFIX_ . 'location_coords` (`x`, `y`, `id_country`) VALUES ';
$result = Db::getInstance()->ExecuteS('SELECT `id_country`, `iso_code` FROM `' . _DB_PREFIX_ . 'country`;');
foreach ($result as $index => $row) {
if (isset($countries[$row['iso_code']])) {
if ($flag) {
$query .= ', ';
}
$query .= '(\'' . $countries[$row['iso_code']]['x'] . '\', \'' . $countries[$row['iso_code']]['y'] . '\', \'' . $row['id_country'] . '\')';
$flag = 1;
}
}
return Db::getInstance()->Execute($query . ';');
}
示例11: install
public function install()
{
if (!parent::install() or !$this->registerHook('top') or !$this->registerHook('leftColumn') or !$this->registerHook('rightColumn') or !$this->registerHook('header')) {
return false;
}
return true;
}
示例12: install
function install()
{
if (!parent::install() or !$this->registerHook('home') or Configuration::updateValue('BLOCK_CATEG_MAX_DEPTH', 1) == false) {
return false;
}
return true;
}
示例13: install
public function install()
{
if (!parent::install() || !$this->registerHook('displayTopColumn') || !$this->registerHook('header') || !$this->registerHook('displayMobileTopSiteMap')) {
return false;
}
return true;
}
示例14: install
public function install()
{
if (!parent::install() || !$this->registerHook('leftColumn') || !$this->registerHook('header') || !Configuration::updateValue('PRODUCTS_VIEWED_NBR', 2)) {
return false;
}
return true;
}
示例15: install
public function install()
{
if (parent::install() && $this->registerHook('leftColumn') && $this->registerHook('rightColumn') && $this->registerHook('header') && $this->registerHook('footer') && $this->registerHook('categoryAddition') && $this->registerHook('categoryUpdate') && $this->registerHook('attributeGroupForm') && $this->registerHook('afterSaveAttributeGroup') && $this->registerHook('afterDeleteAttributeGroup') && $this->registerHook('featureForm') && $this->registerHook('afterDeleteFeature') && $this->registerHook('afterSaveFeature') && $this->registerHook('categoryDeletion') && $this->registerHook('afterSaveProduct') && $this->registerHook('productListAssign') && $this->registerHook('postProcessAttributeGroup') && $this->registerHook('postProcessFeature') && $this->registerHook('featureValueForm') && $this->registerHook('postProcessFeatureValue') && $this->registerHook('afterDeleteFeatureValue') && $this->registerHook('afterSaveFeatureValue') && $this->registerHook('attributeForm') && $this->registerHook('postProcessAttribute') && $this->registerHook('afterDeleteAttribute') && $this->registerHook('afterSaveAttribute')) {
Configuration::updateValue('PS_LAYERED_HIDE_0_VALUES', 1);
Configuration::updateValue('PS_LAYERED_SHOW_QTIES', 1);
Configuration::updateValue('PS_LAYERED_FULL_TREE', 1);
Configuration::updateValue('PS_LAYERED_FILTER_PRICE_USETAX', 1);
Configuration::updateValue('PS_LAYERED_FILTER_CATEGORY_DEPTH', 1);
Configuration::updateValue('PS_LAYERED_FILTER_INDEX_QTY', 0);
Configuration::updateValue('PS_LAYERED_FILTER_INDEX_CDT', 0);
Configuration::updateValue('PS_LAYERED_FILTER_INDEX_MNF', 0);
Configuration::updateValue('PS_LAYERED_FILTER_INDEX_CAT', 0);
$this->rebuildLayeredStructure();
$products_count = Db::getInstance()->getValue('SELECT COUNT(*) FROM `' . _DB_PREFIX_ . 'product`');
if ($products_count < 20000) {
// Lock template filter creation if too many products
$this->rebuildLayeredCache();
}
self::installPriceIndexTable();
$this->installFriendlyUrlTable();
$this->installIndexableAttributeTable();
$this->installProductAttributeTable();
if ($products_count < 5000) {
$this->indexUrl();
$this->indexAttribute();
self::fullPricesIndexProcess();
}
return true;
} else {
// Installation failed (or hook registration) => uninstall the module
$this->uninstall();
return false;
}
}