public static function getChilds($course_id) { $stage = new Event(); $stage_fields = $stage->addition_fields_list(); $course_field = '_' . $stage_fields['course']; $args = array('post_type' => Event::POST_TYPE, 'meta_query' => array(array('key' => $course_field, 'value' => $course_id))); return db::getEntries($args); }
public static function getOrdersByDate($user_id, $type) { $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); $args = array('post_type' => 'shop_order', 'post_status' => 'wc-completed', 'meta_query' => array(array('key' => '_customer_user', 'value' => $user_id)), 'date_query' => array(array('column' => 'post_date_gmt', 'after' => array('year' => $dates[$type][0], 'month' => $dates[$type][1], 'day' => $dates[$type][2])), 'inclusive' => true)); return db::getEntries($args); }
public static function getProposal() { $types_fields = self::types_fields_list(); $date = strtotime(date('Y-m-d')); $args = array('post_type' => static::POST_TYPE, 'meta_query' => array(array('key' => $types_fields['start'], 'value' => $date, 'compare' => '>'), array('key' => $types_fields['show'], 'value' => 'yes'))); return db::getEntries($args); }
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); }