public function show_settings() { $services = $this->_core->get_services(); $replacement = $this->_get_replacement(); ?> <tr valign="top"> <th scope="row" ><?php _e('Default Service', 'appointments'); ?> </th> <td colspan="2"> <select name="default_service"> <option value=""><?php _e('Default', 'appointments'); ?> </option> <?php foreach ($services as $service) { ?> <option value="<?php echo esc_attr($service->ID); ?> " <?php selected($service->ID, $replacement); ?> > <?php echo $service->name; ?> </option> <?php } ?> </select> <span class="description"><?php _e('This is the service that will be used as the default one.', 'appointments'); ?> </span> </td> </tr> <?php }
public function add_service_selection($out, $service_id) { $shared_ids = $this->_get_resource_sharing_services($service_id); $direct_ids = $this->_get_resource_sharing_services($service_id, true); $all = $this->_core->get_services(); $out .= '<div class="app-shared_resources">'; $out .= '<h4>' . __('Shares resources with', 'appointments') . '</h4>'; foreach ($all as $service) { if (empty($service->ID) || $service->ID == $service_id) { continue; } // Don't include empty hits or current service $checked = in_array($service->ID, $shared_ids) ? 'checked="checked"' : ''; $disabled = in_array($service->ID, $shared_ids) && !in_array($service->ID, $direct_ids) ? 'disabled="disabled"' : ''; $out .= "<label for='app-shared_service-{$service_id}-{$service->ID}'>" . "<input type='checkbox' id='app-shared_service-{$service_id}-{$service->ID}' value='{$service->ID}' name='shared_resources[{$service_id}][]' {$checked} {$disabled} />" . ' ' . $service->name . '</label><br />'; } $out .= '</div>'; return strtr($out, "'", '"'); // We have to escape this, because of the way the JS injection works on the services page (wtf really o.0) }
private function resolve_service_id($worker = false) { //Try to guess the service ID related to the working hours. //This would be accurate only for specific providers providing a single service. $services = array(); if ($worker) { $services = appointments_get_worker_services($worker); } else { $services = $this->_core->get_services(); } foreach ($services as $key => $service) { if ($this->_data['service_padding'][$service->ID][self::PADDING_BEFORE] || $this->_data['service_padding'][$service->ID][self::PADDING_AFTER]) { return $service->ID; } } return false; }