public function register_metaboxes()
 {
     $event = new Event();
     $event->register_metabox();
     $course = new Course();
     $course->register_metabox();
     SiteHelper::hideCustomMetabox();
 }
 public function save_metadata($post_id)
 {
     if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
         return $post_id;
     }
     if (Course::POST_TYPE == $_POST['post_type']) {
         #if ( ! current_user_can( 'edit_page', $post_id ) ) return $post_id;
         $fields = Course::addition_fields_list();
         $fields_values = array();
         foreach ($fields as $name => $id) {
             $fields_values[$name] = sanitize_text_field($_POST[$id]);
             $this->updateEntryMeta($post_id, '_' . $name, $fields_values[$name]);
         }
     } elseif (Event::POST_TYPE == $_POST['post_type']) {
         #if ( ! current_user_can( 'edit_post', $post_id ) ) return $post_id;
         $addition_fields = Event::addition_fields_list();
         $fields_values = array();
         // $savan = sanitize_text_field( $_POST[$addition_fields['savan']] );
         // $capitan = sanitize_text_field( $_POST[$addition_fields['capitan']] );
         // $room = sanitize_text_field( $_POST[$addition_fields['room']] );
         // $course = sanitize_text_field( $_POST[$addition_fields['course']] );
         foreach ($addition_fields as $name => $id) {
             if ($name !== 'confirmed') {
                 $fields_values[$name] = sanitize_text_field($_POST[$id]);
                 $this->updateEntryMeta($post_id, '_' . $id, $fields_values[$name]);
             }
         }
     }
 }
 public function init()
 {
     SessionHelper::start();
     $bootstrap = new Bootstrap();
     $bootstrap->init();
     if (!post_type_exists(Event::POST_TYPE) && !post_type_exists(Course::POST_TYPE)) {
         Event::register();
         Course::register();
     }
 }
			<?php 
foreach ($user_protege as $protege_id) {
    $protege_orders = User::getOrdersByDate($protege_id, $date_type);
    if (!empty($protege_orders)) {
        $protege_form_id = User::getRegistrationFormID($protege_id);
        $protege_form = User::getRegistrationForm($protege_form_id);
        $protege_status = '';
        $ptotege_invoice = '';
        $protege_course_start = '';
        foreach ($protege_orders as $order) {
            $order_obj = new \WC_Order($order->ID);
            $order_items = $order_obj->get_items();
            $protege_course_id = db::getEntryMeta($order->ID, $user_fields['course']);
            $ptotege_invoice = db::getEntryMeta($order->ID, '_transaction_id')[0];
            if ($protege_course_id) {
                $stages = Course::getChilds($protege_course_id);
                foreach ($stages as $stage) {
                    $stage_name = Event::getNameByID($stage->ID);
                    if ($stage_name === 'INT') {
                        $protege_course_start = date('Y-m-d', db::getEntryMeta($stage->ID, $stage_type_fields['start'])[0]);
                        break;
                    }
                }
            }
            foreach ($order_items as $item) {
                $user_account++;
                $protege_status = 'Full Paid';
                if (count($order_items) == 1 && $item['product_id'] == 542) {
                    $protege_status = 'Deposit Paid';
                    $protege_course_start = '-';
                }
<?php

use Nerds\Bsalted\Entity\CourseEntity\Course;
use Nerds\Base\Util\Helpers\DatabaseAccessWrapper;
use Nerds\Bsalted\Entity\UserEntity\User;
$db = new DatabaseAccessWrapper();
$savans = User::getByRole('adventure_savant');
$capitans = User::getByRole('adventure_capitan');
$post_id = get_the_ID();
$stored_data = $db->getCourseData()[$post_id];
$fields_list = Course::addition_fields_list();
$human_resourses = explode(',', $stored_data['resourses']);
?>

<div class="bsalted-field">
<label for="<?php 
echo $fields_list['resourses'];
?>
">The Human resources: </label>
<select id="<?php 
echo $fields_list['resourses'];
?>
" data-placeholder="Choose Human resources..." class="chosen-select" multiple style="width:350px;" tabindex="4">
    <optgroup label="Capitans">
    <?php 
foreach ($capitans as $obj) {
    ?>
        <?php 
    if (in_array($obj->ID, $human_resourses)) {
        ?>
            <option value="<?php 
 public static function is_course_confirmed($course_id)
 {
     $course_stages = Course::getChilds($course_id);
     foreach ($course_stages as $stage_obj) {
         if (!Event::is_confirmed($stage_obj->ID)) {
             return false;
         }
     }
     return true;
 }