Coded registration settings view and model. L#2
authorLaury GvR <laury@gaslightmedia.com>
Tue, 7 Feb 2017 20:32:33 +0000 (15:32 -0500)
committerLaury GvR <laury@gaslightmedia.com>
Tue, 7 Feb 2017 20:32:33 +0000 (15:32 -0500)
classes/data/dataManagement.php
models/admin/management/registrations.php
setup/validActions.php
views/admin/management/footer.html
views/admin/management/header.html
views/admin/management/registrations.html

index 5d8eb6a..92a1595 100644 (file)
@@ -314,7 +314,7 @@ class GlmDataRegistrationsManagement extends GlmDataAbstract
                 'use'      => 'a'
             ),
 
-            // Billing Info used for No Charge - Bitmap
+            // Billing Info used for Comp Code - Bitmap
             'reg_bill_info_req_comp_code' => array (
                 'field' => 'reg_bill_info_req_comp_code',
                 'type'     => 'bitmap',
index a0c27c3..bd56d6c 100644 (file)
@@ -52,14 +52,6 @@ class GlmMembersAdmin_management_registrations extends GlmDataRegistrationsManag
      * @access public
      */
     public $settings = array();
-    /**
-     * categories
-     *
-     * @var bool
-     * @access public
-     */
-    public $categories = array();
-    public $oldCatMap = array();
     /**
      * registrations
      *
@@ -67,7 +59,6 @@ class GlmMembersAdmin_management_registrations extends GlmDataRegistrationsManag
      * @access public
      */
     public $registrations = array();
-    public $image_owner;
 
     /**
      * Constructor
@@ -118,34 +109,97 @@ class GlmMembersAdmin_management_registrations extends GlmDataRegistrationsManag
     public function modelAction($actionData = false)
     {
 
-        $option                = false;
-        $test_result           = false;
-        $import_result         = false;
-        $settings_updated      = false;
-        $settings_update_error = false;
-        $registration_settings = false;
-        $icalFeedResult        = false;
-        $import_feeds          = false;
-        $option2               = false;
-
-        if (isset($_REQUEST['option'])) {
-            $option = $_REQUEST['option'];
+        $option                 = false;
+        $option2                = false;
+        $settings_updated       = false;
+        $settings_update_error  = false;
+        $reg_settings           = false;
+        $id                     = 1;
+        
+
+        // Determine if current user can edit configurations
+        if (!current_user_can('glm_members_management')) {
+            return array(
+                'status'           => false,
+                'menuItemRedirect' => 'error',
+                'modelRedirect'    => 'index',
+                'view'             => 'admin/error/index.html',
+                'data'             => array(
+                    'reason' => 'User does not have rights to make configuration changes.'
+                )
+            );
+        }
+
+        // Check for submission option
+        $option2 = '';
+        if (isset($_REQUEST['option2'])) {
+            $option2 = $_REQUEST['option2'];
+        }
+
+        switch($option2) {
+
+            // Update the settings and redisplay the form
+            case 'submit':
+
+                // Update the event management settings
+                $reg_settings = $this->updateEntry( $id );
+                if ($reg_settings['status']) {
+                    $settings_updated = true;
+                } else {
+                    $settings_update_error = true;
+                }
+
+                break;
+
+            // Default is to get the current settings and display the form
+            default:
+
+                // Try to get the first (should be only) entry for general settings.
+                $reg_settings = $this->editEntry( $id );
+                //echo '<pre>$reg_settings: ' . print_r( $reg_settings, true ) . '</pre>';
+
+                if ($reg_settings === false) {
+
+                    if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
+                        glmMembersAdmin::addNotice("<b>&nbsp;&nbsp;/models/admin/management/events.php: Unable to load events management settings.", 'Alert');
+                    }
+
+                }
+
+                break;
+
         }
 
+
+
+        
+        // Try to get the first (should be only) entry for general settings.
+        $regSettings = $this->editEntry( $id );
+
+        if ( $regSettings === false ) {
+
+            if ( GLM_MEMBERS_PLUGIN_ADMIN_DEBUG ) {
+                glmMembersAdmin::addNotice("<b>&nbsp;&nbsp;/modesl/admin/settings/index.php: Unable to load General Settings.", 'Alert');
+            }
+        }
+        
+        
         // Compile template data
         $template_data = array(
-            'option'              => $option,
-            'testval'             => 'abc'
+            'regSettings'           => $reg_settings,
+            'option'                => $option,
+            'settingsUpdated'       => $settings_updated,
+            'settingsUpdateError'   => $settings_update_error,
         );
         
-        echo "<pre>" . print_r("I get here") . "</pre>";
+        //echo "<pre>" . print_r($regSettings, true) . "</pre>";
         // Return status, suggested view, and data to controller
         return array(
-            'status'           => true,
-            'menuItemRedirect' => false,
-            'modelRedirect'    => false,
-            'view'             => 'admin/management/registrations.html',
-            'data'             => $template_data
+            'status'                => true,
+            'menuItemRedirect'      => false,
+            'modelRedirect'         => false,
+            'view'                  => 'admin/management/registrations.html',
+            'data'                  => $template_data
         );
 
 
index e4f1020..5209ebc 100644 (file)
@@ -65,8 +65,7 @@ $glmMembersRegistrationsAddOnValidActions = array(
         ),
         'management' => array(
             'registrations' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_SLUG,
-            'general'   => GLM_MEMBERS_REGISTRATIONS_PLUGIN_SLUG,
-            'regterms' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_SLUG
+            'regterms'      => GLM_MEMBERS_REGISTRATIONS_PLUGIN_SLUG
         ),
     ),
     'frontActions' => array(
index 14acd2f..f491223 100644 (file)
@@ -7,9 +7,9 @@
              */
             // Flash certain elements for a short time after display
             $(".glm-flash-updated").fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500);
-
-            if('{$registrationsSettings.fieldData.calendar_view}'){
-                $("#calendar-view").val('{$registrationsSettings.fieldData.calendar_view}');
+            if('{literal}{$registrationsSettings.fieldData.calendar_view}{/literal}'){
+                $("#calendar-view").val('{literal}{$registrationsSettings.fieldData.calendar_view}{/literal}');
             } else {
                 $("#calendar-view").val("agenda");
             }
index 84f6558..e7a2338 100644 (file)
@@ -1,4 +1,6 @@
+There's some text here too atop header.html
 <h2 class="nav-tab-wrapper" style="margin-bottom: 1em;">
+    
     <input type="hidden" name="glm_action" value="general">
     
     
@@ -11,5 +13,6 @@
        class="glm-settings-tab nav-tab{if $option=='terms'  }{/if}">
         Terms
     </a>
-    cool
-</h2>
\ No newline at end of file
+    
+</h2>
+This is at the bottom of header.html
index 69160d2..ddcc5ea 100644 (file)
@@ -1,3 +1,263 @@
 {include file='admin/management/header.html'}
+<h2 class="nav-tab-wrapper" style="margin-bottom: 1em;">
+        
+    <a id="glm-settings" data-show-table="glm-table-registrations" href="{$thisUrl}?page=glm-members-admin-menu-management&glm_action=registrations" 
+       class="glm-settings-tab nav-tab{if $option=='registrations'} nav-tab-active{/if}">
+        General
+    </a>
+    
+    <a id="glm-settings" data-show-table="glm-table-regterms" href="{$thisUrl}?page=glm-members-admin-menu-management&glm_action=regterms"  
+       class="glm-settings-tab nav-tab{if $option=='regterms'} nav-tab-active{/if}">
+        Terms
+    </a>
+    
+</h2>
 
-This is my story
+
+<table id="glm-table-settings" class="glm-admin-table glm-settings-table">
+    <tr>
+        <td colspan="2">
+            {if $settingsUpdated}<h2 class="glm-notice glm-flash-updated glm-right">Settings Updated</h2>{/if}
+            {if $settingsUpdateError}<span class="glm-error glm-flash-updated glm-right">Settings Update Error</span>{/if}
+            <h3>Registrations General Settings</h3>
+        </td>
+    </tr>
+    <tr>
+        <td>
+                             
+            <form action="{$thisUrl}?page={$thisPage}" method="post" enctype="multipart/form-data">
+                <input type="hidden" name="glm_action" value="registrations">
+                <input type="hidden" name="option" value="registrations">
+                <input type="hidden" name="option2" value="submit">
+
+                <table>
+                    <tr>
+                        <th>Event Registration Page Permalink Name:</th>
+                        <td>
+                            <input type="text" name="canonical_reg_page" value="{$regSettings.fieldData.canonical_reg_page}">
+                            <br>Use only the page name at the end of the permalink for the member detail page.
+                        </td>
+                    </tr>
+                    <tr>
+                        <th>Organization Name</th>
+                        <td>
+                            <input type='text' name="reg_org_name" value="{$regSettings.fieldData.reg_org_name}">
+                        </td>
+                    </tr>
+                    <tr>
+                        <th>Organization Short Name</th>
+                        <td>
+                            <input type='text' name="reg_org_short" value="{$regSettings.fieldData.reg_org_short}">
+                        </td>
+                    </tr>
+                    <tr>
+                        <th>Organization Address</th>
+                        <td>
+                            <input type='text' name="reg_org_name" value="{$regSettings.fieldData.reg_org_address}">
+                        </td>
+                    </tr>
+                    <tr>
+                        <th>Organization City</th>
+                        <td>
+                            <input type='text' name="reg_org_city" value="{$regSettings.fieldData.reg_org_city}">
+                        </td>
+                    </tr>
+                    <tr>
+                        <th>Organization State</th>
+                        <td>
+                            <input type='text' name="reg_org_name" value="{$regSettings.fieldData.reg_org_state}">
+                        </td>
+                    </tr>
+                    <tr>
+                        <th>Organization Zip/Postal Code</th>
+                        <td>
+                            <input type='text' name="reg_org_zip" value="{$regSettings.fieldData.reg_org_zip}">
+                        </td>
+                    </tr>
+                    <tr>
+                        <th>Organization Phone</th>
+                        <td>
+                            <input type='text' name="reg_org_phone" value="{$regSettings.fieldData.reg_org_phone}">
+                        </td>
+                    </tr>
+                    <tr>
+                        <th>Organization Toll Free</th>
+                        <td>
+                            <input type='text' name="reg_org_toll_free" value="{$regSettings.fieldData.reg_org_toll_free}">
+                        </td>
+                    </tr>
+                    <tr>
+                        <th>Organization Internal E-Mail</th>
+                        <td>
+                            <input type='text' name="reg_org_internal_email" value="{$regSettings.fieldData.reg_org_internal_email}">
+                        </td>
+                    </tr>
+                    <tr>
+                        <th>Organization 'from" E-Mail</th>
+                        <td>
+                            <input type='text' name="reg_org_from_email" value="{$regSettings.fieldData.reg_org_from_email}">
+                        </td>
+                    </tr>
+                    <tr>
+                        <th {if $regSettings.fieldRequired.reg_payment_methods}class="glm­required"{/if}>Payment Methods:</th>
+                        <td {if $regSettings.fieldFail.reg_payment_methods}class="glm­form­bad­input" data­tabid="glm-reg-payment-methods"{/if}>
+                      {foreach from=$regSettings.fieldData.reg_payment_methods.bitmap item=v}
+                            <input type="checkbox" name="reg_payment_methods[{$v.value}]" value="{$v.value}"{if $v.default} checked{/if}> {$v.name}<br>
+                      {/foreach}                    
+                            {if $regSettings.fieldFail.reg_payment_methods}<p>{$regSettings.fieldFail.reg_payment_methods}</p>{/if}
+                        </td>
+                    </tr>
+                    <tr>
+                        <th {if $regSettings.fieldRequired.reg_proc_methods}class="glm­required"{/if}>Processing Methods:</th>
+                        <td {if $regSettings.fieldFail.reg_proc_methods}class="glm­form­bad­input" data­tabid="glm-reg-processing-methods"{/if}>
+                      {foreach from=$regSettings.fieldData.reg_proc_methods.bitmap item=v}
+                            <input type="checkbox" name="reg_proc_methods[{$v.value}]" value="{$v.value}"{if $v.default} checked{/if}> {$v.name}<br>
+                      {/foreach}                    
+                            {if $regSettings.fieldFail.reg_proc_methods}<p>{$regSettings.fieldFail.reg_proc_methods}</p>{/if}
+                        </td>
+                    </tr>
+                    <tr>
+                        <th {if $regSettings.fieldRequired.reg_cc_accepts}class="glm­required"{/if}>Credit Card Accepted:</th>
+                        <td {if $regSettings.fieldFail.reg_cc_accepts}class="glm­form­bad­input" data­tabid="glm-reg-cc-accepts"{/if}>
+                      {foreach from=$regSettings.fieldData.reg_cc_accepts.bitmap item=v}
+                            <input type="checkbox" name="reg_cc_accepts[{$v.value}]" value="{$v.value}"{if $v.default} checked{/if}> {$v.name}<br>
+                      {/foreach}                    
+                            {if $regSettings.fieldFail.reg_cc_accepts}<p>{$regSettings.fieldFail.reg_cc_accepts}</p>{/if}
+                        </td>
+                    </tr>
+                    <tr>
+                        <th>Authorize.net Login</th>
+                        <td>
+                            <input type='text' name="reg_authorize_net_login" value="{$regSettings.fieldData.reg_authorize_net_login}">
+                        </td>
+                    </tr>
+                    <tr>
+                        <th>Authorize.net Key</th>
+                        <td>
+                            <input type='text' name="reg_authorize_net_key" value="{$regSettings.fieldData.reg_authorize_net_key}">
+                        </td>
+                    </tr>
+                    <tr>
+                        <th {if $regSettings.fieldRequired.reg_authorize_net_test}class="glm­required"{/if}>Authorize.net Test Mode:</th>
+                        <td {if $regSettings.fieldFail.reg_authorize_net_test}class="glm­form­bad­input" data­tabid="glm-reg-authorize-net-test"{/if}>
+                      {foreach from=$regSettings.fieldData.reg_authorize_net_test.list item=v}
+                            <input type="checkbox" name="reg_authorize_net_test[{$v.value}]" value="{$v.value}"{if $v.default} checked{/if}> {$v.name}<br>
+                      {/foreach}                    
+                            {if $regSettings.fieldFail.reg_authorize_net_test}<p>{$regSettings.fieldFail.reg_authorize_net_test}</p>{/if}
+                        </td>
+                    </tr>
+                    <tr>
+                        <th>Always Use Full Billing Info</th>
+                        <td>
+                            <input type="checkbox" name="reg_authorize_net_conf"{if $regSettings.fieldData.reg_authorize_net_conf.value} checked="checked"{/if}>
+                        </td>
+                    </tr>
+                    <tr>
+                        <th>Authorize.net Merchant Email</th>
+                        <td>
+                            <input type='text' name="reg_authorize_net_merchant_email" value="{$regSettings.fieldData.reg_authorize_net_merchant_email}">
+                        </td>
+                    </tr>
+                    <tr>
+                        <th>Merchant Solutions Account ID</th>
+                        <td>
+                            <input type='text' name="reg_merchant_solutions_acctid" value="{$regSettings.fieldData.reg_merchant_solutions_acctid}">
+                        </td>
+                    </tr>
+                    <tr>
+                        <th>Merchant Solutions Merchant PIN</th>
+                        <td>
+                            <input type='text' name="reg_merchant_solutions_merchantpin" value="{$regSettings.fieldData.reg_merchant_solutions_merchantpin}">
+                        </td>
+                    </tr>
+                    <tr>
+                        <th {if $regSettings.fieldRequired.reg_merchant_solutions_test}class="glm­required"{/if}>Merchant Solutions Test Mode:</th>
+                        <td {if $regSettings.fieldFail.reg_merchant_solutions_test}class="glm­form­bad­input" data­tabid="glm-reg-merchant-solutions-test"{/if}>
+                      {foreach from=$regSettings.fieldData.reg_merchant_solutions_test.list item=v}
+                            <input type="checkbox" name="reg_merchant_solutions_test[{$v.value}]" value="{$v.value}"{if $v.default} checked{/if}> {$v.name}<br>
+                      {/foreach}                    
+                            {if $regSettings.fieldFail.reg_merchant_solutions_test}<p>{$regSettings.fieldFail.reg_merchant_solutions_test}</p>{/if}
+                        </td>
+                    </tr>
+                    <tr>
+                        <th>Always Use Full Billing Info</th>
+                        <td>
+                            <input type="checkbox" name="reg_full_billing_info"{if $regSettings.fieldData.reg_full_billing_info.value} checked="checked"{/if}>
+                        </td>
+                    </tr>
+                    <tr>
+                        <th {if $regSettings.fieldRequired.reg_bill_info_req_no_charge}class="glm­required"{/if}>Billing Info used for No Charge:</th>
+                        <td {if $regSettings.fieldFail.reg_bill_info_req_no_charge}class="glm­form­bad­input" data­tabid="glm-reg-bill-info-req-no-charge"{/if}>
+                      {foreach from=$regSettings.fieldData.reg_bill_info_req_no_charge.bitmap item=v}
+                            <input type="checkbox" name="reg_bill_info_req_no_charge[{$v.value}]" value="{$v.value}"{if $v.default} checked{/if}> {$v.name}<br>
+                      {/foreach}                    
+                            {if $regSettings.fieldFail.reg_bill_info_req_no_charge}<p>{$regSettings.fieldFail.reg_bill_info_req_no_charge}</p>{/if}
+                        </td>
+                    </tr>
+                    <tr>
+                        <th {if $regSettings.fieldRequired.reg_bill_info_req_comp_code}class="glm­required"{/if}>Billing Info used for Comp Code:</th>
+                        <td {if $regSettings.fieldFail.reg_bill_info_req_comp_code}class="glm­form­bad­input" data­tabid="glm-reg-bill-info-req-comp-code"{/if}>
+                      {foreach from=$regSettings.fieldData.reg_bill_info_req_comp_code.bitmap item=v}
+                            <input type="checkbox" name="reg_bill_info_req_comp_code[{$v.value}]" value="{$v.value}"{if $v.default} checked{/if}> {$v.name}<br>
+                      {/foreach}                    
+                            {if $regSettings.fieldFail.reg_bill_info_req_comp_code}<p>{$regSettings.fieldFail.reg_bill_info_req_comp_code}</p>{/if}
+                        </td>
+                    </tr>
+                    <tr>
+                        <th {if $regSettings.fieldRequired.reg_bill_info_req_cash}class="glm­required"{/if}>Billing Info used for Cash:</th>
+                        <td {if $regSettings.fieldFail.reg_bill_info_req_cash}class="glm­form­bad­input" data­tabid="glm-reg-bill-info-req-cash"{/if}>
+                      {foreach from=$regSettings.fieldData.reg_bill_info_req_cash.bitmap item=v}
+                            <input type="checkbox" name="reg_bill_info_req_cash[{$v.value}]" value="{$v.value}"{if $v.default} checked{/if}> {$v.name}<br>
+                      {/foreach}                    
+                            {if $regSettings.fieldFail.reg_bill_info_req_cash}<p>{$regSettings.fieldFail.reg_bill_info_req_cash}</p>{/if}
+                        </td>
+                    </tr>
+                    <tr>
+                        <th {if $regSettings.fieldRequired.reg_bill_info_req_check}class="glm­required"{/if}>Billing Info used for Check:</th>
+                        <td {if $regSettings.fieldFail.reg_bill_info_req_check}class="glm­form­bad­input" data­tabid="glm-reg-bill-info-req-check"{/if}>
+                      {foreach from=$regSettings.fieldData.reg_bill_info_req_check.bitmap item=v}
+                            <input type="checkbox" name="reg_bill_info_req_check[{$v.value}]" value="{$v.value}"{if $v.default} checked{/if}> {$v.name}<br>
+                      {/foreach}                    
+                            {if $regSettings.fieldFail.reg_bill_info_req_check}<p>{$regSettings.fieldFail.reg_bill_info_req_check}</p>{/if}
+                        </td>
+                    </tr>
+                    <tr>
+                        <th {if $regSettings.fieldRequired.reg_bill_info_req_credit_card}class="glm­required"{/if}>Billing Info used for Credit Card:</th>
+                        <td {if $regSettings.fieldFail.reg_bill_info_req_credit_card}class="glm­form­bad­input" data­tabid="glm-reg-bill-info-req-credit-card"{/if}>
+                      {foreach from=$regSettings.fieldData.reg_bill_info_req_credit_card.bitmap item=v}
+                            <input type="checkbox" name="reg_bill_info_req_credit_card[{$v.value}]" value="{$v.value}"{if $v.default} checked{/if}> {$v.name}<br>
+                      {/foreach}                    
+                            {if $regSettings.fieldFail.reg_bill_info_req_credit_card}<p>{$regSettings.fieldFail.reg_bill_info_req_credit_card}</p>{/if}
+                        </td>
+                    </tr>
+                    <tr>
+                        <th {if $regSettings.fieldRequired.reg_bill_info_req_merchant_call}class="glm­required"{/if}>Billing Info used for Payment by Call From Merchant:</th>
+                        <td {if $regSettings.fieldFail.reg_bill_info_req_merchant_call}class="glm­form­bad­input" data­tabid="glm-reg-bill-info-req-merchant-call"{/if}>
+                      {foreach from=$regSettings.fieldData.reg_bill_info_req_merchant_call.bitmap item=v}
+                            <input type="checkbox" name="reg_bill_info_req_merchant_call[{$v.value}]" value="{$v.value}"{if $v.default} checked{/if}> {$v.name}<br>
+                      {/foreach}                    
+                            {if $regSettings.fieldFail.reg_bill_info_req_merchant_call}<p>{$regSettings.fieldFail.reg_bill_info_req_merchant_call}</p>{/if}
+                        </td>
+                    </tr>
+                    <tr>
+                        <th>Enable Request for Medical Info</th>
+                        <td>
+                            <input type="checkbox" name="reg_medical_info"{if $regSettings.fieldData.reg_medical_info.value} checked="checked"{/if}>
+                        </td>
+                    </tr>
+
+                </table>
+                <input type="submit" value="Update Settings" class="button-primary">
+
+            </form>
+            
+        </td>
+    </tr>
+</table>
+
+
+
+
+
+
+{include file='admin/management/footer.html'}
\ No newline at end of file