Пример #1
0
    function form_custom_group($data)
    {
        global $mf_domain;
        ?>
    <div class="wrap">
      <div id="message_mf_error" class="error below-h2" style="display:none;"><p></p></div>
      <div id="icon-themes" class="icon32"><br></div>
      <?php 
        if (!$data['core']['id']['value']) {
            ?>
      <h2><?php 
            _e('Create Custom Group', $mf_domain);
            ?>
</h2>
      <?php 
        } else {
            ?>
    <h2><?php 
            _e('Edit Custom Group', $mf_domain);
            ?>
 - <?php 
            echo $data['core']['label']['value'];
            ?>
</h2>
      <?php 
        }
        ?>


     <form id="addCustomGroup" method="post" action="admin.php?page=mf_dispatcher&init=true&mf_section=mf_custom_group&mf_action=save_custom_group" class="validate mf_form_admin">
      <div class="alignleft fixed" style="width: 40%;" id="mf_add_custom_group">
        <?php 
        foreach ($data['core'] as $core) {
            ?>
          <?php 
            if ($core['type'] == 'hidden') {
                ?>
	          <?php 
                mf_form_hidden($core);
                ?>
          <?php 
            } elseif ($core['type'] == 'text') {
                ?>
	          <div class="form-field mf_form <?php 
                echo $core['div_class'];
                ?>
">
              <?php 
                mf_form_text($core);
                ?>
            </div>
          <?php 
            } elseif ($core['type'] == "select") {
                ?>
            <div class="form-field mf_form <?php 
                echo $core['div_class'];
                ?>
">
              <?php 
                mf_form_select($core);
                ?>
            </div>
          <?php 
            } elseif ($core['type'] == "checkbox") {
                ?>
            <fieldset>
              <div class="form-field mf_form <?php 
                echo $core['div_class'];
                ?>
">
              <?php 
                mf_form_checkbox($core);
                ?>
              </div>
            </fieldset>
          <?php 
            }
            ?>
 
        <?php 
        }
        ?>
      	<p class="submit">
      	  <a style="color:black" href="admin.php?page=mf_dispatcher&mf_section=mf_custom_fields&mf_action=fields_list&post_type=<?php 
        echo $data['core']['post_type']['value'];
        ?>
" class="button">Cancel</a>
      	  <input type="submit" class="button button-primary" name="submit" id="submit" value="Save Custom Group">
      	</p>
      </div>
      <div class="widefat mf_form_right stuffbox metabox-holder">
        <h3><?php 
        _e('About group', $mf_domain);
        ?>
</h3>
        <div class="inside">
          <div id="options_field" class="group_side">
            <p><?php 
        _e('A group allows us to group a series of custom fields and to have a better managing of the custom fields', $mf_domain);
        ?>
</p>
            <p><?php 
        _e('The groups have the great usefulness of which it is possible to duplicate, this is, one creates new instance of the group (with all the custom fields that the group contains)', $mf_domain);
        ?>
</p>
            <p><?php 
        _e('Another characteristic of the duplicated groups is that we them can arrange and have a control of which group we want that it show to be first', $mf_domain);
        ?>
</p>
            <p><img src="<?php 
        echo MF_URL;
        ?>
images/admin/group.jpg"/></p>
          </div>
        </div>
      </div>
    </div>
</form>
  <?php 
    }
    function form_custom_field($data)
    {
        global $mf_domain;
        $name_group = '';
        if ($data['core']['custom_group_id']['value']) {
            $group = $this->get_group($data['core']['custom_group_id']['value']);
            $name_group = $group['name'];
        }
        printf('<input type="hidden" id="name_group_slug" value="%s" >', $name_group);
        ?>
    <div class="wrap">
      <div id="message_mf_error" class="error below-h2" style="display:none;"><p></p></div>
      <div id="icon-edit-pages" class="icon32 icon32-posts-page"><br></div>
      <?php 
        if (!$data['core']['id']['value']) {
            ?>
       <h2><?php 
            _e('Create Custom Field', $mf_domain);
            ?>
</h2>
    <?php 
        } else {
            ?>
    <h2><?php 
            _e('Edit Custom Field', $mf_domain);
            echo ' - ' . $data['core']['label']['value'];
            ?>
</h2>
      <?php 
        }
        ?>

     <form id="addCustomField" method="post" action="admin.php?page=mf_dispatcher&init=true&mf_section=mf_custom_fields&mf_action=save_custom_field" class="validate mf_form_admin">
      <div class="alignleft fixed" style="width: 40%;" id="mf_add_custom_field">
        <?php 
        foreach ($data['core'] as $core) {
            ?>
          <?php 
            if ($core['type'] == 'hidden') {
                ?>
                  <?php 
                mf_form_hidden($core);
                ?>
          <?php 
            } elseif ($core['type'] == 'text') {
                ?>
                  <div class="form-field mf_form <?php 
                echo $core['div_class'];
                ?>
">
              <?php 
                mf_form_text($core);
                ?>
            </div>
          <?php 
            } elseif ($core['type'] == "select") {
                ?>
            <div class="form-field mf_form <?php 
                echo $core['div_class'];
                ?>
">
              <?php 
                mf_form_select($core);
                ?>
            </div>
            <?php 
            } elseif ($core['type'] == "textarea") {
                ?>
            <div class="form-field mf_form helptext-form <?php 
                echo $core['div_class'];
                ?>
">
              <?php 
                mf_form_textarea($core);
                ?>
            </div>
          <?php 
            } elseif ($core['type'] == "checkbox") {
                ?>
            <fieldset>
              <div class="form-field mf_form <?php 
                echo $core['div_class'];
                ?>
">
              <?php 
                mf_form_checkbox($core);
                ?>
              </div>
            </fieldset>
          <?php 
            }
            ?>
        <?php 
        }
        ?>
        <p class="submit">
          <a style="color:black" href="admin.php?page=mf_dispatcher&mf_section=mf_custom_fields&mf_action=fields_list&post_type=<?php 
        echo $data['core']['post_type']['value'];
        ?>
" class="button">Cancel</a>
          <input type="submit" class="button button-primary" name="submit" id="submit" value="Save Custom Field">
        </p>
      </div>
      <div class="widefat mf_form_right stuffbox metabox-holder">
        <h3>Options of field</h3>
        <div class="inside">
        <?php 
        $legend_class = $data['core']['id']['value'] ? sprintf('style="display:none;"') : '';
        ?>
        <div  id="options_field_legend" <?php 
        echo $legend_class;
        ?>
 >
          <p>By default on this box will be displayed a information about custom fields, after the  custom field be selected, this box will be displayed some extra options of the field (if required) or a information about the selected field</p>
        </div>
        <div id="options_field">
           <?php 
        if ($data['core']['id']['value']) {
            $name = sprintf('%s_field', $data['core']['type']['value']);
            $mf_field = new $name();
            $mf_field->get_options($data['option'], $name);
        }
        ?>
        </div>
      </div>
      </div>
    </div>
</form>
  <?php 
    }