Changeset 3039903
- Timestamp:
- 02/22/2024 07:41:53 PM (2 years ago)
- File:
-
- 1 edited
-
conference-scheduler/trunk/conf-scheduler.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
conference-scheduler/trunk/conf-scheduler.php
r2874466 r3039903 4 4 Plugin URI: https://conferencescheduler.com/ 5 5 Description: Display and organize your conference workshops in a powerful, easy-to-use system. 6 Version: 2.4. 56 Version: 2.4.6 7 7 Author: Shane Warner 8 8 Author URI: https://myceliumdesign.ca/ … … 30 30 31 31 if (!defined('CONF_SCHEDULER_VERSION')) 32 define('CONF_SCHEDULER_VERSION', '2.4. 5');32 define('CONF_SCHEDULER_VERSION', '2.4.6'); 33 33 34 34 if (!defined('CONF_SCHEDULER_PATH')) … … 1150 1150 if(isset($session_check)) { 1151 1151 wp_set_object_terms( $post_id, $session, 'conf_sessions', false); 1152 $start = strtotime( get_term_meta( $session ->term_id, 'start', true ) );1153 $end = $start + (get_term_meta( $session ->term_id, 'length', true ) * 60 );1152 $start = strtotime( get_term_meta( $session, 'start', true ) ); 1153 $end = $start + (get_term_meta( $session, 'length', true ) * 60 ); 1154 1154 update_post_meta( $post_id, 'start_time', (int) $start ); 1155 1155 update_post_meta( $post_id, 'end_time', (int) $end ); … … 1822 1822 1823 1823 $session_tree = $this->get_sessions($atts); 1824 $output .= apply_filters('conf_scheduler_before_filters', '', $session_tree, $atts); 1824 1825 1825 1826 // Search/filter options … … 1877 1878 } 1878 1879 1879 /**1880 * Create HTML output for an individual session1881 * @param array $session_tree nested array of session objects1882 * @param array $atts render attributes passed in1883 * @return string HTML output1884 */1880 /** 1881 * Create HTML output for an individual session 1882 * @param array $session_tree nested array of session objects 1883 * @param array $atts render attributes passed in 1884 * @return string HTML output 1885 */ 1885 1886 function render_session($session_tree, $atts = null) { 1886 $output = '';1887 1888 $default_state = (isset($atts['defaultstate']) && in_array($atts['defaultstate'], array('open', 'parent_sessions', 'all_sessions'))) ? $atts['defaultstate'] : '';1889 $hideWorkshops = ( isset($atts['hideworkshops']) && $atts['hideworkshops'] ) ? true : false;1890 foreach ($session_tree as $session_id => $session) {1891 1892 // Determine initial view state1893 $session_class = ' session_'.$session->slug;1894 $day_view_state = $default_state != '' ? ' open' : '';1895 if ( $this->option('day_mode') == 'tabs' ) $day_view_state = ' open';1896 1897 $has_visible_sub_sessions = ( isset($session->children) && count($session->children) && !$session->merge_children );1898 if ( $default_state == 'all_sessions' && $has_visible_sub_sessions) $session_class .= ' open';1899 if ( $default_state == 'open' ) $session_class .= ' open';1900 1901 // Output day if needed1902 if ($session->parent == 0) {1903 if ($session->start >= $this->last_date) {1904 if ($this->last_date != -1) $output .= "</div><!-- .conference_day -->\n"; // close day 1905 $date_format = $this->option('day_format') == 'custom' ? $this->option('day_format_custom') : $this->option('day_format');1906 if ($this->last_date == -1 ) {1907 $this->last_date = $session->start;1908 } else {1909 if ( $this->option('day_mode') == 'tabs' ) $day_view_state = '';1910 }1911 $output .= '<div class="conference_day day_'.date('Ymd', $session->start).$day_view_state.'">'."\n".'<h3>'.date_i18n($date_format, $session->start).'</h3>';1912 $new_cutoff = strtotime('tomorrow 12am', max($session->start, $this->last_date));1913 $this->last_date = apply_filters('conf_scheduler_next_day_timestamp', $new_cutoff, $session->start, $this->last_date); 1914 }1915 } 1916 1917 if ($session->count == 0) $session_class .= ' no_workshops';1918 1919 $output .= '<div class="session'.$session_class.'">'."\n";1920 $title = '';1921 if(!$session->hide_time) {1922 $title .= date(get_option('time_format'), $session->start);1923 if (!apply_filters('conf_scheduler_session_time_hide_end', $this->option('view_mode') == 'timeline'))1924 $title .= ' - '.date(get_option('time_format'), ($session->start + $session->length *60) );1925 }1926 if($this->option('view_mode') != 'timeline' && !$session->hide_title) $title .= ' '.$session->name;1927 1928 $output .= '<h3>'.trim(apply_filters('conf_scheduler_session_title', $title, $session)).'</h3>'; 1929 if ( $session->description )1930 $output .= '<div class="description">'.wpautop($session->description).'</div>';1931 1932 $output .= '<div class="workshops">'."\n";1933 1934 $workshops = array();1935 if(!$hideWorkshops) {1936 if($session->group_by_location) { 1937 // group workshops by location within this session 1938 $output .= $this->render_session_grouped_workshops($session, $atts); 1939 } else { 1940 // render session workshops one by one1941 $workshops = $this->get_session_workshops($session, $atts);1942 1943 foreach ($workshops as $workshop) {1944 $output .= $this->render_workshop($workshop, $session, $atts);1887 $output = ''; 1888 1889 $default_state = (isset($atts['defaultstate']) && in_array($atts['defaultstate'], array('open', 'parent_sessions', 'all_sessions'))) ? $atts['defaultstate'] : ''; 1890 $hideWorkshops = ( isset($atts['hideworkshops']) && $atts['hideworkshops'] ) ? true : false; 1891 foreach ($session_tree as $session_id => $session) { 1892 // Determine initial view state 1893 $session_class = ' session_'.$session->slug; 1894 $day_view_state = $default_state != '' ? ' open' : ''; 1895 if ( $this->option('day_mode') == 'tabs' ) $day_view_state = ' open'; 1896 1897 $has_visible_sub_sessions = ( isset($session->children) && count($session->children) && !$session->merge_children ); 1898 if ( $default_state == 'all_sessions' && $has_visible_sub_sessions ) $session_class .= ' open'; 1899 if ( $default_state == 'open' ) $session_class .= ' open'; 1900 1901 // Output day if needed 1902 if ($session->parent == 0) { 1903 if ($session->start >= $this->last_date) { 1904 if ($this->last_date != -1) $output .= "</div><!-- .conference_day -->\n"; // close day 1905 $date_format = $this->option('day_format') == 'custom' ? $this->option('day_format_custom') : $this->option('day_format'); 1906 if ($this->last_date == -1 ) { 1907 $this->last_date = $session->start; 1908 } else { 1909 if ( $this->option('day_mode') == 'tabs' ) $day_view_state = ''; 1910 } 1911 $output .= '<div class="conference_day day_'.date('Ymd', $session->start).$day_view_state.'">'."\n".'<h3>'.date_i18n($date_format, $session->start).'</h3>'; 1912 $new_cutoff = strtotime('tomorrow 12am', max($session->start, $this->last_date) ); 1913 $this->last_date = apply_filters('conf_scheduler_next_day_timestamp', $new_cutoff, $session->start, $this->last_date); 1914 } 1915 } 1916 1917 if ($session->count == 0) $session_class .= ' no_workshops'; 1918 1919 $output .= '<div class="session'.$session_class.'">'."\n"; 1920 $title = ''; 1921 if(!$session->hide_time) { 1922 $title .= date(get_option('time_format'), $session->start); 1923 if (!apply_filters('conf_scheduler_session_time_hide_end', $this->option('view_mode') == 'timeline')) 1924 $title .= ' - '.date(get_option('time_format'), ($session->start + $session->length *60) ); 1925 } 1926 if($this->option('view_mode') != 'timeline' && !$session->hide_title) $title .= ' '.$session->name; 1927 1928 $output .= '<h3>'.trim(apply_filters('conf_scheduler_session_title', $title, $session)).'</h3>'; 1929 if ( $session->description ) 1930 $output .= '<div class="description">'.wpautop($session->description).'</div>'; 1931 1932 $output .= '<div class="workshops">'."\n"; 1933 1934 $workshops = array(); 1935 if(!$hideWorkshops) { 1936 if($session->group_by_location) { 1937 // group workshops by location within this session 1938 $output .= $this->render_session_grouped_workshops($session, $atts); 1939 } else { 1940 // render session workshops one by one 1941 $workshops = $this->get_session_workshops($session, $atts); 1942 1943 foreach ($workshops as $workshop) { 1944 $output .= $this->render_workshop($workshop, $session, $atts); 1945 } 1945 1946 } 1946 1947 } 1947 } 1948 1949 if(!$hideWorkshops && $session->merge_children && isset($session->children)) { 1950 // add child sessions as split boxes 1951 $output .= $this->render_session_merged_workshops($session->children, $atts); 1952 } 1953 $output .= "</div> <!-- .workshops -->\n"; // close workshops 1954 1955 if(!$workshops && count($session->children) == 0 && $session->count == 0 && !$session->description) { 1956 $output .= '<p class="no_workshops">'.__('No workshops in this session.', 'conf-scheduler')."</p>\n"; 1957 } 1958 1959 if(!$session->merge_children && isset($session->children)) { 1960 $output .= $this->render_session($session->children, $atts); 1961 } 1962 1963 $output .= "</div><!-- .session -->\n"; // close session 1964 } 1965 1966 return $output; 1948 1949 if(!$hideWorkshops && $session->merge_children && isset($session->children)) { 1950 // add child sessions as split boxes 1951 $output .= $this->render_session_merged_workshops($session->children, $atts); 1952 } 1953 $output .= "</div> <!-- .workshops -->\n"; // close workshops 1954 1955 if(!$workshops && count($session->children) == 0 && $session->count == 0 && !$session->description) { 1956 $output .= '<p class="no_workshops">'.__('No workshops in this session.', 'conf-scheduler')."</p>\n"; 1957 } 1958 1959 if(!$session->merge_children && isset($session->children)) { 1960 $output .= $this->render_session($session->children, $atts); 1961 } 1962 1963 $output .= "</div><!-- .session -->\n"; // close session 1964 } 1965 1966 return $output; 1967 1967 } 1968 1968
Note: See TracChangeset
for help on using the changeset viewer.