function get_mf_schedule_by_faire($faire, $day = '', $area = '', $subarea = '') { $faire = strtoupper($faire); $mysqli = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME); if ($mysqli->connect_errno) { echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error; } $select_query = "SELECT area.area,subarea.subarea,subarea.nicename,\n entity.lead_id as entry_id, DAYNAME(schedule.start_dt) as day,\n entity.project_photo as photo, schedule.start_dt, schedule.end_dt, \n entity.presentation_title, entity.desc_short as description, \n (select group_concat( distinct concat(maker.`FIRST NAME`,' ',maker.`LAST NAME`) separator ', ') as Makers\n from wp_mf_maker maker, \n wp_mf_maker_to_entity maker_to_entity\n where schedule.entry_id = maker_to_entity.entity_id AND\n maker_to_entity.maker_id = maker.maker_id AND\n maker_to_entity.maker_type != 'Contact' \n group by maker.lead_id\n ) as makers_list ,\n (select Photo from wp_mf_maker maker, \n wp_mf_maker_to_entity maker_to_entity\n where schedule.entry_id = maker_to_entity.entity_id AND\n maker_to_entity.maker_id = maker.maker_id AND\n maker_to_entity.maker_type = 'presenter' \n group by maker.lead_id\n ) as maker_photo \n \n FROM wp_mf_schedule schedule, \n wp_mf_entity entity, \n wp_mf_location location, \n wp_mf_faire_subarea subarea, \n wp_mf_faire_area area\n \n where schedule.entry_id = entity.lead_id \n AND entity.status = 'Accepted' \n and location.entry_id = schedule.entry_id\n and location.ID = schedule.location_id\n and subarea.id = location.subarea_id\n and area.id = subarea.area_id\n and schedule.faire = '" . $faire . "' " . " ORDER BY subarea.sort_order, \n schedule.start_dt ASC"; $mysqli->query("SET NAMES 'utf8'"); $result = $mysqli->query($select_query) or trigger_error($mysqli->error . "[{$select_query}]"); // Initalize the schedule container $schedules = array(); // Loop through the posts while ($row = $result->fetch_array(MYSQLI_ASSOC)) { // Return some post meta $entry_id = $row['entry_id']; $app_id = $entry_id; $day = $row['day']; $start = strtotime($row['start_dt']); $stop = strtotime($row['end_dt']); $schedule['nicename'] = $row['nicename']; $schedule['subarea'] = $row['subarea']; // REQUIRED: Schedule ID $schedule['id'] = $entry_id; $schedule_name = isset($row['presentation_title']) ? $row['presentation_title'] : ''; // Get Maker and Project Photo images. Use the maker if it is set. $maker_photo = !empty($row['maker_photo']) ? $row['maker_photo'] : ''; $project_photo = !empty($row['photo']) ? $row['photo'] : ''; $app_photo = empty($maker_photo) ? $project_photo : $maker_photo; //find out if there is an override image for this page $overrideImg = findOverride($entry_id, 'schedule'); if ($overrideImg != '') { $app_photo = $overrideImg; } // REQUIED: Application title paired to scheduled item $schedule['name'] = html_entity_decode($schedule_name, ENT_COMPAT, 'utf-8'); $schedule['time_start'] = date(DATE_ATOM, $start); $schedule['time_end'] = date(DATE_ATOM, $stop); $schedule['day'] = $day; $schedule['project_description'] = isset($row['description']) ? $row['description'] : ''; // Rename the field, keeping 'time_end' to ensure this works. $schedule['time_stop'] = date(DATE_ATOM, strtotime('-1 hour', $stop)); // Schedule thumbnails. Nothing more than images from the application it is tied to $schedule['thumb_img_url'] = esc_url(legacy_get_resized_remote_image_url($app_photo, '80', '80')); $schedule['large_img_url'] = esc_url(legacy_get_resized_remote_image_url($app_photo, '600', '600')); // A list of applications assigned to this event (should only be one really...) $schedule['entity_id_refs'] = array(absint($entry_id)); // Application Makers $schedule['maker_list'] = !empty($row['makers_list']) ? $row['makers_list'] : null; $maker_ids = array(); // Put the application into our list of schedules array_push($schedules, $schedule); } return $schedules; }
<div class="slide"> <a href="#"><img class="cycle-gallery-thumb" src="<?php echo legacy_get_resized_remote_image_url($randPhoto, 95, 95); ?> " alt="Slide gallery thumbnail"></a> </div> <?php for ($i = 0; $i < count($entries); $i++) { if ($i == $randEntryKey) { continue; } ?> <div class="slide"> <?php //find out if there is an override image for this page $overrideImg = findOverride($entries[$i]['id'], 'mtm'); $projPhoto = $overrideImg == '' ? $entries[$i]['22'] : $overrideImg; ?> <a href="#"><img class="cycle-gallery-thumb" src="<?php echo legacy_get_resized_remote_image_url($projPhoto, 95, 95); ?> " alt="Slide gallery thumbnail"></a> </div> <?php } // end for ?> </div> </div> <a class="btn-prev" href="#"><i class="icon-arrow-left"></i></a> <a class="btn-next" href="#"><i class="icon-arrow-right"></i></a>
$mysqli->query("SET NAMES 'utf8'"); $result = $mysqli->query($select_query) or trigger_error($mysqli->error . "[{$select_query}]"); // Initalize the app container $apps = array(); // Loop through the posts while ($row = $result->fetch_array(MYSQLI_ASSOC)) { // Store the app information //$app_data = json_decode( mf_clean_content( $post->post_content ) ); // REQUIRED: Application ID $app['id'] = absint($row['lead_id']); // REQUIRED: Application name $app['name'] = html_entity_decode($row['presentation_title'], ENT_COMPAT, 'utf-8'); // Application Thumbnail and Large Images $app_image = $row['project_photo']; //find out if there is an override image for this page $overrideImg = findOverride($row['lead_id'], 'app'); if ($overrideImg != '') { $app_image = $overrideImg; } $app['thumb_img_url'] = esc_url(legacy_get_resized_remote_image_url($app_image, '80', '80')); $app['large_image_url'] = esc_url($app_image); // Should actually be this... Adding it in for the future. $app['large_img_url'] = esc_url($app_image); // Application Locations $app['venue_id_ref'] = $row['venue_id']; // Mobile App Discover $app['mobile_app_discover'] = $row['mobile_app_discover']; // Application Makers $app_id = $app['id']; // get the entity id $maker_ids = $row['exhibit_makers'];
$schedule['id'] = $schedule_id; $schedule_name = isset($row['presentation_title']) ? $row['presentation_title'] : ''; $project_photo = isset($row['project_photo']) ? $row['project_photo'] : ''; // REQUIED: Application title paired to scheduled item $schedule['name'] = html_entity_decode($schedule_name, ENT_COMPAT, 'utf-8'); $schedule['time_start'] = date(DATE_ATOM, strtotime('+4 hour', $start)); $schedule['time_end'] = date(DATE_ATOM, strtotime('+4 hour', $stop)); //ORIGINAL CALL //$schedule['time_start'] = date( DATE_ATOM, strtotime( '-1 hour', strtotime( $dates[$day] . $start . $dates['time_zone'] ) ) ); //$schedule['time_end'] = date( DATE_ATOM, strtotime( '-1 hour', strtotime( $dates[$day] . $stop . $dates['time_zone'] ) ) ); // Rename the field, keeping 'time_end' to ensure this works. $schedule['time_stop'] = date(DATE_ATOM, strtotime('+4 hour', $stop)); // Schedule thumbnails. Nothing more than images from the application it is tied to $app_image = $project_photo; //find out if there is an override image for this page $overrideImg = findOverride($entry_id, 'app'); if ($overrideImg != '') { $app_image = $overrideImg; } $schedule['thumb_img_url'] = esc_url(legacy_get_resized_remote_image_url($app_image, '80', '80')); $schedule['large_img_url'] = esc_url(legacy_get_resized_remote_image_url($app_image, '600', '600')); // REQUIRED: Venue ID reference //$schedule['venue_id_ref'] = $row[11]; //?? $maker_ids = $row['exhibit_makers']; $app['exhibit_makers'] = !empty($maker_ids) ? explode(',', $maker_ids) : null; // A list of applications assigned to this event (should only be one really...) $schedule['entity_id_refs'] = array_merge(array($entry_id)); // Application Makers $schedule['maker_id_refs'] = $maker_ids; // Put the application into our list of schedules array_push($schedules, $schedule);