当前位置: 首页>>代码示例>>PHP>>正文


PHP REDCap::logEvent方法代码示例

本文整理汇总了PHP中REDCap::logEvent方法的典型用法代码示例。如果您正苦于以下问题:PHP REDCap::logEvent方法的具体用法?PHP REDCap::logEvent怎么用?PHP REDCap::logEvent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在REDCap的用法示例。


在下文中一共展示了REDCap::logEvent方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: dirname

<?php

/* 
 * Longitudinal Reports Plugin
 * Luke Stevens, Murdoch Childrens Research Institute https://www.mcri.edu.au
 * Version date 16-Nov-2015 
 */
require_once dirname(__FILE__) . '/config.php';
// Validate id
if (!isset($_POST['report_id'])) {
    exit('0');
}
$report_id = $_POST['report_id'];
$success = LongitudinalReports::deleteReport($report_id);
if ($success) {
    REDCap::logEvent("Delete longitudinal report", "report_id = {$report_id}");
}
print $success === false ? '0' : '1';
开发者ID:lsgs,项目名称:redcap-longitudinal-reports,代码行数:18,代码来源:report_delete_ajax.php

示例2: schedule_surveys

	/**
	 * @param $record
	 * @param $event_id
	 * @param $group_id
	 * @param $debug
	 */
	public static function schedule_surveys($record, $event_id, $group_id, $debug)
	{
		global $Proj, $project_id, $user_rights, $table_pk;
		/**
		 * if the user is in a DAG
		 */
		if ($user_rights['group_id'] != "") {
			/**
			 * does this record exist?
			 */
			$q = db_query("SELECT 1 from redcap_data WHERE project_id = $project_id AND record = '$record' LIMIT 1");
			if (db_num_rows($q) > 0) {
				/**
				 * is the record in this users DAG?
				 */
				$q = db_query("SELECT 1 from redcap_data WHERE project_id = $project_id AND record = '$record' AND field_name = '__GROUPID__' AND value = '{$user_rights['group_id']}' LIMIT 1");
				if (db_num_rows($q) < 1) {
					/**
					 * record is not in Users DAG!
					 */
					REDCap::logEvent('Scheduled record is not in users DAG', '', '', $record, $event_id, $project_id);
					exit;
				}
			}
		}
		/**
		 * check to see if the subject has an existing schedule on an existing arm
		 */
		$sub = "SELECT DISTINCT e.arm_id from redcap_events_calendar c, redcap_events_metadata e WHERE c.project_id = $project_id AND c.record = '$record' AND c.event_id = e.event_id";
		$sched_arm_result = db_query("SELECT arm_num FROM redcap_events_arms WHERE project_id = $project_id AND arm_id IN (" . pre_query($sub) . ")");
		if ($sched_arm_result) {
			$trt = Prioritize::getTrtInfo($record);
			if ($debug) {
				error_log(print_r($trt, true));
			}
			$tx_start_date = $trt['rfxstdtc'];
			$rand_date = $trt['rand_date'];
			$dates = array();
			$arm_num = db_result($sched_arm_result, 0, 'arm_num');
			if (isset($arm_num) && $arm_num != '') { // subject has an existing schedule. keep existing event_id > arm structure
				if ($arm_num != '1') { // make sure we don't put anything in the first arm
					$q = db_query("SELECT * from redcap_events_metadata m, redcap_events_arms a WHERE a.project_id = $project_id AND a.arm_id = m.arm_id AND a.arm_num = $arm_num order by m.day_offset, m.descrip");
					if ($q) {
						while ($row = db_fetch_assoc($q)) { // if we have no $arm_num, this will be empty
							/**
							 * get the event date ($rand_date for baseline and $tx_start_date + day_offset)
							 */
							$row['day_offset'] = $arm_num != $trt['timing_arm_num'] ? $trt['timing_offsets'][$row['descrip']] : $row['day_offset'];
							if (in_array($row['descrip'], array('Baseline', 'EOT+1Year', 'EOT+3Year'))) {
								$this_event_date = isset($rand_date) && $rand_date != '' ? add_date($rand_date, $row['day_offset']) : null;
							} else {
								$this_event_date = isset($tx_start_date) && $tx_start_date != '' ? add_date($tx_start_date, $row['day_offset']) : null;
							}
							$dates[$row['event_id']] = $this_event_date;
						}
						db_free_result($q);
					}
				} else {
					REDCap::logEvent('Scheduling attempted in invalid arm', '', '', $record, $event_id, $project_id);
				}
			} else { // subject's schedule is new. put dates into event_ids for this arm
				$arm_result = db_query("SELECT arm_num FROM redcap_events_arms WHERE project_id = '$project_id' AND arm_name = '{$trt['arm']}'");
				if ($arm_result) {
					$arm_num = db_result($arm_result, 0, 'arm_num');
					if ($arm_num != '1') {
						$q = db_query("SELECT * from redcap_events_metadata m, redcap_events_arms a WHERE a.project_id = $project_id AND a.arm_id = m.arm_id AND a.arm_num = $arm_num order by m.day_offset, m.descrip");
						if ($q) {
							while ($row = db_fetch_assoc($q)) { // if we have no $arm_num, this will be empty
								/**
								 * get the event date ($rand_date for baseline and $tx_start_date + day_offset)
								 */
								if (in_array($row['descrip'], array('Baseline', 'EOT+1Year', 'EOT+3Year'))) {
									$this_event_date = isset($rand_date) && $rand_date != '' ? add_date($rand_date, $row['day_offset']) : null;
								} else {
									$this_event_date = isset($tx_start_date) && $tx_start_date != '' ? add_date($tx_start_date, $row['day_offset']) : null;
								}
								$dates[$row['event_id']] = $this_event_date;
							}
							db_free_result($q);
						}
					} else {
						REDCap::logEvent('Scheduling attempted in invalid arm', '', '', $record, $event_id, $project_id);
					}
					db_free_result($arm_result);
				}
			}
			if ($debug) {
				error_log(print_r($dates, true));
			}
			if (!empty($dates)) {
				/**
				 * do we have an existing schedule?
				 */
				$sql = "SELECT c.event_date, c.baseline_date, e.* FROM redcap_events_calendar c, redcap_events_metadata e WHERE c.project_id = $project_id AND c.record = '$record' AND c.event_id = e.event_id AND e.arm_id IN (" . pre_query($sub) . ")";
//.........这里部分代码省略.........
开发者ID:hcv-target,项目名称:redcap_plugins,代码行数:101,代码来源:Prioritize.php

示例3: db_query

db_query($sql);*/
// Loop through report_ids and set new report_order
$report_order = 1;
$import = array();
foreach ($new_report_ids as $this_report_id) {
    /*	$sql = "update redcap_reports set report_order = ".$report_order++." 
    			where project_id = $project_id and report_id = $this_report_id";
    	db_query($sql);*/
    $rpt = array();
    $rpt['report_id'] = $this_report_id;
    $rpt['report_order'] = $report_order++;
    $import[] = $rpt;
}
// Deal with orphaned report_ids added simultaneously by other user while this user reorders
foreach ($append_report_ids as $this_report_id) {
    /*	$sql = "update redcap_reports set report_order = ".$report_order++." 
    			where project_id = $project_id and report_id = $this_report_id";
    	db_query($sql);*/
    $rpt = array();
    $rpt['report_id'] = $this_report_id;
    $rpt['report_order'] = $report_order++;
    $import[] = $rpt;
}
$success = LongitudinalReports::save($import);
if (!$success) {
    exit('0');
}
// Logging
REDCap::logEvent("Reorder longitudinal reports", "report_id = " . $_POST['report_ids']);
// Return Value: If there are some extra reports that exist that are not currently in the list, then refresh the user's page
print !empty($append_report_ids) ? '2' : '1';
开发者ID:lsgs,项目名称:redcap-longitudinal-reports,代码行数:31,代码来源:report_order_ajax.php

示例4: array

$reportData['orderby_field2'] = $orderby_field2;
$reportData['orderby_sort2'] = $orderby_sort2;
$reportData['orderby_field3'] = $orderby_field3;
$reportData['orderby_sort3'] = $orderby_sort3;
$reportData['update_by'] = $userid;
$reportData['update_at'] = $now->format('Y-m-d H:i:s');
$reportData['report_complete'] = '2';
$success = true;
$data = array();
$data[] = $reportData;
// Can handle multiple records - not needed here
$success = LongitudinalReports::save($data);
// If there are errors, then roll back all changes
if (!$success) {
    //$errors > 0) {
    // Errors occurred, so undo any changes made
    //	db_query("ROLLBACK");
    // Return '0' for error
    exit('0');
} else {
    // Logging
    $log_descrip = $_GET['report_id'] != 0 ? "Edit longitudinal report" : "Create longitudinal report";
    REDCap::logEvent($log_descrip, "report_id = {$report_id}: " . print_r($reportData, true));
    // Commit changes
    //	db_query("COMMIT");
    // Response
    $dialog_title = RCView::img(array('src' => 'tick.png', 'style' => 'vertical-align:middle')) . RCView::span(array('style' => 'color:green;vertical-align:middle'), $lang['report_builder_01']);
    $dialog_content = RCView::div(array('style' => 'font-size:14px;'), $lang['report_builder_73'] . " \"" . RCView::span(array('style' => 'font-weight:bold;'), RCView::escape($title)) . "\" " . $lang['report_builder_74']);
    // Output JSON response
    print json_encode(array('report_id' => $report_id, 'newreport' => $_GET['report_id'] == 0 ? 1 : 0, 'title' => $dialog_title, 'content' => $dialog_content));
}
开发者ID:lsgs,项目名称:redcap-longitudinal-reports,代码行数:31,代码来源:report_edit_ajax.php

示例5: notify

 public function notify($title)
 {
     global $redcap_version;
     $dark = "#800000";
     //#1a74ba  1a74ba
     $light = "#FFE1E1";
     //#ebf6f3
     $border = "#800000";
     //FF0000";	//#a6d1ed	#3182b9
     // Run notification
     $url = APP_PATH_WEBROOT_FULL . "redcap_v{$redcap_version}/" . "DataEntry/index.php?pid={$this->project_id}&page={$this->instrument}&id={$this->record}&event_id={$this->event_id}";
     // Message (email html painfully copied from box.net notification email)
     $msg = RCView::table(array('cellpadding' => '0', 'cellspacing' => '0', 'border' => '0', 'style' => 'border:1px solid #bbb; font:normal 12px Arial;color:#666'), RCView::tr(array(), RCView::td(array('style' => 'padding:13px'), RCView::table(array('style' => 'font:normal 15px Arial'), RCView::tr(array(), RCView::td(array('style' => 'font-size:18px;color:#000;border-bottom:1px solid #bbb'), RCView::span(array('style' => 'color:black'), RCVieW::a(array('style' => 'color:black'), 'REDCap AutoNotification Alert')) . RCView::br())) . RCView::tr(array(), RCView::td(array('style' => 'padding:10px 0'), RCView::table(array('style' => 'font:normal 12px Arial;color:#666'), RCView::tr(array(), RCView::td(array('style' => 'text-align:right'), "Title") . RCView::td(array('style' => 'padding-left:10px;color:#000'), RCView::span(array('style' => 'color:black'), RCView::a(array('style' => 'color:black'), "<b>{$title}</b>")))) . RCView::tr(array(), RCView::td(array('style' => 'text-align:right'), "Project") . RCView::td(array('style' => 'padding-left:10px;color:#000'), RCView::span(array('style' => 'color:black'), RCView::a(array('style' => 'color:black'), REDCap::getProjectTitle())))) . ($this->redcap_event_name ? RCView::tr(array(), RCView::td(array('style' => 'text-align:right'), "Event") . RCView::td(array('style' => 'padding-left:10px;color:#000'), RCView::span(array('style' => 'color:black'), RCView::a(array('style' => 'color:black'), "{$this->redcap_event_name}")))) : '') . RCView::tr(array(), RCView::td(array('style' => 'text-align:right'), "Instrument") . RCView::td(array('style' => 'padding-left:10px;color:#000'), RCView::span(array('style' => 'color:black'), RCView::a(array('style' => 'color:black'), $this->instrument)))) . RCView::tr(array(), RCView::td(array('style' => 'text-align:right'), "Record") . RCView::td(array('style' => 'padding-left:10px;color:#000'), RCView::span(array('style' => 'color:black'), RCView::a(array('style' => 'color:black'), $this->record)))) . RCView::tr(array(), RCView::td(array('style' => 'text-align:right'), "Date/Time") . RCView::td(array('style' => 'padding-left:10px;color:#000'), RCView::span(array('style' => 'color:black'), RCView::a(array('style' => 'color:black'), date('Y-m-d H:i:s'))))) . RCView::tr(array(), RCView::td(array('style' => 'text-align:right'), "Message") . RCView::td(array('style' => 'padding-left:10px;color:#000'), RCView::span(array('style' => 'color:black'), RCView::a(array('style' => 'color:black'), $this->config['message']))))))) . RCView::tr(array(), RCView::td(array('style' => "border:1px solid {$border};background-color:{$light};padding:20px"), RCView::table(array('style' => 'font:normal 12px Arial', 'cellpadding' => '0', 'cellspacing' => '0'), RCView::tr(array('style' => 'vertical-align:middle'), RCView::td(array(), RCView::table(array('cellpadding' => '0', 'cellspacing' => '0'), RCView::tr(array(), RCView::td(array('style' => "border:1px solid #600000;background-color:{$dark};padding:8px;font:bold 12px Arial"), RCView::a(array('class' => 'hide', 'style' => 'color:#fff;white-space:nowrap;text-decoration:none', 'href' => $url), "View Record"))))) . RCView::td(array('style' => 'padding-left:15px'), "To view this record, visit this link:" . RCView::br() . RCView::a(array('style' => "color:{$dark}", 'href' => $url), $url))))))))));
     $msg = "<HTML><head></head><body>" . $msg . "</body></html>";
     // Determine number of emails to send
     // Prepare message
     $email = new Message();
     $email->setTo($this->config['to']);
     $email->setFrom($this->config['from']);
     $email->setSubject($this->config['subject']);
     $email->setBody($msg);
     // Send Email
     if (!$email->send()) {
         error_log('Error sending mail: ' . $email->getSendError() . ' with ' . json_encode($email));
         exit;
     }
     //		error_log ('Email sent');
     // Add Log Entry
     $data_values = "title,{$title}\nrecord,{$this->record}\nevent,{$this->redcap_event_name}";
     REDCap::logEvent('AutoNotify Alert', $data_values);
 }
开发者ID:mypandos,项目名称:REDCap-AutoNotify,代码行数:31,代码来源:common.php

示例6: db_query

				show_var($data_quality_status_query);
			}
		}
	}
	/**
	 * flush and log any '' values for $field_name
	 */
	$find_blank_values_query = "SELECT record, event_id FROM redcap_data WHERE project_id = '$project_id' AND field_name = '$field_name' AND value = ''";
	$find_blanks_result = db_query($find_blank_values_query);
	if ($find_blanks_result) {
		while ($found_blank_row = db_fetch_assoc($find_blanks_result)) {
			$delete_blank_values_query = "DELETE FROM redcap_data WHERE project_id = '$project_id' AND field_name = '$field_name' AND record = '{$found_blank_row['record']}' AND event_id = '{$found_blank_row['event_id']}' AND value = ''";
			if (!$debug) {
				if (db_query($delete_blank_values_query)) {
					//target_log_event($delete_blank_values_query, 'redcap_data', 'delete', $subject_id, "$field_name = ''", "Delete blank $field_name", '', $project_id);
					REDCap::logEvent("Delete blank $field_name", "$field_name = ''", $delete_blank_values_query, $found_blank_row['record'], $found_blank_row['event_id']);
				} else {
					error_log(db_error() . ': ' . $delete_blank_values_query);
					echo(db_error() . ": " . $delete_blank_values_query . "<br />");
				}
			} else {
				show_var($delete_blank_values_query);
			}
		}
		db_free_result($find_blanks_result);
	}
} else {
	print "<h3>You must select both a source (existing) and destination (new) field.</h3>";
}
$timer_stop = microtime(true);
$timer_time = number_format(($timer_stop - $timer_start), 2);
开发者ID:hcv-target,项目名称:redcap_plugins,代码行数:31,代码来源:migrate_data_to_new_variable.php

示例7: date

// Create temp file - Set the target file to be saved in the temp dir (set timestamp in filename as 1 hour from now so that it gets deleted automatically in 1 hour)
$inOneHour = date("YmdHis", mktime(date("H")+1,date("i"),date("s"),date("m"),date("d"),date("Y")));
$target_filename = "{$inOneHour}_pid{$project_id}_".generateRandomHash(6).".csv";
$target_file = APP_PATH_TEMP . $target_filename;


echo RCView::div(array('class'=>'round chklist','id'=>'Large Data Export'),
		RCView::div(array('class'=>'chklisthdr','style'=>'color:rgb(128,0,0);margin-top:10px;'), "Exporting Complete CSV").
		RCView::p(array(),"Breaking $id_count records into $batch_total batch exports...").
		RCView::div(array('id'=>'progress','style'=>'width:600px;border:1px solid #ccc;margin-bottom:10px;')).
		RCView::div(array('id'=>'progress_info','style'=>'width'))
);

if (!$debug) { // Start Export
	REDCap::logEvent("Full Export Requested");
	$fh = fopen($target_file, 'w') or die("can't open file");
	$time_start = microtime(true);
	$batch_times = array();
	foreach ($batches as $b => $batch) {
		print "<pre>Batch $b starts at " . $batch[0] . "</pre>";
		$batch_start = microtime(true);
		if (!empty($batch_times)) {
			// Calculate projected time remaining
			$batch_avg = floatval(array_sum($batch_times) / count($batch_times));
			$batch_remaining = intval($batch_total - count($batch_times));
			$time_remaining = round($batch_remaining * $batch_avg);
			$time_remaining_msg = "Approximately " . $time_remaining . " seconds remaining...";
		}
		$percent = intval(($b+1)/$batch_total * 100).'%';
		$msg = "Processing batch " . ($b + 1) . " of $batch_total.";
开发者ID:hcv-target,项目名称:redcap_plugins,代码行数:30,代码来源:export_all.php

示例8: save

 /**
  * LongitudinalReports::save
  * @param type $saveReportsArray an array of report config parameters rptid => p1 = v1, p2 = v2
  * @return boolean
  */
 public static function save($saveReportsArray)
 {
     $success = true;
     $saveArray = array();
     // Add 'event' level so array is in format expected by REDCap::saveData
     foreach ($saveReportsArray as $rptParams) {
         $saveArray[$rptParams['report_id']][] = $rptParams;
     }
     $result = REDCap::saveData(LR_REPORT_DATA_PROJECT_ID, 'array', $saveArray, 'overwrite');
     if (isset($result['errors']) && count($result['errors']) > 0) {
         $success = false;
         REDCap::logEvent('Longitudinal Reports save failed', print_r($result['errors'], true) . PHP_EOL . ' ' . print_r($saveArray, true));
     }
     return $success;
 }
开发者ID:lsgs,项目名称:redcap-longitudinal-reports,代码行数:20,代码来源:LongitudinalReports.php

示例9: dirname

<?php

/* 
 * Longitudinal Reports Plugin
 * Luke Stevens, Murdoch Childrens Research Institute https://www.mcri.edu.au
 * Version date 16-Nov-2015 
 */
require_once dirname(__FILE__) . '/config.php';
// Validate id
if (!isset($_POST['report_id'])) {
    exit('0');
}
$report_id = $_POST['report_id'];
//$report = LongitudinalReports::getReports($report_id);
//if (empty($report)) exit('0');
// Copy the report and return the new report_id
$new_report_id = LongitudinalReports::copyReport($report_id);
if ($new_report_id === false) {
    exit('0');
}
REDCap::logEvent("Copy longitudinal report", "report_id = {$report_id}, new_report_id = {$new_report_id}");
// Return HTML of updated report list and report_id
print json_encode(array('new_report_id' => $new_report_id, 'html' => LongitudinalReports::renderReportList()));
开发者ID:lsgs,项目名称:redcap-longitudinal-reports,代码行数:23,代码来源:report_copy_ajax.php


注:本文中的REDCap::logEvent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。