?>

<?php 
echo $this->session->flashdata('message');
?>

<?php 
echo form_open('testinvite/manual_reminder_submit/' . $testinvite->id, array('class' => 'pure-form'));
?>

<p>
	U gaat een herinnering versturen aan <strong><?php 
echo name($participant);
?>
</strong> voor de vragenlijst <strong><?php 
echo testsurvey_name($testsurvey);
?>
</strong>.
</p>
<p>
	Alvorens een handmatige herinnering te sturen is het te prefereren de ouder van de proefpersoon te bellen.
	<?php 
echo sprintf(lang('call_contact'), $participant->firstname, parent_name($participant));
?>
</p>
<table class="pure-table">
	<tr>
		<th><?php 
echo lang('phone');
?>
</th>
 /**
  * This method creates an e-mail by referring to a view and replacing the variables. 
  * TODO: refactor to use less parameters (all in one array)?
  */
 function email_replace($view, $participant = NULL, $participation = NULL, $experiment = NULL, $testinvite = NULL, $comb_experiment = NULL, $auto = FALSE, $message = "", $language = L::Dutch)
 {
     $CI =& get_instance();
     $user = $CI->userModel->get_user_by_id(current_user_id());
     reset_language($language);
     $message_data = array();
     $message_data['auto'] = $auto;
     $message_data['message'] = $message;
     $message_data['combination'] = FALSE;
     $message_data['longitudinal'] = FALSE;
     $message_data['survey_link'] = FALSE;
     if ($user) {
         $message_data['user_username'] = $user->username;
         $message_data['user_email'] = $user->email;
     }
     if ($participant) {
         $message_data['name'] = name($participant);
         $message_data['name_first'] = $participant->firstname;
         $message_data['name_parent'] = parent_name($participant);
         $message_data['gender'] = gender_child($participant->gender);
         $message_data['gender_pos'] = gender_pos($participant->gender);
         $message_data['gender_plural'] = gender_sex($participant->gender) . 's';
         $message_data['phone'] = $participant->phone;
     }
     if ($participation) {
         $leader = $CI->userModel->get_user_by_id($participation->user_id_leader);
         $message_data['appointment'] = format_datetime($participation->appointment);
         if ($leader) {
             $message_data['leader_name'] = $leader->firstname;
         }
     }
     if ($experiment) {
         $location = $CI->locationModel->get_location_by_experiment($experiment);
         $message_data['exp_name'] = $experiment->name;
         $message_data['type'] = $experiment->type;
         $message_data['duration'] = $experiment->duration;
         $message_data['duration_total'] = $experiment->duration + INSTRUCTION_DURATION;
         $message_data['description'] = $experiment->description;
         $message_data['location'] = sprintf('%s (%s)', $location->name, $location->roomnumber);
         $message_data['caller_contacts'] = extract_callers($experiment, $comb_experiment);
     }
     if ($comb_experiment) {
         $location = $CI->locationModel->get_location_by_experiment($comb_experiment);
         $comb_participation = $CI->participationModel->get_participation($comb_experiment->id, $participant->id);
         $relation = $CI->relationModel->get_relation_by_experiments($experiment->id, $comb_experiment->id);
         $message_data['combination'] = $relation->relation === RelationType::Combination;
         $message_data['longitudinal'] = $relation->relation === RelationType::Prerequisite;
         $message_data['comb_exp_name'] = $comb_experiment->name;
         $message_data['comb_type'] = $comb_experiment->type;
         $message_data['comb_duration'] = $comb_experiment->duration;
         $message_data['comb_duration_total'] = $comb_experiment->duration + INSTRUCTION_DURATION;
         $message_data['comb_description'] = $comb_experiment->description;
         $message_data['comb_location'] = sprintf('%s (%s)', $location->name, $location->roomnumber);
         $message_data['comb_appointment'] = format_datetime($comb_participation->appointment);
     }
     if ($participant && $experiment) {
         $data = get_min_max_days($participant, $experiment);
         $message_data['min_date'] = format_date($data['min_date_js']);
         $message_data['max_date'] = format_date($data['max_date_js']);
     }
     if ($testinvite) {
         $test = $CI->testInviteModel->get_test_by_testinvite($testinvite);
         $testsurvey = $CI->testInviteModel->get_testsurvey_by_testinvite($testinvite);
         $message_data['survey_name'] = testsurvey_name($testsurvey);
         $message_data['survey_link'] = survey_link($testsurvey->limesurvey_id, $testinvite->token);
         $message_data['results_link'] = results_link($test->code, $testinvite->token);
         $message_data['whennr'] = $testsurvey->whennr;
     }
     return $CI->load->view($view, $message_data, TRUE);
 }
Exemplo n.º 3
0
 /** Checks whether the given parameter is higher than 0 */
 public function testinvite_exists($testsurvey_id)
 {
     $participant_id = $this->input->post('participant');
     $testinvite = $this->testInviteModel->get_testinvite_by_testsurvey_participant($testsurvey_id, $participant_id);
     if ($testinvite) {
         $participant = $this->participantModel->get_participant_by_id($participant_id);
         $testsurvey = $this->testSurveyModel->get_testsurvey_by_id($testsurvey_id);
         $this->form_validation->set_message('testinvite_exists', sprintf(lang('testinvite_already_exists'), name($participant), testsurvey_name($testsurvey)));
         return FALSE;
     }
     return TRUE;
 }
 /** Returns an option list of testsurveys */
 function testsurvey_options($testsurveys)
 {
     $t_options = array();
     foreach ($testsurveys as $t) {
         $t_options[$t->id] = testsurvey_name($t);
     }
     asort($t_options);
     return $t_options;
 }
Exemplo n.º 5
0
 /**
  * Downloads all scores of participants of a testsurvey as a .csv-file.
  * @param integer $testsurvey_id
  */
 public function download_scores($testsurvey_id)
 {
     $testsurvey = $this->testSurveyModel->get_testsurvey_by_id($testsurvey_id);
     $test = $this->testSurveyModel->get_test_by_testsurvey($testsurvey);
     // Retrieve the scores and convert to .csv
     $table = $this->get_results_table($testsurvey_id);
     $csv = scores_to_csv($test->code, $table);
     // Generate filename
     $escaped = preg_replace('/[^A-Za-z0-9_\\-]/', '_', testsurvey_name($testsurvey));
     $filename = $escaped . '_' . mdate("%Y%m%d_%H%i", time()) . '.csv';
     // Download the file
     force_download($filename, $csv);
 }