function __construct($app) { // Parent constructor parent::__construct($app); $record = $this->get_lowest_subject(); print_r($record); return 1; }
function __construct($app) { // Parent constructor parent::__construct($app); //------------------------------------------------------------------------- // Read in passed values //------------------------------------------------------------------------- // Record_id is passed in the GET variable 'record'. // REDCap passes 'authkey' as a POST variable. This program then uses // authkey to request of REDCap which authorized user invoked this // program, if any. $record = isset($_GET['record']) ? htmlspecialchars($_GET['record']) : ''; $authkey = isset($_POST['authkey']) ? htmlspecialchars($_POST['authkey']) : ''; //------------------------------------------------------------------------ // Initialize variables //------------------------------------------------------------------------ $this->record_id = $record; $this->authkey = $authkey; $this->username = ''; $this->main_html = ''; $this->bottom_html = ''; //------------------------------------------------------------------------- // Authenticate //------------------------------------------------------------------------- // Use REDCap's Advanced Bookmark. REDCap sends a POST variable,'authkey'. // This program sends that authkey back to the REDCap API, // and if it is a valid key for a user that is still logged // in to REDCap, REDCap sends back the username. // This program doesn't care _which_ user is authenticated, // as any user that could authenticate this way is authorized. $body_array = $this->project->check_advanced_link_auth($this->authkey); if (is_array($body_array) && isset($body_array['username'])) { $this->username = $body_array['username']; } //------------------------------------------------------------------------ // Pageheader //------------------------------------------------------------------------ $this->pageheader(); //------------------------------------------------------------------------- // Validate user is authorized //------------------------------------------------------------------------- if (empty($this->username)) { $this->bottom_html .= "Unable to validate that you have an active REDCap session and are authorized for this project.\n"; } else { $this->main_html = $this->create_maincontent(); } //------------------------------------------------------------------------- // Show main content //------------------------------------------------------------------------- $this->show_maincontent(); //------------------------------------------------------------------------ // Pagefooter //------------------------------------------------------------------------ $this->pagefooter(); }