public function manage($model, $service, $request, $params) { if (isset($request->req['rm_action']) && $request->req['rm_action'] === 'delete') { $this->remove_field($model, $service, $request, $params); } if (isset($request->req['rm_form_id'])) { $fields_data = $service->get_all_form_fields($request->req['rm_form_id']); } else { die(RM_UI_Strings::get('MSG_NO_FORM_SELECTED')); } foreach ($fields_data as $index => $field_data) { if ($field_data->field_type === 'Price') { $price_field = $service->get('PAYPAL_FIELDS', array('field_id' => $field_data->field_value), array('%d'), 'row'); if ($price_field && isset($price_field->type)) { if ($price_field->type !== 'fixed') { unset($fields_data[$index]); } } } elseif ($field_data->field_type === 'File' || $field_data->field_type === 'Repeatable' || $field_data->field_type === 'Map' || $field_data->field_type === 'Address') { unset($fields_data[$index]); } } $data = new stdClass(); $data->fields_data = $fields_data; $data->forms = RM_Utilities::get_forms_dropdown($service); $data->field_types = RM_Utilities::get_field_types(); $data->form_id = $request->req['rm_form_id']; $view = $this->mv_handler->setView("field_manager"); $view->render($data); }
public function manage($model, $service, $request, $params) { $data = new stdClass(); if (isset($request->req['rm_action'])) { if ($request->req['rm_action'] === 'delete') { $this->remove_field($model, $service, $request, $params); } elseif ($request->req['rm_action'] === 'add_page') { $data->current_page = $this->add_page($model, $service, $request, $params); } elseif ($request->req['rm_action'] === 'delete_page') { $this->delete_page($model, $service, $request, $params); } elseif ($request->req['rm_action'] === 'rename_page') { $this->rename_page($model, $service, $request, $params); } } if (isset($request->req['rm_form_id'])) { $fields_data = $service->get_all_form_fields($request->req['rm_form_id']); } else { die(RM_UI_Strings::get('MSG_NO_FORM_SELECTED')); } $data->fields_data = $fields_data; $data->forms = RM_Utilities::get_forms_dropdown($service); $data->field_types = RM_Utilities::get_field_types(); $data->form_id = $request->req['rm_form_id']; $form = new RM_Forms(); $form->load_from_db($data->form_id); $fopts = $form->get_form_options(); $g = array_keys($data->field_types); if ($data->fields_data && is_array($data->fields_data)) { foreach ($data->fields_data as $in => $out) { if (!in_array($out->field_type, $g)) { unset($data->fields_data[$in]); } } } if (!$fopts->form_pages) { $data->total_page = 1; $data->form_pages = array('Page 1'); } else { $data->total_page = count($fopts->form_pages); $data->form_pages = $fopts->form_pages; } if (!isset($data->current_page)) { $data->current_page = isset($request->req['rm_form_page_no']) ? $request->req['rm_form_page_no'] : 1; } $view = $this->mv_handler->setView("field_manager"); $view->render($data); }
<div class="rmcontent"> <?php if (isset($data->model->is_field_primary) && $data->model->is_field_primary == 1) { include_once plugin_dir_path(__FILE__) . 'template_rm_primary_field_add.php'; } else { $form = new Form("add-field"); $form->configure(array("prevent" => array("bootstrap", "jQuery"), "action" => "")); if (isset($data->model->field_id)) { $form->addElement(new Element_HTML('<div class="rmheader">' . RM_UI_Strings::get("TITLE_EDIT_FIELD_PAGE") . '</div>')); $form->addElement(new Element_Hidden("field_id", $data->model->field_id)); } else { $form->addElement(new Element_HTML('<div class="rmheader">' . RM_UI_Strings::get("TITLE_NEW_FIELD_PAGE") . '</div>')); } $form->addElement(new Element_Hidden("form_id", $data->form_id)); $form->addElement(new Element_Select("<b>" . RM_UI_Strings::get('LABEL_SELECT_TYPE') . ":</b>", "field_type", RM_Utilities::get_field_types(), array("id" => "rm_field_type_select_dropdown", "value" => $data->selected_field, "class" => "rm_static_field rm_required", "required" => "1", "onchange" => "rm_toggle_field_add_form_fields(this)", "longDesc" => RM_UI_Strings::get('HELP_ADD_FIELD_SELECT_TYPE')))); $form->addElement(new Element_Textbox("<b>" . RM_UI_Strings::get('LABEL_LABEL') . ":</b>", "field_label", array("class" => "rm_static_field rm_required", "required" => "1", "value" => $data->model->field_label, "longDesc" => RM_UI_Strings::get('HELP_ADD_FIELD_LABEL')))); //Field_value fields only one can be used at a time $form->addElement(new Element_Textarea("<b>" . RM_UI_Strings::get('LABEL_T_AND_C') . ":</b>", "field_value", array("id" => "rm_field_value_terms", "class" => "rm_static_field rm_field_value", "value" => is_array($data->model->get_field_value()) ? null : $data->model->get_field_value(), "longDesc" => RM_UI_Strings::get('HELP_ADD_FIELD_TnC_VAL')))); $form->addElement(new Element_Textarea("<b>" . RM_UI_Strings::get('LABEL_FILE_TYPES') . ":</b>(" . RM_UI_Strings::get('LABEL_FILE_TYPES_DSC') . ")", "field_value", array("id" => "rm_field_value_file_types", "class" => "rm_static_field rm_field_value", "value" => is_array($data->model->get_field_value()) ? null : $data->model->get_field_value(), "longDesc" => RM_UI_Strings::get('HELP_ADD_FIELD_FILETYPE')))); $form->addElement(new Element_Select("<b>" . RM_UI_Strings::get('LABEL_PRICING_FIELD') . ":</b>", "field_value", $data->paypal_fields, array("id" => "rm_field_value_pricing", "value" => is_array($data->model->get_field_value()) ? null : $data->model->get_field_value(), "class" => "rm_field_value rm_static_field", "longDesc" => RM_UI_Strings::get('HELP_ADD_FIELD_PRICE_FIELD')))); $form->addElement(new Element_Textarea("<b>" . RM_UI_Strings::get('LABEL_PARAGRAPF_TEXT') . ":</b>", "field_value", array("id" => "rm_field_value_paragraph", "class" => "rm_static_field rm_field_value", "value" => is_array($data->model->get_field_value()) ? null : $data->model->get_field_value(), "longDesc" => RM_UI_Strings::get('HELP_ADD_FIELD_PARA_TEXT')))); $form->addElement(new Element_Textarea("<b>" . RM_UI_Strings::get('LABEL_HEADING_TEXT') . ":</b>", "field_value", array("id" => "rm_field_value_heading", "class" => "rm_static_field rm_field_value", "value" => is_array($data->model->get_field_value()) ? null : $data->model->get_field_value(), "longDesc" => RM_UI_Strings::get('HELP_ADD_FIELD_HEADING_TEXT')))); $form->addElement(new Element_Textarea("<b>" . RM_UI_Strings::get('LABEL_OPTIONS') . ":</b>(" . RM_UI_Strings::get('LABEL_DROPDOWN_OPTIONS_DSC') . ")", "field_value", array("id" => "rm_field_value_options_textarea", "class" => "rm_static_field rm_field_value", "value" => is_array($data->model->get_field_value()) ? null : $data->model->get_field_value(), "longDesc" => RM_UI_Strings::get('HELP_ADD_FIELD_OPTIONS_COMMASEP')))); $form->addElement(new Element_Textboxsortable("<b>" . RM_UI_Strings::get('LABEL_OPTIONS') . ":</b>", "field_value[]", array("id" => "rm_field_value_options_sortable", "class" => "rm_static_field rm_field_value", "value" => is_array($data->model->get_field_value()) ? $data->model->get_field_value() : explode(',', $data->model->get_field_value()), "longDesc" => RM_UI_Strings::get('HELP_ADD_FIELD_OPTIONS_SORTABLE')))); //$form->addElement(new Element_HTML("")); $form->addElement(new Element_HTML('<div id="rmaddotheroptiontextboxdiv" style="display:none">')); $form->addElement(new Element_HTML('<div class="rmrow"><div class="rmfield" for="rm_other_option_text"><label> </label></div><div class="rminput"><input type="text" name="rm_textbox" id="rm_other_option_text" class="rm_static_field" readonly="disabled" value="Their Answer"><div id="rmaddotheroptiontextdiv2"><div onclick="jQuery.rm_delete_textbox_other(this)">' . RM_UI_Strings::get('LABEL_DELETE') . '</div></div></div></div>')); $form->addElement(new Element_HTML('</div>')); //$form->addElement(new Element_HTML("<div onclick=''>".RM_UI_Strings::get('LABEL_DELETE')."</div></div>")); $form->addElement(new Element_Hidden("field_is_other_option", "", array("id" => "rm_field_is_other_option")));
if ($f_icon->shape == 'square') { $radius = '0px'; } else { if ($f_icon->shape == 'round') { $radius = '100px'; } else { if ($f_icon->shape == 'sticker') { $radius = '4px'; } } } $bg_r = intval(substr($f_icon->bg_color, 0, 2), 16); $bg_g = intval(substr($f_icon->bg_color, 2, 2), 16); $bg_b = intval(substr($f_icon->bg_color, 4, 2), 16); $icon_style = "style=\"padding:5px;color:#{$f_icon->fg_color};background-color:rgba({$bg_r},{$bg_g},{$bg_b},{$f_icon->bg_alpha});border-radius:{$radius};\""; $field_types_array = RM_Utilities::get_field_types(); ?> <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"> <div class="rmagic"> <!--Dialogue Box Starts--> <div class="rmcontent"> <?php require_once RM_EXTERNAL_DIR . 'icons/icons_list.php'; if (isset($data->model->is_field_primary) && $data->model->is_field_primary == 1) { include_once plugin_dir_path(__FILE__) . 'template_rm_primary_field_add.php'; } else { $form = new Form("add-field"); $form->configure(array("prevent" => array("bootstrap", "jQuery"), "action" => "")); if (isset($data->model->field_id)) { $form->addElement(new Element_HTML('<div class="rmheader">' . RM_UI_Strings::get("TITLE_EDIT_FIELD_PAGE") . '</div>'));