function email_templates($wpi_settings) { ?>
    <?php $notifications_array = apply_filters('wpi_email_templates', $wpi_settings['notification']); ?>
    <?php //WPI_Functions::qc($notifications_array); ?>
    <table class="ud_ui_dynamic_table widefat form-table" style="margin-bottom:8px;" auto_increment="true">
    <thead>
      <tr>
        <th><?php _e('Name', WPI); ?></th>
        <th style="width:150px;"><?php _e('Subject', WPI); ?></th>
        <th style="width:400px;"><?php _e('Content', WPI); ?></th>
      </tr>
    </thead>
    <tbody>
    <?php foreach($notifications_array as $slug => $notification):  ?>
      <tr class="wpi_dynamic_table_row" slug="<?php echo $slug; ?>" new_row="false">
        <td>
          <div style="position:relative;">
            <span class="row_delete">&nbsp;</span>
            <?php echo WPI_UI::input("name=wpi_settings[notification][{$slug}][name]&value={$notification['name']}&type=text&style=width:150px;margin-left:35px;")?>
          </div>
        </td>
        <td>
          <?php echo WPI_UI::input("name=wpi_settings[notification][{$slug}][subject]&value={$notification['subject']}&type=text&style=width:240px;")?>
        </td>
        <td>
          <?php echo WPI_UI::textarea("class=wpi_notification_template_content&name=wpi_settings[notification][{$slug}][content]&value=".urlencode($notification['content']))?>
        </td>
      </tr>
    <?php endforeach; ?>
    </tbody>
    <tfoot>
      <tr>
        <th colspan="3">
          <input type='button' class="button wpi_button wpi_add_row" value="<?php esc_attr(_e('Add Template', WPI)); ?>"/>
        </th>
      </tr>
    </tfoot>
    </table>

    <?php
  }
function postbox_payment_methods($this_invoice) {
  global $wpi_settings;
  if (!empty($this_invoice['billing'])) {
    $this_invoice['billing'] = apply_filters('wpi_billing_method', $this_invoice['billing']);
    ?>
    <table class="form-table">

      <tr class="column-payment-method-default wpi_not_for_quote">
        <th><?php _e("Default Payment Option", WPI) ?></th>
        <td>
          <select id="wp_invoice_payment_method" name="wpi_invoice[default_payment_method]">
            <?php foreach ($this_invoice['billing'] as $key => $payment_option) : ?>
            <?php if (!isset($payment_option['name']))
              continue; ?>
              <option value="<?php echo $key; ?>" <?php echo ($this_invoice['default_payment_method'] == $key) ? 'selected="selected"' : ''; ?> ><?php echo $payment_option['name']; ?></option>
          <?php endforeach; ?>
          </select>&nbsp;&nbsp;
          <?php
          if (count($this_invoice['billing']) > 1) {
            echo WPI_UI::checkbox("class=wpi_client_change_payment_method&name=wpi_invoice[client_change_payment_method]&value=true&label=".__('Client can change payment option.', WPI), !empty( $this_invoice['client_change_payment_method'] )? ( $this_invoice['client_change_payment_method'] == 'on' ? true : false ) : false);
          }
          ?>
        </td>
      </tr>

      <tr class='wpi_not_for_quote wpi-payment-setting column-paymenth-method-<?php echo $key; ?>'>
        <th><?php _e("Accepted Payments", WPI) ?></th>
        <td>
          <ul class="wpi_settings_list">
              <?php foreach ($this_invoice['billing'] as $key => $value) : ?>
              <?php if (empty($value['name']))
                break; ?>
              <li class="clearfix">
      <?php echo WPI_UI::checkbox("name=wpi_invoice[billing][{$key}][allow]&id={$key}&value=true&label={$value['name']}&class=wpi_billing_section_show", $value['allow'] == 'on' ? true : false) ?>
      <?php /* <div class="wpi_notice"><?php _e("Notice the ") ?><span onClick="wpi_select_payment_method('<?php echo $key; ?>');"><u><?php echo $value['name']; ?><?php _e(" Tab") ?></u></span><?php _e(" below. ") ?></div> */ ?>
              </li>
    <?php endforeach; ?>
          </ul>
        </td>
      </tr>


      <tr class="wpi_advanced_payment_options column-publish-currency">
        <th><?php _e("Default Currency", WPI) ?></th>
        <td>
          <select name="wpi_invoice[default_currency_code]">
    <?php foreach ($wpi_settings['currency']['types'] as $value => $currency_x) : ?>
              <option value="<?php echo $value; ?>" <?php echo ($this_invoice['default_currency_code'] == $value) ? 'selected="selected"' : ''; ?>"><?php echo $value; ?> - <?php echo $currency_x; ?></option>
    <?php endforeach; ?>
          </select>
        </td>
      </tr>



      <tr class="wpi_advanced_payment_options wpi_not_for_quote">
        <td colspan="2">
          <div class="wp_invoice_accordion">
    <?php foreach ($this_invoice['billing'] as $key => $value) : ?>
      <?php if (empty($this_invoice['default_payment_method']))
        $this_invoice['default_payment_method'] = key($this_invoice['billing']); ?>
                  <?php if (empty($value['name']))
                    break; ?>
              <div class="<?php echo $key; ?>-setup-section wp_invoice_accordion_section">
                <h3 id="<?php echo $key; ?>-setup-section-header" <?php if ($this_invoice['default_payment_method'] == $key) { ?>aria-expanded="true"<?php } else { ?>aria-expanded="false"<?php } ?>>
                  <span class="selector"><?php echo $value['name'] ?></span>
                </h3>
                <div style="display:<?php echo $this_invoice['default_payment_method'] == $key ? 'block' : 'none'; ?>">
      <?php echo WPI_UI::input("type=hidden&name=wpi_invoice[billing][{$key}][default_option]&class=billing-default-option billing-{$key}-default-option&value={$value['default_option']}") ?>
                  <table class="form-table">
                        <?php
                        foreach ($value['settings'] as $key2 => $setting_value) :
                          $setting_value['value'] = urldecode($setting_value['value']);
                          $setting_value['type'] = !empty($setting_value['type']) ? $setting_value['type'] : 'input';
                          ?>
                      <tr>
                        <th width="300"><span class="<?php echo (!empty($setting_value['description']) ? "wp_invoice_tooltip" : ""); ?>" title="<?php echo (!empty($setting_value['description']) ? $setting_value['description'] : ''); ?>"><?php echo $setting_value['label']; ?></span></th>
                        <td>
                          <?php if ($setting_value['type'] == 'select') : ?>
                            <?php echo WPI_UI::select("name=wpi_invoice[billing][{$key}][settings][{$key2}][value]&values=" . serialize($setting_value['data']) . "&current_value={$setting_value['value']}"); ?>
                          <?php elseif ($setting_value['type'] == 'textarea') : ?>
                            <?php echo WPI_UI::textarea("name=wpi_invoice[billing][{$key}][settings][{$key2}][value]&value={$setting_value['value']}"); ?>
                          <?php elseif ($setting_value['type'] == 'readonly') : ?>
                            <?php $setting_value['value'] = urlencode($setting_value['value']); ?>
                            <?php echo WPI_UI::textarea("name=wpi_invoice[billing][{$key}][settings][{$key2}][value]&value={$setting_value['value']}&special=readonly='readonly'"); ?>
                          <?php else : ?>
                            <?php echo WPI_UI::input("name=wpi_invoice[billing][{$key}][settings][{$key2}][value]&value={$setting_value['value']}"); ?>
                          <?php endif; ?>
        <?php if (!empty($setting_value['special']) && is_array($setting_value['special']) && $setting_value['type'] != 'select') : ?>
                        <?php $s_count = 0; ?>
                            <br />
          <?php foreach ($setting_value['special'] as $s_label => $s_value): ?>
                              <span class="wp_invoice_click_me" onclick="jQuery('input[name=\'wpi_invoice[billing][<?php echo $key; ?>][settings][<?php echo $key2; ?>][value]\']').val('<?php echo $s_value; ?>');"><?php echo $s_label; ?></span>
                    <?php echo (++$s_count < count($setting_value['special']) ? ' | ' : '' ); ?>
                  <?php endforeach; ?>
        <?php endif; ?>
                        </td>
                      </tr>
      <?php endforeach; ?>
                  </table>
                </div>
              </div>
    <?php endforeach; ?>
          </div>
        </td>
      </tr>

      <tr>
        <th></th>
        <td class="wpi_toggle_advanced_payment_options"><span class="wpi_link"><?php _e('Toggle Advanced Payment Options', WPI); ?></span></td>
      </tr>

    </table>
  <?php } else { ?>
    <table class="form-table">
      <tr>
        <th><?php _e("Payment Method", WPI) ?></th>
        <td>
          <input type="hidden" name="wpi_invoice[default_payment_method]" value="manual" />
          <p><?php echo sprintf(__('To manage payment settings you should accept at least one payment method. Visit <a href="%s">Payment Settings page</a> to setup.', WPI), admin_url('admin.php?page=wpi_page_settings#wpi_tab_payment')); ?></p>
          <p><?php echo sprintf(__('If you do not want to use any payment venue then <a href="%s">setup Manual Payment information</a>.', WPI), admin_url('admin.php?page=wpi_page_settings#wpi_tab_payment')); ?></p>
        </td>
      </tr>
      <tr class="wpi_advanced_payment_options column-publish-currency">
        <th><?php _e("Default Currency", WPI) ?></th>
        <td>
          <select name="wpi_invoice[default_currency_code]">
    <?php foreach ($wpi_settings['currency']['types'] as $value => $currency_x) : ?>
              <option value="<?php echo $value; ?>" <?php echo ($this_invoice['default_currency_code'] == $value) ? 'selected="selected"' : ''; ?>"><?php echo $value; ?> - <?php echo $currency_x; ?></option>
    <?php endforeach; ?>
          </select>
        </td>
      </tr>
      <tr>
        <th></th>
        <td class="wpi_toggle_advanced_payment_options"><span class="wpi_link"><?php _e('Toggle Advanced Payment Options', WPI); ?></span></td>
      </tr>
    </table>

  <?php
  }
}
              if ($key=='wpi_paypal' && $key2=='button_url') {
                $display="display:none;";
              } else {
                $display='';
              }
              ?>

              <tr style="<?php echo $display; ?>">
                <th width="300"><span class="<?php echo (!empty($setting_value['description']) ? "wp_invoice_tooltip" : ""); ?>" title="<?php echo (!empty($setting_value['description']) ? $setting_value['description'] : ''); ?>"><?php echo $setting_value['label']; ?></span></th>
                <td>
                  <?php if (isset($setting_value['type']) && $setting_value['type'] == 'select') : ?>
                    <?php echo WPI_UI::select("name=wpi_settings[billing][{$key}][settings][{$key2}][value]&values=" . serialize($setting_value['data']) . "&current_value=".(!empty($setting_value['value']) ? $setting_value['value'] : "")); ?>
                  <?php elseif (isset($setting_value['type']) && $setting_value['type'] == 'textarea') : ?>
                    <?php echo WPI_UI::textarea("name=wpi_settings[billing][{$key}][settings][{$key2}][value]&value={$setting_value['value']}"); ?>
                  <?php elseif (isset($setting_value['type']) && $setting_value['type'] == 'readonly') : ?>
                    <?php echo WPI_UI::textarea("name=wpi_settings[billing][{$key}][settings][{$key2}][value]&value={$setting_value['value']}&special=readonly='readonly'"); ?>
                  <?php else : ?>
                    <?php echo WPI_UI::input("name=wpi_settings[billing][{$key}][settings][{$key2}][value]&value=".(!empty($setting_value['value']) ? $setting_value['value'] : "")); ?>
                  <?php endif; ?>
                  <?php if (!empty($setting_value['special']) && is_array($setting_value['special']) && (!isset($setting_value['type']) || $setting_value['type'] != 'select')) : ?>
                    <?php $s_count = 0; ?>
                    <br/>
                    <?php foreach($setting_value['special'] as $s_label => $s_value): ?>
                      <span class="wp_invoice_click_me" onclick="jQuery('input[name=\'wpi_settings[billing][<?php echo $key; ?>][settings][<?php echo $key2; ?>][value]\']').val('<?php echo $s_value; ?>');"><?php echo $s_label; ?></span>
                      <?php echo (++$s_count < count($setting_value['special']) ? ' | ' : '' ); ?>
                    <?php endforeach; ?>
                  <?php endif; ?>
                </td>
              </tr>

            <?php } ?>
Esempio n. 4
0
        if (isset($setting_value['type']) && $setting_value['type'] == 'select') {
            ?>
                    <?php 
            echo WPI_UI::select(array('name' => "wpi_settings[billing][{$key}][settings][{$key2}][value]", 'values' => serialize($setting_value['data']), 'current_value' => !empty($setting_value['value']) ? $setting_value['value'] : ""));
            ?>
                  <?php 
        } elseif (isset($setting_value['type']) && $setting_value['type'] == 'textarea') {
            ?>
                    <?php 
            echo WPI_UI::textarea(array('name' => "wpi_settings[billing][{$key}][settings][{$key2}][value]", 'value' => $setting_value['value']));
            ?>
                  <?php 
        } elseif (isset($setting_value['type']) && $setting_value['type'] == 'readonly') {
            ?>
                    <?php 
            echo WPI_UI::textarea(array('name' => "wpi_settings[billing][{$key}][settings][{$key2}][value]", 'value' => $setting_value['value'], 'special' => 'readonly="readonly"'));
            ?>
                  <?php 
        } elseif (isset($setting_value['type']) && $setting_value['type'] == 'static') {
            ?>
                    <p><?php 
            echo !empty($setting_value['data']) ? $setting_value['data'] : '';
            ?>
</p>
                  <?php 
        } else {
            ?>
                    <?php 
            echo WPI_UI::input(array('type' => 'text', 'name' => "wpi_settings[billing][{$key}][settings][{$key2}][value]", 'value' => !empty($setting_value['value']) ? $setting_value['value'] : ""));
            ?>
                  <?php