Exemplo n.º 1
0
 public function uninstall()
 {
     if (!parent::uninstall()) {
         return false;
     }
     return true;
 }
Exemplo n.º 2
0
    public function getContent()
    {
        $exportModules = parent::getImportModulesOnDisk();
        //get installed module only
        foreach ($exportModules as $key => $module) {
            if ($module->name == $this->name || !(bool) $module->id) {
                unset($exportModules[$key]);
            }
        }
        $html = '<script type="text/javascript">var globalAjaxShopImporterToken = "' . sha1(_COOKIE_KEY_ . 'ajaxShopImporter') . '";</script>
		<script type="text/javascript" src="../modules/shopimporter/shopimporter.js"></script>
				<script src="' . _PS_JS_DIR_ . 'jquery/jquery.scrollTo-1.4.2-min.js"></script>
				 <script type="text/javascript">
					var conf = new Array(); ';
        $i = 0;
        foreach ($this->supportedImports as $import) {
            if (!array_key_exists('hidden', $import)) {
                $html .= 'conf[' . $i . '] = new Array(\'' . addslashes($import['methodName']) . '\', \'' . addslashes($import['label']) . '\', \'' . addslashes($import['className']) . '\', \'' . addslashes($import['name']) . '\');';
            }
            $i++;
        }
        $html .= '	var notExist = "' . $this->l('is not available in this module') . '";
					var databaseOk = "' . $this->l('Connection to the database OK') . '";
					var wsOk = "' . $this->l('Connection to the web service OK') . '";
					var showErrors = "' . $this->l('Show errors') . '";
					var testImport = "' . $this->l('Test import process') . '";
					var runImport = "' . $this->l('Run Import') . '";
					var importHasErrors = "' . $this->l('Errors occurred during import. For more details click on "Show errors".') . '"
					var importFinish = "' . $this->l('Import is complete.') . '"
					var truncateTable = "' . $this->l('Remove data') . '"
					var oneThing = "' . $this->l('Please choose one thing to import') . '"
				</script>
				<style>
					.margin-form{padding: 0px 0px 1em 120px;width:300px;}
					label{width: 170px;}
					.import{background-color: #CCCCCC;border: 1px solid gray;margin: 0px 0px 10px;padding: 10px 15px;line-height: 20px;}
				</style>
				<fieldset><legend><img src="' . $this->_path . 'logo.gif" alt="" />' . $this->l('Import from another system') . '</legend>
				<div class="warn" ><img src="../img/admin/warn2.png">
					' . $this->l('Before starting the import please backup your database. ') . '
						<a href="index.php?tab=AdminBackup&token=' . Tools::getAdminToken('AdminBackup' . (int) Tab::getIdFromClassName('AdminBackup') . (int) $this->context->employee->id) . '"">' . $this->l(' Click here to backup') . '</a>
				</div>
				<br>
				<div style="float:right;width:450px" id="steps"></div>';
        if (sizeof($exportModules)) {
            $html .= '
				<label>' . $this->l('Choose your import') . ' : </label>
				<div class="margin-form">
					<select name="import_module_name" id="import_module_name">
						<option value="0">---</option>';
            foreach ($exportModules as $key => $module) {
                ($module->name != $this->name and $module->id) ? $html .= '<option value="' . $module->name . '">' . $module->displayName . '</option>' : '';
            }
            $html .= '</select><input type="submit" class="button" id="choose_module_name" value="' . $this->l('Choose') . '">
				</div>';
        } else {
            $html .= '<div class="warn" ><img src="../img/admin/warn2.png">' . $this->l('No import module installed') . '</div>';
        }
        $html .= '
					<div style="display:none;" class="error" id="connectionInformation"></div>
					<div id="config_connector"></div>
						<div class="margin-form">
						<input type="submit" name="displayOptions" id="displayOptions" class="button" value="' . $this->l('Next Step') . '">
					</div>
					<hr>
					<div style="display:none" id="importOptions">
					<h2>' . $this->l('Import Options') . '</h2>
					<div id="importOptionsYesNo">';
        foreach ($this->supportedImports as $key => $import) {
            if (!array_key_exists('hidden', $import)) {
                $html .= '<label>' . $import['name'] . ' : </label>
									<div class="margin-form">
										<label class="t" for="' . $import['identifier'] . '_on' . '"><img src="../img/admin/enabled.gif" alt="Yes" title="Yes"></label>
										<input type="radio" id="' . $import['identifier'] . '_on' . '" name="' . $import['methodName'] . '" class="' . $key . '" value="1" checked="checked">
										<label class="t" for="' . $import['identifier'] . '_off' . '"><img src="../img/admin/disabled.gif" alt="No" title="No" style="margin-left: 10px;"></label>
										<input type="radio" id="' . $import['identifier'] . '_off' . '" name="' . $import['methodName'] . '" class="' . $key . '" value="0">
										' . (array_key_exists('delete', $import) ? '
										<label class="t"><img src="../img/admin/delete.gif" alt="Delete" title="Delete"></label>
										<input type="checkbox" class="truncateTable" id="' . $key . '" name="delete_' . $import['className'] . '">' : '') . (array_key_exists('hasImage', $import) ? '
										<label class="t"><img src="../img/admin/picture.gif" alt="Images" title="Images"></label>
										<input type="checkbox" class="importImages" id="' . $key . '" name="images_' . $import['className'] . '">' : '') . (array_key_exists('info', $import) ? '<p>' . $import['info'] . '</p>' : '') . '
									</div>';
            }
        }
        $html .= '</div><hr>
					<h2>' . $this->l('Advanced Options') . '</h2>
					<div class="warn" id="warnSkip" style="display:none"><img src="../img/admin/warn2.png">
					' . $this->l('This mode is dangerous') . '
					</div>
					<label>' . $this->l('Import for every') . ' : </label>
							<div class="margin-form">
								<select name="nbr_import" id="nbr_import">
									<option value="10">10</option>
									<option value="50">50</option>
									<option value="100" selected="selected">100</option>
									<option value="200">200</option>
								</select>
								<p>' . $this->l('Select the number of occurrences for each query to import') . '</p>
							</div>
					<label>' . $this->l('If errors occur') . ' : </label>
							<div class="margin-form">
								<label class="t"><img src="' . $this->_path . 'img/stop.png"></label>
								<input type="radio" name="hasErrors" id="hasErrors" value="0" checked="checked">
								<label class="t">' . $this->l('Stop') . '</label>
								<label class="t"><img src="' . $this->_path . 'img/skip.png" style="margin-left: 10px;"></label>
								<input type="radio" name="hasErrors" id="hasErrors" value="1">
								<label class="t">' . $this->l('Skip') . '</label>
								<label class="t"><img src="' . $this->_path . 'img/force.gif" style="margin-left: 10px;"></label>
								<input type="radio" name="hasErrors" id="hasErrors" value="2">
								<label class="t">' . $this->l('Force') . '</label>
								<p>' . $this->l('Stop: if there are errors with the data, import will not run.') . '</p>
								<p>' . $this->l('Skip: if there are errors with the data, import will skip incorrect data.') . '</p>
								<p>' . $this->l('Force: if there are errors with the data, import will replace incorrect data by generic data.') . '</p>
							</div>
							<hr>
							<div style="display:none" id="specificOptions">
							<h2>' . $this->l('Specific Options') . '</h2>
								<div style="display:none" class="error" id="specificOptionsErrors"></div>
								<div id="specificOptionsContent">
								</div>
							</div>
							<hr>
							<div class="margin-form">
							<input type="submit" class="button" name="checkAndSaveConfig" id="checkAndSaveConfig" value="' . $this->l('Next Step') . '">
						</div>
					</div>
				</fieldset>';
        return $html;
    }
Exemplo n.º 3
0
 public function filters()
 {
     $filters = array();
     $filters[] = array(ZurmoBaseController::RIGHTS_FILTER_PATH, 'moduleClassName' => 'ImportModule', 'rightName' => ImportModule::getAccessRight());
     return $filters;
 }