Ejemplo n.º 1
0
    $stmt->close();
    return -3;
}
// mgGetNumberOfKeyValuePairsForRecord
$scrf = PAGE_FULL;
/*****************************************************************************/
if (!array_key_exists("records_to_delete_textarea", $_POST)) {
    // Present the form
    if (!array_key_exists("pid", $_GET) or !($proj_id = $_GET["pid"])) {
        exit("<b>Missing project number</b>. Make sure your URL appends \"<tt>?pid=123</tt>\" where <i>123</i> is your project number.");
    }
    $scrf .= "?pid=" . $proj_id;
    if (!SUPER_USER) {
        // Get array of user privileges for a single user in project (will have username as array key)
        $this_user = USERID;
        $rights = REDCap::getUserRights($this_user);
        // If $rights returns NULL, then user does not have access to this project
        if (empty($this_user) or empty($rights)) {
            exit("User {$this_user} does NOT have access to this project.");
        }
        // Check if user can delete records
        if (!$rights[$this_user]['record_delete']) {
            exit("User {$this_user} does NOT have permission to delete records from this project.");
        }
    }
    // echo "<p>The project is $proj_id.</p>"
    ?>

<p>Please paste in a list record numbers to delete, one per-line or separated by spaces. </p>
<p>Note that there is <i>no</i> confirmation of deletion!  Once you click the DELETE RECORDS button below your supplied records will be <b>permanently deleted</b> from this project, so please double-check your list before proceeding. </p>
<form action="
Ejemplo n.º 2
0
$base_path = dirname(dirname(dirname(__FILE__)));
require_once $base_path . "/redcap_connect.php";
require_once $base_path . '/plugins/includes/functions.php';
/**
 * restricted use
 */
$allowed_pids = array('38');
REDCap::allowProjects($allowed_pids);
Kint::enabled($debug);

// Set number of fields to export at a time.
$fields_per_batch = 80000;

// Check user privs
if (!SUPER_USER) {
	$rights = REDCap::getUserRights(USERID);
	$rights = $rights[USERID];
	//echo "<pre>" . print_r($rights,true) . "</pre>";
	d($rights);
	if ($rights['data_export_tool'] != 1) {
		include APP_PATH_DOCROOT . 'ProjectGeneral/header.php';
		displayMsg("You do not have proper data export rights to use this tool ({$rights[USERID]['data_export_tool']})", "errorMsg","center","red","exclamation_frame.png", 600);
		exit();
	}
}

// Check if we are posting back for a download
if(isset($_POST['download'])) {
	// Request to download a processed file
	$target_filename = $_POST['download'];
	$target_file = APP_PATH_TEMP . $target_filename;