コード例 #1
0
                    break;
                case 'hidden':
                    $column->form_element = 'text-line';
                    break;
                case 'timestamp':
                    if (Participants_Db::import_timestamp($column->value) === false) {
                        $column->value = '';
                    }
                    break;
            }
        }
        if ('rich-text' == $column->form_element) {
            wp_editor($column->value, preg_replace('#[0-9_-]#', '', Participants_Db::$prefix . $column->name), array('media_buttons' => false, 'textarea_name' => $column->name, 'editor_class' => $field_class));
        } else {
            $params = array('type' => $column->form_element, 'value' => $column->value, 'name' => $column->name, 'options' => $column->values, 'class' => $field_class, 'attributes' => $attributes, 'module' => 'admin-edit');
            PDb_FormElement::print_element($params);
        }
        if (!empty($column->help_text)) {
            ?>
                <span class="helptext"><?php 
            echo stripslashes(trim($column->help_text));
            ?>
</span>
    <?php 
        }
        ?>
            </td>
          </tr>
          <?php 
    }
    ?>
コード例 #2
0
 /**
  * prints a form element
  * 
  * @param array $params
  */
 public static function print_element($params)
 {
     PDb_FormElement::print_element($params);
 }
コード例 #3
0
 public function print_submit_button($class = 'button-primary', $value = false)
 {
     PDb_FormElement::print_element(array('type' => 'submit', 'value' => $value === false ? $this->options['signup_button_text'] : $value, 'name' => 'submit_button', 'class' => $class . ' pdb-submit', 'module' => $this->module));
 }
コード例 #4
0
ファイル: manage_fields.php プロジェクト: newmight2015/psmpsm
                var order = serializeList($(this));
                $.ajax({
                  url: "<?php 
echo $_SERVER['REQUEST_URI'];
?>
",
                  type: "POST",
                  data: order + '&action=reorder_groups'
                });
              }
            });
          });
        </script>
        <p class="submit">
          <?php 
PDb_FormElement::print_element(array('type' => 'submit', 'name' => 'submit-button', 'value' => $PDb_i18n['update groups'], 'class' => 'button button-primary'));
?>
        </p>
      </form>
    </div><!-- groups tab panel -->
    <div id="help">
<?php 
include 'manage_fields_help.php';
?>
    </div>
  </div><!-- ui-tabs container -->
  <div id="dialog-overlay"></div>
  <div id="confirmation-dialog">
  </div>
  <?php 
/**
コード例 #5
0
 /**
  * prints the element
  */
 public function _print()
 {
     PDb_FormElement::print_element(array('type' => $this->form_element, 'value' => $this->value, 'name' => $this->name, 'options' => $this->values, 'class' => $this->field_class, 'attributes' => $this->attributes, 'module' => $this->module));
 }
コード例 #6
0
 /**
  * builds a dropdown element with a list of columns available for filtering
  *
  * @param string $all     sets the "all fields" or no search string, defaults to "show all"
  * @param bool   $print   if true prints the dropdown element
  * @param array  $columns array of columns to show in the dropdown, defaults to displayed columns
  * @param string $sort    sort method to apply to selector list
  * @param bool   $multi   if true, field name will include [] so the value is submitted as an array element
  *
  * @return NULL or HTML string if $print == false
  */
 public function column_selector($all = false, $print = true, $columns = false, $sort = 'column', $multi = false)
 {
     static $multifield_count = 0;
     $value = $this->list_query->current_filter('search_field');
     if ($multi) {
         $values = $this->list_query->current_filter('search_fields');
         $value = isset($values[$multifield_count]) ? $values[$multifield_count] : '';
     }
     $all_string = false === $all ? '(' . __('select', 'participants-database') . ')' : $all;
     $search_columns = $this->searchable_columns($columns);
     if (count($search_columns) > 1) {
         $element = array('type' => 'dropdown', 'name' => 'search_field' . ($multi ? '[]' : ''), 'value' => $value, 'class' => 'search-item', 'options' => array($all_string => 'none', 'null_select' => false) + $search_columns);
     } else {
         $element = array('type' => 'hidden', 'name' => 'search_field' . ($multi ? '[]' : ''), 'value' => current($search_columns), 'class' => 'search-item');
     }
     $multifield_count++;
     if ($print) {
         PDb_FormElement::print_element($element);
     } else {
         return PDb_FormElement::get_element($element);
     }
 }
コード例 #7
0
    /**
     * prints the groups edit tab content
     * 
     * @global object $wpdb
     * @return null 
     */
    protected function print_group_edit_tab_content()
    {
        global $wpdb;
        ?>
        <div id="field_groups" class="manage-fields-wrap">
          <form id="manage_field_groups" method="post">
            <input type="hidden" name="action" value="<?php 
        echo $this->i18n['update groups'];
        ?>
" />
            <h3><?php 
        _e('Edit / Add / Remove Field Groups', 'participants-database');
        ?>
</h3>
            <p>
              <?php 
        // "add group" functionality
        PDb_FormElement::print_element(array('type' => 'submit', 'value' => $this->i18n['add group'], 'name' => 'action', 'attributes' => array('class' => 'button button-default', 'disabled' => 'disabled')));
        PDb_FormElement::print_element(array('type' => 'text', 'name' => 'group_title', 'value' => '', 'attributes' => array('placeholder' => $this->i18n['new group title'] . '&hellip;', 'class' => 'add_field')));
        $next_order = count($this->group_values) + 1;
        PDb_FormElement::print_hidden_fields(array('group_order' => $next_order));
        ?>
            </p>
            <table class="wp-list-table widefat fixed manage-fields manage-field-groups" >
              <thead>
                <tr>
                  <th scope="col" class="fields vertical-title"><span><?php 
        echo $this->table_header(__('fields', 'participants-database'));
        ?>
</span></th>
                  <th scope="col" class="delete vertical-title"><span><?php 
        echo $this->table_header(__('delete', 'participants-database'));
        ?>
</span></th>
    <?php 
        foreach (current($this->group_values) as $column => $value) {
            $column_class = in_array($column, array('order', 'admin', 'display')) ? $column . ' vertical-title' : $column;
            ?>
                    <th scope="col" class="<?php 
            echo $column_class;
            ?>
"><span><?php 
            echo $this->table_header($column);
            ?>
</span></th>
                  <?php 
        }
        ?>
                </tr>
              </thead>
              <tbody>
                  <?php 
        foreach ($this->group_values as $group => $group_values) {
            //  if ($group == 'internal')
            //    continue;
            $group_count = $wpdb->get_var($wpdb->prepare('SELECT COUNT(*) FROM ' . Participants_Db::$fields_table . ' WHERE `group` = "%s"', $group));
            ?>
                  <tr>
                    <td id="field_count_<?php 
            echo $group;
            ?>
"><?php 
            echo $group_count;
            ?>
</td>
                    <td><a href="<?php 
            echo $group_count;
            ?>
" data-thing-name="delete_<?php 
            echo $group;
            ?>
" class="delete" data-thing="<?php 
            _e('group', 'participants-database');
            ?>
"><span class="glyphicon glyphicon-remove"></span></a></td>
                    <?php 
            foreach ($group_values as $column => $value) {
                $attributes = array();
                $options = array();
                $name = '';
                switch ($column) {
                    case 'display':
                    case 'admin':
                        $attributes = array('style' => 'width:20px');
                        $type = 'checkbox';
                        $options = array(1, 0);
                        break;
                    case 'description':
                        $type = 'text-area';
                        break;
                    case 'order':
                        $attributes = array('style' => 'width:30px');
                        $name = 'order_' . $group;
                        $type = 'drag-sort';
                        break;
                    case 'name':
                        $type = 'text';
                        $attributes = array('readonly' => 'readonly');
                    default:
                        $type = 'text';
                }
                $element_atts = array('name' => empty($name) ? $group . '[' . $column . ']' : $name, 'value' => htmlspecialchars(stripslashes($value)), 'type' => $type);
                if (!empty($attributes)) {
                    $element_atts['attributes'] = $attributes;
                }
                if (!empty($options)) {
                    $element_atts['options'] = $options;
                }
                ?>
                      <td class="<?php 
                echo $column;
                ?>
"><?php 
                PDb_FormElement::print_element($element_atts);
                ?>
</td>
                  <?php 
            }
            ?>
                  </tr>
                <?php 
        }
        ?>
              </tbody>
            </table>
            <p class="submit">
    <?php 
        PDb_FormElement::print_element(array('type' => 'submit', 'name' => 'submit-button', 'value' => $this->i18n['update groups'], 'class' => 'button button-primary'));
        ?>
            </p>
          </form>
        </div><!-- groups tab panel -->
          <?php 
    }
コード例 #8
0
    /**
     * prints the general list form controls for the admin lising: deleting and items-per-page selector
     */
    private static function _general_list_form_top()
    {
        ?>

      <form id="list_form"  method="post">
            <?php 
        PDb_FormElement::print_hidden_fields(array('action' => 'list_action'));
        ?>
        <input type="hidden" id="select_count" value="0" />
                <table class="form-table"><tbody><tr><td>
        <fieldset class="widefat inline-controls">
          <?php 
        if (current_user_can(Participants_Db::$plugin_options['plugin_admin_capability'])) {
            ?>
          <span style="padding-right:20px" ><input type="submit" name="submit-button" class="button button-default" value="<?php 
            echo self::$i18n['delete_checked'];
            ?>
" onClick="return delete_confirm();" id="delete_button"  ></span>
          <?php 
        }
        ?>
            <?php 
        $list_limit = PDb_FormElement::get_element(array('type' => 'text-line', 'name' => 'list_limit', 'value' => self::$page_list_limit, 'attributes' => array('style' => 'width:2.8em', 'maxLength' => '3')));
        ?>
          <?php 
        printf(__('Show %s items per page.', 'participants-database'), $list_limit);
        ?>
      <?php 
        PDb_FormElement::print_element(array('type' => 'submit', 'name' => 'submit-button', 'class' => 'button button-default', 'value' => self::$i18n['change']));
        ?>
          
        </fieldset>
              </td></tr></tbody>
        <?php 
    }
コード例 #9
0
    /**
     * prints the general list form controls for the admin lising: deleting and items-per-page selector
     */
    private static function _general_list_form_top()
    {
        ?>

      <form id="list_form"  method="post">
            <?php 
        PDb_FormElement::print_hidden_fields(array('action' => 'list_action'));
        ?>
        <input type="hidden" id="select_count" value="0" />
            <?php 
        /**
         * action pdb-admin_list_form_top
         * @version 1.6
         * 
         * todo: add relevent data to action
         * 
         * good for adding functionality to the admin list
         */
        //            do_action(Participants_Db::$prefix . 'admin_list_form_top', $this);
        do_action(Participants_Db::$prefix . 'admin_list_form_top');
        ?>
                <table class="form-table"><tbody><tr><td>
        <fieldset class="widefat inline-controls">
                      <?php 
        if (current_user_can(Participants_Db::plugin_capability('plugin_admin_capability', 'delete participants'))) {
            ?>
                        <span style="padding-right:20px" ><input type="submit" name="submit-button" class="button button-default" value="<?php 
            echo self::$i18n['delete_checked'];
            ?>
" id="delete_button"  ></span>
          <?php 
        }
        ?>
            <?php 
        $list_limit = PDb_FormElement::get_element(array('type' => 'text-line', 'name' => 'list_limit', 'value' => self::$page_list_limit, 'attributes' => array('style' => 'width:2.8em', 'maxLength' => '3')));
        ?>
          <?php 
        printf(__('Show %s items per page.', 'participants-database'), $list_limit);
        ?>
      <?php 
        PDb_FormElement::print_element(array('type' => 'submit', 'name' => 'submit-button', 'class' => 'button button-default', 'value' => self::$i18n['change']));
        ?>
          
        </fieldset>
                  </td></tr></tbody></table>
        <?php 
    }
コード例 #10
0
 /**
  * builds a dropdown element with a list of columns available for filtering
  *
  * @param string $all     sets the "all fields" or no search string, defaults to "show all"
  * @param bool   $print   if true prints the dropdown element
  * @param array  $columns array of columns to show in the dropdown, defaults to displayed columns
  * @param string $sort    sort method to apply to selector list
  *
  * @return NULL or HTML string if $print == false
  */
 public function column_selector($all = false, $print = true, $columns = false, $sort = 'column')
 {
     $all_string = false === $all ? '(' . __('select', 'participants-database') . ')' : $all;
     $element = array('type' => 'dropdown', 'name' => 'search_field', 'value' => $this->filter['search_field'], 'class' => 'search-item', 'options' => array($all_string => 'none', 'null_select' => false) + $this->searchable_columns($columns));
     if ($print) {
         PDb_FormElement::print_element($element);
     } else {
         return PDb_FormElement::get_element($element);
     }
 }
コード例 #11
0
 /**
  * prints a settings form element
  *
  * @access public because it's called by WP
  *
  * @param array $input
  *    name - setting slug (required)
  *    type - the type of form element to use
  *    value - the current value of the field
  *    help_text - extra text for the setting page
  *    options - if an array type setting, the values of the settings, array
  *    attributes - any additional attributes to add
  *    class - a CSS class name to add
  */
 public function print_settings_field($input)
 {
     //error_log(__METHOD__.' name:'.$input['name'].' type:'.$input['type'].' title:'.$input['title']);
     if (!isset($input['name'])) {
         return NULL;
     }
     if ($input['type'] == 'header') {
         //echo '<h3>' . $input['title'] . '</h3>';
     } else {
         $options = get_option($this->WP_setting);
         $args = wp_parse_args($input, array('options' => false, 'attributes' => '', 'value' => ''));
         // supply the value of the field from the saved option or the default as defined in the settings init
         $args['value'] = isset($options[$input['name']]) ? $options[$input['name']] : $args['value'];
         $args['name'] = $this->WP_setting . '[' . $input['name'] . ']';
         PDb_FormElement::print_element($args);
         if (!empty($args['help_text'])) {
             printf($this->help_text_wrap, trim($args['help_text']));
         }
     }
 }
コード例 #12
0
 /**
  * prints the submit button
  *
  * @param string $class a classname for the submit button, defaults to 'button-primary'
  * @param string $button_value submit button text
  * 
  */
 public function print_submit_button($class = 'button-primary', $button_value = false)
 {
     $button_value = $button_value ? $button_value : $this->shortcode_atts['submit_button'];
     PDb_FormElement::print_element(array('type' => 'submit', 'value' => $button_value, 'name' => 'submit_button', 'class' => $class . ' pdb-submit', 'module' => $this->module));
 }