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 }
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 }
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 '</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 }