示例#1
0
    /**
     * Display configuration status
     */
    private function _displayStatus()
    {
        global $cookie;
        // Test alert
        $alert = array();
        if (!KialaCountry::getKialaCountries(true)) {
            $alert['registration'] = 1;
        }
        if (!ini_get('allow_url_fopen')) {
            $alert['allowurlfopen'] = 1;
        }
        if (!extension_loaded('curl')) {
            $alert['curl'] = 1;
        }
        if (!is_dir(Configuration::get('KIALA_EXPORT_FOLDER'))) {
            $alert['folder'] = 1;
        }
        if (!Configuration::get('KIALA_REQUEST_SENT')) {
            $alert['request_sent'] = 1;
        }
        // Displaying page
        $this->_html .= '<fieldset>
		<legend><img src="' . $this->_path . 'logo.gif" alt="" /> ' . $this->l('Kiala Module Status') . '</legend>';
        $this->_html .= '<div style="float: left; width: 80%">';
        if (!count($alert)) {
            $this->_html .= '<img src="../modules/kiala/valid.png" /><strong>' . $this->l('Kiala Module is configured and online!') . '</strong>';
            $this->_html .= '<br /><br /><a style="text-decoration:underline" href="index.php?tab=AdminKiala&token=' . Tools::safeOutput(Tools::getAdminToken('AdminKiala' . (int) Tab::getIdFromClassName('AdminKiala') . (int) $cookie->id_employee)) . '">';
            $this->_html .= $this->l('Click here to review and export orders shipped with Kiala') . '</a><br /><br />';
            $this->_html .= '<div class="hint" style="display:block;">' . $this->l('Exported orders can then be imported into the Kiala Pack&Ship software, Keops. It will synchronize your orders with your Kiala account.') . '</div>';
        } else {
            $this->_html .= '<img src="../modules/kiala/warn.png" /><strong>' . $this->l('Kiala Module is not configured yet, you must:') . '</strong>';
            $this->_html .= '<br />' . (isset($alert['registration']) ? '<img src="../modules/kiala/warn.png" />' : '<img src="../modules/kiala/valid.png" />') . ' 1) <a href="' . $this->register_link . '" style="text-decoration:underline">' . $this->l('Register an account with Kiala') . '</a> ' . $this->l(' then configure and activate Kiala delivery for your country (see ') . ' <a href="#country_settings" style="text-decoration:underline">' . $this->l('country settings') . '</a>' . $this->l(')');
            $this->_html .= '<br />' . (isset($alert['allowurlfopen']) ? '<img src="../modules/kiala/warn.png" />' : '<img src="../modules/kiala/valid.png" />') . ' 2) ' . $this->l('Allow url fopen');
            $this->_html .= '<br />' . (isset($alert['curl']) ? '<img src="../modules/kiala/warn.png" />' : '<img src="../modules/kiala/valid.png" />') . ' 3) ' . $this->l('Enable cURL');
            $this->_html .= '<br />' . (isset($alert['folder']) ? '<img src="../modules/kiala/warn.png" />' : '<img src="../modules/kiala/valid.png" />') . ' 4) ' . $this->l('Set a valid export folder');
            if (!$this->processAccountRequestForm()) {
                $errors = '';
                foreach ($this->account_request_form_errors as $error) {
                    $errors .= $error . '<br />';
                }
                $this->_html .= '
					<form method="post" action="' . htmlentities($_SERVER['REQUEST_URI']) . '" style="margin-top: 40px;">';
                if (strlen($errors) > 0) {
                    $this->_html .= $this->displayError($errors);
                }
                $this->_html .= '
						<div style="margin-top: 10px;">
							<label for="lastname">' . $this->l('Lastname:') . '</label><input type="text" value="' . Tools::safeOutput(Tools::getValue('lastname')) . '" name="lastname" id="lastname" />
						</div>
						<div style="margin-top: 10px;">
							<label for="firstname">' . $this->l('Firstname:') . '</label><input type="text" value="' . Tools::safeOutput(Tools::getValue('firstname')) . '" name="firstname" id="firstname" />
						</div>
						<div style="margin-top: 10px;">
							<label for="email">' . $this->l('E-mail:') . '</label><input type="text" value="' . Tools::safeOutput(Tools::getValue('email')) . '" name="email" id="email" />
						</div>
						<div style="margin-top: 10px;">
							<label for="phone">' . $this->l('Phone number:') . '</label><input type="text" value="' . Tools::safeOutput(Tools::getValue('phone')) . '" name="phone" id="phone" />
						</div>
						<div style="margin-top: 10px;">
							<label for="shop_name">' . $this->l('Shop name:') . '</label><input type="text" value="' . Tools::safeOutput(Tools::getValue('shop_name')) . '" name="shop_name" id="shop_name" />
						</div>
						<div style="margin-top: 10px;">
							<label for="packages_per_year">' . $this->l('Number of packages per year:') . '</label><input type="text" value="' . Tools::safeOutput(Tools::getValue('packages_per_year')) . '" name="packages_per_year" id="packages_per_year" />
						</div>
						<div style="margin-top: 10px;">
							<label for="package_weight">' . $this->l('Average weight of a package:') . '</label><input type="text" value="' . Tools::safeOutput(Tools::getValue('package_weight')) . '" name="package_weight" id="package_weight" />
						</div>
						<div style="margin-top: 15px; margin-left: 200px;">
							<input type="submit" name="submit_account_request" value="' . $this->l('Send the request') . '" />
						</div>
					</form>
				';
            } else {
                $this->displayConfirmFormAccountRequest();
            }
        }
        $this->_html .= '</div>';
        $this->_html .= '</fieldset><div class="clear">&nbsp;</div>';
    }