* @var mixed
* @access public
*/
- public $dbh;
+ public $config;
/**
* settings used for the schema and tablenames
*
* @var mixed
* @access public
*/
- public $settings = array();
- /**
- * registrations
- *
- * @var bool
- * @access public
- */
- public $registrations = array();
+// public $settings = array();
+// /**
+// * registrations
+// *
+// * @var bool
+// * @access public
+// */
+// public $registrations = array();
/**
* Constructor
* @return void
*/
public function modelAction($actionData = false)
- {
-
- $option = false;
- $option2 = false;
- $settings_updated = false;
- $settings_update_error = false;
- $reg_settings = false;
- $id = 1;
-
-
+ {
+ // General settings are always stored in a record with ID=1.
+ $id = 1;
// Determine if current user can edit configurations
if (!current_user_can('glm_members_management')) {
return array(
}
// Check for submission option
- $option2 = '';
- if (isset($_REQUEST['option2'])) {
- $option2 = $_REQUEST['option2'];
+ // Check for submission option
+
+ // Check for submission option
+ $option = '';
+ if (isset($_REQUEST['option']) && $_REQUEST['option'] == 'submit') {
+ $option = $_REQUEST['option'];
}
- switch($option2) {
+ switch( $option ) {
// 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;
- }
+ // Update the general settings
+ $reg_settings = $this->updateEntry( 1 );
+
+ echo "<pre>" . print_r($reg_settings, true) . "</pre>";
+
+ // Display admin message that the data has been updated
+ glmMembersAdmin::addNotice('General Settings for the '.GLM_MEMBERS_REGISTRATIONS_PLUGIN_NAME.' plugin have been updated.', 'AdminNotice');
break;
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>';
+ $reg_settings = $this->editEntry( 1 );
+ echo "<pre>" . print_r($reg_settings, true) . "</pre>";
+
+ // Check that we actually have the terms
if ($reg_settings === false) {
if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
- glmMembersAdmin::addNotice("<b> /models/admin/management/events.php: Unable to load events management settings.", 'Alert');
+ glmMembersAdmin::addNotice("<b>/modesl/admin/settings/terms.php:</b> Unable to load Terms Settings.", 'Alert');
}
+ return array(
+ 'status' => false,
+ 'menuItemRedirect' => 'error',
+ 'modelRedirect' => 'index',
+ 'view' => 'admin/error/index.html',
+ 'data' => array(
+ 'reason' => 'Unable to create terms settings entry in database.'
+ )
+ );
}
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> /modesl/admin/settings/index.php: Unable to load General Settings.", 'Alert');
- }
- }
-
// Compile template data
$template_data = array(
'regSettings' => $reg_settings,
'option' => $option,
- 'settingsUpdated' => $settings_updated,
- 'settingsUpdateError' => $settings_update_error,
+// 'settingsUpdated' => $settings_updated,
+// 'settingsUpdateError' => $settings_update_error,
);
//echo "<pre>" . print_r($regSettings, true) . "</pre>";
'view' => 'admin/management/registrations.html',
'data' => $template_data
);
-
-
- }
-
- /**
- * connectPostgresDb
- *
- * Make a connection to the given database for the site. (postgres)
- * Sets the $this->dbh with the postgers database connection
- *
- * @param mixed $db_host
- * @param mixed $db_name
- * @param mixed $db_user
- * @param mixed $db_password
- * @access public
- * @return void
- */
- public function connectPostgresDb($db_host, $db_name, $db_user, $db_password)
- {
- $conn_str = "pgsql:";
- if ( $db_host ) {
- $conn_part[] = "host={$db_host}";
- }
- if ( $db_name ) {
- $conn_part[] = "dbname={$db_name}";
- }
- if ( $db_user ) {
- $conn_part[] = "user={$db_user}";
- }
- if ( $db_password ) {
- $conn_part[] = "password={$db_password}";
- }
- if ( !empty($conn_part) ) {
- $conn_str .= implode( " ", $conn_part );
- }
- $driver_options = array(
- PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_BOTH,
- );
- try {
- $this->dbh = new PDO($conn_str, null, null, $driver_options);
- $this->dbh->setAttribute(
- PDO::ATTR_ERRMODE,
- PDO::ERRMODE_EXCEPTION
- );
- } catch(PDOException $e) {
- echo '<pre>$e: ' . print_r($e, true) . '</pre>';
- wp_die();
- }
}
}
-
-?>
+?>
\ No newline at end of file
<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}">
+ class="glm-settings-tab nav-tab{if $option=='registrations' || $option==''} nav-tab-active{/if}">
General
</a>
<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}
+<!-- {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">
+ <input type="hidden" name="option" value="submit">
<table>
<tr>