include "../include/dbconnopen.php"; $link_id_sqlsafe = mysqli_real_escape_string($cnnEnlace, $_POST['link_id']); $drop_from_program = "UPDATE Participants_Programs SET Date_Dropped='" . date('Y-m-d') . "' WHERE Participant_Program_ID='" . $link_id_sqlsafe . "'"; echo $drop_from_program; mysqli_query($cnnEnlace, $drop_from_program); include "../include/dbconnclose.php"; } else { include "../include/dbconnopen.php"; $participant_sqlsafe = mysqli_real_escape_string($cnnEnlace, $_POST['participant']); $program_id_sqlsafe = mysqli_real_escape_string($cnnEnlace, $_POST['program_id']); $add_person_to_program = "INSERT INTO Participants_Programs (Participant_ID, Program_ID) VALUES ('{$participant_sqlsafe}', '{$program_id_sqlsafe}')"; mysqli_query($cnnEnlace, $add_person_to_program); include "../include/dbconnclose.php"; // Construct a participant object $participant = new Participant(); $participant->load_with_participant_id($participant_sqlsafe); // Find the participants surveys are impact surveys from the last 6 months. $assessments = $participant->find_previous_surveys(6, Assessment::IMPACT_TYPE); print_r($assessments); if ($assessments) { // A survey exists, we should now duplicate the newest (first in array) $assessment = $assessments[0]; // Removing the primary key will cause Assessment to create a new one on Assessment->save() $assessment->assessment_id = null; // Change the type and session $assessment->pre_post = Assessment::INTAKE_TYPE; $assessment->session_id = $program_id_sqlsafe; // Save this back to the database $assessment->save(); } }
$id_sqlsafe = mysqli_real_escape_string($cnnEnlace, $_GET['assessment']); $person_sqlsafe = mysqli_real_escape_string($cnnEnlace, $_GET['person']); /* if the assessment is not new, then Get['assessment'] exists, and this query returns the entered responses. */ $get_assessment_info = "SELECT * FROM Assessments \r\n LEFT JOIN Participants_Caring_Adults ON Caring_Id=Caring_Adults_ID\r\n LEFT JOIN Participants_Future_Expectations ON Future_Id=Future_Expectations_ID\r\n LEFT JOIN Participants_Interpersonal_Violence ON Violence_Id=Interpersonal_Violence_ID\r\n LEFT JOIN Programs ON Participants_Future_Expectations.Program=Programs.Program_ID\r\n WHERE Assessment_ID='" . $id_sqlsafe . "'"; $get_assessment = mysqli_query($cnnEnlace, $get_assessment_info); $assessment_info = mysqli_fetch_array($get_assessment); $caring_id = $assessment_info['Caring_ID']; $baseline_id = $assessment_info['Baseline_ID']; $future_id = $assessment_info['Future_ID']; $violence_id = $assessment_info['Violence_ID']; $person = new Participant(); $person->load_with_participant_id($assessment_info[1]); /* if it IS a new assessment, then we get the person from the get[person]: */ if (!isset($_GET['assessment'])) { $person = new Participant(); $person->load_with_participant_id($person_sqlsafe); } /* create a dropdown of the programs/sessions that the person is involved in. */ $get_programs = "SELECT * FROM Participants_Programs\r\n INNER JOIN Session_Names ON Participants_Programs.Program_ID=Session_Names.Session_ID \r\n INNER JOIN Programs ON Session_Names.Program_ID=Programs.Program_ID\r\n WHERE Participants_Programs.Participant_ID='" . $person->participant_id . "'"; $programs = mysqli_query($cnnEnlace, $get_programs); ?> <h4>Program Impact Survey - <?php echo $person->first_name . " " . $person->last_name; ?> </h4> <div style="text-align:center;"><span class="helptext">Program: </span> <select id="program"> <option value="">-------</option> <?php while ($program = mysqli_fetch_array($programs)) {
$child_sqlsafe = mysqli_real_escape_string($cnnEnlace, $_POST['child']); $add_relative = "INSERT INTO Child_Parent (Parent_ID, Child_ID)\r\n VALUES ('" . $id . "', '" . $child_sqlsafe . "')"; include "../include/dbconnopen.php"; mysqli_query($cnnEnlace, $add_relative); include "../include/dbconnclose.php"; } /* add a participant to the people in a program */ if ($_POST['action'] == 'add_program') { include "../include/dbconnopen.php"; $program_id_sqlsafe = mysqli_real_escape_string($cnnEnlace, $_POST['program_id']); $add_person_to_program = "INSERT INTO Participants_Programs (Participant_ID, Program_ID) VALUES ('{$id}', '{$program_id_sqlsafe}')"; mysqli_query($cnnEnlace, $add_person_to_program); include "../include/dbconnclose.php"; // Construct a participant object $participant = new Participant(); $participant->load_with_participant_id($id); // Find the participants surveys are impact surveys from the last 6 months. $assessments = $participant->find_previous_surveys(6, Assessment::IMPACT_TYPE); if ($assessments) { // A survey exists, we should now duplicate the newest (first in array) $assessment = $assessments[0]; // Removing the primary key will cause Assessment to create a new one on Assessment->save() $assessment->assessment_id = null; // Change the type and session $assessment->pre_post = Assessment::INTAKE_TYPE; $assessment->session_id = $program_id_sqlsafe; // Save this back to the database $assessment->save(); } } ?>
$responses = mysqli_query($cnnLSNA, $get_responses); $response = mysqli_fetch_array($responses); } ?> <h4><?php /*if this is a new survey, get[survey] will not be set, and "new" will appear: */ if (!isset($_GET['survey'])) { ?> New <?php } ?> Survey<?php if (isset($_COOKIE['participant'])) { include "../classes/participants.php"; $parti = new Participant(); $parti->load_with_participant_id($_COOKIE['participant']); echo " - " . $parti->full_name; } ?> </h4> <table class="pm_survey"> <tr><td class="pm_survey question" width="65%">1. School Name</td> <td class="pm_survey response"><select id="new_school"> <option value="">----------</option> <?php $get_schools = "SELECT * FROM Institutions WHERE Institution_Type='1'"; include "../include/dbconnopen.php"; $schools = mysqli_query($cnnLSNA, $get_schools); while ($school = mysqli_fetch_array($schools)) { ?> <option value="<?php
$id_sqlsafe = mysqli_real_escape_string($cnnEnlace, $_GET['id']); $participant_program_list = "SELECT Session_Names.*, Name FROM Session_Names INNER JOIN Participants_Programs ON Session_Names.Session_ID = Participants_Programs.Program_ID INNER JOIN Programs ON Session_Names.Program_ID = Programs.Program_ID WHERE Participant_Id = " . $id_sqlsafe . " ORDER BY Name;"; $access_to_participant = mysqli_query($cnnEnlace, $participant_program_list); $program_array = array(); while ($program = mysqli_fetch_array($access_to_participant)) { $program_array[] = $program['Program_ID']; } $USER->enforce_access_program_array($Enlace_id, $program_array); /* This page shows all the information about a person in one place. * The participant id comes in through a Get. */ include "../include/datepicker_wtw.php"; //get participant info include "../classes/participant.php"; $person = new Participant(); $person->load_with_participant_id($_GET['id']); /* Get role here. The role determines what elements show on the page.s */ $get_role = "SELECT Role FROM Roles WHERE Role_ID = {$person->role}"; include "../include/dbconnopen.php"; if ($this_role = mysqli_query($cnnEnlace, $get_role)) { $role = mysqli_fetch_array($this_role); } include "../include/dbconnclose.php"; ?> <script type="text/javascript"> $(document).ready(function() { $('#participants_selector').addClass('selected'); $('#ajax_loader').hide(); $('#add_date').hide(); $('#add_referral').hide();