Пример #1
0
 /**
  * This function defines all of the code that should be executed on plugin activation.
  *
  * This function makes calls to specific functions that need to be executed when
  * the ARIA plugin is activated in the WordPress admin dashboard.
  *
  * @since    1.0.0
  */
 public static function activate()
 {
     // define all the files that are required
     require_once ABSPATH . 'wp-admin/includes/plugin.php';
     require_once "class-aria-create-competition.php";
     // make sure that the Gravity Forms plugin is enabled
     if (is_plugin_active('gravityforms/gravityforms.php')) {
         // create the form for creating new music competitions
         ARIA_Create_Competition::aria_create_competition_activation();
         //			wp_enqueue_script( 'jquery' );
         //			wp_enqueue_script('cry1', 'http://crypto-js.googlecode.com/svn/tags/3.1.2/build/rollups/hmac-sha1.js' );
         //			wp_enqueue_script( 'cry2', 'http://crypto-js.googlecode.com/svn/tags/3.1.2/build/components/enc-base64-min.js' );
         //			wp_enqueue_script( 'aria', '/wp-content/plugins/ARIA/public/js/aria_dropdown.js' );
     } else {
         wp_die("Error: ARIA requires the Gravity Forms plugin to be installed\n\t\t\tand enabled. Please enable the Gravity Forms plugin and reactivate\n\t\t\tARIA.");
     }
 }
Пример #2
0
<?php

require_once "class-aria-create-competition.php";
require_once "class-aria-music.php";
$teacher_fields = ARIA_Create_Competition::aria_teacher_field_id_array();
$music_fields = ARIA_Music::aria_music_field_id_array();
$all_fields = array_merge($teacher_fields, $music_fields);
echo json_encode($all_fields);
Пример #3
0
 public static function aria_after_teacher_submission($form, $entry)
 {
     // Get the query variables from the link
     $student_hash = get_query_var("student_hash", false);
     $teacher_hash = get_query_var("teacher_hash", false);
     // Get field id arrays
     $student_master_field_ids = ARIA_Create_Master_Forms::aria_master_student_field_id_array();
     $teacher_master_field_ids = ARIA_Create_Master_Forms::aria_master_teacher_field_id_array();
     $teacher_public_field_ids = ARIA_Create_Competition::aria_master_teacher_field_id_array();
     // Update the teacher entry in the teacher master.
     $teacher_master_entry = ARIA_Registration_Handler::aria_find_teacher_entry($form["title"], $teacher_hash);
     if (!teacher_entry) {
         wp_die("Error");
     }
     $teacher_master_entry[(string) $teacher_master_field_ids['name']] = $entry[(string) $teacher_public_field_ids['name']];
     $teacher_master_entry[(string) $teacher_master_field_ids['email']] = $entry[(string) $teacher_public_field_ids['email']];
     $teacher_master_entry[(string) $teacher_master_field_ids['phone']] = $entry[(string) $teacher_public_field_ids['phone']];
     $teacher_master_entry[(string) $teacher_master_field_ids['volunteer_preference']] = $entry[(string) $teacher_public_field_ids['volunteer_preference']];
     $teacher_master_entry[(string) $teacher_master_field_ids['volunteer_time']] = $entry[(string) $teacher_public_field_ids['volunteer_time']];
     $teacher_master_entry[(string) $teacher_master_field_ids['is_judging']] = $entry[(string) $teacher_public_field_ids['is_judging']];
     // Update the student entry in the student master.
     $student_master_entry = ARIA_Registration_Handler::aria_find_student_entry($form["title"], $student_hash);
     if (!student_entry) {
         wp_die("Error");
     }
     $student_master_entry[(string) $student_master_field_ids['student_name']] = $entry[(string) $teacher_public_field_ids['student_name']];
     $student_master_entry[(string) $student_master_field_ids['song_1_period']] = $entry[(string) $teacher_public_field_ids['song_1_period']];
     $student_master_entry[(string) $student_master_field_ids['song_1_composer']] = $entry[(string) $teacher_public_field_ids['song_1_composer']];
     $student_master_entry[(string) $student_master_field_ids['song_1_selection']] = $entry[(string) $teacher_public_field_ids['song_1_selection']];
     $student_master_entry[(string) $student_master_field_ids['song_2_period']] = $entry[(string) $teacher_public_field_ids['song_2_period']];
     $student_master_entry[(string) $student_master_field_ids['song_2_composer']] = $entry[(string) $teacher_public_field_ids['song_2_composer']];
     $student_master_entry[(string) $student_master_field_ids['song_2_selection']] = $entry[(string) $teacher_public_field_ids['song_2_selection']];
     $student_master_entry[(string) $student_master_field_ids['theory_score']] = $entry[(string) $teacher_public_field_ids['theory_score']];
     $student_master_entry[(string) $student_master_field_ids['alternate_theory']] = $entry[(string) $teacher_public_field_ids['alternate_theory']];
     $student_master_entry[(string) $student_master_field_ids['competition_format']] = $entry[(string) $teacher_public_field_ids['competition_format']];
     $student_master_entry[(string) $student_master_field_ids['timing_of_pieces']] = $entry[(string) $teacher_public_field_ids['timing_of_pieces']];
     $teacher_result = GFAPI::update_entry($teacher_master_entry);
     $student_result = GFAPI::update_entry($student_master_entry);
 }
Пример #4
0
/**
 * Begins execution of the plugin.
 *
 * Since everything within the plugin is registered via hooks,
 * then kicking off the plugin from this point in the file does
 * not affect the page life cycle.
 *
 * @since    1.0.0
 */
function run_aria_create_competition()
{
    $plugin = new ARIA_Create_Competition();
    $plugin->run();
}
 /**
  * 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);
 }