RCCWP_CustomWritePanelPage::Content PHP Method

Content() public static method

public static Content ( $customWritePanel = null )
    public static function Content($customWritePanel = null)
    {
        // add the new expanded column, if it's not there already (Traversal)
        RCCWP_Application::AddColumnIfNotExist(MF_TABLE_PANELS, "expanded", $column_attr = "tinyint NOT NULL DEFAULT 1 after type");
        global $mf_domain, $wpdb;
        $customWritePanelName = "";
        $customWritePanelDescription = "";
        $customWritePanelExpanded = 1;
        $write_panel_category_ids = array();
        $defaultTagChecked = 'checked="checked"';
        $customWritePanelAllFieldIds = NULL;
        $customThemePage = NULL;
        $showPost = true;
        $customParentPage = NULL;
        $customWritePanelCategoryIds = NULL;
        if ($customWritePanel != null) {
            $customWritePanelName = $customWritePanel->name;
            $customWritePanelDescription = $customWritePanel->description;
            $customWritePanelExpanded = $customWritePanel->expanded;
            $customWritePanelDisplayOrder = $customWritePanel->display_order;
            $customWritePanelType = $customWritePanel->type;
            if ($customWritePanelType == 'page') {
                $showPost = false;
            }
            $customWritePanelCategoryIds = RCCWP_CustomWritePanel::GetAssignedCategoryIds($customWritePanel->id);
            foreach ($customWritePanelCategoryIds as $key => $c) {
                if ((int) $c != 0) {
                    $tc = get_category($c);
                    $customWritePanelCategoryIds[$key] = $tc->slug;
                }
            }
            $customWritePanelStandardFieldIds = RCCWP_CustomWritePanel::GetStandardFields($customWritePanel->id);
            $customWritePanelAllFieldIds = RCCWP_CustomWritePanel::Get($customWritePanel->id);
            if ($customWritePanelType == 'page') {
                $customThemePage = RCCWP_CustomWritePanel::GetThemePage($customWritePanel->name);
                $customParentPage = RCCWP_CustomWritePanel::GetParentPage($customWritePanel->name);
            }
            $defaultTagChecked = '';
            ?>
			<input type="hidden" name="custom-write-panel-id" value="<?php 
            echo $customWritePanel->id;
            ?>
" />
			<?php 
        }
        ?>


		<table class="form-table" width="100%" border="0" cellspacing="0" cellpadding="6">
		<tbody>
		<tr valign="top">
			<th scope="row"><?php 
        _e('Placement', $mf_domain);
        ?>
</th>
				<td>
				<!-- START :: Javascript for Image/Photo' Css Class -->
				<script type="text/javascript" language="javascript">
					jQuery(document).ready( function() {
							<?php 
        if ($showPost) {
            ?>
								showHide("mf_forpost", "mf_forpage");
							<?php 
        } else {
            ?>
								showHide("mf_forpage", "mf_forpost");
							<?php 
        }
        ?>
						});

					function showHide(showClassID, hideClassID)
					{
						jQuery( function($) {
							$("."+showClassID).css("display","");
							$("."+hideClassID).css("display","none");
							});
					}
				</script>
				<!-- END :: Javascript for Image/Photo' Css Class -->
				<input type="radio" name="radPostPage" id="radPostPage" value="post" <?php 
        if (empty($custoWritePanelType) || $customWritePanelType == 'post') {
            ?>
 checked="checked" <?php 
        }
        ?>
 onclick='showHide("mf_forpost", "mf_forpage");' /> <strong><?php 
        _e('Post', $mf_domain);
        ?>
 </strong> &nbsp; &nbsp; &nbsp;
				<input type="radio" name="radPostPage" id="radPostPage" value="page" <?php 
        if (!empty($customWritePanelType) && $customWritePanelType == 'page') {
            ?>
 checked="checked" <?php 
        }
        ?>
 onclick='showHide("mf_forpage", "mf_forpost");' /> <strong><?php 
        _e('Page', $mf_domain);
        ?>
</strong>
			</td>
		</tr>


		<tr valign="top">
			<th scope="row"  align="right"><?php 
        _e('Name', $mf_domain);
        ?>
:</th>
			<td>
				<input name="custom-write-panel-name" id="custom-write-panel-name" size="40" type="text" value="<?php 
        echo $customWritePanelName;
        ?>
" />
			</td>
		</tr>


		<tr valign="top"  id="catText" class="mf_forpost">
			<th scope="row"  align="right"><div id="catLabel" style="display:inline;"><?php 
        _e('Assigned Categories', $mf_domain);
        ?>
:</div></th>
			<td>

				<?php 
        $cats = get_categories("get=all");
        RCCWP_CustomWritePanelPage::PrintNestedCats($cats, 0, 0, $customWritePanelCategoryIds);
        ?>

			</td>
		</tr>

		<tr valign="top"  id="catText" class="mf_forpage">
			<th scope="row"  align="right"><div id="catLabel" style="display:inline;"><?php 
        _e('Assigned Theme', $mf_domain);
        ?>
:</div></th>
			<td>

				<select name="page_template" id="page_template">
					<option value='default'><?php 
        _e('Default Template');
        ?>
</option>
					<?php 
        $themes_defaults = get_page_templates();
        $theme_select = NULL;
        foreach ($themes_defaults as $v => $k) {
            $theme_select = NULL;
            if ($customWritePanelType == 'page') {
                if ($customThemePage == $k) {
                    $theme_select = 'SELECTED';
                }
            }
            ?>
					<option value='<?php 
            echo $k;
            ?>
' <?php 
            echo $theme_select;
            ?>
 ><?php 
            echo $v;
            ?>
</option>
					<?php 
        }
        ?>
					<?php 
        ?>
				</select>

			</td>
		</tr>

		<tr valign="top"  id="catText" class="mf_forpage">
			<th scope="row"  align="right"><div id="catLabel" style="display:inline;"><?php 
        _e('Page Parent', $mf_domain);
        ?>
:</div></th>
			<td>
			<?php 
        wp_dropdown_pages(array('selected' => $customParentPage, 'name' => 'parent_id', 'show_option_none' => __('Main Page (no parent)'), 'sort_column' => 'menu_order, post_title', 'option_none_value' => -1));
        ?>
			</td>
		</tr>

		<tr>
			<th><?php 
        _e('Quantity', $mf_domain);
        ?>
</th>
			<td>
				<?php 
        if (isset($customWritePanel->id) && !empty($customWritePanel->id)) {
            if ($customWritePanelAllFieldIds->single == 0) {
                $multiple_checked = 'checked="checked"';
                $single_checked = '';
            } else {
                $single_checked = 'checked="checked"';
                $multiple_checked = '';
            }
        } else {
            $multiple_checked = 'checked="checked"';
            $single_checked = '';
        }
        ?>
				<input type="radio" name="single" id="radPostPage" value="1" <?php 
        echo $single_checked;
        ?>
  /> <strong><?php 
        _e('Single', $mf_domain);
        ?>
 </strong> &nbsp; &nbsp; &nbsp;
				<input type="radio" name="single" id="radPostPage" value="0" <?php 
        echo $multiple_checked;
        ?>
  /> <strong><?php 
        _e('Multiple', $mf_domain);
        ?>
</strong>
			</td>
		</tr>

		<tr valign="top">
			<th scope="row" align="right"><?php 
        _e('Standard Fields', $mf_domain);
        ?>
:</th>
			<td>
				<?php 
        global $STANDARD_FIELDS, $wp_version;
        foreach ($STANDARD_FIELDS as $field) {
            if ($field->excludeVersion <= substr($wp_version, 0, 3)) {
                continue;
            }
            if ($field->isAdvancedField) {
                continue;
            }
            $checked = "";
            $classes = "";
            if ($customWritePanel != null) {
                if (in_array($field->id, $customWritePanelStandardFieldIds)) {
                    $checked = "checked=\"checked\"";
                }
            } else {
                if ($field->defaultChecked) {
                    $checked = "checked=\"checked\"";
                }
            }
            if ($field->forPost && !$field->forPage) {
                $classes = $classes . " mf_forpost";
            }
            if ($field->forPage && !$field->forPost) {
                $classes = $classes . " mf_forpage";
            }
            ?>
					<div class="<?php 
            echo $classes;
            ?>
">
						<input type="checkbox" name="custom-write-panel-standard-fields[]" value="<?php 
            echo $field->id;
            ?>
" <?php 
            echo $checked;
            ?>
 />
						<?php 
            echo $field->displayName;
            ?>
						<br />
					</div>
				<?php 
        }
        ?>
			</td>
		</tr>

		<tr valign="top">
			<th scope="row" align="right"><?php 
        _e('Advanced Fields', $mf_domain);
        ?>
:</th>
			<td>
				<?php 
        global $STANDARD_FIELDS, $wp_version;
        foreach ($STANDARD_FIELDS as $field) {
            if ($field->excludeVersion <= substr($wp_version, 0, 3)) {
                continue;
            }
            if (!$field->isAdvancedField) {
                continue;
            }
            $checked = "";
            $classes = "";
            if ($customWritePanel != null) {
                if (in_array($field->id, $customWritePanelStandardFieldIds)) {
                    $checked = "checked=\"checked\"";
                }
            } else {
                if ($field->defaultChecked) {
                    $checked = "checked=\"checked\"";
                }
            }
            if ($field->forPost && !$field->forPage) {
                $classes = $classes . " mf_forpost";
            }
            if ($field->forPage && !$field->forPost) {
                $classes = $classes . " mf_forpage";
            }
            ?>
					<div class="<?php 
            echo $classes;
            ?>
">
						<input type="checkbox" name="custom-write-panel-standard-fields[]" value="<?php 
            echo $field->id;
            ?>
" <?php 
            echo $checked;
            ?>
 />
						<?php 
            echo $field->displayName;
            ?>
						<br />
					</div>
				<?php 
        }
        ?>
			</td>
		</tr>

		<tr valign="top">
			<th scope="row" align="right"><?php 
        _e('Order', $mf_domain);
        ?>
:</th>
			<?php 
        if (empty($customWritePanelDisplayOrder)) {
            $customWritePanelDisplayOrder = "";
        }
        ?>
			<td><input name="custom-write-panel-order" id="custom-write-panel-order" size="2" type="text" value="<?php 
        echo $customWritePanelDisplayOrder;
        ?>
" /></td>
		</tr>

		<tr>
			<th scope="row" align="right"><?php 
        _e('Top Level Fields Expanded', $mf_domain);
        ?>
:</th>
			<td><input name="custom-write-panel-expanded" id="custom-write-panel-expanded" type="checkbox" value="1" <?php 
        echo $customWritePanelExpanded == 0 ? '' : ' checked="checked" ';
        ?>
 />&nbsp;<?php 
        _e('Display the full expanded group editing interface instead of the summary for fields created at the top level (fields not inside a group)', $mf_domain);
        ?>
			  <br /><small><?php 
        _e('Note: the group can still be collapsed by the user, this just determines the default state on load');
        ?>
</td>
		</tr>


		</tbody>
		</table>

		<?php 
    }

Usage Example

    function Main()
    {
        global $flutter_domain;
        ?>

		<div class="wrap">

		<h2><?php 
        _e('Create Custom Write Panel', $flutter_domain);
        ?>
</h2>
		
		<form action="<?php 
        echo RCCWP_ManagementPage::GetCustomWritePanelGenericUrl('finish-create-custom-write-panel');
        ?>
" method="post" id="create-new-write-panel-form">
		
		<?php 
        RCCWP_CustomWritePanelPage::Content();
        ?>
		
		<p class="submit" >
			<a style="color:black" href="<?php 
        echo RCCWP_ManagementPage::GetCustomWritePanelGenericUrl('cancel-create-custom-write-panel');
        ?>
" class="button"><?php 
        _e('Cancel');
        ?>
</a>
			<input type="submit" id="finish-create-custom-write-panel" value="<?php 
        _e('Finish');
        ?>
" />
		</p>
		
		</form>

		</div>
        <br />
        <a href="http://flutter.freshout.us"><img src="<?php 
        echo FLUTTER_URI . "/images/flutter_logo.jpg";
        ?>
" /></a>

		<?php 
    }
All Usage Examples Of RCCWP_CustomWritePanelPage::Content