Пример #1
0
    function CustomFieldCollectionInterface($rightOnly = false)
    {
        global $flutter_domain;
        global $CUSTOM_WRITE_PANEL;
        global $wpdb;
        global $post;
        //if no exists the write panel returni
        if (!isset($CUSTOM_WRITE_PANEL)) {
            return;
        }
        $customGroups = RCCWP_CustomWritePanel::GetCustomGroups($CUSTOM_WRITE_PANEL->id);
        foreach ($customGroups as $customGroup) {
            //render the elements
            $customFields = RCCWP_CustomGroup::GetCustomFields($customGroup->id);
            //when will be edit the  Post
            if (isset($_REQUEST['post']) && count($customFields) > 0) {
                //using the first field name we can know
                //the order  of the groups
                $firstFieldName = $customFields[0]->name;
                $order = RCCWP_CustomField::GetOrderDuplicates($_REQUEST['post'], $firstFieldName);
                ?>
 
                <div class="write_panel_wrapper"  id="write_panel_wrap_<?php 
                echo $customGroup->id;
                ?>
"><?php 
                //build the group duplicates
                foreach ($order as $key => $element) {
                    ?>
                    <?php 
                    RCCWP_WritePostPage::GroupDuplicate2($customGroup, $element, $key, false);
                    ?>
                   <?php 
                }
                ?>
                <?php 
                //knowing what is the biggest duplicate group
                if (!empty($order)) {
                    $tmp = $order;
                    sort($tmp);
                    $top = $tmp[count($tmp) - 1];
                } else {
                    $top = 0;
                }
                ?>
                <input type='hidden' name='g<?php 
                echo $customGroup->id;
                ?>
counter' id='g<?php 
                echo $customGroup->id;
                ?>
counter' value='<?php 
                echo $top;
                ?>
' />
                <input type="hidden" name="rc-custom-write-panel-verify-key" id="rc-custom-write-panel-verify-key" value="<?php 
                echo wp_create_nonce('rc-custom-write-panel');
                ?>
" />
		        <input type="hidden" name="rc-cwp-custom-write-panel-id" value="<?php 
                echo $CUSTOM_WRITE_PANEL->id;
                ?>
" />
                </div>
            <?php 
            } else {
                if (count($customFields) > 0) {
                    ?>
                <div class="write_panel_wrapper" id="write_panel_wrap_<?php 
                    echo $customGroup->id;
                    ?>
">
                <?php 
                    RCCWP_WritePostPage::GroupDuplicate2($customGroup, 1, 1, false);
                    $gc = 1;
                    ?>
                <input type='hidden' name='g<?php 
                    echo $customGroup->id;
                    ?>
counter' id='g<?php 
                    echo $customGroup->id;
                    ?>
counter' value='<?php 
                    echo $gc;
                    ?>
' />
           		<input type='hidden' name="rc-custom-write-panel-verify-key" id="rc-custom-write-panel-verify-key" value="<?php 
                    echo wp_create_nonce('rc-custom-write-panel');
                    ?>
" />
		        <input type='hidden' name="rc-cwp-custom-write-panel-id" value="<?php 
                    echo $CUSTOM_WRITE_PANEL->id;
                    ?>
" />
                </div>
            <?php 
                }
            }
        }
    }