コード例 #1
0
function aria_create_competition($entry, $form)
{
    // wp_die($competition_creation_form_id);
    //echo $competition_creation_form_id . "<br>";
    global $new_form_id;
    wp_die($new_form_id);
    if ($form['id'] == $new_form_id) {
        //if ($form['id'] == $form_id) {
        $competition_student_form = new GF_Form("Student Registration", "");
        $result = GFAPI::add_form($competition_student_form->createFormArray());
    } else {
        echo "form's id: " . $form['id'] . "<br>";
        echo "global form id: " . $new_form_id;
        die;
    }
}
コード例 #2
0
ファイル: class-aria-music.php プロジェクト: wesleykepke/ARIA
 /**
  * This function is responsible for creating the NNMTA music form if it does
  * not previously exist.
  *
  * This function is intended to be used in the event where the festival
  * chairman tries to upload music to the NNMTA database but no such form
  * exists for adding music.
  *
  * @author KREW
  * @since 1.0.0
  */
 private static function aria_create_nnmta_music_form()
 {
     $nnmta_music_form_name = "NNMTA Music Database";
     $nnmta_music_form = new GF_Form($nnmta_music_form_name, "");
     $field_id_arr = self::aria_music_field_id_array();
     // NNMTA song name
     $song_name_field = new GF_Field_Text();
     $song_name_field->label = "Song Name";
     $song_name_field->id = $field_id_arr['song_name'];
     $song_name_field->isRequired = true;
     $nnmta_music_form->fields[] = $song_name_field;
     // NNMTA song composer
     $song_composer_field = new GF_Field_Text();
     $song_composer_field->label = "Composer Name";
     $song_composer_field->id = $field_id_arr['song_composer'];
     $song_composer_field->isRequired = true;
     $nnmta_music_form->fields[] = $song_composer_field;
     // NNMTA song level
     $song_level_field = new GF_Field_Text();
     $song_level_field->label = "Song Level";
     $song_level_field->id = $field_id_arr['song_level'];
     $song_level_field->isRequired = true;
     $nnmta_music_form->fields[] = $song_level_field;
     // NNMTA period level
     $song_period_field = new GF_Field_Text();
     $song_period_field->label = "Song Period";
     $song_period_field->id = $field_id_arr['song_period'];
     $song_period_field->isRequired = true;
     $nnmta_music_form->fields[] = $song_period_field;
     // NNMTA song catalog
     $song_catalog_field = new GF_Field_Text();
     $song_catalog_field->label = "Song Catalog";
     $song_catalog_field->id = $field_id_arr['song_catalog'];
     $song_catalog_field->isRequired = false;
     $nnmta_music_form->fields[] = $song_catalog_field;
     // add the new form to the festival chairman's dashboard
     $new_form_id = GFAPI::add_form($nnmta_music_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());
     }
 }
コード例 #3
0
 /**
  * This function will create a new form for student registration.
  *
  * 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 Entry  $competition_entry The entry of the newly created music competition
  *
  * @since 1.0.0
  * @author KREW
  */
 private static function aria_create_student_form($competition_entry)
 {
     $field_mapping = self::aria_get_competition_entry_meta();
     $competition_name = $competition_entry[$field_mapping['Name of Competition']];
     $student_form = new GF_Form("{$competition_name} Student Registration", "");
     $field_id_array = self::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 = false;
     $parent_name_field = self::aria_add_default_name_inputs($parent_name_field);
     $student_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 = false;
     $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->descriptionPlacement = 'above';
     $student_name_field->id = $field_id_array['student_name'];
     $student_name_field->isRequired = true;
     $student_name_field = self::aria_add_default_name_inputs($student_name_field);
     $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 = false;
     $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 = true;
     $piano_teachers_field->description = "TBD";
     $piano_teachers_field->choices = array(array('text' => 'Test 1', 'value' => 'Tim', 'isSelected' => false), array('text' => 'Test 2', 'value' => 'Jim', 'isSelected' => false));
     $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 = false;
     $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));
     $available_times->inputs = array();
     $available_times = self::aria_add_checkbox_input($available_times, 'Saturday');
     $available_times = self::aria_add_checkbox_input($available_times, 'Sunday');
     $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 = false;
     $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' => 'Thursday 5:30', 'isSelected' => false), array('text' => 'Thursday 7:30', 'value' => 'Sunday', 'isSelected' => false));
     $command_times->inputs = array();
     $command_times = self::aria_add_checkbox_input($command_times, 'Thursday 5:30');
     $command_times = self::aria_add_checkbox_input($command_times, 'Thursday 7:30');
     $student_form->fields[] = $command_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));
     $compliance_field->inputs = array();
     $compliance_field = self::aria_add_checkbox_input($compliance_field, 'I have read and agree with the following statement:');
     $student_form->fields[] = $compliance_field;
     // custom submission message to let the festival chairman know the creation was
     // a success
     $successful_submission_message = 'Congratulations! You have just';
     $successful_submission_message .= ' successfully registered your child.';
     $student_form->confirmation['type'] = 'message';
     $student_form->confirmation['message'] = $successful_submission_message;
     $student_form_arr = $student_form->createFormArray();
     $student_form_arr['isStudentPublicForm'] = true;
     // add the new form to the festival chairman's dashboard
     $new_form_id = GFAPI::add_form($student_form_arr);
     // make sure the new form was added without error
     if (is_wp_error($new_form_id)) {
         wp_die($new_form_id->get_error_message());
     }
     return $new_form_id;
 }
コード例 #4
0
 /**
  * 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);
 }