function __construct($id = '', $output = 'OBJECT')
 {
     $this->id = $id;
     $this->output = $output;
     $this->details = get_post($this->id, $this->output);
     $events = new TC_Events();
     $fields = $events->get_event_fields();
     foreach ($fields as $field) {
         if (!isset($this->details->{$field['field_name']})) {
             $this->details->{$field['field_name']} = get_post_meta($this->id, $field['field_name'], true);
         }
     }
 }
 function add_events_metaboxes()
 {
     global $pagenow, $typenow, $post;
     if ('edit.php' == $pagenow || $post->post_type !== 'tc_events') {
         return;
     }
     $post_id = isset($_GET['post']) ? (int) $_GET['post'] : 0;
     $events_columns = TC_Events::get_event_fields();
     foreach ($events_columns as $events_column) {
         if (!in_array($events_column['field_name'], $this->non_visible_fields())) {
             eval("function " . $events_column['field_name'] . "_metabox() {\n\t\t\t\t\t\ttc_render_metabox(" . $post_id . ", '" . $events_column['field_name'] . "');\n\t\t\t\t\t\t}");
             add_meta_box($events_column['field_name'] . '-tc-metabox-wrapper', $events_column['field_title'], $events_column['field_name'] . '_metabox', 'tc_events');
             //, isset( $events_column[ 'metabox_position' ] ) ? $events_column[ 'metabox_position' ] : 'core', isset( $events_column[ 'metabox_priority' ] ) ? $events_column[ 'metabox_priority' ] : 'low'
         }
     }
 }
            $message = __('You do not have required persmissions for this action.', 'tc');
        }
    }
}
if (isset($_GET['page_num'])) {
    $page_num = (int) $_GET['page_num'];
} else {
    $page_num = 1;
}
if (isset($_GET['s'])) {
    $eventssearch = $_GET['s'];
} else {
    $eventssearch = '';
}
$wp_events_search = new TC_Events_Search($eventssearch, $page_num, '', isset($_GET['post_status']) ? $_GET['post_status'] : 'any');
$fields = $events->get_event_fields();
$columns = $events->get_columns();
?>
<div class="wrap tc_wrap">
    <h2><?php 
echo $events->form_title;
if (isset($_GET['action']) && $_GET['action'] == 'edit') {
    ?>
<a href="admin.php?page=<?php 
    echo $_GET['page'];
    ?>
" class="add-new-h2"><?php 
    _e('Add New', 'tc');
    ?>
</a><?php 
}