public function initialization_settings()
 {
     new MainSection();
     new EventSection();
     new ConfigurationSection();
     $role = User::getRole();
     $role_name = strpos($role, 'capitan') ? 'Capitan' : (strpos($role, 'savan') ? 'Savant' : '');
     if ($role_name) {
         new UserListSection($role_name);
     } elseif (User::is_director() || User::is_admin()) {
         new CustomerProposalSection();
         new ConsultantStatisticSection();
     } elseif (User::is_consultant()) {
         new ConsultantCabinetSection();
     }
 }
예제 #2
0
 public function load_resourses()
 {
     // wp_enqueue_style( 'momentum-css', SiteHelper::getResoursesPath() . '/js/moment/min/moment.min.css');
     // wp_enqueue_style( 'bsalted-css', SiteHelper::getResoursesPath() . '/css/main.css' );
     wp_enqueue_style('fullcalendar-css', SiteHelper::getResoursesPath() . '/js/fullcalendar/dist/fullcalendar.min.css');
     wp_enqueue_style('qtip-css', SiteHelper::getResoursesPath() . '/js/qtip/jquery.qtip.min.css');
     wp_enqueue_style('chosen-css', SiteHelper::getResoursesPath() . '/js/chosen/chosen.min.css');
     wp_enqueue_script('momentum-js', SiteHelper::getResoursesPath() . '/js/moment/min/moment.min.js', array('jquery'), '1.1', false);
     wp_enqueue_script('fullcalendar-js', SiteHelper::getResoursesPath() . '/js/fullcalendar/dist/fullcalendar.min.js', array('jquery'), '1.1', false);
     wp_enqueue_script('qtip-js', SiteHelper::getResoursesPath() . '/js/qtip/jquery.qtip.js', array('jquery'), '1.1', false);
     wp_enqueue_script('chosen-js', SiteHelper::getResoursesPath() . '/js/chosen/chosen.jquery.min.js', array('jquery'), '1.1', false);
     wp_enqueue_script('bsalted-js', SiteHelper::getResoursesPath() . '/js/main/main.js', array('jquery'), '1.1', false);
     $db = new DatabaseAccessWrapper();
     $role = User::getRole();
     $stage = new Event();
     wp_localize_script('fullcalendar-js', 'bsaltedEventsData', $stage->getData());
     wp_localize_script('fullcalendar-js', 'bsaltedOptions', $db::get_option('bsalted_adventures_days'));
     if (in_array($role, UserRole::restricted())) {
         SiteHelper::hideCustomMenuItem();
         if (!$role === 'director_of_logistics') {
             wp_localize_script('bsalted-js', 'userRole', 'limited');
         }
     }
 }
예제 #3
0
 $user_id = $user_obj->user_id;
 $user_form_id = User::getMeta($user_id, $user_fields['registration-form']);
 $user_form = User::getRegistrationForm($user_form_id);
 $assessment_protege_id = User::getMeta($user_id, $user_fields['assessment-protege'] . $raw_stage_name);
 $assessment_savant_id = User::getMeta($user_id, $user_fields['assessment-savant'] . $raw_stage_name);
 $assessment_protege_fields = SiteHelper::protege_assessment_relation();
 $assessment_savant_fields = SiteHelper::savant_assessment_relation();
 $assessment_protege_form_id = $assessment_protege_fields[$raw_stage_name]['form-id'];
 $assessment_savant_form_id = $assessment_savant_fields[$raw_stage_name]['form-id'];
 $assessment_protege_fields_id = $assessment_protege_fields[$raw_stage_name]['fields'];
 $assessment_savant_fields_id = $assessment_savant_fields[$raw_stage_name]['fields'];
 $protege_model = \RGFormsModel::get_lead($assessment_protege_id);
 $savant_model = \RGFormsModel::get_lead($assessment_savant_id);
 $protege_link_text = 'Edit';
 $savant_link_text = 'Edit';
 $user_consultant = User::getByCode($user_form[36]);
 if ($raw_stage_name === 'PRE') {
     foreach ($assessment_savant_fields_id as $id) {
         if ($savant_model[$id]) {
             $savant_link_text = 'Show';
         }
     }
     $protege_link_text = ' - ';
 } else {
     foreach ($assessment_savant_fields_id as $id) {
         if ($savant_model[$id]) {
             $savant_link_text = 'Show';
         }
     }
     foreach ($assessment_protege_fields_id as $id) {
         if ($protege_model[$id]) {
예제 #4
0
 public function remove_stage_confirmation($order_id)
 {
     $stage = new Event();
     $products = SiteHelper::product_stage_relation();
     $order_fields = $this->addition_fields_list();
     // $course_id       = db::getEntryMeta($order_id, $order_fields['course'])[0];
     $course_id = db::getEntryMeta($order_id, $order_fields['course'])[0];
     $order = new \WC_Order($order_id);
     $user_id = $order->user_id;
     $order_items = $order->get_items();
     $items_id = array();
     $itmes = array();
     $stage_fields = Event::addition_fields_list();
     $confirmed_field = '_' . $stage_fields['confirmed'];
     foreach ($order_items as $item) {
         $item_id = $item['item_meta']['_product_id'][0];
         array_push($items_id, $item_id);
     }
     foreach ($items_id as $item_id) {
         if ($item_name = array_search($item_id, $products)) {
             $stage_id = $stage->getIDByParentID($course_id, $item_name);
             #file_put_contents( dirname( __FILE__) . '\remove_stage_confirmation.log', 'Course3 ID = ' . $course_id . 'Item Name =  ' . $item_name . ' Stage =  ' . $stage_id  );
             if ($stage_id) {
                 $confirmed_count = db::getEntryMeta($stage_id, $confirmed_field)[0];
                 User::deleteMeta($user_id, $stage_fields['name'] . $item_name, $stage_id);
                 db::updateEntryMeta($stage_id, $confirmed_field, --$confirmed_count);
             }
         }
     }
 }
<?php

use Nerds\Base\Util\Helpers\SiteHelper;
use Nerds\Base\Util\Helpers\DatabaseAccessWrapper as db;
use Nerds\Bsalted\Entity\UserEntity\User;
$role = User::getRole();
$role_name = strpos($role, 'capitan') ? 'Capitan' : (strpos($role, 'savan') ? 'Savant' : '');
$users = User::getByRole($role);
?>


<h1><?php 
echo $role_name;
?>
's list</h1>

<table class="wp-list-table widefat fixed striped posts">
	<thead>
	<tr>
		<th scope="col" id="cb" class="manage-column column-cb check-column" style=""><label class="screen-reader-text" for="cb-select-all-1">Select All</label>
		</th>
		<th scope="col" id="title" class="manage-column column-title sortable desc" style=""><?php 
echo $role_name;
?>
's full name</th>
		<th scope="col" id="author" class="manage-column column-author" style=""><?php 
echo $role_name;
?>
's login</th>
		<th scope="col" id="categories" class="manage-column column-categories" style="">-</th>
		<th scope="col" id="tags" class="manage-column column-tags" style="">-</th>
                $protege_status = 'Full Paid';
                if (count($order_items) == 1 && $item['product_id'] == 542) {
                    $protege_status = 'Deposit Paid';
                    $protege_course_start = '-';
                }
            }
        }
        ?>
				<tr id="" class="iedit bsalted-proposal-row">
				
					<th scope="row" class="check-column">
						
					</th>
					<td>
						<?php 
        echo User::getFullName($protege_id);
        ?>
					</td>
					<td class="post-title page-title column-title">
						<?php 
        echo $protege_form[5];
        ?>
					</td>			
					<td class="author column-author">
						<?php 
        echo $protege_form[22];
        ?>
					</td>
					<td class="post-title bsaled-proposal-prefered-dates ">
						<?php 
        echo $protege_form[26];
		</th>
		<th scope="col" id="title" class="manage-column column-title sortable desc" style="">ID</th>
		<th scope="col" id="author" class="manage-column column-author" style="">Adventure Consultant name</th>
		<th scope="col" id="categories" class="manage-column column-categories" style="">Introspective Sales</th>
		<th scope="col" id="tags" class="manage-column column-tags" style="">Course Sales</th>
		<th scope="col" id="date" class="manage-column column-date sortable asc" style="">
			-
		</th>
	</tr>
	</thead>

	<tbody id="the-list">
			<?php 
foreach ($users as $user_obj) {
    $user_id = $user_obj->ID;
    $user_code = User::getCode($user_id);
    $user_orders = SiteHelper::getConsultantOrders($user_code, $report_type);
    $user_sales = array();
    $user_course_sales = 0;
    $user_int_sales = 0;
    #$from_date = date('F j, Y', strtotime('+1 day', strtotime($user_data['period'])));
    foreach ($user_orders as $order) {
        $order_id = $order->ID;
        $order_course_id = db::getEntryMeta($order_id, $user_course_field)[0];
        $user_sales[$order_id][$order_course_id] = array();
        $order_obj = new \WC_Order($order_id);
        $order_items = $order_obj->get_items();
        foreach ($order_items as $item) {
            #array_push($user_sales[$order_id][$order_course_id], $item['product_id']);
            $product_name = array_search($item['product_id'], $products);
            if ($product_name === 'PRE') {
		</th>
	</tr>
	</thead>

	<tbody id="the-list">
			<?php 
foreach ($users as $user_obj) {
    $user_id = $user_obj->user_id;
    $user_proposal = User::getMeta($user_id, $user_fields['proposals']);
    $user_course = User::getCourseID($user_id);
    if ($user_proposal) {
        continue;
    }
    $user = User::getByID($user_id)[0];
    $user_form_id = User::getMeta($user_id, $user_fields['registration-form']);
    $user_event_dates = User::getPreferedDatesID($user_form_id);
    ?>
				
				<tr id="post-1" class="iedit bsalted-proposal-row">
					<th scope="row" class="check-column">
					</th>
					<td class="post-title page-title column-title">
						<strong><?php 
    echo $user->display_name;
    ?>
</strong>
					</td>			
					<td class="author column-author"><?php 
    echo $user->user_nicename;
    ?>
</td>
예제 #9
0
 public function getConfirmedByCountry($stage_id)
 {
     $stage_name = $this->getNameByID($stage_id);
     $stage_fields = $this->addition_fields_list();
     $users_bought_stage = User::getBoughtStage($stage_fields['name'] . $stage_name, $stage_id);
     $stage_counter = array('SG' => 0, 'MYR' => 0);
     foreach ($users_bought_stage as $user_obj) {
         $user_id = $user_obj->ID;
         $user_form_id = User::getRegistrationFormID($user_id);
         $user_country = User::getRegistrationForm($user_form_id)[11] === 'singapore' ? $stage_counter['SG']++ : $stage_counter['MYR']++;
     }
     $response1 = $stage_counter['SG'] > 0 ? $stage_counter['SG'] . 'SG' : '0SG';
     $response2 = $stage_counter['MYR'] > 0 ? $stage_counter['MYR'] . 'MYR' : '0MYR';
     #$response = !empty($response1) && !empty($response2) ? $response1 . ' - ' . $response2 : empty($response1) && !empty($response2) ? $response2 : !empty($response1) && empty($response2) ? $response1 : 0;
     $response = $response1 . ' - ' . $response2;
     return $response;
 }
use Nerds\Base\Util\Helpers\SiteHelper;
$order_fields = $this->addition_fields_list();
$user_stages = User::getPaidStages();
$products = array_keys(SiteHelper::product_stage_relation());
$is_user_has_deposit = User::getMeta($user_id, $user_fields['deposit']);
$is_user_has_proposals = User::getMeta($user_id, $user_fields['proposals']);
$course_id = isset($_GET['course-id']) && !empty($_GET['course-id']) ? $_GET['course-id'] : User::getCourseID($user_id);
$course = $db->getEntry($course_id);
$stage1 = new Event();
#var_dump($stage1->getConfirmedByCountry(876));
#var_dump(User::getBoughtStage('stage-name-PRE', 876));
#var_dump(User::getRegistrationForm(106)[11]);
?>

<?php 
if (!User::is_filled_registration()) {
    ?>
	<h2>Please fill the <a href="<?php 
    echo site_url();
    ?>
/account/adventures-registration-form/">Registration Form</a></h2>
<?php 
} elseif (empty($is_user_has_deposit)) {
    ?>
	<div class="bsalted-payments">
		<h3 class="noPay">To begin just put money on your deposit:</h3>
		<form action="." id="bsalted-payments">
			<div class="form-row clearfix">
				<input name="bsalted-stages" id="deposit_offer" class="stage" type="radio" checked>
				<label for="deposit_offer">
					Deposit
예제 #11
0
<?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 
예제 #12
0
 public static function getConsultantCapitan($consultant_id)
 {
     $user_fields = User::types_fields_list();
     return User::getMeta($consultant_id, $user_fields['capitan']);
 }