<?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_fields = User::addition_fields_list();
$user_course_field = $user_fields['course'];
$stages = Event::getProposal();
$order_fields = Order::addition_fields_list();
$products = SiteHelper::product_stage_relation();
$courses_id = array();
$order = new Order();
$events = new Course();
$report_type = isset($_GET['report-type']) && !empty($_GET['report-type']) ? $_GET['report-type'] : 'week';
$today = date('F j, Y');
$period = SiteHelper::getConsultantOrders(null, $report_type, 'period');
$form_date = date('F j, Y', strtotime('+1 day', strtotime($period)));
foreach ($stages as $obj) {
    $stage_id = $obj->ID;
    $course_id = Event::getParentID($stage_id);
    if (!in_array($course_id, $courses_id)) {
        array_push($courses_id, $course_id);
    }
}
?>

Esempio n. 2
0
 public static function getConsultantOrders($code, $type, $mode)
 {
     $order_fields = Order::addition_fields_list();
     $first_day_of_year = split('-', date('Y-m-d', strtotime(date('Y-01-00'))));
     $first_day_of_month = split('-', date('Y-m-d', strtotime('last day of last month')));
     $first_day_of_week = strtotime('last sunday', strtotime('now'));
     $week_start = split('-', date('Y-m-d', $first_day_of_week));
     $dates = array('week' => $week_start, 'month' => $first_day_of_month, 'year' => $first_day_of_year);
     if ($mode && $mode === 'period') {
         return implode('-', $dates[$type]);
     }
     $args = array('post_type' => 'shop_order', 'post_status' => 'wc-completed', 'meta_query' => array(array('key' => $order_fields['consultant'], 'value' => $code)), 'date_query' => array(array('column' => 'post_date_gmt', 'after' => array('year' => $dates[$type][0], 'month' => $dates[$type][1], 'day' => $dates[$type][2])), 'inclusive' => true));
     #$orders = db::getEntries($args);
     return db::getEntries($args);
 }