' . __('Notifications entries','attention-bar'); if (isset($_REQUEST['edit'])) { echo ' ' . __('New entry','attention-bar') . '

'; } else { echo ''; } $msg = ''; if ( !empty($_POST) && check_admin_referer('nb_submit','nb_nonce') ){ if($_POST['notbar_hidden_post'] == 'Y') { if($_POST['notbar_hidden_edit'] == 'Y') { // entry has been edited, only update the existing entry nb_edit_entry($_POST['nb_id']); if ( function_exists('w3tc_pgcache_flush') ) { w3tc_pgcache_flush(); $msg .= __(' & W3 Total Cache Page Cache flushed'); } echo '

' . __('Updated:','attention-bar') . ' ' . $_POST['nb_name'] . $msg . '

'; } else { nb_insert_entry(); if ( function_exists('w3tc_pgcache_flush') ) { w3tc_pgcache_flush(); $msg .= __(' & W3 Total Cache Page Cache flushed'); } echo '

' . __('Saved:','attention-bar') . ' ' . $_POST['nb_name'] . $msg . '

'; } } } if (isset($_REQUEST['delete'])) { nb_delete_entry($_REQUEST['id']); if ( function_exists('w3tc_pgcache_flush') ) { w3tc_pgcache_flush(); $msg .= __(' & W3 Total Cache Page Cache flushed'); } echo '

' . __('Deleted:','attention-bar') .' ' . $_REQUEST['id'] . $msg . '

'; } if (isset($_REQUEST['changestatus'])) { nb_change_status($_REQUEST['id'],$_REQUEST['status']); if ( function_exists('w3tc_pgcache_flush') ) { w3tc_pgcache_flush(); $msg .= __(' & W3 Total Cache Page Cache flushed'); } echo '

' . __('Status changed:','attention-bar') . ' ' . $_REQUEST['id'] . $msg . '

'; } global $wpdb; $table_name = $wpdb->prefix . "nb_data"; $table_notifications = $wpdb->prefix . "nb_nottypes"; $myrows = $wpdb->get_results( "SELECT id,timecreated,status,name,author,epochtimebegin,epochtimeend,content,nottype,fontcolor,bgcolor FROM " . $table_name ); echo '

' . __('Entries','attention-bar') . '

'; echo ' '; foreach ($myrows as $myrows) { if (empty($myrows->epochtimebegin)) { $timebegin = __('Not set','attention-bar'); } else { $timebegin = nb_get_time($myrows->epochtimebegin); } if (empty($myrows->timeend)) { $timeend = __('Not set','attention-bar'); } else { $timeend = nb_get_time($myrows->epochtimeend); } if (empty($myrows->epochtimebegin) && empty($myrows->epochtimeend)) { $timedisplay = '' . __('Always visible','attention-bar') . ''; } else { $timedisplay = 'Start:
' . nb_get_time($myrows->epochtimebegin) . '
End:
' . nb_get_time($myrows->epochtimeend); } if ($myrows->status == 1) { if(empty($myrows->epochtimebegin) || ($myrows->epochtimebegin < nb_get_tzepoch_time(time())) && ($myrows->epochtimeend > nb_get_tzepoch_time(time()))) { $status = __('Enabled','attention-bar'); $rowcolor = "lightgreen"; } else { $status = __('Enabled
(Disabled by schedule)','attention-bar'); $rowcolor = "#ffebe8"; } $changestatus = 0; } else { $changestatus = 1; $status = __('Disabled','attention-bar'); $rowcolor = "#ffebe8"; } if (empty($myrows->bgcolor)) { $bgcolor = __('Not overruled','attention-bar'); } else { $bgcolor = $myrows->bgcolor; } if (empty($myrows->fontcolor)) { $fontcolor = __('Not overruled','attention-bar'); } else { $fontcolor = $myrows->fontcolor; } if (empty($myrows->nottype)) { $nottypename = __('Not set','attention-bar'); $nottypeimage = ''; } else { $nottype = $myrows->nottype; $nottypename = $wpdb->get_var( "SELECT name FROM " . $table_notifications . " WHERE id = " . $nottype ); $nottypeimage = ''; } if (empty($myrows->author)) { $author = __("No author set","attention-bar"); } else { $author = '' . nb_get_username($myrows->author) . ''; } $timecreated = nb_get_time(strtotime($myrows->timecreated)); $deletelink = 'admin.php?page=pd_nb_entries&delete&id=' . $myrows->id; $changestatuslink = 'admin.php?page=pd_nb_entries&changestatus&id=' . $myrows->id . '&status=' . $changestatus; $editlink = 'admin.php?page=pd_nb_entries&edit&id=' . $myrows->id; echo ''; } echo '
ID / Author ' . __('Time to display','attention-bar') . ' ' . __('Notification type','attention-bar') . ' ' . __('Name','attention-bar') . ' ' . __('Time created','attention-bar') . ' ' . __('Options','attention-bar') . ' ' . __('Status','attention-bar') . '
ID / Author ' . __('Time to display','attention-bar') . ' ' . __('Notification type','attention-bar') . ' ' . __('Name','attention-bar') . ' ' . __('Time created','attention-bar') . ' ' . __('Options','attention-bar') . ' ' . __('Status','attention-bar') . '
' . $myrows->id . '
' . $author . '
' . $timedisplay . '' . $nottypeimage . '
' . $nottypename . '
' . $myrows->name . '' . $timecreated . 'BC:
' . $bgcolor . '
FC:
' . $fontcolor . '
' . $status . '
'; // reset values to default $beginvalue = ''; $endvalue = ''; $namevalue = ''; $contentvalue = ''; $edithidden = 'N'; $notstatusvalue = '1'; $idhidden = ''; $nottypevalue = ''; // check if we are in edit mode if (isset($_REQUEST['edit'])) { $table_name = $wpdb->prefix . "nb_data"; $editrow = $wpdb->get_results( "SELECT * FROM " . $table_name . ' WHERE id = ' . $_REQUEST['id'] ); foreach ($editrow as $editrow) { $beginvalue = nb_get_edit_time($editrow->epochtimebegin); $endvalue = nb_get_edit_time($editrow->epochtimeend); $namevalue = $editrow->name; $contentvalue = stripslashes($editrow->content); $edithidden = "Y"; $idhidden = $editrow->id; $bgcolorvalue = $editrow->bgcolor; $fontcolorvalue = $editrow->fontcolor; $nottypevalue = $editrow->nottype; $notstatusvalue = $editrow->status; } } echo '

' . __('New / edit entry','attention-bar') . '

'; wp_nonce_field('nb_submit','nb_nonce'); echo '

Scheduled time

'; nb_createinput('text',array( 'id' => 'nb_timebegin', 'name' => 'nb_timebegin', 'label' => __('Start time','attention-bar'), 'desc' => __('If you leave the start time empty, the notification will always be visible','attention-bar'), 'sel' => $beginvalue, )); echo '
'; nb_createinput('text',array( 'id' => 'nb_timeend', 'name' => 'nb_timeend', 'label' => __('End time','attention-bar'), 'sel' => $endvalue, )); echo '

Content input

'; nb_createinput('text',array( 'id' => 'nb_name', 'name' => 'nb_name', 'label' => __('Name','attention-bar'), 'sel' => $namevalue, 'size' => 30, 'mand' => true )); echo '
'; if (get_option('pd_nb_gui_mce','false') == 'true') { echo '
'; ?> '; } else { nb_createinput('multitext',array( 'id' => 'nb_content', 'name' => 'nb_content', 'label' => __('Content','attention-bar'), 'sel' => $contentvalue, 'rows' => 3, 'cols' => 80, 'mand' => true )); } echo '

'; // Get all notification types $table_notifications = $wpdb->prefix . "nb_nottypes"; $nottypes = $wpdb->get_results( "SELECT id,name,bgcolor,fontcolor FROM " . $table_notifications . " ORDER BY name"); echo '

Bar type settings

'; nb_createinput('select',array( 'id' => 'nb_nottype', 'name' => 'nb_nottype', 'label' => __('Notification type','attention-bar'), 'desc' => __('If no notification type is set, the default settings will be used as set in the settings panel','attention-bar'), 'sel' => $nottypevalue, 'values' => $nottypes )); echo '
'; nb_createinput('color',array( 'id' => 'nb_bgcolor', 'name' => 'nb_bgcolor', 'label' => __('Bar color','attention-bar'), 'desc' => __('Background color of the Attention bar on a per message base. This overrules the color from the chosen notification type','attention-bar'), 'sel' => $bgcolorvalue, 'size' => 8 )); echo '
'; nb_createinput('color',array( 'id' => 'nb_fontcolor', 'name' => 'nb_fontcolor', 'label' => __('Font color','attention-bar'), 'desc' => __('Font color of the Attention bar on a pre message base. This overrules the color from the chosen notification type','attention-bar'), 'sel' => $fontcolorvalue, 'size' => 8 )); echo '
'; nb_createinput('radio',array( 'id' => 'nb_status', 'name' => 'nb_status', 'label' => __('Status','attention-bar'), 'values' => array('1','0'), 'labels' => array( __('Enabled','attention-bar'),__('Disabled','attention-bar')), 'sel' => $notstatusvalue, 'after' => '
' )); echo '

'; echo nb_get_info_box(); echo '
'; } ?>