function awpcp_display_extra_fields($x_msg)
 {
     $output = '';
     $count_extra_fields = count_extra_fields();
     $add_label = __('Add New Field', 'awpcp-extra-fields');
     $add_params = array('page' => 'Configure5', 'action' => 'addnewfield');
     $add_url = add_query_arg($add_params, admin_url('admin.php'));
     $add_button = '<p><a class="button-primary" title="%1$s" href="%2$s"" accesskey="s">%1$s</a></p>';
     $add_button = sprintf($add_button, $add_label, $add_url);
     if ($count_extra_fields > 0) {
         if (isset($x_msg) && !empty($x_msg)) {
             $output .= awpcp_print_message($x_msg);
         }
         $output .= $add_button;
         $order_fields_url = awpcp_get_admin_form_fields_url();
         $order_fields_link = sprintf('<a href="%s">', $order_fields_url);
         $message = __('If you want to order the fields in a particular way, go <order-fields-link>here</a> to <order-fields-link>customize the order of all AWPCP fields</a>.', 'awpcp-extra-fields');
         $message = str_replace('<order-fields-link>', $order_fields_link, $message);
         $output .= '<p>' . $message . '</p>';
         // Setup the table
         $output .= "<table class=\"widefat\" cellspacing=\"0\">";
         $output .= "<thead>";
         $output .= "<tr>";
         $output .= "<th scope=\"col\" class=\"manage-column\">";
         $output .= __("Name", 'awpcp-extra-fields');
         $output .= "</th>";
         $output .= "<th scope=\"col\" class=\"manage-column\">";
         $output .= __("Post Label", 'awpcp-extra-fields');
         $output .= "</th>";
         $output .= "<th scope=\"col\" class=\"manage-column\">";
         $output .= __("View Label", 'awpcp-extra-fields');
         $output .= "</th>";
         $output .= "<th scope=\"col\" class=\"manage-column\">";
         $output .= __("Input Type", 'awpcp-extra-fields');
         $output .= "</th>";
         $output .= "<th scope=\"col\" class=\"manage-column\">";
         $output .= __("Data Type", 'awpcp-extra-fields');
         $output .= "</th>";
         $output .= "<th scope=\"col\" class=\"manage-column\">";
         $output .= __("Options", 'awpcp-extra-fields');
         $output .= "</th>";
         $output .= "<th scope=\"col\" class=\"manage-column\">";
         $output .= __("Validation", 'awpcp-extra-fields');
         $output .= "</th>";
         $output .= "<th scope=\"col\" class=\"manage-column\">";
         $output .= __("Privacy", 'awpcp-extra-fields');
         $output .= "</th>";
         $output .= "<th scope=\"col\" class=\"manage-column\">";
         $output .= __("Categories", 'awpcp-extra-fields');
         $output .= "</th>";
         $output .= "<th scope=\"col\" class=\"manage-column\">";
         $output .= __("Action", 'awpcp-extra-fields');
         $output .= "</th>";
         $output .= "</tr>";
         $output .= "</thead>";
         $output .= "<tfoot>";
         $output .= "<tr>";
         $output .= "<th scope=\"col\" class=\"manage-column\">";
         $output .= __("Name", 'awpcp-extra-fields');
         $output .= "</th>";
         $output .= "<th scope=\"col\" class=\"manage-column\">";
         $output .= __("Post Label", 'awpcp-extra-fields');
         $output .= "</th>";
         $output .= "<th scope=\"col\" class=\"manage-column\">";
         $output .= __("View Label", 'awpcp-extra-fields');
         $output .= "</th>";
         $output .= "<th scope=\"col\" class=\"manage-column\">";
         $output .= __("Input Type", 'awpcp-extra-fields');
         $output .= "</th>";
         $output .= "<th scope=\"col\" class=\"manage-column\">";
         $output .= __("Data Type", 'awpcp-extra-fields');
         $output .= "</th>";
         $output .= "<th scope=\"col\" class=\"manage-column\">";
         $output .= __("Options", 'awpcp-extra-fields');
         $output .= "</th>";
         $output .= "<th scope=\"col\" class=\"manage-column\">";
         $output .= __("Validation", 'awpcp-extra-fields');
         $output .= "</th>";
         $output .= "<th scope=\"col\" class=\"manage-column\">";
         $output .= __("Privacy", 'awpcp-extra-fields');
         $output .= "</th>";
         $output .= "<th scope=\"col\" class=\"manage-column\">";
         $output .= __("Category", 'awpcp-extra-fields');
         $output .= "</th>";
         $output .= "<th scope=\"col\" class=\"manage-column\">";
         $output .= __("Action", 'awpcp-extra-fields');
         $output .= "</th>";
         $output .= "</tr>";
         $output .= "</tfoot>";
         $output .= "<tbody>";
         $fields = awpcp_get_extra_fields();
         foreach ($fields as $field) {
             if (strcasecmp($field->field_mysql_data_type, 'VARCHAR') == 0) {
                 $input_type = 'Short Text';
             } else {
                 if (strcasecmp($field->field_mysql_data_type, 'TEXT') == 0) {
                     $input_type = 'Long Text';
                 } else {
                     if (strcasecmp($field->field_mysql_data_type, 'INT') == 0) {
                         $input_type = 'Whole Number';
                     } else {
                         if (strcasecmp($field->field_mysql_data_type, 'FLOAT') === 0) {
                             $input_type = 'Decimal Number';
                         }
                     }
                 }
             }
             $input_type = $field->field_input_type;
             $output .= "<tr><td>{$field->field_name}</td>";
             $output .= "<td>" . stripslashes_deep($field->field_label) . "</td>";
             $output .= "<td>" . stripslashes_deep($field->field_label_view) . "</td>";
             $output .= "<td>{$input_type}</td>";
             $output .= "<td>{$field->field_mysql_data_type}</td>";
             $output .= "<td>";
             $output .= awpcp_get_comma_separated_list((array) $field->field_options);
             $output .= "</td>";
             $required_text = __('required', 'awpcp-extra-fields');
             if ($field->required && $field->field_validation) {
                 $output .= "<td>{$field->field_validation} ({$required_text})</td>";
             } else {
                 if ($field->required) {
                     $output .= "<td>{$required_text}</td>";
                 } else {
                     $output .= "<td>{$field->field_validation}</td>";
                 }
             }
             $output .= "<td>{$field->field_privacy}</td>";
             $output .= '<td>';
             $categories = awpcp_extra_fields_get_field_categoires($field);
             if (count($categories) == countcategories()) {
                 $output .= __('All', 'awpcp-extra-fields');
             } else {
                 $output .= awpcp_get_comma_separated_categories_list($categories);
             }
             $output .= '</td>';
             $output .= "<td><a href=\"?page=Configure5&action=edit&id={$field->field_id}\">";
             $output .= __("Edit", 'awpcp-extra-fields');
             $output .= "</a> | <a href=\"?page=Configure5&action=delete&id={$field->field_id}\">";
             $output .= __("Delete", 'awpcp-extra-fields');
             $output .= "</a>";
             $output .= "</td></tr>";
         }
         // while ($rsrow=mysql_fetch_row($res)) {
         // 	if($rsrow[5] == 'VARCHAR'){ $rsrow[4] = "Short text";}
         // 	if($rsrow[5] == 'TEXT'){ $rsrow[4] = "Long text";}
         // 	if($rsrow[5] == 'INT'){ $rsrow[4] = "Number";}
         // 	if($rsrow[5] == 'float'){ $rsrow[4] = "Money";}
         // 	$output .= "<tr><td>$rsrow[1]</td>";
         // 	$output .= "<td>$rsrow[2]</td>";
         // 	$output .= "<td>$rsrow[3]</td>";
         // 	$output .= "<td>$rsrow[4]</td>";
         // 	$output .= "<td>$rsrow[5]</td>";
         // 	$output .= "<td>$rsrow[6]</td>";
         // 	$output .= "<td>$rsrow[7]</td>";
         // 	$output .= "<td>$rsrow[8]</td>";
         // 	$output .= "<td>$rsrow[9]</td>";
         // 	$output .= "<td><a href=\"?page=Configure5&action=edit&id=$rsrow[0]\">";
         // 	$output .= __("Edit",'awpcp-extra-fields' );
         // 	$output .= "</a> | <a href=\"?page=Configure5&action=delete&id=$rsrow[0]\">";
         // 	$output .= __("Delete",'awpcp-extra-fields' );
         // 	$output .= "</a>";
         // 	$output .= "</td></tr>";
         // }
         $output .= "</tbody></table>";
     } else {
         $output .= __("It appears you have not added any extra fields yet. Start adding extra fields using the link below", 'awpcp-extra-fields');
         $output .= $add_button;
         $output .= "</p>";
     }
     // Get the fields
     return $output;
 }
Exemplo n.º 2
0
                <div style="border-top:1px solid #dddddd;">
                    <?php 
    $msg = __("Go to the %s section to edit/delete current categories or add new categories.", "AWPCP");
    ?>
                    <?php 
    $url = awpcp_get_admin_categories_url();
    ?>
                    <p><?php 
    echo sprintf($msg, sprintf('<a href="%s">%s</a>', $url, __('Manage Categories', 'AWPCP')));
    ?>
</p>

                    <ul>
                        <?php 
    $totalcategories = countcategories();
    ?>
                        <li style="margin-bottom:6px;list-style:none;">
                            <?php 
    _e("Total number of categories in the system", "AWPCP");
    ?>
:
                            <strong><?php 
    echo $totalcategories;
    ?>
</strong>
                        </li>

                        <?php 
    $totalparentcategories = countcategoriesparents();
    ?>