/** * Generate content for app settings */ function screen_content_app_settings() { // In the future we may use this function without BP too if (function_exists('bp_loggedin_user_id')) { $user_id = bp_loggedin_user_id(); } else { global $current_user; $user_id = $current_user->ID; } if ($this->_core->is_worker($user_id) && isset($this->_core->options["allow_worker_wh"]) && 'yes' == $this->_core->options["allow_worker_wh"]) { // A little trick to pass correct lsw variables to the related function $_REQUEST["app_location_id"] = 0; $_REQUEST["app_provider_id"] = $user_id; $this->_core->get_lsw(); $result = array(); $result_open = $this->_core->get_exception($this->_core->location, $this->_core->worker, 'open'); if ($result_open) { $result["open"] = $result_open->days; } else { $result["open"] = null; } $result_closed = $this->_core->get_exception($this->_core->location, $this->_core->worker, 'closed'); if ($result_closed) { $result["closed"] = $result_closed->days; } else { $result["closed"] = null; } do_action('app_before_bp_app_settings', $user_id); ?> <div class="standard-form"> <form method="post"> <h4><?php _e('My Working Hours', 'appointments'); ?> </h4> <?php echo $this->_core->working_hour_form('open'); ?> <h4><?php _e('My Break Hours', 'appointments'); ?> </h4> <?php echo $this->_core->working_hour_form('closed'); ?> <h4><?php _e('My Exceptional Working Days', 'appointments'); ?> </h4> <input class="datepick" id="open_datepick" type="text" style="width:100%" name="open[exceptional_days]" value="<?php if (isset($result["open"])) { echo $result["open"]; } ?> " /> <h4><?php _e('My Holidays', 'appointments'); ?> </h4> <input class="datepick" id="closed_datepick" type="text" style="width:100%" name="closed[exceptional_days]" value="<?php if (isset($result["closed"])) { echo $result["closed"]; } ?> " /> <div class="submit"> <input type="submit" name="app_bp_settings_submit" value="<?php _e('Save Changes', 'appointments'); ?> " class="auto"> <input type="hidden" name="app_bp_settings_user" value="<?php echo $user_id; ?> "> <?php wp_nonce_field('app_bp_settings_submit', 'app_bp_settings_submit'); ?> </div> </form> </div> <?php do_action('app_after_bp_app_settings', $user_id); } }