/**
  * Email log type filter.
  *
  * @access protected
  * @since  8.3
  *
  * @param string $which
  */
 protected function extra_tablenav($which)
 {
     if ('top' !== $which) {
         return;
     }
     $emailLogTypes = wp_list_pluck(cnLog_Email::types(), 'name', 'id');
     unset($emailLogTypes[cnLog_Email::LOG_TYPE]);
     cnHTML::select(array('id' => 'type', 'default' => array(-1 => __('View All', 'connections')), 'options' => $emailLogTypes), $this->type);
     submit_button('Filter', 'secondary', 'filter_action', FALSE, array('id' => 'email-log-query-submit'));
 }
예제 #2
0
    /**
     * Callback used to render the log view of the log type being viewed.
     *
     * @access private
     * @since  8.3
     * @static
     *
     * @uses   current_user_can()
     * @uses   wp_list_pluck()
     * @uses   esc_url()
     * @uses   self_admin_url()
     * @uses   cnLog::types()
     * @uses   cnLog_Email::types()
     * @uses   cnHTML::select()
     * @uses   submit_button()
     * @uses   do_action()
     */
    public static function logs()
    {
        if (!current_user_can('install_plugins')) {
            return;
        }
        $current = cnLog_Email::LOG_TYPE;
        $views = wp_list_pluck(cnLog::views(), 'id');
        if (isset($_GET['view']) && array_key_exists($_GET['view'], $views)) {
            $current = $_GET['view'];
        }
        ?>

		<div class="wrap" id="cn-logs">

			<form id="cn-log-type" method="get"
			      action="<?php 
        echo esc_url(self_admin_url('admin.php'));
        ?>
">

				<input type="hidden" name="page" value="connections_tools"/>
				<input type="hidden" name="tab" value="logs"/>

				<?php 
        $allLogTypes = wp_list_pluck(cnLog::types(), 'name', 'id');
        $emailLogTypes = wp_list_pluck(cnLog_Email::types(), 'name', 'id');
        unset($emailLogTypes[cnLog_Email::LOG_TYPE]);
        cnHTML::select(array('id' => 'view', 'options' => array_diff_assoc($allLogTypes, $emailLogTypes)), $current);
        submit_button('Switch', 'secondary', 'action', FALSE, array('id' => 'log-type-submit'));
        ?>

			</form>

			<?php 
        do_action('cn_logs_view_' . $current);
        ?>

		</div>

	<?php 
    }