-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0606335
commit 2c3989b
Showing
5 changed files
with
157 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
<?php | ||
|
||
function mahoee_scheduling_site_settings_page() | ||
{ | ||
if (!current_user_can('manage_options')) { | ||
return; | ||
} | ||
|
||
echo '<form method="post" action="options.php">'; | ||
settings_fields('mahoee_scheduling'); | ||
do_settings_sections('mahoee-scheduling'); | ||
submit_button(); | ||
echo '</form>'; | ||
|
||
} | ||
|
||
function mahoee_scheduling_register_settings() | ||
{ | ||
register_setting('mahoee_scheduling', 'mahoee_scheduling_recurring', ['type' => 'object']); | ||
|
||
add_settings_section( | ||
'recurring', | ||
'Agenda Recorrente', | ||
'mahoee_scheduling_recurring_section_callback', | ||
'mahoee-scheduling', | ||
); | ||
|
||
add_settings_field( | ||
'weekdays', | ||
'Dias da Semana', | ||
'mahoee_scheduling_recurring_weekdays_callback', | ||
'mahoee-scheduling', | ||
'recurring' | ||
); | ||
|
||
add_settings_field( | ||
'shifts', | ||
'Turnos nesses Dias', | ||
'mahoee_scheduling_recurring_shifts_callback', | ||
'mahoee-scheduling', | ||
'recurring' | ||
); | ||
} | ||
add_action('admin_init', 'mahoee_scheduling_register_settings'); | ||
|
||
function mahoee_scheduling_recurring_section_callback() | ||
{ | ||
echo 'Informe quais dias da semana você opera consistentemente com os turnos selecionado.'; | ||
} | ||
|
||
function mahoee_scheduling_recurring_weekdays_callback() | ||
{ | ||
$options = get_option('mahoee_scheduling_recurring'); | ||
$weekdays = isset($options['weekdays']) ? $options['weekdays'] : []; | ||
$days = [ | ||
0 => 'Domingo', | ||
1 => 'Segunda-feira', | ||
2 => 'Terça-feira', | ||
3 => 'Quarta-feira', | ||
4 => 'Quinta-feira', | ||
5 => 'Sexta-feira', | ||
6 => 'Sábado', | ||
]; | ||
|
||
foreach ($days as $value => $day) { | ||
echo '<label><input type="checkbox" name="mahoee_scheduling_recurring[weekdays][]" value="' . $value . '" ' . (in_array($value, $weekdays) ? 'checked' : '') . '> ' . $day . '</label><br>'; | ||
} | ||
} | ||
|
||
function mahoee_scheduling_recurring_shifts_callback() | ||
{ | ||
$options = get_option('mahoee_scheduling_recurring'); | ||
$shifts = isset($options['shifts']) ? $options['shifts'] : []; | ||
$days = [ | ||
0 => 'Manhã', | ||
1 => 'Tarde', | ||
2 => 'Noite', | ||
]; | ||
|
||
foreach ($days as $value => $shift) { | ||
echo '<label><input type="checkbox" name="mahoee_scheduling_recurring[shifts][]" value="' . $value . '" ' . (in_array($value, $shifts) ? 'checked' : '') . '> ' . $shift . '</label><br>'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
/* | ||
Plugin Name: Mahoee Scheduling | ||
Plugin URI: https://github.com/mahoee-labs/wordpress-plugins/ | ||
Author: Mahoee | ||
Author URI: http://mahoee.com/ | ||
Description: Manage Let's Encrypt certificates for a multisite network. | ||
Version: 0.1.0 | ||
License: MIT License | ||
License URI: https://opensource.org/licenses/MIT | ||
Text Domain: mahoee-scheduling | ||
*/ | ||
|
||
if (!defined('ABSPATH')) { | ||
exit; // Exit if accessed directly | ||
} | ||
|
||
require_once __DIR__ . '/vendor/autoload.php'; | ||
|
||
define('MAHOEE_SCHEDULING_PLUGIN_DIR', plugin_dir_path(__FILE__)); | ||
|
||
require_once MAHOEE_SCHEDULING_PLUGIN_DIR . 'admin/site-settings.php'; | ||
|
||
// Site admin menu | ||
function mahoee_scheduling_site_menu() | ||
{ | ||
add_menu_page( | ||
'Agendamentos desse Site', | ||
'Agendamentos', | ||
'manage_options', | ||
'mahoee-scheduling', | ||
'mahoee_scheduling_site_settings_page', | ||
'dashicons-schedule', | ||
31 | ||
); | ||
} | ||
add_action('admin_menu', 'mahoee_scheduling_site_menu'); |