options_group, $assignment_desk->get_plugin_option_fullname('general'), array(&$this, 'assignment_desk_validate') );
/* General */
add_settings_section( 'general', 'General', array(&$this, 'general_setting_section'), $assignment_desk->top_level_page );
add_settings_field( 'default_new_assignment_status', 'Default assignment status', array(&$this, 'default_new_assignment_status_option'), $assignment_desk->top_level_page, 'general' );
add_settings_field( 'default_workflow_status', 'Default workflow status', array(&$this, 'default_workflow_status_option'), $assignment_desk->top_level_page, 'general' );
/* Assignment Management */
add_settings_section( 'assignment_management', 'Assignment Management', array(&$this, 'assignment_management_setting_section'), $assignment_desk->top_level_page );
add_settings_field( 'assignment_email_notifications_enabled', 'Enable assignment email notifications', array(&$this, 'assignment_email_notifications_enabled_option'), $assignment_desk->top_level_page, 'assignment_management' );
add_settings_field( 'assignment_email_template_subject', 'Subject template for notifications', array(&$this, 'assignment_email_template_subject_option'), $assignment_desk->top_level_page, 'assignment_management' );
add_settings_field( 'assignment_email_template', 'Template for notifications', array(&$this, 'assignment_email_template_option'), $assignment_desk->top_level_page, 'assignment_management' );
add_settings_section( 'miscellaneous', 'Miscellaneous', array(&$this, 'miscellaneous_setting_section'), $assignment_desk->top_level_page );
add_settings_field( 'google_maps_api_key', 'Google Maps API key', array(&$this, 'google_maps_api_key_option'), $assignment_desk->top_level_page, 'miscellaneous' );
register_setting( $assignment_desk->pitch_form_options_group, $assignment_desk->get_plugin_option_fullname('pitch_form') );
/* Pitch form */
add_settings_section( 'story_pitches', 'Story Pitches', array(&$this, 'story_pitches_setting_section'), $assignment_desk->pitch_form_settings_page );
add_settings_field( 'pitch_form_enabled', 'Enable pitch forms', array(&$this, 'pitch_form_enabled_option'), $assignment_desk->pitch_form_settings_page, 'story_pitches' );
add_settings_field( 'pitch_form_elements', 'Pitch form elements', array(&$this, 'pitch_form_elements_option'), $assignment_desk->pitch_form_settings_page, 'story_pitches' );
register_setting( $assignment_desk->public_facing_options_group, $assignment_desk->get_plugin_option_fullname('public_facing') );
/* Public-facing */
add_settings_section( 'public_facing_views', 'Public-Facing Views', array(&$this, 'public_facing_views_setting_section'), $assignment_desk->public_facing_settings_page );
add_settings_field( 'public_facing_filtering', 'Public-facing filtering', array(&$this, 'public_facing_filtering_option'), $assignment_desk->public_facing_settings_page, 'public_facing_views' );
add_settings_field( 'public_facing_elements', 'Public-facing elements', array(&$this, 'public_facing_elements_option'), $assignment_desk->public_facing_settings_page, 'public_facing_views' );
add_settings_field( 'public_facing_functionality', 'Public-facing functionality', array(&$this, 'public_facing_functionality_option'), $assignment_desk->public_facing_settings_page, 'public_facing_views' );
add_settings_field( 'public_facing_assignment_statuses[]', 'Public-facing assignment statuses', array(&$this, 'public_facing_assignment_statuses'), $assignment_desk->public_facing_settings_page, 'public_facing_views' );
}
function setup_defaults() {
global $assignment_desk, $wpdb;
$options = $assignment_desk->general_options;
if ( $assignment_desk->edit_flow_exists() ) {
global $edit_flow;
$default_workflow_status = get_term_by('slug', $edit_flow->options['custom_status_default_status'],
$edit_flow->custom_status->status_taxonomy);
$options['default_workflow_status'] = $default_workflow_status->term_id;
}
// @todo - Why does get_term_by not work during activation?
// $new_status = get_term_by('slug', 'new', $assignment_desk->custom_taxonomies->assignment_status_label);
$new_status = $wpdb->get_results("SELECT t.*, tt.*
FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id
WHERE tt.taxonomy = '{$assignment_desk->custom_taxonomies->assignment_status_label}'
AND t.slug = 'new' LIMIT 1");
$new_status = $new_status[0];
$options['default_new_assignment_status'] = $new_status->term_id;
$options['assignment_email_template_subject'] = _("[%blogname%] You've been assigned to %title%");
$options['assignment_email_template'] =
_(
"Hello %display_name%,
You've been assigned to the story %title%.
Please login to %dashboard_link% to accept or decline.
Thanks
Blog Editor");
// @todo - other defaults ?
update_option($assignment_desk->get_plugin_option_fullname('general'), $options);
}
function default_new_assignment_status_option() {
global $assignment_desk;
$options = $assignment_desk->general_options;
$assignment_statuses = $assignment_desk->custom_taxonomies->get_assignment_statuses();
if ( count($assignment_statuses) ) {
echo '';
} else {
echo "No statuses set. Please custom_taxonomies->assignment_status_label . "'>create at least one assignment status.";
}
}
/**
* Define post status for newly submitted pitches
* @requires Edit Flow
*/
function default_workflow_status_option() {
global $assignment_desk;
if (class_exists('edit_flow')) {
global $edit_flow;
$options = $assignment_desk->general_options;
$post_statuses = $edit_flow->custom_status->get_custom_statuses();
echo '
';
echo 'Indicate the status in your workflow a new story pitch should be given.';
} else {
echo 'Please enable Edit Flow to define custom workflow statuses. Without Edit Flow, new pitches will be saved with a post status of "draft"';
}
}
function general_setting_section() {
global $assignment_desk;
}
function assignment_management_setting_section() {
global $assignment_desk;
}
function assignment_email_notifications_enabled_option() {
global $assignment_desk;
$options = $assignment_desk->general_options;
echo '';
}
function assignment_email_template_subject_option() {
global $assignment_desk;
$options = $assignment_desk->general_options;
?>
general_options;
echo '
';
echo '' .
_('We support the following tokens') .
': %blogname%, %title%, %role%, %display_name%, %location%, %post_link%, and %dashboard_link%.';
}
function google_maps_api_key_option() {
global $assignment_desk;
$options = $assignment_desk->general_options;
echo '';
}
function miscellaneous_setting_section() {
}
function story_pitches_setting_section() {
global $assignment_desk;
echo "Add an Assignment Desk pitch form to any page or post by adding <!--$assignment_desk->pitch_form_key--> where you'd it to appear.";
}
function pitch_form_enabled_option() {
global $assignment_desk;
$options = $assignment_desk->pitch_form_options;
echo '';
}
/**
* Enable/disable data elements on pitch form
*/
function pitch_form_elements_option() {
global $assignment_desk;
if ($assignment_desk->edit_flow_exists()) {
global $edit_flow;
}
$options = $assignment_desk->pitch_form_options;
echo '';
// Title
echo '
';
echo '';
// Due date
if ($assignment_desk->edit_flow_exists()) {
echo '
<!--$assignment_desk->all_posts_key--> in a page.";
}
function public_facing_filtering_option() {
global $assignment_desk;
$options = $assignment_desk->public_facing_options;
// Filter by post status
echo 'get_plugin_option_fullname('public_facing')
. '[public_facing_filtering_post_status_enabled]"';
if ( $options['public_facing_filtering_post_status_enabled'] ) {
echo ' checked="checked"';
}
echo ' /> ';
// Filter by participant type
echo 'get_plugin_option_fullname('public_facing')
. '[public_facing_filtering_participant_type_enabled]"';
if ( $options['public_facing_filtering_participant_type_enabled'] ) {
echo ' checked="checked"';
}
echo ' /> ';
// Sort by
echo 'get_plugin_option_fullname('public_facing')
. '[public_facing_filtering_sort_by_enabled]"';
if ( $options['public_facing_filtering_sort_by_enabled'] ) {
echo ' checked="checked"';
}
echo ' /> ';
echo 'Indicate the different ways the user can filter posts.'; } function public_facing_elements_option() { global $assignment_desk; if ($assignment_desk->edit_flow_exists()) { global $edit_flow; } $options = $assignment_desk->public_facing_options; echo '