function aria_create_student_form($competition_name) { $student_form = new GF_Form("{$competition_name} Student Registration", ""); $field_id_array = aria_student_field_id_array(); $parent_name_field = new GF_Field_Name(); $parent_name_field->label = "Parent Name"; $parent_name_field->id = $field_id_array['parent_name']; $parent_name_field->isRequired = true; $parent_form->fields[] = $parent_name_field; $parent_email_field = new GF_Field_Email(); $parent_email_field->label = "Parent's Email"; $parent_email_field->id = $field_id_array['parent_email']; $parent_email_field->isRequired = true; $student_form->fields[] = $parent_email_field; $student_name_field = new GF_Field_Name(); $student_name_field->label = "Student Name"; $student_name_field->description = "Please capitalize your child's first " . "and last names and double check the spelling. The way you type the name " . "here is the way it will appear on all awards and in the Command " . "Performance program."; $student_name_field->id = $field_id_array['student_name']; $student_name_field->isRequired = true; $student_form->fields[] = $student_name_field; $student_birthday_date_field = new GF_Field_Date(); $student_birthday_date_field->label = "Student Birthday"; $student_birthday_date_field->id = $field_id_array['student_birthday']; $student_birthday_date_field->isRequired = true; $student_birthday_date_field->calendarIconType = 'calendar'; $student_birthday_date_field->dateType = 'datepicker'; $student_form->fields[] = $student_birthday_date_field; $piano_teachers_field = new GF_Field_Select(); $piano_teachers_field->label = "Piano Teacher's Name"; $piano_teachers_field->id = $field_id_array['teacher_name']; $piano_teachers_field->isRequired = false; $piano_teachers_field->description = "TBD"; $student_form->fields[] = $piano_teachers_field; $teacher_missing_field = new GF_Field_Text(); $teacher_missing_field->label = "If your teacher's name is not listed, " . "enter name below."; $teacher_missing_field->id = $field_id_array['not_listed_teacher_name']; $teacher_missing_field->isRequired = false; $student_form->fields[] = $teacher_missing_field; $available_times = new GF_Field_Checkbox(); $available_times->label = "Available Festival Days (check all available times)"; $available_times->id = $field_id_array['available_festival_days']; $available_times->isRequired = true; $available_times->description = "There is no guarantee that scheduling " . "requests will be honored."; $available_times->choices = array(array('text' => 'Saturday', 'value' => 'Saturday', 'isSelected' => false), array('text' => 'Sunday', 'value' => 'Sunday', 'isSelected' => false)); $student_form->fields[] = $available_times; $command_times = new GF_Field_Checkbox(); $command_times->label = "Preferred Command Performance Time (check all available times)"; $command_times->id = $field_id_array['preferred_command_performance']; $command_times->isRequired = true; $command_times->description = "Please check the Command Performance time " . "that you prefer in the event that your child receives a superior rating."; $command_times->choices = array(array('text' => 'Thursday 5:30', 'value' => 'Saturday', 'isSelected' => false), array('text' => 'Thursday 7:30', 'value' => 'Sunday', 'isSelected' => false)); $student_form->fields[] = $available_times; $compliance_field = new GF_Field_checkbox(); $compliance_field->label = "Compliance Statement"; $compliance_field->id = $field_id_array['compliance_statement']; $compliance_field->isRequired = true; $compliance_field->description = "As a parent, I understand and agree to " . "comply with all rules, regulations, and amendments as stated in the " . "Festival syllabus. I am in full compliance with the laws regarding " . "photocopies and can provide verification of authentication of any legally " . "printed music. I understand that adjudicator decisions are final and " . "will not be contested. I know that small children may not remain in the " . "room during performances of non-family members. I understand that " . "requests for specific days/times will be scheduled if possible but cannot" . " be guaranteed."; $compliance_field->choices = array(array('text' => 'I have read and agree with the following statement:', 'value' => 'Agree', 'isSelected' => false)); $student_form->fields[] = $compliance_field; $result = GFAPI::add_form($student_form->createFormArray()); aria_initialize_confirmation($result); }
/** * This function will create a new form for the students to use to register personal information. * * This function is responsible for creating and adding all of the associated fields * that are necessary for students to enter data about their upcoming music competition. * * @param String $competition_name The name of the newly created music competition * * @since 1.0.0 * @author KREW */ function aria_create_student_form($competition_name) { $student_form = new GF_Form("{$competition_name} Student Registration", ""); $field_id_array = aria_student_field_id_array(); // parent name $parent_name_field = new GF_Field_Name(); $parent_name_field->label = "Parent Name"; $parent_name_field->id = $field_id_array['parent_name']; $parent_name_field->isRequired = true; $parent_form->fields[] = $parent_name_field; // parent email $parent_email_field = new GF_Field_Email(); $parent_email_field->label = "Parent's Email"; $parent_email_field->id = $field_id_array['parent_email']; $parent_email_field->isRequired = true; $student_form->fields[] = $parent_email_field; // student name $student_name_field = new GF_Field_Name(); $student_name_field->label = "Student Name"; $student_name_field->description = "Please capitalize your child's first " . "and last names and double check the spelling. The way you type the name " . "here is the way it will appear on all awards and in the Command " . "Performance program."; $student_name_field->id = $field_id_array['student_name']; $student_name_field->isRequired = true; $student_form->fields[] = $student_name_field; // student birthday $student_birthday_date_field = new GF_Field_Date(); $student_birthday_date_field->label = "Student Birthday"; $student_birthday_date_field->id = $field_id_array['student_birthday']; $student_birthday_date_field->isRequired = true; $student_birthday_date_field->calendarIconType = 'calendar'; $student_birthday_date_field->dateType = 'datepicker'; $student_form->fields[] = $student_birthday_date_field; // student's piano teacher $piano_teachers_field = new GF_Field_Select(); $piano_teachers_field->label = "Piano Teacher's Name"; $piano_teachers_field->id = $field_id_array['teacher_name']; $piano_teachers_field->isRequired = false; $piano_teachers_field->description = "TBD"; $student_form->fields[] = $piano_teachers_field; // student's piano teacher does not exist $teacher_missing_field = new GF_Field_Text(); $teacher_missing_field->label = "If your teacher's name is not listed, " . "enter name below."; $teacher_missing_field->id = $field_id_array['not_listed_teacher_name']; $teacher_missing_field->isRequired = false; $student_form->fields[] = $teacher_missing_field; // student's available times to compete $available_times = new GF_Field_Checkbox(); $available_times->label = "Available Festival Days (check all available times)"; $available_times->id = $field_id_array['available_festival_days']; $available_times->isRequired = true; $available_times->description = "There is no guarantee that scheduling " . "requests will be honored."; $available_times->choices = array(array('text' => 'Saturday', 'value' => 'Saturday', 'isSelected' => false), array('text' => 'Sunday', 'value' => 'Sunday', 'isSelected' => false)); $student_form->fields[] = $available_times; // student's available times to compete for command performance $command_times = new GF_Field_Checkbox(); $command_times->label = "Preferred Command Performance Time (check all available times)"; $command_times->id = $field_id_array['preferred_command_performance']; $command_times->isRequired = true; $command_times->description = "Please check the Command Performance time " . "that you prefer in the event that your child receives a superior rating."; $command_times->choices = array(array('text' => 'Thursday 5:30', 'value' => 'Saturday', 'isSelected' => false), array('text' => 'Thursday 7:30', 'value' => 'Sunday', 'isSelected' => false)); $student_form->fields[] = $available_times; // the compliance field for parents $compliance_field = new GF_Field_checkbox(); $compliance_field->label = "Compliance Statement"; $compliance_field->id = $field_id_array['compliance_statement']; $compliance_field->isRequired = true; $compliance_field->description = "As a parent, I understand and agree to " . "comply with all rules, regulations, and amendments as stated in the " . "Festival syllabus. I am in full compliance with the laws regarding " . "photocopies and can provide verification of authentication of any legally " . "printed music. I understand that adjudicator decisions are final and " . "will not be contested. I know that small children may not remain in the " . "room during performances of non-family members. I understand that " . "requests for specific days/times will be scheduled if possible but cannot" . " be guaranteed."; $compliance_field->choices = array(array('text' => 'I have read and agree with the following statement:', 'value' => 'Agree', 'isSelected' => false)); $student_form->fields[] = $compliance_field; // add the new form to the festival chairman's dashboard $new_form_id = GFAPI::add_form($student_form->createFormArray()); // make sure the new form was added without error if (is_wp_error($new_form_id)) { wp_die($new_form_id->get_error_message()); } /* add a customized confirmation message this is done after the form has been added so that the initial confirmation hash has been added to the object */ $added_student_form = GFAPI::get_form(intval($new_form_id)); $successful_submission_message = 'Congratulations! You have just successfully registered'; $successful_submission_message .= ' your child.'; GFAPI::update_form($added_student_form); }