/** * This function will create the form that will be the source of truth for * a certain competitions teachers. * * This function is called in "class-aria-create-competition.php" and is * responsible for creating the teacher master form. This form is the absolute * source of truth for the teachers of any given competition. Entries in other * forms will update entries in this form. * * @param $competition_name String The competition name * * @since 1.0.0 * @author KREW */ public static function aria_create_teacher_master_form($competition_name) { $teacher_master_form = new GF_Form($competition_name . " Teacher Master", ""); $field_id_array = self::aria_master_teacher_field_id_array(); // Students $parent_name_field = new GF_Field_List(); $parent_name_field->label = "Students"; $parent_name_field->id = $field_id_array['students']; $teacher_master_form->fields[] = $parent_name_field; // teacher name $teacher_name_field = new GF_Field_Name(); $teacher_name_field->label = "Name"; $teacher_name_field->id = $field_id_array['name']; $teacher_name_field->isRequired = false; $teacher_name_field = ARIA_Create_Competition::aria_add_default_name_inputs($teacher_name_field); $teacher_master_form->fields[] = $teacher_name_field; // teacher email $teacher_email_field = new GF_Field_Email(); $teacher_email_field->label = "Email"; $teacher_email_field->id = $field_id_array['email']; $teacher_email_field->isRequired = false; $teacher_master_form->fields[] = $teacher_email_field; // teacher phone $teacher_phone_field = new GF_Field_Phone(); $teacher_phone_field->label = "Phone"; $teacher_phone_field->id = $field_id_array['phone']; $teacher_phone_field->isRequired = false; $teacher_master_form->fields[] = $teacher_phone_field; // !!!new field // teacher is judging $teacher_judging_field = new GF_Field_Radio(); $teacher_judging_field->label = "Are you scheduled to judge for the festival?"; $teacher_judging_field->id = $field_id_array['is_judging']; $teacher_judging_field->isRequired = false; $teacher_judging_field->choices = array(array('text' => 'Yes', 'value' => 'Yes', 'isSelected' => false), array('text' => 'No', 'value' => 'No', 'isSelected' => false)); $conditionalRules = array(); $conditionalRules[] = array('fieldId' => $field_id_array['is_judging'], 'operator' => 'is', 'value' => 'No'); $teacher_master_form->fields[] = $teacher_judging_field; // teacher volunteer preference $volunteer_preference_field = new GF_Field_Checkbox(); $volunteer_preference_field->label = "Volunteer Preference"; $volunteer_preference_field->id = $field_id_array['volunteer_preference']; $volunteer_preference_field->isRequired = false; /*!!! $volunteer_preference_field->choices = array( array('text' => 'Section Proctor', 'value' => 'Section Proctor', 'isSelected' => false), array('text' => 'Posting Results', 'value' => 'Posting Results', 'isSelected' => false), array('text' => 'Information Table', 'value' => 'Information Table', 'isSelected' => false), array('text' => 'Greeting and Assisting with Locating Rooms', 'value' => 'Greeting', 'isSelected' => false), array('text' => 'Hospitality (managing food in judges rooms)', 'value' => 'Hospitality', 'isSelected' => false) ); $volunteer_preference_field->description = "Please check 1 time slot if you" ." have 1-3 students competing, 2 time slots if you have 4-6 students" ." competing, and 3 time slots if you have more than 6 students competing."; */ $volunteer_preference_field->choices = array(array('text' => 'Proctor sessions', 'value' => 'Proctor sessions', 'isSelected' => false), array('text' => 'Monitor door during sessions', 'value' => 'Monitor door during sessions', 'isSelected' => false), array('text' => 'Greet students and parents', 'value' => 'Greet students and parents', 'isSelected' => false), array('text' => 'Prepare excellent ribbons', 'value' => 'Prepare excellent ribbons', 'isSelected' => false), array('text' => 'Put seals on certificates', 'value' => 'Put seals on certificates', 'isSelected' => false), array('text' => 'Early set up', 'value' => 'Early set up', 'isSelected' => false), array('text' => 'Clean up', 'value' => 'Clean up', 'isSelected' => false), array('text' => 'Help with food for judges and volunteers', 'value' => 'Help with food for judges and volunteers', 'isSelected' => false)); $volunteer_preference_field->description = "Please check at least two volunteer job" . "preferences for this year's Festival. You will be notified by email of your" . "volunteer assignments as Festival approaches."; $volunteer_preference_field->conditionalLogic = array('actionType' => 'show', 'logicType' => 'all', 'rules' => $conditionalRules); $teacher_master_form->fields[] = $volunteer_preference_field; // volunteer time $volunteer_time_field = new GF_Field_Checkbox(); $volunteer_time_field->label = "Times Available for Volunteering"; $volunteer_time_field->id = $field_id_array['volunteer_time']; $volunteer_time_field->isRequired = false; $volunteer_time_field->description = "Please check at least two times you are" . "available to volunteer during Festival weekend."; $volunteer_time_field->conditionalLogic = array('actionType' => 'show', 'logicType' => 'all', 'rules' => $conditionalRules); $teacher_master_form->fields[] = $volunteer_time_field; // student's hash $teacher_hash_field = new GF_Field_Text(); $teacher_hash_field->id = $field_id_array['hash']; $teacher_hash_field->isRequired = false; $teacher_master_form->fields[] = $teacher_hash_field; $teacher_master_form_array = $teacher_master_form->createFormArray(); $teacher_master_form_array['isTeacherMasterForm'] = true; return GFAPI::add_form($teacher_master_form_array); }