Changeset 1605169
- Timestamp:
- 02/28/2017 11:32:53 AM (9 years ago)
- Location:
- elvantools/trunk
- Files:
-
- 5 edited
-
elvantotools.php (modified) (3 diffs)
-
readme.txt (modified) (3 diffs)
-
settings.php (modified) (3 diffs)
-
style.css (modified) (1 diff)
-
widget.php (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
elvantools/trunk/elvantotools.php
r1598689 r1605169 58 58 'service_types' => isset($options['roster_service_types']) ? $options['roster_service_types'] : false, 59 59 'departments' => isset($options['roster_departments']) ? $options['roster_departments'] : false, 60 'show_details' => isset($options['roster_show_details']) ? $options['roster_show_details'] : false, 60 61 'sub_departments' => isset($options['roster_sub_departments']) ? $options['roster_sub_departments'] : false, 61 62 'positions' => isset($options['roster_positions']) ? $options['roster_positions'] : false, … … 80 81 $header_prefix = '<thead class="elvantotools_header">'; 81 82 $header_suffix = '</thead>'; 82 $header_element_prefix = '<th >';83 $header_element_prefix = '<th class="elvantotools-header-service">'; 83 84 $header_element_suffix = '</th>'; 84 $header_content = ' <strong>[service]</strong>';85 $header_content = '[service]'; 85 86 $body_prefix = '<tbody>'; 86 87 $body_suffix = '</tbody>'; … … 102 103 $empty_suffix = '</td></tr>'; 103 104 104 $output = elvantotools_roster_generate ($key, $offset, $weeks, $services, $service_types, $departments, $sub_departments, $positions, $display_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 );105 $output = elvantotools_roster_generate ($key, $offset, $weeks, $services, $service_types, $departments, $sub_departments, $positions, $display_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); 105 106 106 107 return do_shortcode($output); -
elvantools/trunk/readme.txt
r1598691 r1605169 4 4 Requires at least: 4.2.2 5 5 Tested up to: 4.7.2 6 Stable tag: 1. 16 Stable tag: 1.3 7 7 8 8 ElvantoTools is a plugin that allows the display of Elvanto information … … 15 15 to log into Elvanto. 16 16 17 The JagTech website is http s://jagtech.biz17 The JagTech website is http://jagtech.biz 18 18 19 19 == Installation == … … 52 52 v1.1 53 53 Fixed missing icons 54 54 v1.2 55 Fixed web address 56 v1.3 57 Added service plan popup -
elvantools/trunk/settings.php
r1594470 r1605169 227 227 228 228 add_settings_field( 229 'roster_show_details', 230 'Link to service details', 231 array( $this, 'roster_show_details_callback' ), 232 'elvantotools-setting-admin', 233 'setting_section_roster', 234 array('field'=>'roster_show_details') 235 ); 236 237 add_settings_field( 229 238 'roster_show_subs', 230 239 'Show sub-departments', … … 320 329 } 321 330 322 foreach (array('elvanto_api_key','elvanto_time_zone','roster_service_types','roster_departments','songs_service_types','songs_categories','roster_show_depts','roster_show_subs', 'song_in_plan' ) as $field) {331 foreach (array('elvanto_api_key','elvanto_time_zone','roster_service_types','roster_departments','songs_service_types','songs_categories','roster_show_depts','roster_show_subs', 'song_in_plan', 'roster_show_details') as $field) { 323 332 if( isset( $input[$field] ) ) 324 333 $new_input[$field] = sanitize_text_field( $input[$field] ); … … 422 431 public function roster_service_types_callback() { $this->print_input_text('text', 'roster_service_types'); echo ' (service_types)'; } 423 432 public function roster_show_depts_callback() { $this->print_checkbox('roster_show_depts'); echo ' (show_depts)'; } 433 public function roster_show_details_callback() { $this->print_checkbox('roster_show_details'); echo ' (show_details)'; } 424 434 public function roster_show_subs_callback() { $this->print_checkbox('roster_show_subs'); echo ' (show_subs)'; } 425 435 public function song_in_plan_callback() { $this->print_checkbox('song_in_plan'); echo ' (in_plan)'; } -
elvantools/trunk/style.css
r1594470 r1605169 123 123 div.elvantotools-widget-song > span.elvantotools_song_title:before { content: counter(song-number) ". "; counter-increment: song-number } 124 124 125 .elvantotools-header-service { font-weight: bold } 126 127 .elvantotools-popup-trigger { cursor:pointer; } 128 .elvantotools-overlay { position: fixed; top:0; bottom:0; left:0; right: 0; background: rgba(0,0,0, 0.7); transition: opacity 500ms; visibility: hidden; opacity: 0; z-index: 999999} 129 .elvantotools-overlay:target { visibility: visible; opacity: 1; } 130 .elvantotools-popup { width: 30% ; position: relative; transition: all 5s ease-in-out; background: #fff; padding: 20px; margin: 50px auto; max-height:75%; overflow-y:scroll } 131 .elvantotools-popup .elvantotools-popup-close { position: absolute; top:5px; right: 5px; transition: all 200ms; font-weight: bold; font-size: 30px; text-decoration: none; color: #333; cursor:pointer } 132 .elvantotools-popup .elvantotools-popup-close:hover { color: #666 } 133 .elvantotools-popup .elvantotools-popup-content { max-height: 30%; overflow: auto; } 134 135 table.elvantotools-service-plan > thead > tr { background-color: rgba(255,255,255,0.5); color: black } 136 th.elvantotools-series-name { font-style: italic; font-weight: bold; font-size: large; margin-top: 5px; margin-bottom: 5px } 137 tr.elvantotools-item { padding-top: 3px; } 138 tr.elvantotools-item-heading { background-color: rgba(255,255,255,0.2); font-weight: bolder } 139 tr.elvantotools-item-song { background-color: rgba(0,0,0,0.2); } 140 tr.elvantotools-item-item { background-color: rgba(0,0,0,0.1); } 141 td.elvantotools-item-duration { color: darkgray; font-weight: bold } 142 div.elvantotools-item-title { font-weight: bold } 143 div.elvantotools-item-description { font-style: italic; color: gray; padding-top: 3px; padding-bottom: 3px } 144 div.elvantotools-item-description ul { padding-bottom: 0px; } 145 146 -
elvantools/trunk/widget.php
r1598689 r1605169 63 63 } 64 64 65 function elvantotools_roster_generate ($api_key, $offset, $weeks, $service_max, $service_types, $departments, $department_subs, $department_positions, $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 ) {65 function elvantotools_roster_generate ($api_key, $offset, $weeks, $service_max, $service_types, $departments, $department_subs, $department_positions, $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) { 66 66 67 67 $old_tz = date_default_timezone_get(); … … 89 89 ); 90 90 91 if ($show_details) { 92 $fields['fields[1]'] = urlencode('series_name'); 93 $fields['fields[2]'] = urlencode('plans'); 94 } 95 91 96 global $elvantotools_last_error; 92 97 if (($output = elvantotools_curl_cache("https://api.elvanto.com/v1/services/getAll.json", $fields, $api_key)) === FALSE) { … … 100 105 $service_dates = array(); 101 106 $depts = array(); 107 $service_plans = array(); 108 $service_series = array(); 109 $service_ids = array(); 102 110 103 111 $show_depts = (strpos($label_content, '[department]') !== FALSE); … … 130 138 if (!array_key_exists($service_date, $service_dates)) { 131 139 $service_dates[$service_date] = array(); 140 $service_plans[$service_date] = array(); 141 $service_series[$service_date] = array(); 142 $service_ids[$service_date] = array(); 132 143 } 133 144 … … 137 148 $service_name = $service['service_type']['name']; 138 149 $service_dates[$service_date][] = $service_name; 150 151 if ($show_details) { 152 $service_series[$service_date][$service_name] = $service['series_name']; 153 $service_ids[$service_date][$service_name] = $service['id']; 154 foreach ($service['plans']['plan'] as $plan) { 155 //error_log('plan='.print_r($plan,true)); 156 $new_plan = array(); 157 foreach ($plan['items']['item'] as $item) { 158 $new_item = array(); 159 $new_item['duration'] = $item['duration']; 160 $new_item['title'] = $item['title']; 161 $new_item['type'] = $item['heading'] ? 'heading' : ($item['song'] ? 'song' : 'item'); 162 $new_item['description'] = $item['description']; 163 $new_plan[] = $new_item; 164 } 165 $service_plans[$service_date][$service_name] = $new_plan; 166 } 167 } 139 168 140 169 foreach ($service['volunteers']['plan'] as $plan) { … … 200 229 $header_label_content); 201 230 231 if ($show_details) 232 $details = ' <a class="elvantotools-popup-trigger" href="#[id]"><span class="dashicons dashicons-format-aside"></span></a><div id="[id]" class="elvantotools-overlay"><div class="elvantotools-popup"><a class="elvantotools-popup-close" href="#" >×</a><div class="elvantotools-popup-content">[plan]</div></div></div>'; 233 234 error_log('service_dates='.print_r($service_dates,true)); 235 202 236 foreach ($service_dates as $service_date=>$services) { 203 foreach ($services as $service) 204 $table_head .= $header_element_prefix.str_replace('[service]',$service,$header_content).$header_element_suffix; 237 foreach ($services as $service) { 238 if ($show_details) { 239 $formatted_details = '<table class="elvantotools-service-plan"><thead><tr><th class="elvantotools-series-name" colspan="2">'.$service_series[$service_date][$service].'</th></tr></thead><tbody>'; 240 foreach ($service_plans[$service_date][$service] as $item) { 241 $formatted_details .= '<tr class="elvantotools-item elvantotools-item-'.$item['type'].'"> 242 <td><div class="elvantotools-item-title">'.$item['title'].'</div>'.($item['description'] ? '<div class="elvantotools-item-description">'.$item['description'].'</div>':'').'</td> 243 <td class="elvantotools-item-duration">'.$item['duration'].'</td> 244 </tr>'; 245 } 246 $formatted_details .= '</tbody></table>'; 247 $formatted_details = str_replace('[plan]',$formatted_details,$details); 248 $formatted_details = str_replace('[id]',$service_ids[$service_date][$service],$formatted_details); 249 } else { 250 $formatted_details = ''; 251 } 252 $table_head .= $header_element_prefix.str_replace('[service]',$service.$formatted_details,$header_content).$header_element_suffix; 253 } 205 254 } 206 255 … … 707 756 if (!isset($instance['departments'])) $instance['departments'] = isset($options['roster_departments']) ? $options['roster_departments'] : ''; 708 757 if (!isset($instance['sub_departments'])) $instance['sub_departments'] = isset($options['roster_sub_departments']) ? $options['roster_sub_departments'] : ''; 758 if (!isset($instance['show_details'])) $instance['show_details'] = isset($options['roster_show_details']) ? $options['roster_show_details'] : false; 709 759 if (!isset($instance['positions'])) $instance['positions'] = isset($options['positions']) ? $options['positions'] : ''; 710 760 $show_labels = (!$instance['positions'] || strpos(',',$instance['positions']) !== FALSE); … … 740 790 $empty_suffix = '</div></div>'; 741 791 742 $output = elvantotools_roster_generate ($instance['key'], $instance['offset'], $instance['weeks'], $instance['services'], $instance['service_types'], $instance['departments'], $instance['sub_departments'], $instance['positions'], $display_columns, $instance['dates'], $instance['zone'], $instance['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 );792 $output = elvantotools_roster_generate ($instance['key'], $instance['offset'], $instance['weeks'], $instance['services'], $instance['service_types'], $instance['departments'], $instance['sub_departments'], $instance['positions'], $display_columns, $instance['dates'], $instance['zone'], $instance['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); 743 793 744 794 echo do_shortcode($output); … … 767 817 $services = ! empty( $instance['services'] ) ? $instance['services'] : __( (isset($options['elvanto_services']) ? $options['elvanto_services'] : '0'), 'text_domain' ); 768 818 $dates = ! empty( $instance['dates'] ) ? $instance['dates'] : __( '', 'text_domain' ); 819 $show_details = ! empty( $instance['show_details'] ) ? $instance['show_details'] : __( (isset($options['roster_show_details']) ? $options['roster_show_details'] : false), 'text_domain' ); 769 820 ?> 770 821 <div class="elvantotools-widget-header-logo"> … … 805 856 <td><input class="elvantotools-widget-input-narrow" id="<?php echo $this->get_field_id( 'dates' ); ?>" name="<?php echo $this->get_field_name( 'dates' ); ?>" type="text" value="<?php echo esc_attr( $dates ); ?>" placeholder="e.g. M j, Y"> </td> 806 857 </tr> 858 <tr> 859 <td><label for="<?php echo $this->get_field_id('show_details'); ?>"><input type="checkbox" id="<?php echo $this->get_field_id('show_details');?>" name="<?php echo $this->get_field_name('show_details');?>" <?=(isset($instance['show_details']) && $instance['show_details'] == 'on') ? 'CHECKED' : ''?>> <?php _e( 'Link to details'); ?></label></td> 860 </tr> 807 861 </tbody></table> 808 862 <div class="elvantotools-widget"> … … 833 887 $instance['key'] = ( ! empty( $new_instance['key'] ) ) ? $new_instance['key'] : ''; 834 888 $instance['service_types'] = ( ! empty( $new_instance['service_types'] ) ) ? $new_instance['service_types'] : ''; 889 $instance['show_details'] = ( ! empty( $new_instance['show_details'] ) ) ? $new_instance['show_details'] : false; 835 890 $instance['departments'] = ( ! empty( $new_instance['departments'] ) ) ? $new_instance['departments'] : ''; 836 891 $instance['sub_departments'] = ( ! empty( $new_instance['sub_departments'] ) ) ? $new_instance['sub_departments'] : '';
Note: See TracChangeset
for help on using the changeset viewer.