Changeset 1681054
- Timestamp:
- 06/19/2017 11:09:50 AM (9 years ago)
- Location:
- elvantools/trunk
- Files:
-
- 3 edited
-
elvantotools.php (modified) (2 diffs)
-
readme.txt (modified) (2 diffs)
-
widget.php (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
elvantools/trunk/elvantotools.php
r1675433 r1681054 3 3 * @package ElvantoTools 4 4 * @author JagTech 5 * @version 1. 65 * @version 1.7 6 6 */ 7 7 /* … … 10 10 Description: Display rosters and song lists from Elvanto 11 11 Author: JagTech 12 Version: 1. 612 Version: 1.7 13 13 Author URI: http://jagtech.biz 14 14 */ -
elvantools/trunk/readme.txt
r1675433 r1681054 4 4 Requires at least: 4.2.2 5 5 Tested up to: 4.8 6 Stable tag: 1. 66 Stable tag: 1.7 7 7 8 8 ElvantoTools is a plugin that allows the display of Elvanto information … … 62 62 v1.6 63 63 Added position merging 64 v1.7 65 Fixed various bugs in roster widget -
elvantools/trunk/widget.php
r1675433 r1681054 73 73 function elvantotools_roster_generate ($api_key, $offset, $weeks, $service_max, $service_types, $departments, $department_subs, $department_positions, $department_positions_merge, $columns, $dates, $zone, $sort, $prefix, $suffix, $top_left_content, $header_label_content, $header_content, $header_prefix, $header_suffix, $header_element_prefix, $header_element_suffix, $body_prefix, $body_suffix, $row_prefix, $row_suffix, $label_content, $element_prefix, $element_suffix, $name_prefix, $name_suffix, $name_separator, $content, $empty_prefix, $empty_suffix, $show_details) { 74 74 75 //error_log('label_content='.$label_content); 76 //error_log('departments='.print_r($departments,true)); 77 //error_log('department_subs='.print_r($department_subs,true)); 78 //error_log('department_positions='.print_r($department_positions,true)); 79 75 80 $old_tz = date_default_timezone_get(); 76 81 date_default_timezone_set($zone); … … 86 91 if ($exclude_department_positions) 87 92 $department_positions = substr($department_positions,1); 93 94 //error_log('departments='.print_r($departments,true)); 95 //error_log('department_subs='.print_r($department_subs,true)); 96 //error_log('department_positions='.print_r($department_positions,true)); 88 97 89 98 $departments = trim($departments) ? explode(',',$departments) : array(); … … 137 146 138 147 $jdata = json_decode($output, true); 139 148 //error_log('jdata='.print_r($jdata,true)); 140 149 $service_dates = array(); 141 150 $depts = array(); … … 204 213 } 205 214 215 206 216 foreach ($service['volunteers']['plan'] as $plan) { 207 217 foreach ($plan['positions']['position'] as $position) { 218 //error_log('test position[sub_department_name]='.$position['sub_department_name']); 219 //error_log('test department_subs='.print_r($department_subs,true)); 220 //error_log('test exclude_sub_departments='.($exclude_sub_departments ? 'true' : 'false')); 221 //error_log('test false='.print_r(false,true)); 208 222 if ((!count($departments) || ($exclude_departments xor in_array($position['department_name'], $departments))) && 209 (!count($department_subs) || ($exclude_ department_subs xor in_array($position['sub_department_name'], $department_subs))) &&223 (!count($department_subs) || ($exclude_sub_departments xor in_array($position['sub_department_name'], $department_subs))) && 210 224 (!count($department_positions) || ($exclude_department_positions xor in_array($position['position_name'], $department_positions)))) { 225 //error_log('passed'); 211 226 if (is_array($position['volunteers'])) { 212 227 if (!$show_depts) $position['department_name'] = 'All'; … … 239 254 } 240 255 241 //error_log( print_r($positions,true));256 //error_log('depts='.print_r($depts,true)); 242 257 // Display the headers 243 258 $table_head = ''; … … 312 327 $table_body = $body_prefix; 313 328 // Sort the array if a list of deparetments was specified 314 if (count($departments) && !$exclude_departments) 329 if (count($departments) && !$exclude_departments) { 315 330 $depts = elvantotools_sort_by_array($depts, $departments); 316 331 //error_log('depts='.print_r($depts,true)); 332 } 317 333 reset($depts); $first_dept = key($depts); 318 334 foreach ($depts as $dept=>$subs) { 319 if (count($department_subs) && !$exclude_sub_departments) 320 $subs = elvantotools_sort_by_array($subs, $department_subs); 335 //error_log('subs='.print_r($subs,true)); 336 if (count($department_subs) && $show_subs && !$exclude_sub_departments) 337 $subs = elvantotools_sort_by_array($subs, $department_subs); 338 //error_log('subs='.print_r($subs,true)); 321 339 reset($subs); $first_sub = key($subs); 322 340 foreach ($subs as $sub=>$positions) { … … 808 826 if (!isset($instance['sub_departments'])) $instance['sub_departments'] = isset($options['roster_sub_departments']) ? $options['roster_sub_departments'] : ''; 809 827 if (!isset($instance['show_details'])) $instance['show_details'] = isset($options['roster_show_details']) ? $options['roster_show_details'] : false; 810 if (!isset($instance['positions'])) $instance['positions'] = isset($options[' positions']) ? $options['positions'] : '';811 if (!isset($instance['merge'])) $instance['merge'] = isset($options[' merge']) ? $options['merge'] : '';812 $show_labels = (!$instance['positions'] || strpos( ',',$instance['positions']) !== FALSE);828 if (!isset($instance['positions'])) $instance['positions'] = isset($options['roster_positions']) ? $options['roster_positions'] : ''; 829 if (!isset($instance['merge'])) $instance['merge'] = isset($options['roster_positions_merge']) ? $options['roster_positions_merge'] : ''; 830 $show_labels = (!$instance['positions'] || strpos($instance['positions'], ',') !== FALSE); 813 831 $instance['columns'] = $columns; 814 832 if (!isset($instance['sort'])) $instance['sort'] = ''; … … 859 877 //error_log('instance='.print_r($instance, true)); 860 878 $options = get_option('elvantotools_options'); 861 $title = ! empty( $instance['title'] ) ? $instance['title'] : __( ' Song List', 'text_domain' );879 $title = ! empty( $instance['title'] ) ? $instance['title'] : __( 'Roster', 'text_domain' ); 862 880 $key = __( (isset($options['elvanto_api_key']) ? $options['elvanto_api_key'] : ''), 'text_domain' ) ; 863 881 $service_types = ! empty( $instance['service_types'] ) ? $instance['service_types'] : __( (isset($options['roster_service_types']) ? $options['roster_service_types'] : ''), 'text_domain' ) ; 864 882 $departments = ! empty( $instance['departments'] ) ? $instance['departments'] : __( (isset($options['roster_departments']) ? $options['roster_departments'] : ''), 'text_domain' ) ; 865 883 $sub_departments = ! empty( $instance['sub_departments'] ) ? $instance['sub_departments'] : __( (isset($options['roster_sub_departments']) ? $options['roster_sub_departments'] : ''), 'text_domain' ) ; 866 $positions = ! empty( $instance['positions'] ) ? $instance['positions'] : __( (isset($options[' positions']) ? $options['positions'] : ''), 'text_domain' ) ;867 $merge = ! empty( $instance['merge'] ) ? $instance['merge'] : __( (isset($options[' merge']) ? $options['merge'] : ''), 'text_domain' ) ;884 $positions = ! empty( $instance['positions'] ) ? $instance['positions'] : __( (isset($options['roster_positions']) ? $options['roster_positions'] : ''), 'text_domain' ) ; 885 $merge = ! empty( $instance['merge'] ) ? $instance['merge'] : __( (isset($options['roster_positions_merge']) ? $options['roster_positions_merge'] : ''), 'text_domain' ) ; 868 886 $offset = ! empty( $instance['offset'] ) ? $instance['offset'] : __( (isset($options['offset']) ? $options['offset'] : '0'), 'text_domain' ); 869 887 $weeks = ! empty( $instance['weeks'] ) ? $instance['weeks'] : __( (isset($options['elvanto_weeks']) ? $options['elvanto_weeks'] : '1'), 'text_domain' ); … … 951 969 $instance['offset'] = ( ! empty( $new_instance['offset'] ) ) ? absint($new_instance['offset']) : 0; 952 970 $instance['weeks'] = ( ! empty( $new_instance['weeks'] ) ) ? $new_instance['weeks'] : 1; 953 $instance['services'] = ( ! empty( $new_instance['services'] && $new_instance['services'])) ? $new_instance['services'] : '';971 $instance['services'] = ( ! empty( $new_instance['services']) && $new_instance['services']) ? $new_instance['services'] : ''; 954 972 $instance['dates'] = ( ! empty( $new_instance['dates'] ) ) ? $new_instance['dates'] : ''; 955 973 foreach (explode(',',ELVANTOTOOLS_ROSTER_FIELD_NAMES) as $field) { … … 1086 1104 //error_log('instance='.print_r($instance, true)); 1087 1105 $options = get_option('elvantotools_options'); 1088 $title = ! empty( $instance['title'] ) ? $instance['title'] : __( ' Roster Title', 'text_domain' );1106 $title = ! empty( $instance['title'] ) ? $instance['title'] : __( 'Song List', 'text_domain' ); 1089 1107 $key = __( (isset($options['elvanto_api_key']) ? $options['elvanto_api_key'] : ''), 'text_domain' ) ; 1090 1108 $service_types = ! empty( $instance['service_types'] ) ? $instance['service_types'] : __( (isset($options['roster_service_types']) ? $options['roster_service_types'] : ''), 'text_domain' ) ; … … 1169 1187 $instance['video_width'] = ( ! empty( $new_instance['video_width'] ) ) ? absint($new_instance['video_width']) : 0; 1170 1188 $instance['video_height'] = ( ! empty( $new_instance['video_height'] ) ) ? absint($new_instance['video_height']) : 0; 1171 $instance['services'] = ( ! empty( $new_instance['services'] && $new_instance['services'])) ? $new_instance['services'] : '';1189 $instance['services'] = ( ! empty( $new_instance['services']) && $new_instance['services']) ? $new_instance['services'] : ''; 1172 1190 $instance['dates'] = ( ! empty( $new_instance['dates'] ) ) ? $new_instance['dates'] : ''; 1173 1191 foreach (explode(',',ELVANTOTOOLS_SONGS_FIELD_NAMES) as $field) {
Note: See TracChangeset
for help on using the changeset viewer.