*/
public function modelAction ( $actionData = false )
{
-
- $success = true;
- $text = 'text';
- $haveInfoRecords = false;
- $memberInfoRecords = false;
- $noActive = false;
- $showArchived = false;
$memberID = 0;
- $clickThroughCounts = array('day' => 0, 'week' => 0, 'month' => 0);
- $detailViewCounts = array('day' => 0, 'week' => 0, 'month' => 0);
// Enqueue Materialize
wp_register_script(
wp_enqueue_style('admin-css', GLM_MEMBERS_PLUGIN_URL . 'css/glma-admin-sass.css');
wp_enqueue_style('css-icons', "https://fonts.googleapis.com/icon?family=Material+Icons");
+ require_once GLM_MEMBERS_PLUGIN_CLASS_PATH . '/data/dataMemberInfo.php';
+
// Check if there's a logged in user who is locked to their own entity.
$lockedToMember = apply_filters( 'glm_members_locked_to_member_id', false );
$memberID = $lockedToMember;
- // Get the current date, first date of this week, and first date of this month
- $today = date('Y-m-d');
- $thisWeek = date('Y-m-d', strtotime('-'.date('w').' days'));
- $thisMonth = date('Y-m-d', strtotime('-'.(date('j')-1).' days'));
-
- // $clickThroughCounts = $this->wpdb->get_row("
- // SELECT COALESCE ((
- // SELECT clicks
- // FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX."clickthrough_stats
- // WHERE member = $memberID
- // AND stat_type = 1
- // AND stat_date = '$today'
- // ), 0) AS day,
- // COALESCE ((
- // SELECT clicks
- // FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX."clickthrough_stats
- // WHERE member = $memberID
- // AND stat_type = 2
- // AND stat_date = '$thisWeek'
- // ), 0) AS week,
- // COALESCE ((
- // SELECT clicks
- // FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX."clickthrough_stats
- // WHERE member = $memberID
- // AND stat_type = 3
- // AND stat_date = '$thisMonth'
- // ), 0) AS month
- // ", ARRAY_A);
-
- // $detailViewCounts = $this->wpdb->get_row("
- // SELECT COALESCE ((
- // SELECT clicks
- // FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX."member_detail_stats
- // WHERE member = $memberID
- // AND stat_type = 1
- // AND stat_date = '$today'
- // ), 0) AS day,
- // COALESCE ((
- // SELECT clicks
- // FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX."member_detail_stats
- // WHERE member = $memberID
- // AND stat_type = 2
- // AND stat_date = '$thisWeek'
- // ), 0) AS week,
- // COALESCE ((
- // SELECT clicks
- // FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX."member_detail_stats
- // WHERE member = $memberID
- // AND stat_type = 3
- // AND stat_date = '$thisMonth'
- // ), 0) AS month
- // ", ARRAY_A);
-
- // Setup the data Abstract class for member info.
- require_once GLM_MEMBERS_PLUGIN_CLASS_PATH . '/data/dataMemberInfo.php';
- $MemberInfo = new GlmDataMemberInfo($this->wpdb, $this->config);
- $hideArchived = " && T.status != ".$this->config['status_numb']['Archived'];
-
- // Check if there's any member information records.
- if (is_array($memberInfoRecords) && count($memberInfoRecords) > 0) {
- $haveInfoRecords = true;
- }
-
// Create a set of useful data for each registered plugin that has a filter
// Use that filter to retrieve table information, then run query for each 'list' field.
foreach ( $this->config[ 'addOns' ] as $a ) {
$templateData = array(
'lockedToMember' => $lockedToMember,
'member' => $actionData,
- 'showArchived' => $showArchived,
- 'statusTypeNumbers' => $this->config['status_numb'],
'memberID' => $memberID,
- 'haveInfoRecords' => $haveInfoRecords,
- 'memberInfoRecords' => $memberInfoRecords,
- 'clickThroughCounts' => $clickThroughCounts,
- 'detailViewCounts' => $detailViewCounts,
- 'statusPending' => $this->config['status_numb']['Pending'],
'addons' => $addons,
'baseUrl' => GLM_MEMBERS_PLUGIN_URL
);
public function orderSort ($a, $b) { return (strcmp ($a['order'],$b['order'])); }
- public function queryWidgetLists( &$widgetData = false ) {
-
- // foreach ( $widgetData['components'] as &$widgetComponent ) {
- // $where = " TRUE ";
- // $order = "";
- // $limit = "5";
- // if ( isset($widgetComponent['where']) && $widgetComponent['where'] !== "" ) {
- // $where .= " AND " . $widgetComponent['where'];
- // }
- // if ( isset($widgetComponent['orderBy']) && $widgetComponent['orderBy'] !== "" ) {
- // $order .= " ORDER BY " . $widgetComponent['orderBy'];
- // }
- // echo "<br>Result:" . var_dump( $widgetComponent['result'] );
-
- // if ( $widgetComponent['template'] == 'list' && isset($widgetComponent['fields']) && isset($widgetComponent['table']) ) {
- // $table = $widgetComponent['table'];
- // $fields = $widgetComponent['fields'];
- // $resultsQuery = "SELECT " . $fields . " FROM " . $table . " WHERE" . $where . $order . " LIMIT " . $limit . ";";
- // //echo "<br>" .$resultsQuery;
- // $widgetComponent['sql'] = $resultsQuery;
- // $widgetComponent['listItems'] = $this->wpdb->get_results($resultsQuery);
-
- // if ( isset($widgetComponent['listItems']) ) {
- // foreach ( $widgetComponent['listItems'] as &$listItem ) {
- // if ( isset($listItem->ref_type) ) {
- // // Get the ref type from the config array - has to be forced lowercase due to inconsistency
- // // in url vs config array reference to ref_type (e.g. member vs Member, and member vs members)
- // $listItem->ref_type = strtolower($this->config['ref_type'][$listItem->ref_type]);
- // }
- // }
- // }
- // $countQuery = "SELECT COUNT(" . $widgetComponent['entityID'] . ") FROM " . $widgetComponent['table'] . " WHERE " . $where . ";";
- // $widgetComponent['count'] = $this->wpdb->get_var($countQuery);
-
- // }
- // if ( isset($widgetComponent['table']) && ($widgetComponent['template'] == 'list' || $widgetComponent['template'] == 'entityAmount') ) {
- //$table = $widgetComponent['table'];
- //$countQuery = "SELECT COUNT(id) FROM " . $widgetComponent['table'] . " WHERE " . $where . ";";
- //echo "<br>" .$countQuery;
- //$widgetComponent['count'] = $this->wpdb->get_var($countQuery);
- //echo "<pre>" . var_dump($widgetComponent['count']) . "</pre>";
- // }
- // }
- return $widgetData;
- }
-
}