Ejemplo n.º 1
0
 public function renderTestRow($id, $label, $selectedRecord, $selectedEvent)
 {
     // Make a dropdown that contains all record_ids.
     $data = REDCap::getData('array', NULL, REDCap::getRecordIdField());
     //error_log("data: ".print_r($data,true));
     foreach ($data as $record_id => $arr) {
         $record_id_options[$record_id] = $record_id;
     }
     // Get all Events
     $events = REDCap::getEventNames(TRUE, FALSE);
     $row = RCView::tr(array(), RCView::td(array('class' => 'td1'), self::insertHelp('test')) . RCView::td(array('class' => 'td2'), "<label for='test-{$id}'><b>{$label}:</b></label>") . RCView::td(array('class' => 'td3'), RCView::span(array(), "Test logic using " . REDCap::getRecordIdField() . ":" . RCView::select(array('id' => "test_record-{$id}", 'name' => "test_record-{$id}", 'class' => "tbi x-form-text x-form-field", 'style' => 'height:20px;border:0px;', 'onchange' => "testLogic('{$id}');"), $record_id_options, $selectedRecord)) . RCView::span(array('style' => 'display:' . (REDCap::isLongitudinal() ? 'inline;' : 'none;')), " of event " . RCView::select(array('id' => "test_event-{$id}", 'name' => "test_event-{$id}", 'class' => "tbi x-form-text x-form-field", 'style' => 'height:20px;border:0px;', 'onchange' => "testLogic('{$id}');"), $events, $selectedEvent)) . RCView::span(array(), RCView::button(array('class' => 'jqbuttonmed ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only', 'onclick' => 'testLogic("' . $id . '");', 'style' => 'margin:0px 10px;'), 'Test') . RCView::span(array('id' => 'result-' . $id)))));
     return $row;
 }
Ejemplo n.º 2
0
}
######## HTML PAGE ###########
?>
<style type='text/css'>
	td.td1 {vertical-align:text-top;}
	td.td2 {vertical-align:text-top; padding-top: 5px; padding-right:15px; width:70px;}
	td.td2 label {font-variant:small-caps; font-size: 12px;}
	div.desc {font-variant:normal; font-style:italic; font-size: smaller; padding-top:5px; width:70px;}
	table.tbi input {width: 500px; display: inline; height:20px}
	table.tbi input[type='radio'] {width: 14px; display: normal;}
	table.tbi textarea {width: 500px; display:inline; height:50px;}
</style>

<?php 
$instructions = "The Auto-Notification plugin is tested each time a record is saved in your project.  When the condition is 'true' a message will be sent as configured.  A message is written to the log recording the record, event, and name of the trigger.  A given record-event-trigger will only be fired once.";
$section = $an->renderTriggers() . RCView::div(array(), RCView::button(array('class' => 'jqbuttonmed ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only', 'onclick' => 'javascript:addTrigger();'), RCView::img(array('src' => 'add.png', 'class' => 'imgfix')) . ' Add another trigger')) . RCView::div(array('class' => 'round chklist', 'id' => 'notification_config'), RCView::div(array('class' => 'chklisthdr', 'style' => 'color:rgb(128,0,0);margin-top:10px;'), "Configure Notification Email") . RCView::p(array(), 'This notification email will include a link to the record and will therefore include the value of the ' . REDCap::getRecordIdField() . ' field.  For this reasons, this first field <b>SHOULD NOT INCLUDE PHI</b>.  It is recommended to use an auto-numbering first field as best practice and include PHI as a secondary identifier.') . RCView::table(array('cellspacing' => '5', 'class' => 'tbi'), AutoNotify::renderRow('to', 'To', $an->config['to']) . AutoNotify::renderRow('from', 'From', $an->config['from']) . AutoNotify::renderRow('subject', 'Subject', empty($an->config['subject']) ? 'SECURE:' : $an->config['subject']) . AutoNotify::renderRow('message', 'Message', $an->config['message']))) . RCView::div(array('class' => 'round chklist', 'id' => 'det_config'), RCView::div(array('class' => 'chklisthdr', 'style' => 'color:rgb(128,0,0);margin-top:10px;'), "Pre- and Post- AutoNotification DET Triggers") . RCView::p(array(), 'You can run another Data Entry Trigger before or after this auto-notification test by inserting the complete DET urls below.<br><i>Please note that these DET urls will be called each time this DET is called, whether the conditional logic evaluates to true or not.</i>') . RCView::table(array('cellspacing' => '5', 'class' => 'tbi'), AutoNotify::renderRow('pre_script_det_url', 'Pre-notification DET Url', $an->config['pre_script_det_url']) . AutoNotify::renderRow('post_script_det_url', 'Post-notification DET Url', $an->config['post_script_det_url'])));
$page = RCView::div(array('class' => 'autonotify_config'), RCView::h3(array(), 'AutoNotify: a DET-based Notification Plugin') . $section . RCView::div(array(), RCView::button(array('class' => 'jqbuttonmed ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only', 'onclick' => 'javascript:save();'), RCView::img(array('src' => 'bullet_disk.png', 'class' => 'imgfix')) . '<b>Save Configuration</b>') . " " . RCView::button(array('class' => 'jqbuttonmed ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only', 'onclick' => 'javascript:refresh();'), 'Refresh')));
print $page;
print AutoNotify::renderHelpDivs();
?>

<script type="text/javascript">

	// Take all input elements inside our autonotify_config div and post them to this page
	function save() {
		var params = new Object;	// Info to save
		// Loop through each trigger
		var triggers = new Object;
		i=0;
		$('div.trigger', '#triggers_config').each (function (index1, value1) {
			i++;