public function get_clases($inicio = false, $fin = false, $front = false, $analitica = false) { $inicio = $inicio ? $inicio : strtotime(date_i18n('Y-m-d')); $fin = $fin ? $fin : $inicio + dias(6); $status = $analitica ? array('future', 'publish') : 'future'; /* mario( formateo_fecha( $inicio ) ); mario( formateo_fecha( $fin ) ); */ $clases = $format_clases = array(); $args = array('post_type' => 'clase', 'posts_per_page' => -1, 'order' => 'ASC', 'date_query' => array(array('after' => formateo_fecha($inicio), 'before' => formateo_fecha($fin), 'inclusive' => true)), 'post_status' => $status, 'meta_query' => array(array('key' => 'instructor', 'value' => $this->ID, 'compare' => '='))); if (!$front) { $args['fields'] = 'ids'; } $clases = get_posts($args); if ($clases) { if ($front) { $format_clases = formateo_clases_cal($clases, $analitica); } else { foreach ($clases as $id) { $format_clases[] = new Clase($id); } } } return $format_clases; }
public function get_clases($inicio = false, $fin = false, $todas = true, $analitica = false) { $clases_format = array(); $status = $todas ? array('future', 'publish') : 'future'; $inicio = $inicio ? $inicio : strtotime(date_i18n('Y-m-d')); $fin = $fin ? $fin : $inicio + dias(7); $salones = $this->get_salones(); if ($salones) { $args = array('post_type' => 'clase', 'posts_per_page' => -1, 'date_query' => array(array('after' => formateo_fecha($inicio), 'before' => formateo_fecha($fin), 'inclusive' => true)), 'post_status' => $status, 'meta_query' => array(array('key' => 'salon', 'value' => $salones, 'compare' => 'IN'))); if ($analitica) { $args['order'] = 'ASC'; } $clases = get_posts($args); $clases_format = formateo_clases_cal($clases, $analitica); } return $clases_format; }
public function get_clases($todas = true, $inicio = false, $fin = false, $especial = false) { $status = $todas ? array('future', 'publish') : array('future'); $clases_format = array(); $args = array('post_type' => 'clase', 'posts_per_page' => -1, 'post_status' => $status, 'meta_query' => array(array('key' => 'salon', 'value' => $this->ID, 'compare' => '=')), 'order' => 'ASC'); if ($inicio && $fin) { $args['date_query'] = array(array('after' => formateo_fecha($inicio), 'before' => formateo_fecha($fin), 'inclusive' => true)); } $clases = get_posts($args); if ($especial) { return $clases; } if ($clases) { $clases_format = formateo_clases_cal($clases); } return $clases_format; }