Example #1
0
<?php

use Nerds\Bsalted\Entity\CourseEntity\Course;
use Nerds\Bsalted\Entity\EventEntity\Event;
use Nerds\Bsalted\Entity\UserEntity\User;
use Nerds\Base\Util\Helpers\DatabaseAccessWrapper as db;
use Nerds\Base\Util\Helpers\SiteHelper;
$stage = new Event();
$stage_fields = $stage->addition_fields_list();
$user_fields = User::addition_fields_list();
$db = new db();
$savans = User::getByRole('adventure_savant');
$capitans = User::getByRole('adventure_capitan');
$stage_id = get_the_ID();
$raw_stage_name = $stage->getNameByID($stage_id);
$stored_data = $stage->getData()[$stage_id];
$course_data = $db->getCourseData()[$stored_data['course']];
$human_resourses = explode(',', $course_data['resourses']);
$stage_name = $stage_fields['name'] . $raw_stage_name;
$types_fields = $stage->types_fields_list();
$args = array('post_type' => Course::POST_TYPE, 'selected' => $stored_data['course'], 'name' => $stage_fields['course'], 'show_option_none' => 'Courses...', 'option_none_value' => '0');
?>

<?php 
if (!$amount) {
    ?>
	
<div class="bsalted-field">

	<?php 
    echo '<label for="courses">Select a Course:</label> ';
<?php

use Nerds\Base\Util\Helpers\SiteHelper;
use Nerds\Base\Util\Helpers\DatabaseAccessWrapper as db;
use Nerds\Bsalted\Entity\UserEntity\User;
use Nerds\Bsalted\Entity\EventEntity\Event;
use Nerds\Bsalted\Entity\CourseEntity\Course;
use Nerds\Bsalted\Entity\OrderEntity\Order;
$users = User::getByRole('adventure_consultant');
$user_id = User::getID();
$user_name = User::getFullName($user_id);
$user_capitan_id = SiteHelper::getConsultantCapitan($user_id);
$user_capitan_name = User::getFullName($user_capitan_id);
$user_code = User::getCode($user_id);
$date_type = isset($_GET['report-type']) && !empty($_GET['report-type']) ? $_GET['report-type'] : 'week';
$period = SiteHelper::getConsultantOrders($user_code, 'week', 'period');
#$user_orders      = SiteHelper::getConsultantOrders($user_code, 'week', 'period');
$user_protege = SiteHelper::getConsultantProteges($user_id);
$date_range = date('F j, Y', strtotime('+1 day', strtotime($period)));
$user_account = 0;
$user_amount = db::get_option('bsalted_cosultant_amount');
$user_bonus5 = db::get_option('bsalted_cosultant_bonus5');
$user_bonus10 = db::get_option('bsalted_cosultant_bonus10');
$user_fields = User::addition_fields_list();
$stage_type_fields = Event::types_fields_list();
$user_ordrs = User::getOrdersByDate(21, 'week');
#var_dump($user_amount);
?>


<div class="bsalted-consultant-top">
<?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>
 public static function send_info_to_director($user_id)
 {
     $directors = User::getByRole('director_of_logistics');
     $user_info = User::getInfo($user_id);
     $headers = array('Content-Type: text/html; charset=UTF-8');
     $subject = 'New Protege is waiting for proposal';
     $link = '<a href="' . get_site_url() . '/wp-admin/admin.php?page=bsalted-proposal-list">See Proposal List</a>';
     foreach ($directors as $director) {
         $body = '<h3>Hello ' . $director->display_name . '</h3>';
         $body .= '<p>New protege ' . $user_info->display_name . ' just paid for the Deposit.</p>' . $link;
         wp_mail($director->user_email, $subject, $body, $headers);
     }
 }