public function administrator()
    {
        global $Modules, $login;
        echo '<h1>';
        echo get_class($this);
        if ($login == 'aboservice') {
            echo '<button type="button" id="delete_module" href="' . tep_href_link('checkout.php', 'module=' . $_GET['module']) . '&action=delete_module" class="btn btn-danger pull-right">' . Translate('Verwijder module') . '</button>';
            echo '<button type="button" id="add_new" class="btn btn-primary pull-right" style="margin-right:5px;">' . Translate('Voeg een veld toe') . '</button>';
        }
        echo '</h1>';
        echo '<hr />';
        if (isset($_POST['action']) && $_POST['action'] == 'save') {
            /********************/
            /*  Save changes    */
            /********************/
            unset($_POST['action']);
            $db_array = array();
            foreach ($_POST as $key => $data) {
                foreach ($data as $id => $value) {
                    $db_array[$id][$key] = $value;
                }
            }
            foreach ($db_array as $id => $data) {
                tep_db_perform('checkout_' . get_class($this), $data, 'update', 'id="' . $id . '"');
            }
            $this->update_config();
        } else {
            if (isset($_POST['action']) && $_POST['action'] == 'create') {
                /********************/
                /*  Create field    */
                /********************/
                unset($_POST['action']);
                tep_db_perform('checkout_' . get_class($this), $_POST, 'insert');
                $this->update_config();
            } else {
                if (isset($_GET['action']) && $_GET['action'] == 'delete') {
                    /********************/
                    /*  Delete field    */
                    /********************/
                    unset($_GET['action']);
                    tep_db_query('DELETE FROM checkout_' . get_class($this) . ' WHERE id = "' . $_GET['id'] . '"');
                    unset($_GET['id']);
                    $this->update_config();
                } else {
                    if (isset($_GET['action']) && $_GET['action'] == 'delete_module') {
                        /********************/
                        /*  Delete module   */
                        /********************/
                        unset($_GET['action']);
                        parent::delete_module(get_class($this));
                    }
                }
            }
        }
        ?>
		<form name="<?php 
        echo get_class($this);
        ?>
" class="form-horizontal"
		      action="<?php 
        echo tep_href_link('checkout.php', 'module=' . $_GET['module']);
        ?>
" method="post">
			<input type="hidden" name="action" value="save"/>
			<table class="table table-striped table-bordered">
				<thead>
				<tr>
					<th><?php 
        echo Translate('Naam');
        ?>
</th>
					<th><?php 
        echo Translate('Type');
        ?>
</th>
					<th><?php 
        echo Translate('Input type');
        ?>
</th>
					<th><?php 
        echo Translate('Status');
        ?>
</th>
					<th><?php 
        echo Translate('Block');
        ?>
</th>
					<th><?php 
        echo Translate('Label');
        ?>
</th>
					<th><?php 
        echo Translate('Database value');
        ?>
</th>
					<th><?php 
        echo Translate('Regular expression');
        ?>
</th>
					<th><?php 
        echo Translate('Functie');
        ?>
</th>
					<th><?php 
        echo Translate('Voorwaarde');
        ?>
</th>
					<th><?php 
        echo Translate('Error');
        ?>
</th>
					<th><?php 
        echo Translate('Volgorde');
        ?>
</th>
					<th><?php 
        echo Translate('Verwijderen');
        ?>
</th>
				</tr>
				</thead>
				<tbody>
				<?php 
        $db_query = tep_db_query('SELECT * FROM checkout_' . get_class($this) . ' ORDER BY block asc, sort_order asc');
        while ($db = tep_db_fetch_array($db_query)) {
            ?>
					<tr<?php 
            echo $db['value'] == 'false' ? ' class="inactive"' : '';
            ?>
>
						<td><input type="text" name="name[<?php 
            echo $db['id'];
            ?>
]" value="<?php 
            echo $db['name'];
            ?>
"
						           class="input-large"/></td>
						<td>
							<select name="type[<?php 
            echo $db['id'];
            ?>
]" class="input-medium">
								<option
									value="config"<?php 
            echo $db['type'] == 'config' ? ' selected="selected"' : '';
            ?>
><?php 
            echo Translate('configuratie');
            ?>
</option>
								<option
									value="field"<?php 
            echo $db['type'] == 'field' ? ' selected="selected"' : '';
            ?>
><?php 
            echo Translate('Veld');
            ?>
</option>
								<option
									value="dropdown"<?php 
            echo $db['type'] == 'dropdown' ? ' selected="selected"' : '';
            ?>
><?php 
            echo Translate('Dropdown');
            ?>
</option>
							</select>
						</td>
						<td>
							<select name="input[<?php 
            echo $db['id'];
            ?>
]" class="input-medium">
								<option value=""><?php 
            echo Translate('Niet van toepassing');
            ?>
</option>
								<option
									value="text"<?php 
            echo $db['input'] == 'text' ? ' selected="selected"' : '';
            ?>
><?php 
            echo Translate('Tekst');
            ?>
</option>
								<option
									value="email"<?php 
            echo $db['input'] == 'email' ? ' selected="selected"' : '';
            ?>
><?php 
            echo Translate('E-mail');
            ?>
</option>
								<option
									value="tel"<?php 
            echo $db['input'] == 'tel' ? ' selected="selected"' : '';
            ?>
><?php 
            echo Translate('Telefoon');
            ?>
</option>
							</select>
						</td>
						<td>
							<select name="value[<?php 
            echo $db['id'];
            ?>
]" class="input-small">
								<option
									value="true"<?php 
            echo $db['value'] == 'true' ? ' selected="selected"' : '';
            ?>
><?php 
            echo Translate('Actief');
            ?>
</option>
								<option
									value="false"<?php 
            echo $db['value'] == 'false' ? ' selected="selected"' : '';
            ?>
><?php 
            echo Translate('Niet Actief');
            ?>
</option>
							</select>
						</td>
						<td>
							<select name="block[<?php 
            echo $db['id'];
            ?>
]" class="input-medium">
								<option value=""><?php 
            echo Translate('Niet van toepassing');
            ?>
</option>
								<option
									value="delivery"<?php 
            echo $db['block'] == 'delivery' ? ' selected="selected"' : '';
            ?>
><?php 
            echo Translate('Leveringsadres');
            ?>
</option>
								<option
									value="billing"<?php 
            echo $db['block'] == 'billing' ? ' selected="selected"' : '';
            ?>
><?php 
            echo Translate('Facturatieadres');
            ?>
</option>
							</select>
						</td>
						<td><input type="text" name="label[<?php 
            echo $db['id'];
            ?>
]"
						           value="<?php 
            echo $db['label'];
            ?>
" class="input-medium"/></td>
						<td>
							<select name="dbvalue[<?php 
            echo $db['id'];
            ?>
]" class="input-large">
								<option value=""><?php 
            echo Translate('Niet van toepassing');
            ?>
</option>
								<?php 
            $dbvalues_array = array();
            $dbvalues_query = tep_db_query('SHOW COLUMNS FROM address_book');
            while ($dbvalues = tep_db_fetch_array($dbvalues_query)) {
                $dbvalues_array[] = $dbvalues['Field'];
            }
            $dbvalues_query = tep_db_query('SHOW COLUMNS FROM temp_orders');
            while ($dbvalues = tep_db_fetch_array($dbvalues_query)) {
                $dbvalues_array[] = $dbvalues['Field'];
            }
            $dbvalues_array = array_unique($dbvalues_array);
            foreach ($dbvalues_array as $dbvalues) {
                ?>
									<option
										value="<?php 
                echo $dbvalues;
                ?>
"<?php 
                echo $db['dbvalue'] == $dbvalues ? ' selected="selected"' : '';
                ?>
><?php 
                echo $dbvalues;
                ?>
</option>
								<?php 
            }
            ?>
							</select>
						</td>
						<td><input type="text" name="expression[<?php 
            echo $db['id'];
            ?>
]"
						           value="<?php 
            echo stripslashes($db['expression']);
            ?>
" class="input-large"/></td>
						<td><input type="text" name="function[<?php 
            echo $db['id'];
            ?>
]"
						           value="<?php 
            echo stripslashes($db['function']);
            ?>
" class="input-medium"/></td>
						<td><input type="text" name="condition[<?php 
            echo $db['id'];
            ?>
]"
						           value="<?php 
            echo stripslashes($db['condition']);
            ?>
" class="input-xlarge"/></td>
						<td><input type="text" name="error[<?php 
            echo $db['id'];
            ?>
]"
						           value="<?php 
            echo stripslashes($db['error']);
            ?>
" class="input-xlarge"/></td>
						<td><input type="number" name="sort_order[<?php 
            echo $db['id'];
            ?>
]"
						           value="<?php 
            echo stripslashes($db['sort_order']);
            ?>
" class="input-mini"/></td>
						<td><a href="<?php 
            echo tep_href_link('checkout.php', 'module=' . $_GET['module'] . '&action=delete&id=' . $db['id']);
            ?>
"
						       class="btn btn-danger"><?php 
            echo Translate('Verwijderen');
            ?>
</a></td>
					</tr>
				<?php 
        }
        ?>
				</tbody>
			</table>
			<div class="form-actions">
				<button class="btn btn-primary" type="submit"><?php 
        echo Translate('Opslaan');
        ?>
</button>
				<button class="btn" type="reset"><?php 
        echo Translate('Annuleren');
        ?>
</button>
			</div>
		</form>
		<div id="new_instance" style="display:none;">
			<form name="<?php 
        echo get_class($this);
        ?>
" class="form-horizontal well"
			      action="<?php 
        echo tep_href_link('checkout.php', 'module=' . $_GET['module']);
        ?>
" method="post">
				<input type="hidden" name="action" value="create"/>

				<div class="control-group">
					<label class="control-label" for="name"><?php 
        echo Translate('Naam');
        ?>
</label>

					<div class="controls">
						<input type="text" name="name" value="" class="input-xlarge" id="name"/>
					</div>
				</div>
				<div class="control-group">
					<label class="control-label" for="type"><?php 
        echo Translate('Type');
        ?>
</label>

					<div class="controls">
						<select name="type" class="input-xlarge" id="type">
							<option value="config"><?php 
        echo Translate('configuratie');
        ?>
</option>
							<option value="field"><?php 
        echo Translate('Veld');
        ?>
</option>
							<option value="dropdown"><?php 
        echo Translate('Dropdown');
        ?>
</option>
						</select>
					</div>
				</div>
				<div class="control-group">
					<label class="control-label" for="input"><?php 
        echo Translate('Input type');
        ?>
</label>

					<div class="controls">
						<select name="input" class="input-xlarge" id="input">
							<option value=""><?php 
        echo Translate('Niet van toepassing');
        ?>
</option>
							<option value="text"><?php 
        echo Translate('Tekst');
        ?>
</option>
							<option value="email"><?php 
        echo Translate('E-mail');
        ?>
</option>
							<option value="tel"><?php 
        echo Translate('Telefoon');
        ?>
</option>
						</select>
					</div>
				</div>
				<div class="control-group">
					<label class="control-label" for="value"><?php 
        echo Translate('Status');
        ?>
</label>

					<div class="controls">
						<select name="value" class="input-xlarge" id="value">
							<option value="true"><?php 
        echo Translate('Actief');
        ?>
</option>
							<option value="false"><?php 
        echo Translate('Niet Actief');
        ?>
</option>
						</select>
					</div>
				</div>
				<div class="control-group">
					<label class="control-label" for="block"><?php 
        echo Translate('Block');
        ?>
</label>

					<div class="controls">
						<select name="block" class="input-xlarge" id="block">
							<option value=""><?php 
        echo Translate('Niet van toepassing');
        ?>
</option>
							<option value="delivery"><?php 
        echo Translate('Leveringsadres');
        ?>
</option>
							<option value="billing"><?php 
        echo Translate('Facturatieadres');
        ?>
</option>
						</select>
					</div>
				</div>
				<div class="control-group">
					<label class="control-label" for="label"><?php 
        echo Translate('Label');
        ?>
</label>

					<div class="controls">
						<input type="text" name="label" value="" class="input-xlarge" id="label"/>
					</div>
				</div>
				<div class="control-group">
					<label class="control-label" for="dbvalue"><?php 
        echo Translate('Database value');
        ?>
</label>

					<div class="controls">
						<select name="dbvalue" class="input-xlarge" id="dbvalue">
							<option value=""><?php 
        echo Translate('Niet van toepassing');
        ?>
</option>
							<?php 
        $dbvalues_array = array();
        $dbvalues_query = tep_db_query('SHOW COLUMNS FROM address_book');
        while ($dbvalues = tep_db_fetch_array($dbvalues_query)) {
            $dbvalues_array[] = $dbvalues['Field'];
        }
        $dbvalues_query = tep_db_query('SHOW COLUMNS FROM temp_orders');
        while ($dbvalues = tep_db_fetch_array($dbvalues_query)) {
            $dbvalues_array[] = $dbvalues['Field'];
        }
        $dbvalues_array = array_unique($dbvalues_array);
        foreach ($dbvalues_array as $dbvalues) {
            ?>
								<option value="<?php 
            echo $dbvalues;
            ?>
"><?php 
            echo $dbvalues;
            ?>
</option>
							<?php 
        }
        ?>
						</select>
					</div>
				</div>
				<div class="control-group">
					<label class="control-label" for="expression"><?php 
        echo Translate('Regular expression');
        ?>
</label>

					<div class="controls">
						<input type="text" name="expression" value="" class="input-xlarge" id="expression"/>
					</div>
				</div>
				<div class="control-group">
					<label class="control-label" for="function"><?php 
        echo Translate('Functie');
        ?>
</label>

					<div class="controls">
						<input type="text" name="function" value="" class="input-xlarge" id="function"/>
					</div>
				</div>
				<div class="control-group">
					<label class="control-label" for="condition"><?php 
        echo Translate('Voorwaarde');
        ?>
</label>

					<div class="controls">
						<input type="text" name="condition" value="" class="input-xlarge" id="condition"/>
					</div>
				</div>
				<div class="control-group">
					<label class="control-label" for="error"><?php 
        echo Translate('Error');
        ?>
</label>

					<div class="controls">
						<input type="text" name="error" value="" class="input-xlarge" id="error"/>
					</div>
				</div>
				<div class="control-group">
					<label class="control-label" for="sort_order"><?php 
        echo Translate('Volgorde');
        ?>
</label>

					<div class="controls">
						<input type="text" name="sort_order" value="" class="input-xlarge" id="sort_order"/>
					</div>
				</div>
				<div class="form-actions">
					<button class="btn btn-primary" type="submit"><?php 
        echo Translate('Opslaan');
        ?>
</button>
					<button class="btn" type="reset"><?php 
        echo Translate('Annuleren');
        ?>
</button>
				</div>
			</form>
		</div>
	<?php 
    }
示例#2
0
    public function administrator()
    {
        global $Modules, $login;
        echo '<h1>';
        echo get_class($this);
        if ($login == 'aboservice') {
            echo '<button type="button" id="delete_module" href="' . tep_href_link('checkout.php', 'module=' . $_GET['module']) . '&action=delete_module" class="btn btn-danger pull-right">' . Translate('Verwijder module') . '</button>';
        }
        echo '<button type="button" id="add_new" class="btn btn-primary pull-right" style="margin-right:5px;">' . Translate('Voeg een instantie toe') . '</button>';
        echo '</h1>';
        echo '<hr />';
        if (isset($_POST['action']) && $_POST['action'] == 'save') {
            if (isset($_POST['delete'])) {
                /********************/
                /*	Delete instance	*/
                /********************/
                tep_db_query('DELETE FROM checkout_' . get_class($this) . ' WHERE id = "' . $_POST['delete'] . '"');
            } else {
                /********************/
                /*	Save changes	*/
                /********************/
                $instances = array();
                unset($_POST['action']);
                foreach ($_POST as $key => $data) {
                    foreach ($data as $id => $value) {
                        if ($key == 'zone') {
                            if (isset($value['*'])) {
                                $instances[$id][$key] = '*';
                            } else {
                                $instances[$id][$key] = implode(';', $value);
                            }
                        } else {
                            $instances[$id][$key] = $value;
                        }
                    }
                }
                foreach ($instances as $id => $data) {
                    if (isset($this->instances[get_class($this) . '_' . $id])) {
                        tep_db_perform('checkout_' . get_class($this), $data, 'update', 'id="' . $id . '"');
                    } else {
                        $data['id'] = $id;
                        tep_db_perform('checkout_' . get_class($this), $data, 'insert');
                    }
                }
            }
            $this->update_instances();
        } else {
            if (isset($_GET['action']) && $_GET['action'] == 'delete_module') {
                /********************/
                /*	Delete module	*/
                /********************/
                unset($_GET['action']);
                parent::delete_module(get_class($this));
            }
        }
        foreach ($this->instances as $instance => $instance_data) {
            ?>
		<form name="<?php 
            echo $instance;
            ?>
" class="form-horizontal well" action="<?php 
            echo tep_href_link('checkout.php', 'module=' . $_GET['module']);
            ?>
" method="post">
			<input type="hidden" name="action" value="save" />
			<fieldset>
			<legend>
				<?php 
            echo $instance;
            ?>
				<button class="btn btn-danger pull-right" type="submit" name="delete" value="<?php 
            echo $instance_data['id'];
            ?>
"><?php 
            echo Translate('Verwijderen');
            ?>
</button>
			</legend>
			<div class="control-group">
				<label class="control-label" for="<?php 
            echo $instance;
            ?>
_title"><?php 
            echo Translate('Titel');
            ?>
</label>
				<div class="controls">
					<input type="text" name="title[<?php 
            echo $instance_data['id'];
            ?>
]" value="<?php 
            echo $instance_data['title'];
            ?>
" class="input-xlarge" id="<?php 
            echo $instance;
            ?>
_title" />
				</div>
			</div>
			<div class="control-group">
				<label class="control-label" for="<?php 
            echo $instance;
            ?>
_status"><?php 
            echo Translate('Status');
            ?>
</label>
				<div class="controls">
					<div class="btn-group" data-toggle="buttons-radio">
						<button type="submit" name="status[<?php 
            echo $instance_data['id'];
            ?>
]" value="true" class="btn<?php 
            echo $instance_data['status'] == 'true' ? ' active' : '';
            ?>
"><?php 
            echo Translate('Actief');
            ?>
</button>
						<button type="submit" name="status[<?php 
            echo $instance_data['id'];
            ?>
]" value="false" class="btn<?php 
            echo $instance_data['status'] == 'false' ? ' active' : '';
            ?>
"><?php 
            echo Translate('Niet actief');
            ?>
</button>
					</div>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label" for="<?php 
            echo $instance;
            ?>
_description"><?php 
            echo Translate('Omschrijving');
            ?>
</label>
				<div class="controls">
					<input type="text" name="description[<?php 
            echo $instance_data['id'];
            ?>
]" value="<?php 
            echo $instance_data['description'];
            ?>
" class="input-xxlarge" id="<?php 
            echo $instance;
            ?>
_description" />
					<span class="help-block"><?php 
            echo Translate('Omschrijving gebruikt in de checkout, samen met de titel');
            ?>
</span>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label" for="<?php 
            echo $instance;
            ?>
_order_status_id"><?php 
            echo Translate('Bestel status');
            ?>
</label>
				<div class="controls">
					<select name="order_status_id[<?php 
            echo $instance_data['id'];
            ?>
]" class="input-xlarge" id="<?php 
            echo $instance;
            ?>
_order_status_id">
						<?php 
            $statusses = parent::get_order_statusses();
            foreach ($statusses as $id => $name) {
                echo '<option value="' . $id . '"' . ($instance_data['order_status_id'] == $id ? ' selected="selected"' : '') . '>' . $name . '</option>';
            }
            ?>
					</select>
					<span class="help-block"><?php 
            echo Translate('De status na het plaatsen van de bestelling met deze methode.');
            ?>
</span>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label"><?php 
            echo Translate('Zone');
            ?>
</label>
				<div class="controls">
					<label class="checkbox inline"><?php 
            echo Translate('All');
            ?>
					<input type="checkbox" name="zone[<?php 
            echo $instance_data['id'];
            ?>
][*]" value="*" <?php 
            echo $instance_data['zone'] == '*' ? ' checked="checked"' : '';
            ?>
 />
					</label>
					<?php 
            $selected_zones = explode(';', $instance_data['zone']);
            $zones = parent::get_all_zones();
            foreach ($zones as $zone_id => $zone_name) {
                echo '<label class="checkbox inline">' . $zone_name;
                echo '<input type="checkbox" name="zone[' . $instance_data['id'] . '][' . $zone_id . ']" value="' . $zone_id . '"' . (in_array($zone_id, $selected_zones) ? ' checked="checked"' : '') . ' />';
                echo '</label>';
            }
            ?>
					<span class="help-block"><?php 
            echo Translate('Voor welke zone is deze methode actief');
            ?>
</span>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label" for="<?php 
            echo $instance;
            ?>
_quote"><?php 
            echo Translate('Verzendkost');
            ?>
</label>
				<div class="controls">
					<input type="text" name="quote[<?php 
            echo $instance_data['id'];
            ?>
]" value="<?php 
            echo $instance_data['quote'];
            ?>
" class="input-xlarge" id="<?php 
            echo $instance;
            ?>
_quote" />
				</div>
			</div>
			<div class="control-group">
				<label class="control-label" for="<?php 
            echo $instance;
            ?>
_sort_order"><?php 
            echo Translate('Volgorde');
            ?>
</label>
				<div class="controls">
					<input type="text" name="sort_order[<?php 
            echo $instance_data['id'];
            ?>
]" value="<?php 
            echo $instance_data['sort_order'];
            ?>
" class="input-xlarge" id="<?php 
            echo $instance;
            ?>
_sort_order" />
					<span class="help-block"><?php 
            echo Translate('Volgorde waarin de instanties worden getoond in de checkout.');
            ?>
</span>
				</div>
			</div>
			<div class="form-actions">
				<button class="btn btn-primary" type="submit"><?php 
            echo Translate('Opslaan');
            ?>
</button>
				<button class="btn" type="reset"><?php 
            echo Translate('Annuleren');
            ?>
</button>
			</div>
			</fieldset>
		</form>
		<?php 
        }
        end($this->instances);
        $new_id = end(explode('_', key($this->instances))) + 1;
        ?>
		<div id="new_instance" style="display:none;">
		<form name="<?php 
        echo get_class($this) . '_' . $new_id;
        ?>
" class="form-horizontal well" action="<?php 
        echo tep_href_link('checkout.php', 'module=' . $_GET['module']);
        ?>
" method="post">
			<input type="hidden" name="action" value="save" />
			<fieldset>
			<legend>
				<?php 
        echo get_class($this) . '_' . $new_id;
        ?>
			</legend>
			<div class="control-group">
				<label class="control-label" for="<?php 
        echo get_class($this) . '_' . $new_id;
        ?>
_title"><?php 
        echo Translate('Titel');
        ?>
</label>
				<div class="controls">
					<input type="text" name="title[<?php 
        echo $new_id;
        ?>
]" value="" class="input-xlarge" id="<?php 
        echo get_class($this) . '_' . $new_id;
        ?>
_title" />
				</div>
			</div>
			<input type="hidden" name="status[<?php 
        echo $new_id;
        ?>
]" value="false" />
			<div class="control-group">
				<label class="control-label" for="<?php 
        echo get_class($this) . '_' . $new_id;
        ?>
_description"><?php 
        echo Translate('Omschrijving');
        ?>
</label>
				<div class="controls">
					<input type="text" name="description[<?php 
        echo $new_id;
        ?>
]" value="" class="input-xxlarge" id="<?php 
        echo get_class($this) . '_' . $new_id;
        ?>
_description" />
					<span class="help-block"><?php 
        echo Translate('Omschrijving gebruikt in de checkout, samen met de titel');
        ?>
</span>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label" for="<?php 
        echo get_class($this) . '_' . $new_id;
        ?>
_order_status_id"><?php 
        echo Translate('Bestel status');
        ?>
</label>
				<div class="controls">
					<select name="order_status_id[<?php 
        echo $new_id;
        ?>
]" class="input-xlarge" id="<?php 
        echo get_class($this) . '_' . $new_id;
        ?>
_order_status_id">
						<?php 
        $statusses = parent::get_order_statusses();
        foreach ($statusses as $id => $name) {
            echo '<option value="' . $id . '">' . $name . '</option>';
        }
        ?>
					</select>
					<span class="help-block"><?php 
        echo Translate('De status na het plaatsen van de bestelling met deze methode.');
        ?>
</span>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label"><?php 
        echo Translate('Zone');
        ?>
</label>
				<div class="controls">
					<label class="checkbox inline"><?php 
        echo Translate('All');
        ?>
					<input type="checkbox" name="zone[<?php 
        echo $new_id;
        ?>
][*]" value="*" />
					</label>
					<?php 
        $zones = parent::get_all_zones();
        foreach ($zones as $zone_id => $zone_name) {
            echo '<label class="checkbox inline">' . $zone_name;
            echo '<input type="checkbox" name="zone[' . $new_id . '][' . $zone_id . ']" value="' . $zone_id . '" />';
            echo '</label>';
        }
        ?>
					<span class="help-block"><?php 
        echo Translate('Voor welke zone is deze methode actief');
        ?>
</span>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label" for="<?php 
        echo get_class($this) . '_' . $new_id;
        ?>
_quote"><?php 
        echo Translate('Verzendkost');
        ?>
</label>
				<div class="controls">
					<input type="text" name="quote[<?php 
        echo $new_id;
        ?>
]" value="" class="input-xlarge" id="<?php 
        echo get_class($this) . '_' . $new_id;
        ?>
_quote" />
				</div>
			</div>
			<div class="control-group">
				<label class="control-label" for="<?php 
        echo get_class($this) . '_' . $new_id;
        ?>
_sort_order"><?php 
        echo Translate('Volgorde');
        ?>
</label>
				<div class="controls">
					<input type="text" name="sort_order[<?php 
        echo $new_id;
        ?>
]" value="" class="input-xlarge" id="<?php 
        echo get_class($this) . '_' . $new_id;
        ?>
_sort_order" />
					<span class="help-block"><?php 
        echo Translate('Volgorde waarin de instanties worden getoond in de checkout.');
        ?>
</span>
				</div>
			</div>
			<div class="form-actions">
				<button class="btn btn-primary" type="submit"><?php 
        echo Translate('Opslaan');
        ?>
</button>
				<button class="btn" type="reset"><?php 
        echo Translate('Annuleren');
        ?>
</button>
			</div>
			</fieldset>
		</form>
		</div>
		<?php 
    }
示例#3
0
    public function administrator()
    {
        global $Modules, $login;
        echo '<h1>';
        echo get_class($this);
        if ($login == 'aboservice') {
            echo '<button type="button" id="delete_module" href="' . tep_href_link('checkout.php', 'module=' . $_GET['module']) . '&action=delete_module" class="btn btn-danger pull-right">' . Translate('Verwijder module') . '</button>';
        }
        echo '</h1>';
        echo '<hr />';
        if (isset($_POST['action']) && $_POST['action'] == 'save') {
            /********************/
            /*	Save changes	*/
            /********************/
            unset($_POST['action']);
            foreach ($_POST as $key => $data) {
                if ($key == 'zone') {
                    if (isset($data['*'])) {
                        $_POST[$key] = '*';
                    } else {
                        $_POST[$key] = implode(';', $data);
                    }
                }
            }
            tep_db_perform('checkout_' . get_class($this), $_POST, 'update', 'id="1"');
            $this->update_config();
        } else {
            if (isset($_GET['action']) && $_GET['action'] == 'delete_module') {
                /********************/
                /*	Delete module	*/
                /********************/
                unset($_GET['action']);
                parent::delete_module(get_class($this));
            }
        }
        ?>
		<form name="<?php 
        echo get_class($this);
        ?>
" class="form-horizontal well" action="<?php 
        echo tep_href_link('checkout.php', 'module=' . $_GET['module']);
        ?>
" method="post">
			<input type="hidden" name="action" value="save" />
			<fieldset>
			<div class="control-group">
				<label class="control-label" for="title"><?php 
        echo Translate('Titel');
        ?>
</label>
				<div class="controls">
					<input type="text" name="title" value="<?php 
        echo $this->config['title'];
        ?>
" class="input-xlarge" id="title" />
				</div>
			</div>
			<div class="control-group">
				<label class="control-label" for="status"><?php 
        echo Translate('Status');
        ?>
</label>
				<div class="controls">
					<div class="btn-group" data-toggle="buttons-radio">
						<button type="submit" name="status" value="true" class="btn<?php 
        echo $this->config['status'] == 'true' ? ' active' : '';
        ?>
"><?php 
        echo Translate('Actief');
        ?>
</button>
						<button type="submit" name="status" value="false" class="btn<?php 
        echo $this->config['status'] == 'false' ? ' active' : '';
        ?>
"><?php 
        echo Translate('Niet actief');
        ?>
</button>
					</div>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label" for="description"><?php 
        echo Translate('Omschrijving');
        ?>
</label>
				<div class="controls">
					<input type="text" name="description" value="<?php 
        echo $this->config['description'];
        ?>
" class="input-xxlarge" id="description" />
					<span class="help-block"><?php 
        echo Translate('Omschrijving gebruikt in de checkout, samen met de titel');
        ?>
</span>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label" for="shipping_cost"><?php 
        echo Translate('Verzendkost');
        ?>
</label>
				<div class="controls">
					<input type="text" name="shipping_cost" value="<?php 
        echo $this->config['shipping_cost'];
        ?>
" class="input-xlarge" id="shipping_cost" />
				</div>
			</div>
			<div class="control-group">
				<label class="control-label" for="dspid"><?php 
        echo Translate('DSPID');
        ?>
</label>
				<div class="controls">
					<input type="text" name="dspid" value="<?php 
        echo $this->config['dspid'];
        ?>
" class="input-xlarge" id="dspid" />
				</div>
			</div>
			<div class="control-group">
				<label class="control-label" for="min_amount"><?php 
        echo Translate('Minimum bedrag');
        ?>
</label>
				<div class="controls">
					<input type="text" name="min_amount" value="<?php 
        echo $this->config['min_amount'];
        ?>
" class="input-xlarge" id="min_amount" />
					<span class="help-block"><?php 
        echo Translate('Minimum bedrag van de bestelling voor deze methode gebruikt kan worden');
        ?>
</span>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label" for="max_weight"><?php 
        echo Translate('Maximum gewicht');
        ?>
</label>
				<div class="controls">
					<input type="text" name="max_weight" value="<?php 
        echo $this->config['max_weight'];
        ?>
" class="input-xlarge" id="max_weight" />
					<span class="help-block"><?php 
        echo Translate('Het maximum gewicht die de bestelling mag hebben voor het gebruik van deze methode');
        ?>
</span>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label" for="free_shipping_over"><?php 
        echo Translate('Gratis verzending vanaf');
        ?>
</label>
				<div class="controls">
					<input type="text" name="free_shipping_over" value="<?php 
        echo $this->config['free_shipping_over'];
        ?>
" class="input-xlarge" id="free_shipping_over" />&euro;
					<span class="help-block"><?php 
        echo Translate('Verzending wordt gratis bij een totaal bestelbedrag boven dit bedrag');
        ?>
</span>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label" for="sort_order"><?php 
        echo Translate('Volgorde');
        ?>
</label>
				<div class="controls">
					<input type="text" name="sort_order" value="<?php 
        echo $this->config['sort_order'];
        ?>
" class="input-xlarge" id="sort_order" />
				</div>
			</div>
			<div class="form-actions">
				<button class="btn btn-primary" type="submit"><?php 
        echo Translate('Opslaan');
        ?>
</button>
				<button class="btn" type="reset"><?php 
        echo Translate('Annuleren');
        ?>
</button>
			</div>
			</fieldset>
		</form>
		<?php 
    }
    public function administrator()
    {
        global $Modules, $login;
        echo '<h1>';
        echo get_class($this);
        if ($login == 'aboservice') {
            echo '<button type="button" id="delete_module" href="' . tep_href_link('checkout.php', 'module=' . $_GET['module']) . '&action=delete_module" class="btn btn-danger pull-right">' . Translate('Verwijder module') . '</button>';
        }
        echo '</h1>';
        echo '<hr />';
        if (isset($_POST['action']) && $_POST['action'] == 'save') {
            /********************/
            /*	Save changes	*/
            /********************/
            unset($_POST['action']);
            foreach ($_POST as $key => $data) {
                if ($key == 'zone') {
                    if (isset($data['*'])) {
                        $_POST[$key] = '*';
                    } else {
                        $_POST[$key] = implode(';', $data);
                    }
                }
            }
            tep_db_perform('checkout_' . get_class($this), $_POST, 'update', 'id="1"');
            $this->update_config();
        } else {
            if (isset($_GET['action']) && $_GET['action'] == 'delete_module') {
                /********************/
                /*	Delete module	*/
                /********************/
                unset($_GET['action']);
                parent::delete_module(get_class($this));
            }
        }
        ?>
		<form name="<?php 
        echo get_class($this);
        ?>
" class="form-horizontal well" action="<?php 
        echo tep_href_link('checkout.php', 'module=' . $_GET['module']);
        ?>
" method="post">
			<input type="hidden" name="action" value="save" />
			<fieldset>
			<div class="control-group">
				<label class="control-label" for="title"><?php 
        echo Translate('Titel');
        ?>
</label>
				<div class="controls">
					<input type="text" name="title" value="<?php 
        echo $this->config['title'];
        ?>
" class="input-xlarge" id="title" />
				</div>
			</div>
			<div class="control-group">
				<label class="control-label" for="status"><?php 
        echo Translate('Status');
        ?>
</label>
				<div class="controls">
					<div class="btn-group" data-toggle="buttons-radio">
						<button type="submit" name="status" value="true" class="btn<?php 
        echo $this->config['status'] == 'true' ? ' active' : '';
        ?>
"><?php 
        echo Translate('Actief');
        ?>
</button>
						<button type="submit" name="status" value="false" class="btn<?php 
        echo $this->config['status'] == 'false' ? ' active' : '';
        ?>
"><?php 
        echo Translate('Niet actief');
        ?>
</button>
					</div>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label" for="description"><?php 
        echo Translate('Omschrijving');
        ?>
</label>
				<div class="controls">
					<input type="text" name="description" value="<?php 
        echo $this->config['description'];
        ?>
" class="input-xxlarge" id="description" />
					<span class="help-block"><?php 
        echo Translate('Omschrijving gebruikt in de checkout, samen met de titel');
        ?>
</span>
				</div>
			</div>
			<div class="form-actions">
				<button class="btn btn-primary" type="submit"><?php 
        echo Translate('Opslaan');
        ?>
</button>
				<button class="btn" type="reset"><?php 
        echo Translate('Annuleren');
        ?>
</button>
			</div>
			</fieldset>
		</form>
		<?php 
    }
示例#5
0
    public function administrator()
    {
        global $Modules, $login;
        echo '<h1>';
        echo get_class($this);
        if ($login == 'aboservice') {
            echo '<button type="button" id="delete_module" href="' . tep_href_link('checkout.php', 'module=' . $_GET['module']) . '&action=delete_module" class="btn btn-danger pull-right">' . Translate('Verwijder module') . '</button>';
            echo '<button type="button" id="add_new" class="btn btn-primary pull-right" style="margin-right:5px;">' . Translate('Voeg een instantie toe') . '</button>';
        }
        echo '</h1>';
        echo '<hr />';
        if (isset($_POST['action']) && $_POST['action'] == 'save') {
            if (isset($_POST['delete'])) {
                /********************/
                /*	Delete instance	*/
                /********************/
                tep_db_query('DELETE FROM checkout_' . get_class($this) . ' WHERE id = "' . $_POST['delete'] . '"');
            } else {
                /********************/
                /*	Save changes	*/
                /********************/
                $instances = array();
                unset($_POST['action']);
                if (!isset($_POST['method_images'])) {
                    foreach ($this->instances as $key => $data) {
                        $_POST['method_images'][$data['id']] = array();
                    }
                }
                foreach ($_POST as $key => $data) {
                    foreach ($data as $id => $value) {
                        if ($key == 'zone' || $key == 'shipping_module') {
                            if (isset($value['*'])) {
                                $instances[$id][$key] = '*';
                            } else {
                                $instances[$id][$key] = implode(';', $value);
                            }
                        } else {
                            if ($key == 'method_images') {
                                $instances[$id][$key] = implode(';', $value);
                            } else {
                                $instances[$id][$key] = $value;
                            }
                        }
                    }
                }
                foreach ($instances as $id => $data) {
                    if (isset($this->instances[get_class($this) . '_' . $id])) {
                        tep_db_perform('checkout_' . get_class($this), $data, 'update', 'id="' . $id . '"');
                    } else {
                        $data['id'] = $id;
                        tep_db_perform('checkout_' . get_class($this), $data, 'insert');
                    }
                }
            }
            $this->update_instances();
        } else {
            if (isset($_GET['action']) && $_GET['action'] == 'delete_module') {
                /********************/
                /*	Delete module	*/
                /********************/
                unset($_GET['action']);
                parent::delete_module(get_class($this));
            }
        }
        foreach ($this->instances as $instance => $instance_data) {
            ?>
		<form name="<?php 
            echo $instance;
            ?>
" class="form-horizontal well" action="<?php 
            echo tep_href_link('checkout.php', 'module=' . $_GET['module']);
            ?>
" method="post">
			<input type="hidden" name="action" value="save" />
			<fieldset>
			<legend>
				<?php 
            echo $instance;
            ?>
				<button class="btn btn-danger pull-right" type="submit" name="delete" value="<?php 
            echo $instance_data['id'];
            ?>
"><?php 
            echo Translate('Verwijderen');
            ?>
</button>
			</legend>
			<div class="control-group">
				<label class="control-label" for="<?php 
            echo $instance;
            ?>
_title"><?php 
            echo Translate('Titel');
            ?>
</label>
				<div class="controls">
					<input type="text" name="title[<?php 
            echo $instance_data['id'];
            ?>
]" value="<?php 
            echo $instance_data['title'];
            ?>
" class="input-xlarge" id="<?php 
            echo $instance;
            ?>
_title" />
				</div>
			</div>
			<div class="control-group">
				<label class="control-label" for="<?php 
            echo $instance;
            ?>
_status"><?php 
            echo Translate('Status');
            ?>
</label>
				<div class="controls">
					<div class="btn-group" data-toggle="buttons-radio">
						<button type="submit" name="status[<?php 
            echo $instance_data['id'];
            ?>
]" value="true" class="btn<?php 
            echo $instance_data['status'] == 'true' ? ' active' : '';
            ?>
"><?php 
            echo Translate('Actief');
            ?>
</button>
						<button type="submit" name="status[<?php 
            echo $instance_data['id'];
            ?>
]" value="false" class="btn<?php 
            echo $instance_data['status'] == 'false' ? ' active' : '';
            ?>
"><?php 
            echo Translate('Niet actief');
            ?>
</button>
					</div>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label" for="<?php 
            echo $instance;
            ?>
_pspid"><?php 
            echo Translate('PSP ID');
            ?>
</label>
				<div class="controls">
					<input type="text" name="pspid[<?php 
            echo $instance_data['id'];
            ?>
]" value="<?php 
            echo $instance_data['pspid'];
            ?>
" class="input-xlarge" id="<?php 
            echo $instance;
            ?>
_pspid" />
				</div>
			</div>
			<div class="control-group">
				<label class="control-label" for="<?php 
            echo $instance;
            ?>
_sha_string"><?php 
            echo Translate('SHA String');
            ?>
</label>
				<div class="controls">
					<input type="text" name="sha_string[<?php 
            echo $instance_data['id'];
            ?>
]" value="<?php 
            echo $instance_data['sha_string'];
            ?>
" class="input-xlarge" id="<?php 
            echo $instance;
            ?>
_sha_string" />
				</div>
			</div>
			<div class="control-group">
				<label class="control-label" for="<?php 
            echo $instance;
            ?>
_mode"><?php 
            echo Translate('Mode');
            ?>
</label>
				<div class="controls">
					<div class="btn-group" data-toggle="buttons-radio">
						<button type="submit" name="mode[<?php 
            echo $instance_data['id'];
            ?>
]" value="test" class="btn<?php 
            echo $instance_data['mode'] == 'test' ? ' active' : '';
            ?>
"><?php 
            echo Translate('Test');
            ?>
</button>
						<button type="submit" name="mode[<?php 
            echo $instance_data['id'];
            ?>
]" value="prod" class="btn<?php 
            echo $instance_data['mode'] == 'prod' ? ' active' : '';
            ?>
"><?php 
            echo Translate('Productie');
            ?>
</button>
					</div>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label" for="<?php 
            echo $instance;
            ?>
_description"><?php 
            echo Translate('Omschrijving');
            ?>
</label>
				<div class="controls">
					<input type="text" name="description[<?php 
            echo $instance_data['id'];
            ?>
]" value="<?php 
            echo $instance_data['description'];
            ?>
" class="input-xxlarge" id="<?php 
            echo $instance;
            ?>
_description" />
					<span class="help-block"><?php 
            echo Translate('Omschrijving gebruikt in de checkout, samen met de titel');
            ?>
</span>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label" for="<?php 
            echo $instance;
            ?>
_order_status_id"><?php 
            echo Translate('Bestel status');
            ?>
</label>
				<div class="controls">
					<select name="order_status_id[<?php 
            echo $instance_data['id'];
            ?>
]" class="input-xlarge" id="<?php 
            echo $instance;
            ?>
_order_status_id">
						<?php 
            $statusses = parent::get_order_statusses();
            foreach ($statusses as $id => $name) {
                echo '<option value="' . $id . '"' . ($instance_data['order_status_id'] == $id ? ' selected="selected"' : '') . '>' . $name . '</option>';
            }
            ?>
					</select>
					<span class="help-block"><?php 
            echo Translate('De status na het plaatsen van de bestelling met deze methode.');
            ?>
</span>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label"><?php 
            echo Translate('Verzendmethode');
            ?>
</label>
				<div class="controls">
					<label class="checkbox inline"><?php 
            echo Translate('All');
            ?>
					<input type="checkbox" name="shipping_module[<?php 
            echo $instance_data['id'];
            ?>
][*]" <?php 
            echo $instance_data['shipping_module'] == '*' ? ' checked="checked"' : '';
            ?>
 />
					</label>
					<?php 
            $shipping_modules = explode(';', $instance_data['shipping_module']);
            foreach ($Modules->modules['shipping'] as $module) {
                global ${$module};
                if (isset(${$module}->instances)) {
                    foreach (${$module}->instances as $shipping_instance => $shipping_instance_data) {
                        echo '<label class="checkbox inline">' . $shipping_instance_data['title'];
                        echo '<input type="checkbox" name="shipping_module[' . $instance_data['id'] . '][' . $shipping_instance . ']" value="' . $shipping_instance . '"' . (in_array($shipping_instance, $shipping_modules) ? ' checked="checked"' : '') . ' />';
                        echo '</label>';
                    }
                } else {
                    echo '<label class="checkbox inline">' . ${$module}->config['title'];
                    echo '<input type="checkbox" name="shipping_module[' . $instance_data['id'] . '][' . $module . ']" value="' . $module . '"' . (in_array($module, $shipping_modules) ? ' checked="checked"' : '') . ' />';
                    echo '</label>';
                }
            }
            ?>
					<span class="help-block"><?php 
            echo Translate('Voor welke verzendmethodes is deze methode actief');
            ?>
</span>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label"><?php 
            echo Translate('Zone');
            ?>
</label>
				<div class="controls">
					<label class="checkbox inline"><?php 
            echo Translate('All');
            ?>
					<input type="checkbox" name="zone[<?php 
            echo $instance_data['id'];
            ?>
][*]" value="*" <?php 
            echo $instance_data['zone'] == '*' ? ' checked="checked"' : '';
            ?>
 />
					</label>
					<?php 
            $selected_zones = explode(';', $instance_data['zone']);
            $zones = parent::get_all_zones();
            foreach ($zones as $zone_id => $zone_name) {
                echo '<label class="checkbox inline">' . $zone_name;
                echo '<input type="checkbox" name="zone[' . $instance_data['id'] . '][' . $zone_id . ']" value="' . $zone_id . '"' . (in_array($zone_id, $selected_zones) ? ' checked="checked"' : '') . ' />';
                echo '</label>';
            }
            ?>
					<span class="help-block"><?php 
            echo Translate('Voor welke zone is deze methode actief');
            ?>
</span>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label"><?php 
            echo Translate('Afbeeldingen actieve methodes');
            ?>
</label>
				<div class="controls clearfix">
					<ul class="thumbnails">
						<?php 
            $selected = explode(';', $instance_data['method_images']);
            $moddir = dirname(__FILE__) . '/img/methods';
            $files = $this->listFolderFiles($moddir);
            foreach ($files as $file) {
                $file = basename($file);
                echo '<li>';
                echo '<label for="' . $file . '" class="thumbnail" style="text-align:center;">';
                echo '<img src="' . HTTP_SERVER . DIR_WS_HTTP_CATALOG . DIR_WS_MODULES . 'checkout/modules/' . get_class($this) . '/img/methods/' . $file . '" />';
                echo '<input type="checkbox" name="method_images[' . $instance_data['id'] . '][]" value="' . $file . '"' . (in_array($file, $selected) ? ' checked="checked"' : '') . ' id="' . $file . '" />';
                echo '</label>';
                echo '</li>';
            }
            ?>
					</ul>
					<span class="help-block"><?php 
            echo Translate('Selecteer de afbeeldingen van de methodes die actief zijn. Deze afbeeldingen worden getoond in de checkout.');
            ?>
</span>
				</div>
			</div>
			<div class="form-actions">
				<button class="btn btn-primary" type="submit"><?php 
            echo Translate('Opslaan');
            ?>
</button>
				<button class="btn" type="reset"><?php 
            echo Translate('Annuleren');
            ?>
</button>
			</div>
			</fieldset>
		</form>
		<?php 
        }
        end($this->instances);
        $new_id = end(explode('_', key($this->instances))) + 1;
        ?>
		<div id="new_instance" style="display:none;">
		<form name="<?php 
        echo get_class($this) . '_' . $new_id;
        ?>
" class="form-horizontal well" action="<?php 
        echo tep_href_link('checkout.php', 'module=' . $_GET['module']);
        ?>
" method="post">
			<input type="hidden" name="action" value="save" />
			<fieldset>
			<legend>
				<?php 
        echo get_class($this) . '_' . $new_id;
        ?>
			</legend>
			<div class="control-group">
				<label class="control-label" for="<?php 
        echo get_class($this) . '_' . $new_id;
        ?>
_title"><?php 
        echo Translate('Titel');
        ?>
</label>
				<div class="controls">
					<input type="text" name="title[<?php 
        echo $new_id;
        ?>
]" value="" class="input-xlarge" id="<?php 
        echo get_class($this) . '_' . $new_id;
        ?>
_title" />
				</div>
			</div>
			<input type="hidden" name="status[<?php 
        echo $new_id;
        ?>
]" value="false" />
			<div class="control-group">
				<label class="control-label" for="<?php 
        echo get_class($this) . '_' . $new_id;
        ?>
_pspid"><?php 
        echo Translate('PSP ID');
        ?>
</label>
				<div class="controls">
					<input type="text" name="pspid[<?php 
        echo $new_id;
        ?>
]" value="" class="input-xlarge" id="<?php 
        echo get_class($this) . '_' . $new_id;
        ?>
_pspid" />
				</div>
			</div>
			<div class="control-group">
				<label class="control-label" for="<?php 
        echo get_class($this) . '_' . $new_id;
        ?>
_sha_string"><?php 
        echo Translate('SHA String');
        ?>
</label>
				<div class="controls">
					<input type="text" name="sha_string[<?php 
        echo $new_id;
        ?>
]" value="" class="input-xlarge" id="<?php 
        echo get_class($this) . '_' . $new_id;
        ?>
_sha_string" />
				</div>
			</div>
			<div class="control-group">
				<label class="control-label" for="<?php 
        echo get_class($this) . '_' . $new_id;
        ?>
_description"><?php 
        echo Translate('Omschrijving');
        ?>
</label>
				<div class="controls">
					<input type="text" name="description[<?php 
        echo $new_id;
        ?>
]" value="" class="input-xxlarge" id="<?php 
        echo get_class($this) . '_' . $new_id;
        ?>
_description" />
					<span class="help-block"><?php 
        echo Translate('Omschrijving gebruikt in de checkout, samen met de titel');
        ?>
</span>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label" for="<?php 
        echo get_class($this) . '_' . $new_id;
        ?>
_order_status_id"><?php 
        echo Translate('Bestel status');
        ?>
</label>
				<div class="controls">
					<select name="order_status_id[<?php 
        echo $new_id;
        ?>
]" class="input-xlarge" id="<?php 
        echo get_class($this) . '_' . $new_id;
        ?>
_order_status_id">
						<?php 
        $statusses = parent::get_order_statusses();
        foreach ($statusses as $id => $name) {
            echo '<option value="' . $id . '">' . $name . '</option>';
        }
        ?>
					</select>
					<span class="help-block"><?php 
        echo Translate('De status na het plaatsen van de bestelling met deze methode.');
        ?>
</span>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label"><?php 
        echo Translate('Verzendmethode');
        ?>
</label>
				<div class="controls">
					<label class="checkbox inline"><?php 
        echo Translate('All');
        ?>
					<input type="checkbox" name="shipping_module[<?php 
        echo $new_id;
        ?>
][*]" />
					</label>
					<?php 
        $shipping_modules = explode(';', $instance_data['shipping_module']);
        foreach ($Modules->modules['shipping'] as $module) {
            global ${$module};
            if (isset(${$module}->instances)) {
                foreach (${$module}->instances as $shipping_instance => $shipping_instance_data) {
                    echo '<label class="checkbox inline">' . $shipping_instance_data['title'];
                    echo '<input type="checkbox" name="shipping_module[' . $new_id . '][' . $shipping_instance . ']" value="' . $shipping_instance . '" />';
                    echo '</label>';
                }
            } else {
                echo '<label class="checkbox inline">' . ${$module}->config['title'];
                echo '<input type="checkbox" name="shipping_module[' . $new_id . '][' . $module . ']" value="' . $module . '"' . (in_array($module, $shipping_modules) ? ' checked="checked"' : '') . ' />';
                echo '</label>';
            }
        }
        ?>
					<span class="help-block"><?php 
        echo Translate('Voor welke verzendmethodes is deze methode actief');
        ?>
</span>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label"><?php 
        echo Translate('Zone');
        ?>
</label>
				<div class="controls">
					<label class="checkbox inline"><?php 
        echo Translate('All');
        ?>
					<input type="checkbox" name="zone[<?php 
        echo $new_id;
        ?>
][*]" value="*" />
					</label>
					<?php 
        $zones = parent::get_all_zones();
        foreach ($zones as $zone_id => $zone_name) {
            echo '<label class="checkbox inline">' . $zone_name;
            echo '<input type="checkbox" name="zone[' . $new_id . '][' . $zone_id . ']" value="' . $zone_id . '" />';
            echo '</label>';
        }
        ?>
					<span class="help-block"><?php 
        echo Translate('Voor welke zone is deze methode actief');
        ?>
</span>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label"><?php 
        echo Translate('Afbeeldingen actieve methodes');
        ?>
</label>
				<div class="controls clearfix">
					<ul class="thumbnails">
						<?php 
        $moddir = dirname(__FILE__) . '/img/methods';
        $files = $this->listFolderFiles($moddir);
        foreach ($files as $file) {
            $file = basename($file);
            echo '<li>';
            echo '<label for="' . $file . '" class="thumbnail" style="text-align:center;">';
            echo '<img src="' . HTTP_SERVER . DIR_WS_HTTP_CATALOG . DIR_WS_MODULES . 'checkout/modules/' . get_class($this) . '/img/methods/' . $file . '" />';
            echo '<input type="checkbox" name="method_images[' . $new_id . '][]" value="' . $file . '" id="' . $file . '" />';
            echo '</label>';
            echo '</li>';
        }
        ?>
					</ul>
					<span class="help-block"><?php 
        echo Translate('Selecteer de afbeeldingen van de methodes die actief zijn. Deze afbeeldingen worden getoond in de checkout.');
        ?>
</span>
				</div>
			</div>
			<div class="form-actions">
				<button class="btn btn-primary" type="submit"><?php 
        echo Translate('Opslaan');
        ?>
</button>
				<button class="btn" type="reset"><?php 
        echo Translate('Annuleren');
        ?>
</button>
			</div>
			</fieldset>
		</form>
		</div>
		<?php 
    }
    public function administrator()
    {
        global $Modules, $login;
        echo '<h1>';
        echo get_class($this);
        if ($login == 'aboservice') {
            echo '<button type="button" id="delete_module" href="' . tep_href_link('checkout.php', 'module=' . $_GET['module']) . '&action=delete_module" class="btn btn-danger pull-right">' . Translate('Verwijder module') . '</button>';
            echo '<button type="button" id="add_new" class="btn btn-primary pull-right" style="margin-right:5px;">' . Translate('Voeg een instantie toe') . '</button>';
        }
        echo '</h1>';
        echo '<hr />';
        if (isset($_POST['action']) && $_POST['action'] == 'save') {
            if (isset($_POST['delete'])) {
                /********************/
                /*	Delete instance	*/
                /********************/
                tep_db_query('DELETE FROM checkout_' . get_class($this) . ' WHERE id = "' . $_POST['delete'] . '"');
            } else {
                /********************/
                /*	Save changes	*/
                /********************/
                $instances = array();
                unset($_POST['action']);
                foreach ($_POST as $key => $data) {
                    foreach ($data as $id => $value) {
                        if ($key == 'zone' || $key == 'shipping_module') {
                            if (isset($value['*'])) {
                                $instances[$id][$key] = '*';
                            } else {
                                $instances[$id][$key] = implode(';', $value);
                            }
                        } else {
                            if (strstr($key, 'Icepay_Paymentmethod_')) {
                                $file = strtolower(str_replace('Icepay_Paymentmethod_', '', $key));
                                $this->writeToMethodFile($data, $key, $file);
                                unset($_POST[$key]);
                                break;
                            } else {
                                $instances[$id][$key] = $value;
                            }
                        }
                    }
                }
                foreach ($instances as $id => $data) {
                    if (isset($this->instances[get_class($this) . '_' . $id])) {
                        tep_db_perform('checkout_' . get_class($this), $data, 'update', 'id="' . $id . '"');
                    } else {
                        $data['id'] = $id;
                        tep_db_perform('checkout_' . get_class($this), $data, 'insert');
                    }
                }
            }
            header("Location: " . $_SERVER['HTTP_REFERER']);
            $this->update_instances();
        } else {
            if (isset($_GET['action']) && $_GET['action'] == 'delete_module') {
                /********************/
                /*	Delete module	*/
                /********************/
                unset($_GET['action']);
                parent::delete_module(get_class($this));
            }
        }
        $api = Icepay_Api_Basic::getInstance()->readFolder(realpath('api/paymentmethods'))->prepareFiltering();
        foreach ($this->instances as $instance => $instance_data) {
            ?>
		<form name="<?php 
            echo $instance;
            ?>
" class="form-horizontal well" action="<?php 
            echo tep_href_link('checkout.php', 'module=' . $_GET['module']);
            ?>
" method="post">
			<input type="hidden" name="action" value="save" />
			<fieldset>
			<legend>
				<?php 
            echo $instance;
            ?>
				<button class="btn btn-danger pull-right" type="submit" name="delete" value="<?php 
            echo $instance_data['id'];
            ?>
"><?php 
            echo Translate('Verwijderen');
            ?>
</button>
			</legend>
			<div class="control-group">
				<label class="control-label" for="<?php 
            echo $instance;
            ?>
_title"><?php 
            echo Translate('Titel');
            ?>
</label>
				<div class="controls">
					<input type="text" name="title[<?php 
            echo $instance_data['id'];
            ?>
]" value="<?php 
            echo $instance_data['title'];
            ?>
" class="input-xlarge" id="<?php 
            echo $instance;
            ?>
_title" />
				</div>
			</div>
			<div class="control-group">
				<label class="control-label" for="<?php 
            echo $instance;
            ?>
_status"><?php 
            echo Translate('Status');
            ?>
</label>
				<div class="controls">
					<div class="btn-group" data-toggle="buttons-radio">
						<button type="submit" name="status[<?php 
            echo $instance_data['id'];
            ?>
]" value="true" class="btn<?php 
            echo $instance_data['status'] == 'true' ? ' active' : '';
            ?>
"><?php 
            echo Translate('Actief');
            ?>
</button>
						<button type="submit" name="status[<?php 
            echo $instance_data['id'];
            ?>
]" value="false" class="btn<?php 
            echo $instance_data['status'] == 'false' ? ' active' : '';
            ?>
"><?php 
            echo Translate('Niet actief');
            ?>
</button>
					</div>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label" for="<?php 
            echo $instance;
            ?>
_merchant_id"><?php 
            echo Translate('Merchant ID');
            ?>
</label>
				<div class="controls">
					<input type="text" name="merchant_id[<?php 
            echo $instance_data['id'];
            ?>
]" value="<?php 
            echo $instance_data['merchant_id'];
            ?>
" class="input-xlarge" id="<?php 
            echo $instance;
            ?>
_merchant_id" />
				</div>
			</div>
			<div class="control-group">
				<label class="control-label" for="<?php 
            echo $instance;
            ?>
_secret_code"><?php 
            echo Translate('Geheime code');
            ?>
</label>
				<div class="controls">
					<input type="text" name="secret_code[<?php 
            echo $instance_data['id'];
            ?>
]" value="<?php 
            echo $instance_data['secret_code'];
            ?>
" class="input-xlarge" id="<?php 
            echo $instance;
            ?>
_secret_code" />
				</div>
			</div>
			<div class="control-group">
				<label class="control-label" for="<?php 
            echo $instance;
            ?>
_description"><?php 
            echo Translate('Omschrijving');
            ?>
</label>
				<div class="controls">
					<input type="text" name="description[<?php 
            echo $instance_data['id'];
            ?>
]" value="<?php 
            echo $instance_data['description'];
            ?>
" class="input-xxlarge" id="<?php 
            echo $instance;
            ?>
_description" />
					<span class="help-block"><?php 
            echo Translate('Omschrijving gebruikt in de checkout, samen met de titel');
            ?>
</span>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label" for="<?php 
            echo $instance;
            ?>
_order_status_id"><?php 
            echo Translate('Bestel status');
            ?>
</label>
				<div class="controls">
					<select name="order_status_id[<?php 
            echo $instance_data['id'];
            ?>
]" class="input-xlarge" id="<?php 
            echo $instance;
            ?>
_order_status_id">
						<?php 
            $statusses = parent::get_order_statusses();
            foreach ($statusses as $id => $name) {
                echo '<option value="' . $id . '"' . ($instance_data['order_status_id'] == $id ? ' selected="selected"' : '') . '>' . $name . '</option>';
            }
            ?>
					</select>
					<span class="help-block"><?php 
            echo Translate('De status na het plaatsen van de bestelling met deze methode.');
            ?>
</span>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label"><?php 
            echo Translate('Verzendmethode');
            ?>
</label>
				<div class="controls">
					<label class="checkbox inline"><?php 
            echo Translate('All');
            ?>
					<input type="checkbox" name="shipping_module[<?php 
            echo $instance_data['id'];
            ?>
][*]" <?php 
            echo $instance_data['shipping_module'] == '*' ? ' checked="checked"' : '';
            ?>
 />
					</label>
					<?php 
            $shipping_modules = explode(';', $instance_data['shipping_module']);
            foreach ($Modules->modules['shipping'] as $module) {
                global ${$module};
                if (isset(${$module}->instances)) {
                    foreach (${$module}->instances as $shipping_instance => $shipping_instance_data) {
                        echo '<label class="checkbox inline">' . $shipping_instance_data['title'];
                        echo '<input type="checkbox" name="shipping_module[' . $instance_data['id'] . '][' . $shipping_instance . ']" value="' . $shipping_instance . '"' . (in_array($shipping_instance, $shipping_modules) ? ' checked="checked"' : '') . ' />';
                        echo '</label>';
                    }
                } else {
                    echo '<label class="checkbox inline">' . ${$module}->config['title'];
                    echo '<input type="checkbox" name="shipping_module[' . $instance_data['id'] . '][' . $module . ']" value="' . $module . '"' . (in_array($module, $shipping_modules) ? ' checked="checked"' : '') . ' />';
                    echo '</label>';
                }
            }
            ?>
					<span class="help-block"><?php 
            echo Translate('Voor welke verzendmethodes is deze methode actief');
            ?>
</span>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label"><?php 
            echo Translate('Zone');
            ?>
</label>
				<div class="controls">
					<label class="checkbox inline"><?php 
            echo Translate('All');
            ?>
					<input type="checkbox" name="zone[<?php 
            echo $instance_data['id'];
            ?>
][*]" value="*" <?php 
            echo $instance_data['zone'] == '*' ? ' checked="checked"' : '';
            ?>
 />
					</label>
					<?php 
            $selected_zones = explode(';', $instance_data['zone']);
            $zones = parent::get_all_zones();
            foreach ($zones as $zone_id => $zone_name) {
                echo '<label class="checkbox inline">' . $zone_name;
                echo '<input type="checkbox" name="zone[' . $instance_data['id'] . '][' . $zone_id . ']" value="' . $zone_id . '"' . (in_array($zone_id, $selected_zones) ? ' checked="checked"' : '') . ' />';
                echo '</label>';
            }
            ?>
					<span class="help-block"><?php 
            echo Translate('Voor welke zone is deze methode actief');
            ?>
</span>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label"><?php 
            echo Translate('Betaalmethodes');
            ?>
</label>
				<div class="controls clearfix">
					<div class="tabbable">
						<?php 
            $moddir = dirname(__FILE__) . '/api/paymentmethods';
            $files = $this->listFolderFiles($moddir);
            ?>
						<ul class="nav nav-tabs">
							<?php 
            foreach ($files as $key => $file) {
                echo '<li ' . ($key == 0 ? ' class="active"' : '') . '><a href="#' . substr(basename($file), 0, -4) . '" data-toggle="tab">' . ucfirst(substr(basename($file), 0, -4)) . '</a></li>';
            }
            ?>
						</ul>
						<div class="tab-content">
							<?php 
            foreach ($files as $key => $file) {
                $name = strtolower(substr(basename($file), 0, -4));
                $className = "Icepay_Paymentmethod_" . ucfirst($name);
                $class = new $className();
                ?>
							<div class="tab-pane<?php 
                echo $key == 0 ? ' active' : '';
                ?>
" id="<?php 
                echo substr(basename($file), 0, -4);
                ?>
">
								<input type="hidden" name="<?php 
                echo $className;
                ?>
[_version]" value="<?php 
                echo $class->_version;
                ?>
" />
								<input type="hidden" name="<?php 
                echo $className;
                ?>
[_method]" value="<?php 
                echo $class->_method;
                ?>
" />
								<div class="control-group">
									<label class="control-label" for="<?php 
                echo $className;
                ?>
_status"><?php 
                echo Translate('Status');
                ?>
</label>
									<div class="controls clearfix">
										<div class="btn-group" data-toggle="buttons-radio">
											<button type="submit" name="<?php 
                echo $className;
                ?>
[_status]" value="1" class="btn<?php 
                echo $class->_status == '1' ? ' active' : '';
                ?>
"><?php 
                echo Translate('Actief');
                ?>
</button>
											<button type="submit" name="<?php 
                echo $className;
                ?>
[_status]" value="0" class="btn<?php 
                echo $class->_status == '0' ? ' active' : '';
                ?>
"><?php 
                echo Translate('Niet actief');
                ?>
</button>
										</div>
									</div>
								</div>
								<div class="control-group">
									<label class="control-label" for="<?php 
                echo $className;
                ?>
_readable_name"><?php 
                echo Translate('Naam');
                ?>
</label>
									<div class="controls clearfix">
										<input type="text" name="<?php 
                echo $className;
                ?>
[_readable_name]" class="input-medium" value="<?php 
                echo $class->_readable_name;
                ?>
" id="<?php 
                echo $className;
                ?>
_readable_name" />
									</div>
								</div>
								<div class="control-group">
									<label class="control-label" for="<?php 
                echo $className;
                ?>
_issuer"><?php 
                echo Translate('Instantie');
                ?>
</label>
									<div class="controls clearfix">
										<?php 
                foreach ($class->_issuer as $issuer => $data) {
                    ?>
										<label class="checkbox">
											<input type="hidden" name="<?php 
                    echo $className;
                    ?>
[_issuer][<?php 
                    echo $issuer;
                    ?>
][name]" value="<?php 
                    echo $data['name'];
                    ?>
" />
											<input type="hidden" name="<?php 
                    echo $className;
                    ?>
[_issuer][<?php 
                    echo $issuer;
                    ?>
][image]" value="<?php 
                    echo $data['image'];
                    ?>
" />
											<input type="checkbox" name="<?php 
                    echo $className;
                    ?>
[_issuer][<?php 
                    echo $issuer;
                    ?>
][status]"<?php 
                    echo $data['status'] == 'on' ? ' checked=checked' : '';
                    ?>
> <?php 
                    echo $data['name'];
                    ?>
										</label>
										<?php 
                }
                ?>
									</div>
								</div>
								<div class="control-group">
									<label class="control-label" for="<?php 
                echo $className;
                ?>
_minimum_amount"><?php 
                echo Translate('Minimum bestelbedrag');
                ?>
</label>
									<div class="controls clearfix">
										<div class="input-append">
											<input type="number" name="<?php 
                echo $className;
                ?>
[_amount][minimum]" class="input-medium" value="<?php 
                echo $class->_amount['minimum'];
                ?>
" id="<?php 
                echo $className;
                ?>
_minimum_amount" /><span class="add-on">€</span>
										</div>
									</div>
								</div>
								<div class="control-group">
									<label class="control-label" for="<?php 
                echo $className;
                ?>
_maximum_amount"><?php 
                echo Translate('Maximum bestelbedrag');
                ?>
</label>
									<div class="controls clearfix">
										<div class="input-append">
											<input type="number" name="<?php 
                echo $className;
                ?>
[_amount][maximum]" class="input-medium" value="<?php 
                echo $class->_amount['maximum'];
                ?>
" id="<?php 
                echo $className;
                ?>
_maximum_amount" /><span class="add-on">€</span>
										</div>
									</div>
								</div>
							</div>
							<?php 
            }
            ?>
						</div>
					</div>
				</div>
			</div>
			<div class="form-actions">
				<button class="btn btn-primary" type="submit"><?php 
            echo Translate('Opslaan');
            ?>
</button>
				<button class="btn" type="reset"><?php 
            echo Translate('Annuleren');
            ?>
</button>
			</div>
			</fieldset>
		</form>
		<?php 
        }
        end($this->instances);
        $new_id = end(explode('_', key($this->instances))) + 1;
        ?>
		<div id="new_instance" style="display:none;">
		<form name="<?php 
        echo get_class($this) . '_' . $new_id;
        ?>
" class="form-horizontal well" action="<?php 
        echo tep_href_link('checkout.php', 'module=' . $_GET['module']);
        ?>
" method="post">
			<input type="hidden" name="action" value="save" />
			<fieldset>
			<legend>
				<?php 
        echo get_class($this) . '_' . $new_id;
        ?>
			</legend>
			<div class="control-group">
				<label class="control-label" for="<?php 
        echo get_class($this) . '_' . $new_id;
        ?>
_title"><?php 
        echo Translate('Titel');
        ?>
</label>
				<div class="controls">
					<input type="text" name="title[<?php 
        echo $new_id;
        ?>
]" value="" class="input-xlarge" id="<?php 
        echo get_class($this) . '_' . $new_id;
        ?>
_title" />
				</div>
			</div>
			<input type="hidden" name="status[<?php 
        echo $new_id;
        ?>
]" value="false" />
			<div class="control-group">
				<label class="control-label" for="<?php 
        echo get_class($this) . '_' . $new_id;
        ?>
_merchant_id"><?php 
        echo Translate('Merchant ID');
        ?>
</label>
				<div class="controls">
					<input type="text" name="merchant_id[<?php 
        echo $new_id;
        ?>
]" value="" class="input-xlarge" id="<?php 
        echo get_class($this) . '_' . $new_id;
        ?>
_merchant_id" />
				</div>
			</div>
			<div class="control-group">
				<label class="control-label" for="<?php 
        echo get_class($this) . '_' . $new_id;
        ?>
_secret_code"><?php 
        echo Translate('Geheime code');
        ?>
</label>
				<div class="controls">
					<input type="text" name="secret_code[<?php 
        echo $new_id;
        ?>
]" value="" class="input-xlarge" id="<?php 
        echo get_class($this) . '_' . $new_id;
        ?>
_secret_code" />
				</div>
			</div>
			<div class="control-group">
				<label class="control-label" for="<?php 
        echo get_class($this) . '_' . $new_id;
        ?>
_description"><?php 
        echo Translate('Omschrijving');
        ?>
</label>
				<div class="controls">
					<input type="text" name="description[<?php 
        echo $new_id;
        ?>
]" value="" class="input-xxlarge" id="<?php 
        echo get_class($this) . '_' . $new_id;
        ?>
_description" />
					<span class="help-block"><?php 
        echo Translate('Omschrijving gebruikt in de checkout, samen met de titel');
        ?>
</span>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label" for="<?php 
        echo get_class($this) . '_' . $new_id;
        ?>
_order_status_id"><?php 
        echo Translate('Bestel status');
        ?>
</label>
				<div class="controls">
					<select name="order_status_id[<?php 
        echo $new_id;
        ?>
]" class="input-xlarge" id="<?php 
        echo get_class($this) . '_' . $new_id;
        ?>
_order_status_id">
						<?php 
        $statusses = parent::get_order_statusses();
        foreach ($statusses as $id => $name) {
            echo '<option value="' . $id . '">' . $name . '</option>';
        }
        ?>
					</select>
					<span class="help-block"><?php 
        echo Translate('De status na het plaatsen van de bestelling met deze methode.');
        ?>
</span>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label"><?php 
        echo Translate('Verzendmethode');
        ?>
</label>
				<div class="controls">
					<label class="checkbox inline"><?php 
        echo Translate('All');
        ?>
					<input type="checkbox" name="shipping_module[<?php 
        echo $new_id;
        ?>
][*]" />
					</label>
					<?php 
        $shipping_modules = explode(';', $instance_data['shipping_module']);
        foreach ($Modules->modules['shipping'] as $module) {
            global ${$module};
            if (isset(${$module}->instances)) {
                foreach (${$module}->instances as $shipping_instance => $shipping_instance_data) {
                    echo '<label class="checkbox inline">' . $shipping_instance_data['title'];
                    echo '<input type="checkbox" name="shipping_module[' . $new_id . '][' . $shipping_instance . ']" value="' . $shipping_instance . '" />';
                    echo '</label>';
                }
            } else {
                echo '<label class="checkbox inline">' . ${$module}->config['title'];
                echo '<input type="checkbox" name="shipping_module[' . $new_id . '][' . $module . ']" value="' . $module . '"' . (in_array($module, $shipping_modules) ? ' checked="checked"' : '') . ' />';
                echo '</label>';
            }
        }
        ?>
					<span class="help-block"><?php 
        echo Translate('Voor welke verzendmethodes is deze methode actief');
        ?>
</span>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label"><?php 
        echo Translate('Zone');
        ?>
</label>
				<div class="controls">
					<label class="checkbox inline"><?php 
        echo Translate('All');
        ?>
					<input type="checkbox" name="zone[<?php 
        echo $new_id;
        ?>
][*]" value="*" />
					</label>
					<?php 
        $zones = parent::get_all_zones();
        foreach ($zones as $zone_id => $zone_name) {
            echo '<label class="checkbox inline">' . $zone_name;
            echo '<input type="checkbox" name="zone[' . $new_id . '][' . $zone_id . ']" value="' . $zone_id . '" />';
            echo '</label>';
        }
        ?>
					<span class="help-block"><?php 
        echo Translate('Voor welke zone is deze methode actief');
        ?>
</span>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label"><?php 
        echo Translate('Afbeeldingen actieve methodes');
        ?>
</label>
				<div class="controls clearfix">
					<ul class="thumbnails">
						<?php 
        $moddir = dirname(__FILE__) . '/img/methods';
        $files = $this->listFolderFiles($moddir);
        foreach ($files as $file) {
            $file = basename($file);
            echo '<li>';
            echo '<label for="' . $file . '" class="thumbnail" style="text-align:center;">';
            echo '<img src="' . HTTP_SERVER . DIR_WS_HTTP_CATALOG . DIR_WS_MODULES . 'checkout/modules/' . get_class($this) . '/img/methods/' . $file . '" />';
            echo '<input type="checkbox" name="method_images[' . $new_id . '][]" value="' . $file . '" id="' . $file . '" />';
            echo '</label>';
            echo '</li>';
        }
        ?>
					</ul>
					<span class="help-block"><?php 
        echo Translate('Selecteer de afbeeldingen van de methodes die actief zijn. Deze afbeeldingen worden getoond in de checkout.');
        ?>
</span>
				</div>
			</div>
			<div class="form-actions">
				<button class="btn btn-primary" type="submit"><?php 
        echo Translate('Opslaan');
        ?>
</button>
				<button class="btn" type="reset"><?php 
        echo Translate('Annuleren');
        ?>
</button>
			</div>
			</fieldset>
		</form>
		</div>
		<?php 
    }
示例#7
0
    public function administrator()
    {
        global $Modules;
        echo '<h1>';
        echo get_class($this);
        echo '<button type="button" id="delete_module" href="' . tep_href_link('checkout.php', 'module=' . $_GET['module']) . '&action=delete_module" class="btn btn-danger pull-right">' . Translate('Verwijder module') . '</button>';
        echo '</h1>';
        echo '<hr />';
        if (isset($_POST['action']) && $_POST['action'] == 'save') {
            /********************/
            /*	Save changes	*/
            /********************/
            unset($_POST['action']);
            foreach ($_POST as $key => $data) {
                if ($key == 'bpost_types') {
                    $types_total = 0;
                    foreach ($data as $type => $value) {
                        $types_total += $type;
                    }
                    $_POST[$key] = $types_total;
                }
            }
            tep_db_perform('checkout_' . get_class($this), $_POST, 'update', 'id="1"');
            $this->update_config();
        } else {
            if (isset($_GET['action']) && $_GET['action'] == 'delete_module') {
                /********************/
                /*	Delete module	*/
                /********************/
                unset($_GET['action']);
                parent::delete_module(get_class($this));
            }
        }
        ?>
		<form name="<?php 
        echo get_class($this);
        ?>
" class="form-horizontal well" action="<?php 
        echo tep_href_link('checkout.php', 'module=' . $_GET['module']);
        ?>
" method="post">
			<input type="hidden" name="action" value="save" />
			<fieldset>
			<div class="control-group">
				<label class="control-label" for="title"><?php 
        echo Translate('Titel');
        ?>
</label>
				<div class="controls">
					<input type="text" name="title" value="<?php 
        echo $this->config['title'];
        ?>
" class="input-xlarge" id="title" />
				</div>
			</div>
			<div class="control-group">
				<label class="control-label" for="status"><?php 
        echo Translate('Status');
        ?>
</label>
				<div class="controls">
					<div class="btn-group" data-toggle="buttons-radio">
						<button type="submit" name="status" value="true" class="btn<?php 
        echo $this->config['status'] == 'true' ? ' active' : '';
        ?>
"><?php 
        echo Translate('Actief');
        ?>
</button>
						<button type="submit" name="status" value="false" class="btn<?php 
        echo $this->config['status'] == 'false' ? ' active' : '';
        ?>
"><?php 
        echo Translate('Niet actief');
        ?>
</button>
					</div>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label" for="description"><?php 
        echo Translate('Omschrijving');
        ?>
</label>
				<div class="controls">
					<input type="text" name="description" value="<?php 
        echo $this->config['description'];
        ?>
" class="input-xxlarge" id="description" />
					<span class="help-block"><?php 
        echo Translate('Omschrijving gebruikt in de checkout, samen met de titel');
        ?>
</span>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label" for="account_id"><?php 
        echo Translate('Account Id');
        ?>
</label>
				<div class="controls">
					<input type="text" name="account_id" value="<?php 
        echo $this->config['account_id'];
        ?>
" class="input-xlarge" id="account_id" />
				</div>
			</div>
			<div class="control-group">
				<label class="control-label" for="shipping_cost"><?php 
        echo Translate('Verzendkost');
        ?>
</label>
				<div class="controls">
					<input type="text" name="shipping_cost" value="<?php 
        echo $this->config['shipping_cost'];
        ?>
" class="input-xlarge" id="shipping_cost" />
				</div>
			</div>
			<div class="control-group">
				<label class="control-label" for="min_amount"><?php 
        echo Translate('Minimum bedrag');
        ?>
</label>
				<div class="controls">
					<input type="text" name="min_amount" value="<?php 
        echo $this->config['min_amount'];
        ?>
" class="input-xlarge" id="min_amount" />
					<span class="help-block"><?php 
        echo Translate('Minimum bedrag van de bestelling voor deze methode gebruikt kan worden');
        ?>
</span>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label" for="max_weight"><?php 
        echo Translate('Maximum gewicht');
        ?>
</label>
				<div class="controls">
					<input type="text" name="max_weight" value="<?php 
        echo $this->config['max_weight'];
        ?>
" class="input-xlarge" id="max_weight" />
					<span class="help-block"><?php 
        echo Translate('Het maximum gewicht die de bestelling mag hebben voor het gebruik van deze methode');
        ?>
</span>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label" for="free_shipping_over"><?php 
        echo Translate('Gratis verzending vanaf');
        ?>
</label>
				<div class="controls">
					<input type="text" name="free_shipping_over" value="<?php 
        echo $this->config['free_shipping_over'];
        ?>
" class="input-xlarge" id="free_shipping_over" />&euro;
					<span class="help-block"><?php 
        echo Translate('Verzending wordt gratis bij een totaal bestelbedrag boven dit bedrag');
        ?>
</span>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label" for="max_sp"><?php 
        echo Translate('Aantal afhaalpunten');
        ?>
</label>
				<div class="controls">
					<input type="text" name="max_sp" value="<?php 
        echo $this->config['max_sp'];
        ?>
" class="input-xlarge" id="max_sp" />
					<span class="help-block"><?php 
        echo Translate('Het maximum aantal afhaalpunten die mag getoond worden in de checkout.');
        ?>
</span>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label"><?php 
        echo Translate('Post punt types');
        ?>
</label>
				<div class="controls">
					<label class="checkbox" for="type1">
						<input name="bpost_types[1]" type="checkbox" value="" id="type1"<?php 
        echo $this->config['bpost_types'] % 2 ? 'checked=checked' : '';
        ?>
 />
						<?php 
        echo Translate('Post Office');
        ?>
					</label>
					<label class="checkbox" for="type2">
						<input name="bpost_types[2]" type="checkbox" value="" id="type2"<?php 
        echo in_array($this->config['bpost_types'], array(2, 3, 6, 7)) ? 'checked=checked' : '';
        ?>
 />
						<?php 
        echo Translate('Post Point');
        ?>
					</label>
					<label class="checkbox" for="type4">
						<input name="bpost_types[4]" type="checkbox" value="" id="type4"<?php 
        echo in_array($this->config['bpost_types'], array(4, 5, 6, 7)) ? 'checked=checked' : '';
        ?>
 />
						<?php 
        echo Translate('Bpack 24/7');
        ?>
					</label>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label" for="sort_order"><?php 
        echo Translate('Volgorde');
        ?>
</label>
				<div class="controls">
					<input type="text" name="sort_order" value="<?php 
        echo $this->config['sort_order'];
        ?>
" class="input-xlarge" id="sort_order" />
				</div>
			</div>
			<div class="form-actions">
				<button class="btn btn-primary" type="submit"><?php 
        echo Translate('Opslaan');
        ?>
</button>
				<button class="btn" type="reset"><?php 
        echo Translate('Annuleren');
        ?>
</button>
			</div>
			</fieldset>
		</form>
		<?php 
    }
    public function administrator()
    {
        global $Modules, $login;
        echo '<h1>';
        echo get_class($this);
        if ($login == 'aboservice') {
            echo '<button type="button" id="delete_module" href="' . tep_href_link('checkout.php', 'module=' . $_GET['module']) . '&action=delete_module" class="btn btn-danger pull-right">' . Translate('Verwijder module') . '</button>';
        }
        echo '</h1>';
        echo '<hr />';
        if (isset($_POST['action']) && $_POST['action'] == 'save') {
            if (isset($_POST['delete'])) {
                /********************/
                /*	Delete instance	*/
                /********************/
                tep_db_query('DELETE FROM checkout_' . get_class($this) . ' WHERE id = "' . $_POST['delete'] . '"');
            } else {
                /********************/
                /*	Save changes	*/
                /********************/
                $instances = array();
                unset($_POST['action']);
                tep_db_perform('checkout_' . get_class($this), $_POST, 'update', 'id="1"');
            }
            $this->update_config();
        } else {
            if (isset($_GET['action']) && $_GET['action'] == 'delete_module') {
                /********************/
                /*	Delete module	*/
                /********************/
                unset($_GET['action']);
                parent::delete_module(get_class($this));
            }
        }
        ?>
		<form name="<?php 
        echo get_class($this);
        ?>
" class="form-horizontal well" action="<?php 
        echo tep_href_link('checkout.php', 'module=' . $_GET['module']);
        ?>
" method="post">
			<input type="hidden" name="action" value="save" />
			<fieldset>
			<div class="control-group">
				<label class="control-label" for="title"><?php 
        echo Translate('Titel');
        ?>
</label>
				<div class="controls">
					<input type="text" name="title" value="<?php 
        echo $this->config['title'];
        ?>
" class="input-xxlarge" id="title" />
				</div>
			</div>
			<div class="control-group">
				<label class="control-label" for="status"><?php 
        echo Translate('Status');
        ?>
</label>
				<div class="controls">
					<div class="btn-group" data-toggle="buttons-radio">
						<button type="submit" name="status" value="true" class="btn<?php 
        echo $this->config['status'] == 'true' ? ' active' : '';
        ?>
"><?php 
        echo Translate('Actief');
        ?>
</button>
						<button type="submit" name="status" value="false" class="btn<?php 
        echo $this->config['status'] == 'false' ? ' active' : '';
        ?>
"><?php 
        echo Translate('Niet actief');
        ?>
</button>
					</div>
				</div>
			</div>
			<div class="form-actions">
				<button class="btn btn-primary" type="submit"><?php 
        echo Translate('Opslaan');
        ?>
</button>
				<button class="btn" type="reset"><?php 
        echo Translate('Annuleren');
        ?>
</button>
			</div>
			</fieldset>
		</form>
		<?php 
    }
    public function administrator()
    {
        global $Modules, $login;
        echo '<h1>';
        echo get_class($this);
        if ($login == 'aboservice') {
            echo '<button type="button" id="delete_module" href="' . tep_href_link('checkout.php', 'module=' . $_GET['module']) . '&action=delete_module" class="btn btn-danger pull-right">' . Translate('Verwijder module') . '</button>';
        }
        echo '</h1>';
        echo '<hr />';
        if (isset($_POST['action']) && $_POST['action'] == 'save') {
            /********************/
            /*	Save changes	*/
            /********************/
            unset($_POST['action']);
            foreach ($_POST as $key => $data) {
                if ($key == 'zone' || $key == 'shipping_module') {
                    if (isset($data['*'])) {
                        $_POST[$key] = '*';
                    } else {
                        $_POST[$key] = implode(';', $data);
                    }
                }
            }
            tep_db_perform('checkout_' . get_class($this), $_POST, 'update', 'id="1"');
            $this->update_config();
        } else {
            if (isset($_GET['action']) && $_GET['action'] == 'delete_module') {
                /********************/
                /*	Delete module	*/
                /********************/
                unset($_GET['action']);
                parent::delete_module(get_class($this));
            }
        }
        ?>
		<form name="<?php 
        echo get_class($this);
        ?>
" class="form-horizontal well" action="<?php 
        echo tep_href_link('checkout.php', 'module=' . $_GET['module']);
        ?>
" method="post">
			<input type="hidden" name="action" value="save" />
			<fieldset>
			<div class="control-group">
				<label class="control-label" for="title"><?php 
        echo Translate('Titel');
        ?>
</label>
				<div class="controls">
					<input type="text" name="title" value="<?php 
        echo $this->config['title'];
        ?>
" class="input-xlarge" id="title" />
				</div>
			</div>
			<div class="control-group">
				<label class="control-label" for="status"><?php 
        echo Translate('Status');
        ?>
</label>
				<div class="controls">
					<div class="btn-group" data-toggle="buttons-radio">
						<button type="submit" name="status" value="true" class="btn<?php 
        echo $this->config['status'] == 'true' ? ' active' : '';
        ?>
"><?php 
        echo Translate('Actief');
        ?>
</button>
						<button type="submit" name="status" value="false" class="btn<?php 
        echo $this->config['status'] == 'false' ? ' active' : '';
        ?>
"><?php 
        echo Translate('Niet actief');
        ?>
</button>
					</div>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label" for="description"><?php 
        echo Translate('Omschrijving');
        ?>
</label>
				<div class="controls">
					<input type="text" name="description" value="<?php 
        echo $this->config['description'];
        ?>
" class="input-xxlarge" id="description" />
					<span class="help-block"><?php 
        echo Translate('Omschrijving gebruikt in de checkout, samen met de titel');
        ?>
</span>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label" for="order_status_id"><?php 
        echo Translate('Bestel status');
        ?>
</label>
				<div class="controls">
					<select name="order_status_id" class="input-xlarge" id="order_status_id">
						<?php 
        $statusses = parent::get_order_statusses();
        foreach ($statusses as $id => $name) {
            echo '<option value="' . $id . '"' . ($this->config['order_status_id'] == $id ? ' selected="selected"' : '') . '>' . $name . '</option>';
        }
        ?>
					</select>
					<span class="help-block"><?php 
        echo Translate('De status na het plaatsen van de bestelling met deze methode.');
        ?>
</span>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label"><?php 
        echo Translate('Verzendmethode');
        ?>
</label>
				<div class="controls">
					<label class="checkbox inline"><?php 
        echo Translate('All');
        ?>
					<input type="checkbox" name="shipping_module[*]" <?php 
        echo $this->config['shipping_module'] == '*' ? ' checked="checked"' : '';
        ?>
 />
					</label>
					<?php 
        $shipping_modules = explode(';', $this->config['shipping_module']);
        foreach ($Modules->modules['shipping'] as $module) {
            global ${$module};
            if (isset(${$module}->instances)) {
                foreach (${$module}->instances as $shipping_instance => $shipping_instance_data) {
                    echo '<label class="checkbox inline">' . $shipping_instance_data['title'];
                    echo '<input type="checkbox" name="shipping_module[' . $shipping_instance . ']" value="' . $shipping_instance . '"' . (in_array($shipping_instance, $shipping_modules) ? ' checked="checked"' : '') . ' />';
                    echo '</label>';
                }
            } else {
                echo '<label class="checkbox inline">' . ${$module}->config['title'];
                echo '<input type="checkbox" name="shipping_module[' . $module . ']" value="' . $module . '"' . (in_array($module, $shipping_modules) ? ' checked="checked"' : '') . ' />';
                echo '</label>';
            }
        }
        ?>
					<span class="help-block"><?php 
        echo Translate('Voor welke verzendmethodes is deze methode actief');
        ?>
</span>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label"><?php 
        echo Translate('Zone');
        ?>
</label>
				<div class="controls">
					<label class="checkbox inline"><?php 
        echo Translate('All');
        ?>
					<input type="checkbox" name="zone[*]" value="*" <?php 
        echo $this->config['zone'] == '*' ? ' checked="checked"' : '';
        ?>
 />
					</label>
					<?php 
        $selected_zones = explode(';', $this->config['zone']);
        $zones = parent::get_all_zones();
        foreach ($zones as $zone_id => $zone_name) {
            echo '<label class="checkbox inline">' . $zone_name;
            echo '<input type="checkbox" name="zone[' . $zone_id . ']" value="' . $zone_id . '"' . (in_array($zone_id, $selected_zones) ? ' checked="checked"' : '') . ' />';
            echo '</label>';
        }
        ?>
					<span class="help-block"><?php 
        echo Translate('Voor welke zone is deze methode actief');
        ?>
</span>
				</div>
			</div>
			<div class="form-actions">
				<button class="btn btn-primary" type="submit"><?php 
        echo Translate('Opslaan');
        ?>
</button>
				<button class="btn" type="reset"><?php 
        echo Translate('Annuleren');
        ?>
</button>
			</div>
			</fieldset>
		</form>
		<?php 
    }