示例#1
0
 private function _installDataSample()
 {
     if (!file_exists(_PS_MODULE_DIR_ . 'leotempcp/libs/DataSample.php')) {
         return true;
     }
     require_once _PS_MODULE_DIR_ . 'leotempcp/libs/DataSample.php';
     $sample = new Datasample(1);
     return $sample->processImport($this->name);
 }
 public function processData()
 {
     //process databsample
     $dataSample = new Datasample();
     $html = array();
     if (Tools::isSubmit('submitSample')) {
         $dataSample->processSample();
     } else {
         if (Tools::isSubmit('submitImport')) {
             $dataSample->processImport();
         } else {
             if (Tools::isSubmit('submitBackup')) {
                 $dataSample->processBackUp();
             } else {
                 if (Tools::isSubmit('submitRestore')) {
                     $dataSample->restoreBackUpFile();
                 } else {
                     if (Tools::isSubmit('submitExportDBStruct')) {
                         $dataSample->exportDBStruct();
                         $dataSample->exportThemeSql();
                     } elseif (Tools::isSubmit('submitConfigsTheme')) {
                         $dataSample->processConfigs();
                     } elseif (Tools::isSubmit('submitApplyConfigs')) {
                         $dataSample->processApplyConfigs();
                     }
                 }
             }
         }
     }
     $html = $dataSample->getMessager();
     foreach ($html as $key => $val) {
         if ($key == "error") {
             foreach ($val as $v) {
                 $this->_html .= $this->displayError($v);
             }
         } else {
             foreach ($val as $v) {
                 $this->_html .= $this->displayConfirmation($v);
             }
             Tools::redirectAdmin($this->context->link->getAdminLink('AdminModules', true) . '&conf=6&configure=' . $this->name . '&tab_module=' . $this->tab . '&module_name=' . $this->name);
         }
     }
 }
示例#3
0
 /**
  * @see Module::install()
  */
 public function install()
 {
     if ($this->_leotype == 0) {
         LeoManagewidgetsInstall::installModuleTab($this->name, 'Leo Manage widgets', 'widgets', 'AdminParentModules');
         LeoManagewidgetsInstall::installModuleTab($this->name, 'Leo Manage Widget Images', 'images', -1);
     }
     /* Adds Module */
     $res = true;
     if (parent::install()) {
         $res &= $this->registerHook('header');
         $res &= $this->registerHook('actionShopDataDuplication');
         $res &= $this->registerHook('actionAdminPerformanceControllerAfter');
         // clear cache
         foreach ($this->_hooksPos as $value) {
             $res &= $this->registerHook($value);
         }
     }
     /* Creates tables */
     if ($this->_leotype == 1) {
         Configuration::updateValue('LEO_MANAGERWIDGETS_VERSION', $this->version);
         require_once _PS_MODULE_DIR_ . 'leotempcp/libs/DataSample.php';
         $sample = new Datasample(1);
         return $sample->processImport($this->name);
     } else {
         $res &= LeoManagewidgetsInstall::createTables();
     }
     return (bool) $res;
 }