Exemple #1
0
function add_condition_fields()
{
    $form_id = JRequest::getVar('form_id');
    $cond_index = JRequest::getVar('cond_index');
    $cond_fieldindex = JRequest::getVar('cond_fieldindex');
    $cond_fieldid = JRequest::getVar('cond_fieldid');
    $row = JTable::getInstance('formmaker', 'Table');
    $row->load($form_id);
    $ids = array();
    $types = array();
    $labels = array();
    $paramss = array();
    $select_and_input = array("type_text", "type_password", "type_textarea", "type_name", "type_number", "type_phone", "type_submitter_mail", "type_address", "type_country", "type_spinner", "type_checkbox", "type_radio", "type_own_select", "type_paypal_price", "type_paypal_select", "type_paypal_checkbox", "type_paypal_radio", "type_paypal_shipping");
    $fields = explode('*:*new_field*:*', $row->form_fields);
    $fields = array_slice($fields, 0, count($fields) - 1);
    foreach ($fields as $field) {
        $temp = explode('*:*id*:*', $field);
        array_push($ids, $temp[0]);
        $temp = explode('*:*type*:*', $temp[1]);
        array_push($types, $temp[0]);
        $temp = explode('*:*w_field_label*:*', $temp[1]);
        array_push($labels, $temp[0]);
        array_push($paramss, $temp[1]);
    }
    foreach ($types as $key => $value) {
        if (!in_array($types[$key], $select_and_input)) {
            unset($ids[$key]);
            unset($labels[$key]);
            unset($types[$key]);
            unset($paramss[$key]);
        }
    }
    $ids = array_values($ids);
    $labels = array_values($labels);
    $types = array_values($types);
    $paramss = array_values($paramss);
    HTML_contact::add_condition_fields($cond_index, $cond_fieldindex, $cond_fieldid, $ids, $types, $labels, $paramss, $form_id);
}