*/
public function modelAction($actionData = false)
{
- $glm_action = '';
- $option = false;
- $settings_updated = false;
- $settings_update_error = false;
- $custom_fields = false;
- $haveCustomFields = false;
- $where = ' TRUE ';
- $glm_field_tab_name = get_option( 'glm_field_tab_name' );
+ $glm_action = '';
+ $option = false;
+ $settings_updated = false;
+ $settings_update_error = false;
+ $custom_fields = false;
+ $haveCustomFields = false;
+ $where = ' TRUE ';
+ $glm_field_tab_name = get_option( 'glm_field_tab_name' );
+ $glm_field_contact_tab_name = get_option( 'glm_field_contact_tab_name' );
// If tab name option is empty then set it.
if ( !$glm_field_tab_name ) {
update_option( 'glm_field_tab_name', 'Custom Fields', true );
}
+ if ( !$glm_field_contact_tab_name ) {
+ update_option( 'glm_field_contact_tab_name', 'Custom Fields', true );
+ }
if (isset($_REQUEST['option2'])) {
$option = $_REQUEST['option2'];
switch ($option) {
case 'updateTabNameOption':
- // echo '<pre>$_REQUEST: ' . print_r( $_REQUEST, true ) . '</pre>';
$tab_name = filter_var( $_REQUEST['glm_field_tab_name'] );
- update_option( 'glm_field_tab_name', $tab_name, true );
- $glm_field_tab_name = get_option( 'glm_field_tab_name' );
+ if ( $tab_name ) {
+ update_option( 'glm_field_tab_name', $tab_name, true );
+ $glm_field_tab_name = get_option( 'glm_field_tab_name' );
+ }
+ $contact_tab_name = filter_var( $_REQUEST['glm_field_contact_tab_name'] );
+ if ( $contact_tab_name ) {
+ update_option( 'glm_field_contact_tab_name', $contact_tab_name, true );
+ $glm_field_contact_tab_name = get_option( 'glm_field_contact_tab_name' );
+ }
break;
case 'deleteOption':
// Compile template data
$template_data = array(
- 'option2' => $option,
- 'settingsUpdated' => $settings_updated,
- 'settingsUpdateError' => $settings_update_error,
- 'custom_fields' => false,//$custom_fields,
- 'field_types' => $this->config['custom_field_types'],
- 'haveCustomFields' => $haveCustomFields,
- 'uid' => $uid,
- 'glm_action' => $glm_action,
- 'groups' => $groups,
- 'glm_field_tab_name' => $glm_field_tab_name,
+ 'option2' => $option,
+ 'settingsUpdated' => $settings_updated,
+ 'settingsUpdateError' => $settings_update_error,
+ 'custom_fields' => false,//$custom_fields,
+ 'field_types' => $this->config['custom_field_types'],
+ 'haveCustomFields' => $haveCustomFields,
+ 'uid' => $uid,
+ 'glm_action' => $glm_action,
+ 'groups' => $groups,
+ 'glm_field_tab_name' => $glm_field_tab_name,
+ 'glm_field_contact_tab_name' => $glm_field_contact_tab_name,
);
// echo "<pre>Template data:" . print_r($template_data, true) . "</pre>";
+<div style="max-width: 950px;">
{* Add Custom Field Group Button and Dialog Box *}
<div id="newGroupButton" class="button button-primary right">Add A Custom Field Group</div>
</table>
{* Manage name for custom field tab *}
-{if $uid == 'glm-member-db'}
<form id="editFieldForm" action="{$thisUrl}?page={$thisPage}&glm_action={$glm_action}&option=customfields" method="post" enctype="multipart/form-data">
<input type="hidden" name="glm_action" value="{$glm_action}" />
<input type="hidden" name="option" value="customfields" />
<tr>
<th> Tab Name </th>
<td>
- <input name="glm_field_tab_name" value="{$glm_field_tab_name}" />
+ {if $uid == 'glm-member-db'}
+ <input name="glm_field_tab_name" value="{$glm_field_tab_name}" />
+ {else}
+ <input name="glm_field_contact_tab_name" value="{$glm_field_contact_tab_name}" />
+ {/if}
</td>
<th>
<input class="button button-secondary glm-button-small" type="submit" value="Update">
</tr>
</table>
</form>
-{/if}
{* custom fields table *}
<div id="sortable-groups">
<div style="padding: 10px;" class="glm-custom-sortable-group-handle">
<strong>{$group.group_name}</strong>
( {if $group.publish}Published{else}Not Published{/if} )
- <a class="deletGroupButton button button-secondary glm-button-small"
- data-groupId="{$group.id}">Delete</a>
- <a class="groupEdit button button-secondary glm-button-small"
+ <a class="groupEdit button button-secondary glm-button-small dashicons dashicons-edit"
data-groupId="{$group.id}"
data-groupName="{$group.group_name|escape:'html'}"
- data-publish="{$group.publish}">Edit</a>
+ data-publish="{$group.publish}"> </a>
+ <a class="deletGroupButton button button-secondary glm-button-small dashicons dashicons-trash" data-groupId="{$group.id}"> </a>
</div>
<table style="width:100%; background-color: #fff; border: 1px solid black;">
<thead>
{foreach $group.custom_fields as $field}
<tr id="field_{$field.id}" class="glm-custom-sort-field-container">
<td colspan="5" style="border-bottom: 1px solid black;">
- <table style="width:100%; margin: 0;">
+ <table style="width:100%; margin: 0; padding: .5rem;">
<tr>
<td class="glm-custom-sortable-handle">
{$field.field_name}
<td width="10%"> {$field.required.name} </td>
<td width="10%"> {$field.admin_search.name} </td>
<td width="10%" align="right">
- <div class="deleteFieldButton button button-secondary glm-button-small" data-fieldID="{$field.id}">Delete</div>
-
- <div class="editField button button-secondary glm-button-small"
+ <div class="editField button button-secondary glm-button-small dashicons dashicons-edit"
data-fieldID="{$field.id}"
data-fieldName="{$field.field_name|escape:'html'}"
data-fieldType="{$field.field_type.value|escape:'html'}"
data-adminSearch="{$field.admin_search.value}"
data-groupid="{$field.gid}"
data-required="{$field.required.value}"
- >Edit</div>
+ > </div>
+
+ <div class="deleteFieldButton button button-secondary glm-button-small dashicons dashicons-trash" data-fieldID="{$field.id}"> </div>
+
</td>
</tr>
{if $field.field_type.value == 'picklist'}
<tr class="picklist-options-container">
- <td colspan="5" style="padding-left: 2rem;">
+ <td colspan="5" style="padding: .5rem 0 .5rem 3rem;">
<table style="width:100%;">
<thead>
<tr style="background-color: #ddd;">
</thead>
{if $field.options && !empty($field.options)}
{foreach $field.options as $option}
- <tr>
+ <tr {if $option@iteration is div by 2}style="background-color: lightgrey;"{/if}>
<td style="text-align: left;"> {$option.option_value} </td>
<td style="text-align: left;"> {$option.option_text} </td>
<td width="10%">
- <div class="deleteOptionButton button button-secondary glm-button-small"
- data-option-id="{$option.id}">Delete</div>
- <div class="fieldoption button button-secondary glm-button-small"
+ <div class="fieldoption button button-secondary glm-button-small dashicons dashicons-edit"
+ title="Edit"
data-id="{$option.id}"
data-field-id="{$option.field_id}"
data-option-name="{$option.option_value|escape:'html'}"
data-option-value="{$option.option_text|escape:'html'}"
- >Edit</div>
+ > </div>
+
+ <div class="deleteOptionButton button button-secondary glm-button-small dashicons dashicons-trash" title="Delete" data-option-id="{$option.id}"> </div>
</td>
</tr>
{/foreach}
{/foreach}
{/if}
</div>
+</div>
<script type="text/javascript">
jQuery(document).ready(function($) {