/**
  * Render Meta Box content.
  *
  * @param WP_Post $post The post object.
  */
 public function render_character_meta_box_content($post)
 {
     //n = name, sp = species, a = alignment, g = gender, b = behaviour, sk = skill, st = stamina, l = luck, gd = gold;
     // Add an nonce field so we can check for it later.
     wp_nonce_field('wpifw_inner_custom_box', 'wpifw_inner_custom_box_nonce');
     // Use get_post_meta to retrieve an existing value from the database.
     $show_the_value = get_post_meta($post->ID, '_character_profile', true);
     if (!$show_the_value) {
         $newCharacter = 1;
         $key = array();
     }
     $key = get_the_title($ID);
     if ($key == '') {
         $show_the_value = array();
         $key = array();
     }
     // Display the form, using the current value.
     echo '<table class="form-table">';
     echo '<tbody>';
     $allow_classes = get_option('allow_classes');
     $count_classes = wp_count_posts('character_defaults');
     if ($allow_classes == 'on' && $count_classes->publish > 0) {
         echo '<tr scope="row">';
         echo '<th>';
         echo '<label for="wpifw_parentClass">';
         _e('Use Class', 'wpifw_text');
         echo '</label> ';
         echo '</th>';
         echo '<td>';
         $useClass = $show_the_value[$key]['useClass'];
         echo '<input type="checkbox" id="wpifw_use_class_yes" name="wpifw_use_class_yes"';
         if ($useClass == 'on') {
             echo ' checked ';
         }
         echo '>Yes</input>';
         echo '</td>';
         echo '</tr>';
         echo '<tr scope="row" id="classRow"';
         if ($useClass != 'on') {
             echo ' style="display:none" ';
         }
         echo '>';
         $characterClass = $show_the_value[$key]['species'];
         echo '<th>';
         echo '<label for="wpifw_parentClass">';
         _e('Character Class', 'wpifw_text');
         echo '</label> ';
         echo '</th>';
         echo '<td>';
         echo '<select type="dropdown" id="wpifw_character_species" name="wpifw_character_species">';
         echo wpifw_utils::wpifw_generate_class_options($characterClass);
         echo '</select> ';
         echo '</td>';
         echo '</tr>';
     }
     echo '<tr scope="row">';
     $characterAlignment = $show_the_value[$key]['alignment'];
     echo '<th>';
     echo '<label for="wpifw_character_alignment">';
     _e('Alignment', 'wpifw_text');
     echo '</label> ';
     echo '</th>';
     echo '<td>';
     echo '<select type="dropdown" id="wpifw_character_alignment" name="wpifw_character_alignment">';
     echo '<option value="Friend" ';
     if ($characterAlignment == 'Friend') {
         echo 'selected';
     }
     echo ' >';
     _e('Friend', 'wpifw_text');
     echo '</option>';
     echo '<option value="Foe" ';
     if ($characterAlignment == 'Foe') {
         echo 'selected';
     }
     echo ' >';
     _e('Foe', 'wpifw_text');
     echo '</option>';
     echo '<option value="Neutral" ';
     if ($characterAlignment == 'Neutral') {
         echo 'selected';
     }
     echo ' >';
     _e('Neutral', 'wpifw_text');
     echo '</option>';
     echo '</select> ';
     echo '</td>';
     echo '</tr>';
     echo '<tr scope="row">';
     $characterGender = $show_the_value[$key]['gender'];
     echo '<th>';
     echo '<label for="wpifw_character_gender">';
     _e('Gender', 'wpifw_text');
     echo '</label> ';
     echo '</th>';
     echo '<td>';
     echo '<select type="dropdown" id="wpifw_character_gender" name="wpifw_character_gender">';
     echo '<option value="Male" ';
     if ($characterGender == 'Male') {
         echo 'selected';
     }
     echo ' >';
     _e('Male', 'wpifw_text');
     echo '</option>';
     echo '<option value="Female" ';
     if ($characterGender == 'Female') {
         echo 'selected';
     }
     echo ' >';
     _e('Female', 'wpifw_text');
     echo '</option>';
     echo '<option value="It" ';
     if ($characterGender == 'It') {
         echo 'selected';
     }
     echo ' >';
     _e('It', 'wpifw_text');
     echo '</option>';
     echo '</select> ';
     echo '</td>';
     echo '</tr>';
     echo '<tr scope="row">';
     $characterBehaviour = $show_the_value[$key]['behaviour'];
     echo '<th>';
     echo '<label for="wpifw_character_behaviour">';
     _e('Behaviour', 'wpifw_text');
     echo '</label> ';
     echo '</th>';
     echo '<td>';
     echo '<select type="dropdown" id="wpifw_character_behaviour" name="wpifw_character_behaviour">';
     echo '<option value="Attacker" ';
     if ($characterBehaviour == 'Attacker') {
         echo 'selected';
     }
     echo ' >';
     _e('Attacker', 'wpifw_text');
     echo '</option>';
     echo '<option value="Defender" ';
     if ($characterBehaviour == 'Defender') {
         echo 'selected';
     }
     echo ' >';
     _e('Defender', 'wpifw_text');
     echo '</option>';
     echo '</select> ';
     echo '</td>';
     echo '</tr>';
     //begin stats
     $useDefaults = $show_the_value[$key]['useDefaults'];
     if ($allow_classes == 'on' && $count_classes->publish > 0) {
         echo '<tr scope="row">';
         echo '<th colspan="2">';
         echo '<hr />';
         echo '</th>';
         echo '</tr>';
         if ($useClass === 'on') {
             echo '<tr scope="row" id="use_stat_defaults" style="display:table-row">';
         } else {
             echo '<tr scope="row" id="use_stat_defaults" style="display:none">';
         }
         echo '<th>';
         echo '<label for="wpifw_character_use">';
         _e('Use Class defaults?', 'wpifw_text');
         echo '</label> ';
         echo '</th>';
         echo '<td>';
         echo '<input type="checkbox" id="wpifw_use_defaults_yes" name="wpifw_use_defaults_yes"';
         if ($useDefaults === 'on') {
             echo ' checked';
         }
         echo '></input> Yes ';
         echo '</td>';
         echo '</tr>';
         echo '</tbody>';
         echo '</table>';
     }
     echo '<table class="form-table" id="character-stats">';
     //Skill
     echo '<tbody>';
     echo '<tr scope="row">';
     echo '<th>';
     echo '<label for="wpifw_character_skill">';
     _e('Skill', 'wpifw_text');
     echo '</label> ';
     echo '</th>';
     echo '<td>';
     if (!$newCharacter) {
         $skillroll = $show_the_value[$key]['skill'][0];
     } else {
         $skillroll = "2d6";
     }
     echo '<select type="dropdown" id="wpifw_skill_d1" name="wpifw_skill_d1">';
     echo wpifw_utils::wpifw_generate_dice_options('quantity', $skillroll);
     echo '</select>';
     echo ' x ';
     echo '<select type="dropdown" id="wpifw_skill_d2" name="wpifw_skill_d2">';
     echo wpifw_utils::wpifw_generate_dice_options('type', $skillroll);
     echo '</select>';
     echo ' Sided Dice ';
     echo '</td>';
     echo '</tr>';
     //stamina
     echo '<tr scope="row">';
     echo '<th>';
     echo '<label for="wpifw_character_stamina">';
     _e('Stamina', 'wpifw_text');
     echo '</label> ';
     echo '</th>';
     echo '<td>';
     if (!$newCharacter) {
         $staminaroll = $show_the_value[$key]['stamina'][0];
     } else {
         $staminaroll = "2d6";
     }
     echo '<select type="dropdown" id="wpifw_stamina_d1" name="wpifw_stamina_d1">';
     echo wpifw_utils::wpifw_generate_dice_options('quantity', $staminaroll);
     echo '</select>';
     echo ' x ';
     echo '<select type="dropdown" id="wpifw_stamina_d2" name="wpifw_stamina_d2">';
     echo wpifw_utils::wpifw_generate_dice_options('type', $staminaroll);
     echo '</select>';
     echo ' Sided Dice ';
     echo '</td>';
     echo '</tr>';
     //Luck
     echo '<tr scope="row">';
     echo '<th>';
     echo '<label for="wpifw_character_luck">';
     _e('Luck', 'wpifw_text');
     echo '</label> ';
     echo '</th>';
     echo '<td>';
     if (!$newCharacter) {
         $luckroll = $show_the_value[$key]['luck'][0];
     } else {
         $luckroll = "2d6";
     }
     echo '<select type="dropdown" id="wpifw_luck_d1" name="wpifw_luck_d1">';
     echo wpifw_utils::wpifw_generate_dice_options('quantity', $luckroll);
     echo '</select>';
     echo ' x ';
     echo '<select type="dropdown" id="wpifw_luck_d2" name="wpifw_luck_d2">';
     echo wpifw_utils::wpifw_generate_dice_options('type', $luckroll);
     echo '</select>';
     echo ' Sided Dice ';
     echo '</td>';
     echo '</tr>';
     //Gold
     echo '<tr scope="row">';
     if (!$newCharacter) {
         $goldroll = $show_the_value[$key]['gold'][0];
     } else {
         $goldroll = "2d6";
     }
     echo '<th>';
     echo '<label for="wpifw_gold">';
     _e('Currency', 'wpifw_text');
     echo '</label> ';
     echo '</th>';
     echo '<td>';
     echo '<input type="checkbox" id="wpifw_has_gold" name="wpifw_has_gold" value="has_gold" ';
     if ($goldroll != 0) {
         echo ' checked';
     }
     echo '/> ';
     _e('Can Have Currency', 'wpifw_text');
     echo '<br />';
     echo '<div id="gold_selector" style="display:';
     if ($goldroll != 0) {
         echo 'block">';
     } else {
         echo 'none">';
     }
     echo '<br /><select type="dropdown" id="wpifw_gold_d1" name="wpifw_gold_d1">';
     echo wpifw_utils::wpifw_generate_dice_options('quantity', $goldroll);
     echo '</select>';
     echo ' x ';
     echo '<select type="dropdown" id="wpifw_gold_d2" name="wpifw_gold_d2">';
     echo wpifw_utils::wpifw_generate_dice_options('type', $goldroll);
     echo '</select>';
     echo ' Sided Dice ';
     echo '</div>';
     echo '</td>';
     echo '</tr>';
     //end stats
     echo '</tbody>';
     echo '</table>';
 }
Example #2
0
 /**
  * Function to update opening scene option options 
  * @link : 
  */
 function wpifw_update_opening_scene()
 {
     if (isset($_POST['opening_scene'])) {
         update_option('opening_scene', $_POST['opening_scene']);
         //don't update if not admin
         if (wpifw_utils::wpifw_isAdmin()) {
             update_option('allow_fight', $_POST['allow_fight']);
             update_option('allow_classes', $_POST['allow_classes']);
             update_option('allow_luck', $_POST['allow_luck']);
             update_option('allow_passphrase', $_POST['allow_passphrase']);
             update_option('allow_preface', $_POST['allow_preface']);
             update_option('wpifw_preface', $_POST['wpifw_preface']);
         }
         update_option('icon_color', $_POST['icon_color']);
         update_option('cover_image_id', $_POST['cover_image_id']);
         update_option('cover_image_url', $_POST['cover_image_url']);
         update_option('cover_image_thumbnail_url', $_POST['cover_image_thumbnail_url']);
         update_option('cover_image_overlay_url', $_POST['cover_image_overlay_url']);
         update_option('cover_image_overlay_id', $_POST['cover_image_overlay_id']);
         update_option('cover_image_overlay_title', $_POST['cover_image_overlay_title']);
         update_option('opening_scene_updated', 1);
     }
     // end if
 }
</th>
                                <?php 
    $incorrectDestination = $show_the_value[1]['incorrectDestination'];
    ?>
								<td><select type="dropdown" name="incorrectDestination" id="incorrectDestination-dropdown"><?php 
    wpifw_utils::wpifw_get_scenes_in_act($incorrectDestination);
    ?>
</select></td>
                            </tr>
                            <tr>
                            	<th><?php 
    _e('Decline destination', 'wpifw_text');
    ?>
</th>
                                <?php 
    $declineDestination = $show_the_value[1]['declineDestination'];
    ?>
								<td><select type="dropdown" name="declineDestination" id="declineDestination-dropdown"><?php 
    wpifw_utils::wpifw_get_scenes_in_act($declineDestination);
    ?>
</select></td>
                            </tr>
                            


                            
						</tbody> 
					</table>    	
				<?php 
    echo '</div>';
}
    $id = 'dashboardid';
    $title = 'Dashboard';
    $help = '<p>' . __('Dashboard help.') . '</p>';
    $screen->add_help_tab(array('id' => $id, 'title' => $title, 'content' => $help));
    $screen->set_help_sidebar(__('<h4>External Links</h4><a href="http://choosablepath.net/resources/support/dashboard/">The dashboard</a>'));
} else {
    if ($screen->id == 'dashboard_page_wpifw_options') {
        $id = 'dashboardOptionsid';
        $title = 'Options';
        $help = '<p>' . __('<h4>Options</h4><p>This is the elp</p>') . '</p>';
        $screen->add_help_tab(array('id' => $id, 'title' => $title, 'content' => $help));
        $id = 'openingsceneid';
        $title = 'Opening Scene';
        $help = '<p>' . __('<h4>Setting the Opening Scene</h4>') . '</p>';
        $screen->add_help_tab(array('id' => $id, 'title' => $title, 'content' => $help));
        if (wpifw_utils::wpifw_isAdmin()) {
            $id = 'allowfightid';
            $title = 'Allow Characters';
            $help = '<p>' . __('<h4>Creating Characters</h4>') . '</p>';
            $screen->add_help_tab(array('id' => $id, 'title' => $title, 'content' => $help));
            $id = 'allowclassesid';
            $title = 'Allow Classes';
            $help = '<p>' . __('<h4>Creating Character Classes</h4>') . '</p>';
            $screen->add_help_tab(array('id' => $id, 'title' => $title, 'content' => $help));
            $id = 'allowluckid';
            $title = 'Allow Luck';
            $help = '<p>' . __('<h4>Incorporating Chance</h4>') . '</p>';
            $screen->add_help_tab(array('id' => $id, 'title' => $title, 'content' => $help));
            $id = 'allowpasssphraseid';
            $title = 'Allow Passphrases';
            $help = '<p>' . __('<h4>Using Passphrases</h4>') . '</p>';