Update routines
This commit is contained in:
parent
f9238eef72
commit
138b3859aa
@ -42,50 +42,47 @@ class MainController
|
|||||||
{
|
{
|
||||||
global $dbHandler, $wpdb;
|
global $dbHandler, $wpdb;
|
||||||
|
|
||||||
$show_menu = false;
|
$no_events = true;
|
||||||
|
|
||||||
foreach ([self::KOMPASS_EVENTS_EVENTS] as $table) {
|
foreach ( [ self::KOMPASS_EVENTS_EVENTS ] as $table ) {
|
||||||
$sqlTable = $wpdb->prefix . $table;
|
$sqlTable = $wpdb->prefix . $table;
|
||||||
$sql = "SHOW TABLES LIKE '$sqlTable'";
|
$sql = "SHOW TABLES LIKE '$sqlTable'";
|
||||||
|
|
||||||
$result = $wpdb->get_var( $sql );
|
$result = $wpdb->get_var( $sql );
|
||||||
if ( $result == $sqlTable ) {
|
if ( $result == $sqlTable ) {
|
||||||
$show_menu = true;
|
|
||||||
|
$no_events = 0 === $dbHandler->countSqlRows( self::KOMPASS_EVENTS_EVENTS, [ 'archived' => false ] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$show_menu) {
|
|
||||||
return;
|
if ( !$no_events ) {
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
add_menu_page(
|
add_menu_page(
|
||||||
__('Events (legacy)', BDP_LV_PLUGIN_SLUG),
|
__( 'Events (legacy)', BDP_LV_PLUGIN_SLUG ),
|
||||||
__('Events (legacy)', BDP_LV_PLUGIN_SLUG),
|
__( 'Events (legacy)', BDP_LV_PLUGIN_SLUG ),
|
||||||
'send_mails',
|
'send_mails',
|
||||||
'kompass-events',
|
'kompass-events',
|
||||||
[$this, 'router'],
|
[ $this, 'router' ],
|
||||||
'dashicons-tickets-alt',
|
'dashicons-tickets-alt',
|
||||||
3
|
3
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach ($dbHandler->readFromDb( self::KOMPASS_EVENTS_EVENTS, ['archived' => false]) as $currentEvent) {
|
foreach ( $dbHandler->readFromDb( self::KOMPASS_EVENTS_EVENTS, [ 'archived' => false ] ) as $currentEvent ) {
|
||||||
add_submenu_page(
|
add_submenu_page(
|
||||||
'kompass-events',
|
'kompass-events',
|
||||||
$currentEvent->event_name,
|
$currentEvent->event_name,
|
||||||
$currentEvent->event_name,
|
$currentEvent->event_name,
|
||||||
'show_groups',
|
'show_groups',
|
||||||
'kompass-events&action=show-event&event-id=' . $currentEvent->id,
|
'kompass-events&action=show-event&event-id=' . $currentEvent->id,
|
||||||
[ $this, 'router' ]);
|
[ $this, 'router' ] );
|
||||||
}
|
}
|
||||||
|
|
||||||
add_submenu_page(
|
|
||||||
'kompass-events',
|
|
||||||
__('New Event', BDP_LV_PLUGIN_SLUG),
|
|
||||||
__('New Event', BDP_LV_PLUGIN_SLUG),
|
|
||||||
'show_groups',
|
|
||||||
'kompass-events&action=new-event',
|
|
||||||
[ $this, 'router' ]);
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function router()
|
public function router()
|
||||||
|
Loading…
Reference in New Issue
Block a user