예제 #1
0
 public function viewEntries($form_id)
 {
     // the object that reads the entry data
     $vfbdb = new VFB_Pro_Data();
     // getting all post ids for entries for that form id
     $entriesIDs = $vfbdb->get_entries_meta_by_form_id($form_id, "");
     // looping through entries to get individual data
     foreach ($entriesIDs as $entryID) {
         $entry_id = $entryID['ID'];
         $fields = $vfbdb->get_fields($form_id, "AND field_type NOT IN ('page-break','captcha','submit') ORDER BY field_order ASC");
         // looping through each field for a sing entry
         if (is_array($fields) && !empty($fields)) {
             foreach ($fields as $field) {
                 $label = isset($field['data']['label']) ? $field['data']['label'] : '';
                 $meta_key = '_vfb_field-' . $field['id'];
                 $value = $vfbdb->get_entry_meta_by_id($entry_id, $meta_key);
                 // skipping the file-upload field type
                 if (in_array($field['field_type'], array('url', 'file-upload'))) {
                     continue;
                 }
                 if (empty($value)) {
                     continue;
                 }
                 $value = strip_tags($value);
                 // adding the header label to the headers variable
                 if (!in_array($label, $this->headers)) {
                     array_push($this->headers, $label);
                 }
                 // exporting the data to the array
                 $data_pair = array($label, $value);
                 array_push($this->data, $data_pair);
             }
         }
     }
     // hardcoded for now :S
     for ($i = 0; $i < sizeof($this->headers); $i++) {
         if ($this->headers[$i] === 'bearbeitet') {
             $temp = $this->headers[11];
             $this->headers[11] = $this->headers[$i];
             $this->headers[$i] = $temp;
         }
     }
 }
예제 #2
0
    function __construct()
    {
        $form_id = '';
        $vfbdb = new VFB_Pro_Data();
        $forms = $vfbdb->get_all_forms();
        ?>
        <select id="vfb-entry-form-ids" name="form-id" onchange="this.options[this.selectedIndex].value != 0 && (window.location = window.location+'&form_id='+this.options[this.selectedIndex].value);">
            <option value="0"><?php 
        _e('Select a Form', 'vfb-pro');
        ?>
</option>
            <?php 
        if (is_array($forms) && !empty($forms)) {
            foreach ($forms as $form) {
                $entry_count = $vfbdb->get_entries_count($form['id']);
                echo sprintf('<option value="%1$d"%3$s>%1$d - %2$s (%4$d)</option>', $form['id'], $form['title'], selected($form['id'], $form_id, false), $entry_count);
            }
        }
        ?>
        </select>
    <?php 
    }