GetPanelPage() public static method

public static GetPanelPage ( )
    /**
     * View groups/fields of a write panel
     *
     */
    function View()
    {
        global $mf_domain;
        $customWritePanelId = (int) $_REQUEST['custom-write-panel-id'];
        $customWritePanels = RCCWP_CustomWritePanel::GetCustomWritePanels();
        $customWritePanel = RCCWP_CustomWritePanel::Get($customWritePanelId);
        $custom_groups = RCCWP_CustomWritePanel::GetCustomGroups($customWritePanelId);
        // get default group id
        foreach ($custom_groups as $group) {
            if ($group->name == '__default') {
                $customDefaultGroupId = $group->id;
                break;
            }
        }
        ?>

		<script type="text/javascript" language="javascript">
			function confirmBeforeDelete()
			{
				return confirm("<?php 
        _e('Are you sure you want to delete this custom Field?', $mf_domain);
        ?>
");
			}
		</script>
		<div class="wrap">

		<form action="<?php 
        echo RCCWP_ManagementPage::GetPanelPage() . "&mf_action=view-custom-write-panel";
        ?>
" method="post"  id="posts-filter" name="SelectWritePanel">
			<h2>
				<?php 
        echo $customWritePanel->name;
        ?>
				<span style="font-size:small">
					&nbsp; &nbsp;
					<a href="<?php 
        echo RCCWP_ManagementPage::GetCustomWritePanelGenericUrl('edit-custom-write-panel', $panel->id);
        ?>
" ><?php 
        _e('Edit', $mf_domain);
        ?>
</a>|
					<a href="<?php 
        echo RCCWP_ManagementPage::GetCustomWritePanelGenericUrl('delete-custom-write-panel', $panel->id);
        ?>
" onclick="return confirmBeforeDelete();"><?php 
        _e('Delete', $mf_domain);
        ?>
</a>|
					<a href="<?php 
        echo RCCWP_ManagementPage::GetCustomWritePanelGenericUrl('export-custom-write-panel', $panel->id);
        ?>
" ><?php 
        _e('Export', $mf_domain);
        ?>
</a>
				</span>
			</h2>
			<p id="post-search" style="margin-top:6px">
				<strong>
					<?php 
        _e('Choose a Write Panel', $mf_domain);
        ?>
					<select name="custom-write-panel-id" style="margin-top:-2px" onchange="document.SelectWritePanel.submit()">
						<?php 
        foreach ($customWritePanels as $panel) {
            ?>
							<option <?php 
            echo $customWritePanelId == $panel->id ? ' selected ' : '';
            ?>
 value="<?php 
            echo $panel->id;
            ?>
"><?php 
            echo $panel->name;
            ?>
</option>
						<?php 
        }
        ?>
					</select>
				</strong>
				<a href="<?php 
        echo RCCWP_ManagementPage::GetCustomWritePanelGenericUrl('create-custom-group');
        ?>
" class="button-secondary">+ <?php 
        _e('Create a Group', $mf_domain);
        ?>
</a>
				<a href="<?php 
        echo RCCWP_ManagementPage::GetCustomWritePanelGenericUrl('create-custom-field') . "&custom-group-id={$customDefaultGroupId}";
        ?>
" class="button-secondary">+ <?php 
        _e('Create a Field', $mf_domain);
        ?>
</a>
			</p>
		</form>
		
		<br class="clear"/>

  		<table cellpadding="3" cellspacing="3" width="100%" class="widefat">
  		<thead>
	  		<tr>
	  			<th width="60%" scope="col"><?php 
        _e('Name', $mf_domain);
        ?>
</th>
	  			<th width="20%" scope="col"><?php 
        _e('Type', $mf_domain);
        ?>
</th>
				<th width="20%" scope="col"><?php 
        _e('Actions', $mf_domain);
        ?>
</th>
			</tr>
  		</thead>
  		<tbody>
	  		<?php 
        foreach ($custom_groups as $group) {
            if ($customDefaultGroupId != $group->id) {
                ?>
		  			<tr>
		  				<td><strong><a style="color:#D54E21" href="<?php 
                echo RCCWP_ManagementPage::GetCustomWritePanelGenericUrl('edit-custom-group') . "&custom-group-id={$group->id}";
                ?>
"><?php 
                echo $group->name;
                ?>
</a></strong>&nbsp;&nbsp;(<a style="font-size:very-small" href="<?php 
                echo RCCWP_ManagementPage::GetCustomWritePanelGenericUrl('create-custom-field') . "&custom-group-id={$group->id}";
                ?>
"><?php 
                _e('create field', $mf_domain);
                ?>
</a>) </td>
		  				<td><?php 
                _e('Group', $mf_domain);
                ?>
</td>
		  				<td><a onclick="return confirmBeforeDelete();" href="<?php 
                echo RCCWP_ManagementPage::GetCustomWritePanelGenericUrl('delete-custom-group') . "&custom-group-id={$group->id}";
                ?>
">X <?php 
                _e('Delete', $mf_domain);
                ?>
</a></td>
		  				
		  			</tr>
	  		<?php 
                RCCWP_CustomWritePanelPage::DisplayGroupFields($group->id, true);
            }
        }
        RCCWP_CustomWritePanelPage::DisplayGroupFields($customDefaultGroupId);
        ?>
  		</tbody>
  		</table>
		</div>
		<br />
		<?php 
    }
Exemplo n.º 2
0
 /**
  * Generates a url containing the write panel id and the action
  *
  * @return unknown
  */
 function GetCustomWritePanelGenericUrl($mfAction, $customWritePanelId = null)
 {
     if (empty($customWritePanelId) && isset($_REQUEST['custom-write-panel-id'])) {
         $customWritePanelId = $_REQUEST['custom-write-panel-id'];
     }
     if (!empty($customWritePanelId)) {
         $url = RCCWP_ManagementPage::GetPanelPage() . "&custom-write-panel-id={$customWritePanelId}&mf_action={$mfAction}";
     } else {
         $url = RCCWP_ManagementPage::GetPanelPage() . "&mf_action={$mfAction}";
     }
     return $url;
 }
    /**
     * View groups/fields of a write panel
     *
     */
    function View()
    {
        global $mf_domain;
        $customWritePanelId = (int) $_REQUEST['custom-write-panel-id'];
        $customWritePanels = RCCWP_CustomWritePanel::GetCustomWritePanels();
        $customWritePanel = RCCWP_CustomWritePanel::Get($customWritePanelId);
        $custom_groups = RCCWP_CustomWritePanel::GetCustomGroups($customWritePanelId);
        // get default group id
        foreach ($custom_groups as $group) {
            if ($group->name == '__default' && $group->panel_id == $customWritePanelId) {
                // traversal added extra condition to handle globals
                $customDefaultGroupId = $group->id;
                break;
            }
        }
        ?>

		<script type="text/javascript" language="javascript">
			function confirmBeforeDelete()
			{
				return confirm("<?php 
        _e('Are you sure you want to delete this custom Field?', $mf_domain);
        ?>
");
			}
			
			function confirmBeforeDeleteGroup()
			{
				return confirm("<?php 
        _e('Are you sure you want to delete this field group?\\n\\nNote: All fields that are part of this group will also be deleted!', $mf_domain);
        ?>
");
			}
		</script>
		<div class="wrap">

		<form action="<?php 
        echo RCCWP_ManagementPage::GetPanelPage() . "&mf_action=view-custom-write-panel";
        ?>
" method="post"  id="posts-filter" name="SelectWritePanel">
			<h2>
				<?php 
        echo $customWritePanel->name;
        ?>
				<span style="font-size:small">
					&nbsp; &nbsp;
					<a href="<?php 
        echo RCCWP_ManagementPage::GetCustomWritePanelGenericUrl('edit-custom-write-panel', $customWritePanel->id);
        ?>
" ><?php 
        _e('Edit', $mf_domain);
        ?>
</a>|
					<a href="<?php 
        echo RCCWP_ManagementPage::GetCustomWritePanelGenericUrl('delete-custom-write-panel', $customWritePanel->id);
        ?>
" onclick="return confirmBeforeDelete();"><?php 
        _e('Delete', $mf_domain);
        ?>
</a>|
					<a href="<?php 
        echo RCCWP_ManagementPage::GetCustomWritePanelGenericUrl('export-custom-write-panel', $customWritePanel->id);
        ?>
" ><?php 
        _e('Export', $mf_domain);
        ?>
</a>
				</span>
			</h2>
			<p id="post-search" style="margin-top:6px">
				<strong>
					<?php 
        _e('Choose a Write Panel', $mf_domain);
        ?>
					<select name="custom-write-panel-id" style="margin-top:-2px" onchange="document.SelectWritePanel.submit()">
						<?php 
        foreach ($customWritePanels as $panel) {
            ?>
							<option <?php 
            echo $customWritePanelId == $panel->id ? ' selected ' : '';
            ?>
 value="<?php 
            echo $panel->id;
            ?>
"><?php 
            echo $panel->name;
            ?>
</option>
						<?php 
        }
        ?>
					</select>
				</strong>
				<a href="<?php 
        echo RCCWP_ManagementPage::GetCustomWritePanelGenericUrl('create-custom-group');
        ?>
" class="button-secondary">+ <?php 
        _e('Create a Group', $mf_domain);
        ?>
</a>
				<a href="<?php 
        echo RCCWP_ManagementPage::GetCustomWritePanelGenericUrl('create-custom-field') . "&custom-group-id={$customDefaultGroupId}";
        ?>
" class="button-secondary">+ <?php 
        _e('Create a Field', $mf_domain);
        ?>
</a>
			</p>
		</form>
    <br class="clear"/>
    <?php 
        if (isset($_GET['save_order']) && $_GET['saved_order'] == "true") {
            ?>
      <div id="message" class="updated">
        Saved Order.
      </div>
    <?php 
        }
        ?>

 		<?php 
        foreach ($custom_groups as $group) {
            ?>
 
      <?php 
            if ($group->name == "__default") {
                ?>
        <h2>Magic Fields</h2>
      <?php 
            } else {
                ?>
 
       <h2 class="mf-no-default-group"><a href="<?php 
                echo RCCWP_ManagementPage::GetCustomWritePanelGenericUrl('edit-custom-group') . "&custom-group-id={$group->id}";
                ?>
"><?php 
                echo $group->name;
                ?>
</a></strong>
          <span class="mf_add_group_field">(<a href="<?php 
                echo RCCWP_ManagementPage::GetCustomWritePanelGenericUrl('create-custom-field') . "&custom-group-id={$group->id}";
                ?>
"><?php 
                _e('create field', $mf_domain);
                ?>
</a>)</span>
          <span class="mf_delete_group_field">(<a onclick="return confirmBeforeDeleteGroup();" href="<?php 
                echo RCCWP_ManagementPage::GetCustomWritePanelGenericUrl('delete-custom-group') . "&custom-group-id={$group->id}";
                ?>
"><?php 
                _e('delete', $mf_domain);
                ?>
</a>)</span>

       </h2>
      <?php 
            }
            ?>
		<form action="<?php 
            echo RCCWP_ManagementPage::GetCustomWritePanelGenericUrl('save-fields-order');
            ?>
" method="post"  id="posts-filter" name="ImportWritePanelForm" enctype="multipart/form-data">
  	<table cellpadding="3" cellspacing="3" width="100%" class="widefat">
  		<thead>
	  		<tr>
          <th width="5%"></th>
	  			<th width="20%" scope="col"><?php 
            _e('Label', $mf_domain);
            ?>
</th>
	  			<th width="35%" scope="col"><?php 
            _e('Name (Order)', $mf_domain);
            ?>
</th>
	  			<th width="20%" scope="col"><?php 
            _e('Type', $mf_domain);
            ?>
</th>
					<th width="20%" scope="col"><?php 
            _e('Actions', $mf_domain);
            ?>
</th>
				</tr>
  		</thead>
  		<tbody class="sortable">
      <?php 
            RCCWP_CustomWritePanelPage::DisplayGroupFields($group->id);
            ?>
  		</tbody>
  		</table>
	    <?php 
        }
        ?>
		</div>
		<br />
    <input type="submit" name="save_submit" value="<?php 
        _e('Save Order', $mf_domain);
        ?>
" id="save_order" />
    </form>
		<?php 
    }