Exemplo n.º 1
0
 function cp_show_form($catid)
 {
     global $wpdb;
     $fid = '';
     // call tinymce init code if html is enabled
     if (get_option('cp_allow_html') == 'yes') {
         appthemes_tinymce($width = 540, $height = 200);
     }
     //$catid = '129'; // used for testing
     // get the category ids from all the form_cats fields.
     // they are stored in a serialized array which is why
     // we are doing a separate select. If the form is not
     // active, then don't return any cats.
     $sql = "SELECT ID, form_cats FROM {$wpdb->cp_ad_forms} WHERE form_status = 'active'";
     $results = $wpdb->get_results($sql);
     if ($results) {
         // now loop through the recordset
         foreach ($results as $result) {
             // put the form_cats into an array
             $catarray = unserialize($result->form_cats);
             // now search the array for the $catid which was passed in via the cat drop-down
             if (in_array($catid, $catarray)) {
                 // when there's a catid match, grab the form id
                 $fid = $result->ID;
                 // put the form id into the post array for step2
                 $_POST['fid'] = $fid;
             }
         }
         // now we should have the formid so show the form layout based on the category selected
         $sql = $wpdb->prepare("SELECT f.field_label, f.field_name, f.field_type, f.field_values, f.field_perm, f.field_tooltip, f.field_min_length, m.meta_id, m.field_pos, m.field_req, m.form_id " . "FROM {$wpdb->cp_ad_fields} f " . "INNER JOIN {$wpdb->cp_ad_meta} m " . "ON f.field_id = m.field_id " . "WHERE m.form_id = %s " . "ORDER BY m.field_pos asc", $fid);
         $results = $wpdb->get_results($sql);
         if ($results) {
             // loop through the custom form fields and display them
             echo cp_formbuilder($results);
         } else {
             // display the default form since there isn't a custom form for this cat
             echo cp_show_default_form();
         }
     } else {
         // display the default form since there isn't a custom form for this cat
         echo cp_show_default_form();
     }
     // show the image, featured ad, payment type and other options
     echo cp_other_fields();
 }
 function cp_show_form_buyer($catid, $renew = false, $type = 'buyer')
 {
     global $wpdb, $cp_options;
     $fid = '';
     // call tinymce init code if html is enabled and user not on mobile device
     if ($cp_options->allow_html && !wp_is_mobile()) {
         appthemes_tinymce(490, 300);
     }
     // get the category ids from all the form_cats fields.
     // they are stored in a serialized array which is why
     // we are doing a separate select. If the form is not
     // active, then don't return any cats.
     $sql = "SELECT ID, form_cats,form_name FROM {$wpdb->cp_ad_forms} WHERE form_status = 'active'";
     $results = $wpdb->get_results($sql);
     if ($results) {
         // now loop through the recordset
         foreach ($results as $result) {
             // put the form_cats into an array
             $catarray = unserialize($result->form_cats);
             // now search the array for the $catid which was passed in via the cat drop-down
             if (in_array($catid, $catarray)) {
                 // when there's a catid match, grab the form id
                 $fid = $result->ID;
                 // put the form id into the post array for step2
                 $_POST['fid'] = $fid;
             }
             //code added by rj starts
             if ($catid == '') {
                 if (strpos($result->form_name, $type) != false) {
                     // when there's a catid match, grab the form id
                     $fid = $result->ID;
                     // put the form id into the post array for step2
                     $_POST['fid'] = $fid;
                 }
             }
             //code added by rj ends
         }
         // now we should have the formid so show the form layout based on the category selected
         $sql = $wpdb->prepare("SELECT * FROM {$wpdb->cp_ad_fields} f INNER JOIN {$wpdb->cp_ad_meta} m ON f.field_id = m.field_id WHERE m.form_id = %s ORDER BY m.field_pos asc", $fid);
         $results = $wpdb->get_results($sql);
         if ($results) {
             // loop through the custom form fields and display them
             //echo cp_formbuilder($results, $renew);
             echo cp_formbuilder_buyer($results, $renew);
         } else {
             // display the default form since there isn't a custom form for this cat
             echo cp_show_default_form($renew);
         }
     } else {
         // display the default form since there isn't a custom form for this cat
         echo cp_show_default_form($renew);
     }
     // show the image, featured ad, payment type and other options
     $renew_id = $renew ? $renew->ID : false;
     //echo cp_other_fields($renew_id);
 }
Exemplo n.º 3
0
 function cp_show_form($category_id, $listing)
 {
     $form_id = cp_get_form_id($category_id);
     $form_fields = cp_get_custom_form_fields($form_id);
     if ($form_fields) {
         // loop through the custom form fields and display them
         cp_formbuilder($form_fields, $listing);
     } else {
         // display the default form since there isn't a custom form for this cat
         cp_show_default_form($listing);
     }
     // show the image, featured ad, payment type and other options
     cp_other_fields($listing->ID);
 }
Exemplo n.º 4
0
						<form name="mainform" id="mainform" class="form_edit" action="<?php 
echo appthemes_get_step_url();
?>
" method="post" enctype="multipart/form-data">
							<?php 
wp_nonce_field($action);
?>

							<ol>

							<?php 
if ($form_fields) {
    cp_formbuilder($form_fields, $listing);
} else {
    cp_show_default_form($listing);
}
// check and make sure images are allowed
if ($cp_options->ad_images) {
    if (appthemes_plupload_is_enabled()) {
        appthemes_plupload_form($listing->ID);
    } else {
        $images_count = cp_get_ad_images($listing->ID);
        // print out image upload fields. pass in count of images allowed
        cp_ad_edit_image_input_fields($images_count);
    }
} else {
    ?>

									<div class="pad10"></div>
									<li>