<commit_before><?php
namespace Vanderbilt\EmailTriggerExternalModule;

use ExternalModules\AbstractExternalModule;
use ExternalModules\ExternalModules;
require_once 'EmailTriggerExternalModule.php';

$form = $_REQUEST['form'];
$project_id = $_REQUEST['project_id'];
$index = $_REQUEST['index'];
$queue = $_REQUEST['queue'];

if(!empty($form) && !empty($project_id)){
    $Project = new \Project($project_id);

    $events_array = array();
    foreach ($Project->eventsForms as $id => $event){
        foreach ($event as $eform){
            if($eform == $form){
                array_push($events_array,$id);
            }
        }
    }

    if(!empty($events_array)){

        if($index != ""){
            $form_name_event = empty($module->getProjectSetting('form-name-event'))?array():$module->getProjectSetting('form-name-event');
            $selected_event = $form_name_event[$index];
        }

        $selector_id = "form_event";
        if($queue != "1"){
            $event_selector = '<td><span class="external-modules-instance-label"> </span><label>REDCap Instrument Event:</label></td><td class="external-modules-input-td">';
        }else{
            $event_selector = '<div>';
            $selector_id = "queue_event_select";
        }

        $event_selector .= '<select class="external-modules-input-element" id="'.$selector_id.'" name="'.$selector_id.'"><option value=""></option>';
        foreach ($events_array as $id){
            $event_unique_name = \REDCap::getEventNames("true","",$id);
            if($selected_event == $id){
                $event_selector .= '<option value="'.$id.'" selected event_name="'.$event_unique_name.'">'.$Project->eventInfo[$id]['name_ext'].'</option>';
            }else{
                $event_selector .= '<option value="'.$id.'" event_name="'.$event_unique_name.'">'.$Project->eventInfo[$id]['name_ext'].'</option>';
            }
        }
        $event_selector .= '</select>';
        if($queue != "1"){
            $event_selector .= '</td>';
        }else{
            $event_selector .= '</div>';
        }
    }
}

echo json_encode(array(
    'status' => 'success',<commit_msg>Configuration survey link bug fixed to get the event name on longitudinal<commit_after><?php
namespace Vanderbilt\EmailTriggerExternalModule;

use ExternalModules\AbstractExternalModule;
use ExternalModules\ExternalModules;
require_once 'EmailTriggerExternalModule.php';

$form = $_REQUEST['form'];
$project_id = $_REQUEST['project_id'];
$index = $_REQUEST['index'];
$queue = $_REQUEST['queue'];

if(!empty($form) && !empty($project_id)){
    $Project = new \Project($project_id);

    $events_array = array();
    foreach ($Project->eventsForms as $id => $event){
        foreach ($event as $eform){
            if($eform == $form){
                array_push($events_array,$id);
            }
        }
    }

    if(!empty($events_array)){

        if($index != ""){
            $form_name_event = empty($module->getProjectSetting('form-name-event'))?array():$module->getProjectSetting('form-name-event');
            $selected_event = $form_name_event[$index];
        }

        $selector_id = "form_event";
        $selector_name = "form-name-event";
        if($queue != "1"){
            $event_selector = '<td><span class="external-modules-instance-label"> </span><label>REDCap Instrument Event:</label></td><td class="external-modules-input-td">';
        }else{
            $event_selector = '<div>';
            $selector_id = "queue_event_select";
            $selector_name = "queue_event_select";
        }

        $event_selector .= '<select class="external-modules-input-element" id="'.$selector_id.'" name="'.$selector_name.'"><option value=""></option>';
        foreach ($events_array as $id){
            $event_unique_name = \REDCap::getEventNames("true","",$id);
            if($selected_event == $id){
                $event_selector .= '<option value="'.$id.'" selected event_name="'.$event_unique_name.'">'.$Project->eventInfo[$id]['name_ext'].'</option>';
            }else{
                $event_selector .= '<option value="'.$id.'" event_name="'.$event_unique_name.'">'.$Project->eventInfo[$id]['name_ext'].'</option>';
            }
        }
        $event_selector .= '</select>';
        if($queue != "1"){
            $event_selector .= '</td>';
        }else{
            $event_selector .= '</div>';
        }
    }
}

echo json_encode(array(
    'status' => 'success',
{'fraction_non_alphanumeric': 0.18936504375140228, 'fraction_numerical': 0.0008974646623289208, 'mean_word_length': 2.9242957746478875, 'pattern_counts': {'":': 0, '<': 41, '<?xml version=': 0, '>': 53, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5199424', 'n_tokens_mistral': 1297, 'n_tokens_neox': 1287, 'n_words': 204}