add_filter(
GLM_MEMBERS_EVENTS_PLUGIN_SLUG .'-dashboard-widget',
function ( $member = null ) {
+ require_once GLM_MEMBERS_EVENTS_PLUGIN_CLASS_PATH.'/data/dataEvents.php';
+ $Events = new GlmDataEvents($this->wpdb, $this->config);
+
+ // Set default values for using getList() later, where the custom set of fields below will be used.
+ $where = '';
+ $order = '';
+ $fieldVals = true;
+ $idField = 'id';
+ $start = false;
+ $limit = false;
+
+ // Save the current fields array and make a copy. Will be restored before the return.
+ $fSave = $Events->fields;
+
+ // Remove what we don't want from the copy and get the list
+ $Events->fields = array(
+ 'id' => $fSave['id'],
+ 'name' => $fSave['name'],
+ 'name_slug' => $fSave['name_slug'],
+ 'ref_type' => $fSave['ref_type'],
+ 'ref_dest' => $fSave['ref_dest'],
+ 'ref_dest_id' => $fSave['ref_dest_id'],
+ 'status' => $fSave['status'],
+ );
+
$eventsIndexPage = GLM_MEMBERS_EVENTS_PLUGIN_ADMIN_URL . '?page=glm-members-admin-menu-events-index&glm_action=edit';
$eventsTable = GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . "events";
$eventsEditPage = GLM_MEMBERS_PLUGIN_ADMIN_MENU_URL_BASE.'events-index&glm_action=list&option=edit';
$eventsListPage = GLM_MEMBERS_EVENTS_PLUGIN_ADMIN_URL . '?page=glm-members-admin-menu-events-list';
+ $eventsRefLink = GLM_MEMBERS_EVENTS_PLUGIN_ADMIN_URL . '?page=glm-members-admin-menu-member&glm_action=index';
$content = [
'title' => 'Events',
'components' => [
'title' => 'Number of Events',
'order' => 1,
'template' => 'entityAmount',
- 'table' => $eventsTable,
'url' => $eventsIndexPage . "&option=search",
+ 'result' => $Events->getStats(),
],
[
'id' => 'textSearch',
'resultUrl' => $eventsListPage.'&event=',
],
[
- 'id' => 'pending',
- 'title' => "Pending Events",
- 'slug' => "pending-events",
- 'order' => 3,
- 'template' => 'list',
- 'entityID' => 'eventID',
- 'table' => $eventsTable,
- 'fields' => "id, name as title, ref_dest, ref_type, status",
- 'where' => 'status='.$this->config['status_numb']['Pending'] . '',
- 'resultUrl' => $eventsEditPage,
+ 'id' => 'pending-events',
+ 'title' => 'Pending Events',
+ 'slug' => 'pending-events',
+ 'order' => 3,
+ 'template' => 'list',
+ 'entityID' => 'event',
+ 'defaultRefType'=> 'member',
+ 'refLink' => $eventsRefLink,
+ 'url' => $eventsEditPage,
+ 'result' => $Events->getList("status=".$Events->config['status_numb']['Pending'], $order, $fieldVals, $idField, $start, $limit),
+ 'count' => $Events->getStats("status=".$Events->config['status_numb']['Pending'], $order, $fieldVals, $idField, $start, $limit),
+ 'fieldMap' => [
+ 'id' => 'id',
+ 'ref_dest_name' => 'ref_dest',
+ 'name' => 'name',
+ 'ref_type' => 'ref_type',
+ 'ref_dest_id' => 'ref_dest_id',
+ 'status' => 'status'
+ ],
],
]
];
- return $content;
+ // Restore the fields list
+ $Events->fields = $fSave;
+
+ return $content;
},
13,
1