From 732f53890847f5809bc325bb0a41bf3f57de4f5a Mon Sep 17 00:00:00 2001 From: "Scott J. Pearson" Date: Fri, 9 Jun 2023 10:54:42 -0500 Subject: [PATCH] 5.8.0 --- Application.php | 41 ++++++++-------- CareerDev.php | 73 ++++++++++++++++------------ FlightTrackerExternalModule.php | 8 ++- add.php | 10 ++-- charts/baseWeb.php | 17 ++++--- classes/Consortium.php | 9 ++-- classes/DataDictionaryManagement.php | 10 +--- classes/NameMatcher.php | 6 ++- classes/Portal.php | 59 +++++++++++++++++----- classes/Scholar.php | 63 +++++++++++++++++++++--- config.php | 3 +- hooks/checkHook.php | 4 +- hooks/followupHook.php | 4 +- install.php | 52 +++++++++++--------- metadata.json | 14 +++++- profile.php | 47 +++--------------- socialNetwork/collaboration.php | 9 ++-- 17 files changed, 264 insertions(+), 165 deletions(-) diff --git a/Application.php b/Application.php index cde69237..cc07ff5c 100644 --- a/Application.php +++ b/Application.php @@ -293,8 +293,8 @@ public static function log($mssg, $pid = FALSE) { CareerDev::log($mssg, $pid); } - public static function getInstitutions($pid = NULL) { - return CareerDev::getInstitutions($pid); + public static function getInstitutions($pid = NULL, $searchOnly = TRUE) { + return CareerDev::getInstitutions($pid, $searchOnly); } public static function getImportHTML() { @@ -325,10 +325,10 @@ public static function getImportHTML() { return $str; } - public static function getHeader($tokenName = "") { - $pid = CareerDev::getPID(); - $token = self::getSetting("token", $pid); - $server = self::getSetting("server", $pid); + public static function getHeader($tokenName = "", $token = "", $server = "", $pid = "") { + $pid = $pid ?: CareerDev::getPID(); + $token = $token ?: self::getSetting("token", $pid); + $server = $server?: self::getSetting("server", $pid); if (!$tokenName) { $tokenName = self::getSetting("tokenName", $pid); @@ -412,22 +412,22 @@ public static function getHeader($tokenName = "") { $navBar = new NavigationBar(); $navBar->addFALink("home", "Home", CareerDev::getHomeLink()); - $navBar->addFAMenu("clinic-medical", "General", CareerDev::getMenu("General")); + $navBar->addFAMenu("clinic-medical", "General", CareerDev::getMenu("General", $pid)); if ($switches->isOnForProject("Grants")) { $navBar->addMenu("Grants", CareerDev::getMenu("Grants")); } if ($switches->isOnForProject("Publications")) { - $navBar->addFAMenu("sticky-note", "Pubs", CareerDev::getMenu("Pubs")); + $navBar->addFAMenu("sticky-note", "Pubs", CareerDev::getMenu("Pubs", $pid)); } - $navBar->addFAMenu("table", "View", CareerDev::getMenu("View")); - $navBar->addFAMenu("calculator", "Wrangle", CareerDev::getMenu("Wrangler")); - $navBar->addFAMenu("school", "Scholars", CareerDev::getMenu("Scholars")); - $navBar->addMenu("REDCap", CareerDev::getMenu("REDCap")); - $navBar->addFAMenu("tachometer-alt", "Dashboards", CareerDev::getMenu("Dashboards")); - $navBar->addFAMenu("filter", "Cohorts / Filters", CareerDev::getMenu("Cohorts")); - $navBar->addFAMenu("chalkboard-teacher", "Mentors", CareerDev::getMenu("Mentors")); - $navBar->addFAMenu("pen", "Resources", CareerDev::getMenu("Resources")); - $navBar->addFAMenu("question-circle", "Help", CareerDev::getMenu("Help")); + $navBar->addFAMenu("table", "View", CareerDev::getMenu("View", $pid)); + $navBar->addFAMenu("calculator", "Wrangle", CareerDev::getMenu("Wrangler", $pid)); + $navBar->addFAMenu("school", "Scholars", CareerDev::getMenu("Scholars", $pid)); + $navBar->addMenu("REDCap", CareerDev::getMenu("REDCap", $pid)); + $navBar->addFAMenu("tachometer-alt", "Dashboards", CareerDev::getMenu("Dashboards", $pid)); + $navBar->addFAMenu("filter", "Cohorts / Filters", CareerDev::getMenu("Cohorts", $pid)); + $navBar->addFAMenu("chalkboard-teacher", "Mentors", CareerDev::getMenu("Mentors", $pid)); + $navBar->addFAMenu("pen", "Resources", CareerDev::getMenu("Resources", $pid)); + $navBar->addFAMenu("question-circle", "Help", CareerDev::getMenu("Help", $pid)); $str .= $navBar->getHTML(); return $str; @@ -549,11 +549,14 @@ public static function getPids() { } else if (self::isServer("redcaptest.vanderbilt.edu")) { # TODO Add test projects with plugin } - return $pids; } else { $module = self::getModule(); - return $module->getPids(); + $pids = $module->getPids(); } + for ($i = 0; $i < count($pids); $i++) { + $pids[$i] = (string) $pids[$i]; + } + return $pids; } public static function getActiveSourcePids() { diff --git a/CareerDev.php b/CareerDev.php index 96a2cddf..4a71a720 100644 --- a/CareerDev.php +++ b/CareerDev.php @@ -22,7 +22,7 @@ class CareerDev { public static $passedModule = NULL; public static function getVersion() { - return "5.7.18"; + return "5.8.0"; } public static function getLockFile($pid) { @@ -596,32 +596,41 @@ public static function getInstitutionCount() { return count(self::getInstitutions()); } - public static function getInstitutions($pid = NULL) { - $shortInst = self::getShortInstitution($pid); - $longInst = self::getInstitution($pid); + public static function getInstitutions($pid = NULL, $searchOnly = TRUE) { + if ($searchOnly) { + $shortInst = self::getShortInstitution($pid); + $longInst = self::getInstitution($pid); - $institutions = array(); - if (preg_match("/".strtolower($shortInst)."/", strtolower($longInst))) { - $institutions[] = $shortInst; - $institutions[] = $longInst; - } else { - $institutions[] = $longInst; - } + $institutions = array(); + if (preg_match("/".strtolower($shortInst)."/", strtolower($longInst))) { + $institutions[] = $shortInst; + $institutions[] = $longInst; + } else { + $institutions[] = $longInst; + } - $otherInsts = preg_split("/\s*[,\/]\s*/", self::getSetting("other_institutions", $pid)); - foreach ($otherInsts as $otherInst) { - if ($otherInst && !in_array($otherInst, $institutions)) { - $institutions[] = $otherInst; - } - } - foreach ($institutions as $i => $institution) { - $institutions[$i] = str_replace("'", "'", $institution); - $institutions[$i] = str_replace("'", "'", $institutions[$i]); - $institutions[$i] = str_replace("&", "&", $institutions[$i]); - $institutions[$i] = str_replace(""", "\"", $institutions[$i]); - } + $otherInsts = preg_split("/\s*[,\/]\s*/", self::getSetting("other_institutions", $pid)); + foreach ($otherInsts as $otherInst) { + if ($otherInst && !in_array($otherInst, $institutions)) { + $institutions[] = $otherInst; + } + } + foreach ($institutions as $i => $institution) { + $institutions[$i] = str_replace("'", "'", $institution); + $institutions[$i] = str_replace("'", "'", $institutions[$i]); + $institutions[$i] = str_replace("&", "&", $institutions[$i]); + $institutions[$i] = str_replace(""", "\"", $institutions[$i]); + } - return $institutions; + return $institutions; + } else { + $displayInstitutionList = self::getSetting("display_institutions", $pid); + if (!$displayInstitutionList) { + return self::getInstitutions($pid, TRUE); + } else { + return preg_split("/\s*[,;]\s*/", trim($displayInstitutionList)); + } + } } public static function isEligible($pid) { @@ -821,8 +830,10 @@ public static function getSetting($field, $pid = "") { } if (file_exists(self::getCredentialsFile())) { include(self::getCredentialsFile()); - if (isset($info['prod'][$field])) { + if (isset($info['prod'][$field]) && ($pid == NEWMAN_SOCIETY_PROJECT)) { return $info['prod'][$field]; + } else if (isset($info['localhost'][$field]) && ($pid == LOCALHOST_TEST_PROJECT)) { + return $info['localhost'][$field]; } } if (($field == "admin_email") || ($field == "adminEmail")) { @@ -1036,8 +1047,8 @@ public static function has($instrument, $pid = "") { return FALSE; } - public static function getMenu($menuName) { - $pid = self::getPid(); + public static function getMenu($menuName, $pid = NULL) { + $pid = $pid ?: self::getPid(); $r = self::getREDCapDir(); if ($menuName == "Grants") { $ary = [ @@ -1080,7 +1091,7 @@ public static function getMenu($menuName) { "REDCap Reports" => $r."/DataExport/index.php", "Missingness Report
(Computationally Expensive)" => self::link("/tablesAndLists/missingness.php"), ]; - if (self::has("patent") && $switches->isOnForProject("Patents")) { + if (self::has("patent", $pid) && $switches->isOnForProject("Patents")) { $ary["Patent Viewer"] = self::link("patents/view.php"); } return $ary; @@ -1090,7 +1101,7 @@ public static function getMenu($menuName) { $server = self::getSetting("server", $pid); $switches = new FeatureSwitches($token, $server, $pid); $ary = []; - if (self::has("mentoring_agreement") && $switches->isOnForProject("Mentee-Mentor")) { + if (self::has("mentoring_agreement", $pid) && $switches->isOnForProject("Mentee-Mentor")) { $ary["Configure Mentee-Mentor Agreements"] = self::link("/mentor/config.php"); $ary["Add Mentors for Existing Scholars"] = self::link("addMentor.php"); $ary["Mentee-Mentor Agreements Dashboard"] = self::link("/mentor/dashboard.php"); @@ -1133,7 +1144,7 @@ public static function getMenu($menuName) { "Dates" => self::link("/dashboard/dates.php"), "Resources" => self::link("/dashboard/resources.php"), ]; - if (self::has("mentoring_agreement")) { + if (self::has("mentoring_agreement", $pid)) { $ary["Mentee-Mentor Agreements"] = self::link("mentor/dashboard.php"); } return $ary; @@ -1226,7 +1237,7 @@ public static function getMenu($menuName) { $ary["Lexical Translator"] = self::link("/lexicalTranslator.php"); } $ary["Position Change Wrangler"] = self::link("/wrangler/positions.php"); - if (self::has("patent") && $switches->isOnForProject("Patents")) { + if (self::has("patent", $pid) && $switches->isOnForProject("Patents")) { $ary["Patent Wrangler"] = self::link("/wrangler/include.php")."&wranglerType=Patents"; } return $ary; diff --git a/FlightTrackerExternalModule.php b/FlightTrackerExternalModule.php index da13a3c8..ff7c5fbb 100755 --- a/FlightTrackerExternalModule.php +++ b/FlightTrackerExternalModule.php @@ -1009,7 +1009,11 @@ function redcap_every_page_before_render($project_id) { echo "\n"; echo " \n"; } else if (PAGE == "DataEntry/index.php") { echo "\n"; @@ -1156,7 +1160,7 @@ function hasMentorAgreementRights($project_id, $userid) function makeHeaders($token, $server, $pid, $tokenName) { $str = ""; - $str .= Application::getHeader($tokenName); + $str .= Application::getHeader($tokenName, $token, $server, $pid); if (!CareerDev::isFAQ() && CareerDev::isHelpOn()) { $currPage = CareerDev::getCurrPage(); $str .= ""; diff --git a/add.php b/add.php index 6402373f..826e0a62 100644 --- a/add.php +++ b/add.php @@ -19,7 +19,7 @@ list($lines, $matchedMentorUids, $newMentorNames) = parsePostForLines($_POST); $newLines = []; $originalMentorNames = []; - if (!empty($matchedMentorUids)) { + if (!empty($matchedMentorUids) || Application::isLocalhost()) { $mentorCol = 13; for ($i = 0; $i < count($lines); $i++) { if (isset($newMentorNames[$i])) { @@ -35,7 +35,7 @@ } } $newUids = getUidsForMentors($newLines); - if (!empty($newUids)) { + if (!empty($newUids) || Application::isLocalhost()) { echo makeAdjudicationTable($lines, $newUids, $matchedMentorUids, $originalMentorNames); } else { commitChanges($token, $server, $lines, $matchedMentorUids, $pid, $createRecordsURI); @@ -87,7 +87,7 @@ throw new \Exception("This should never happen."); } $mentorUids = getUidsForMentors($lines); - if (!empty($mentorUids)) { + if (!empty($mentorUids) || Application::isLocalhost()) { echo makeAdjudicationTable($lines, $mentorUids, [], []); $url = APP_PATH_WEBROOT."ProjectGeneral/keep_alive.php?pid=".$pid; echo ""; } +if (!isset($_GET['hideHeader'])) { ?> Flight Tracker for Scholars @@ -155,4 +156,8 @@ function search(page, div, name) { } } - \ No newline at end of file + + + $md) { $fieldLabels[$type] = self::getLabels($md); @@ -1067,7 +1061,7 @@ private static function alterOptionalFields(&$metadata, $pid) { private static function alterInstitutionFields(&$metadata, $pid) { if ($pid) { - $institutions = Application::getInstitutions(); + $institutions = Application::getInstitutions($pid, FALSE); if (empty($institutions)) { $institutions = ["Home Institution"]; } diff --git a/classes/NameMatcher.php b/classes/NameMatcher.php index a0a82eca..05fc14b6 100644 --- a/classes/NameMatcher.php +++ b/classes/NameMatcher.php @@ -873,7 +873,11 @@ public static function splitName($name, $parts = 2, $loggingOn = FALSE, $clearOf } } } - return array("", ""); + $ary = []; + for ($i = 0; $i < $parts; $i++) { + $ary[] = ""; + } + return $ary; } public static function clearOfHonorifics($nodes) { diff --git a/classes/Portal.php b/classes/Portal.php index da136057..7e33298a 100644 --- a/classes/Portal.php +++ b/classes/Portal.php @@ -2,6 +2,8 @@ namespace Vanderbilt\CareerDevLibrary; +use function Vanderbilt\FlightTrackerExternalModule\appendCitationLabel; + require_once(__DIR__ . '/ClassLoader.php'); @@ -15,28 +17,39 @@ public static function getCurrentUserIDAndName() { && isset($_GET['uid']) ) { # pre release - $username = Sanitizer::sanitize($_GET['uid']); - $info = REDCapLookup::getUserInfo($username); - return [$username, $info['user_firstname'] ?? "", $info['user_lastname'] ?? ""]; + if ($_GET['uid'] == "bastarja") { + return ["bastarja", "Julie", "Bastarache"]; + } else if ($_GET['uid'] == "edwardt5") { + return ["edwardt5", "Todd", "Edwards"]; + } else { + $username = Sanitizer::sanitize($_GET['uid']); + $info = REDCapLookup::getUserInfo($username); + return [$username, $info['user_firstname'] ?? "", $info['user_lastname'] ?? ""]; + } } else { return REDCapLookup::getCurrentUserIDAndName(); } } + private static function downloadAndSave($setting, $func, $token, $server, $pid) { + $data = Download::$func($token, $server); + Application::saveSetting($setting, $data, $pid); + return $data; + } + public static function getMatches($username, $firstName, $lastName, $pids) { $usernameInLC = strtolower($username); - $matchedRecordsByUserid = []; - $matchedRecordsByName = []; + $matches = []; $projectTitles = []; foreach ($pids as $pid) { $token = Application::getSetting("token", $pid); $server = Application::getSetting("server", $pid); $turnOffSet = Application::getSetting("turn_off", $pid); - if ($token && $server && !$turnOffSet) { + if ($token && $server && !$turnOffSet && REDCapManagement::isActiveProject($pid)) { Application::setPid($pid); - $userids = Application::getSetting("userids", $pid) ?: []; - $firstNames = Application::getSetting("first_names", $pid) ?: []; - $lastNames = Application::getSetting("last_names", $pid) ?: []; + $userids = Application::getSetting("userids", $pid) ?: self::downloadAndSave("userids", "userids", $token, $server, $pid); + $firstNames = Application::getSetting("first_names", $pid) ?: self::downloadAndSave("first_names", "firstnames", $token, $server, $pid); + $lastNames = Application::getSetting("last_names", $pid) ?: self::downloadAndSave("last_names", "lastnames", $token, $server, $pid); $foundMatch = FALSE; $matchedRecordsInProject = []; @@ -55,7 +68,7 @@ public static function getMatches($username, $firstName, $lastName, $pids) { } } if (!empty($matchedRecordsInProject)) { - $matchedRecordsByUserid[$pid] = $matchedRecordsInProject; + $matches[$pid] = $matchedRecordsInProject; $foundMatch = TRUE; } @@ -70,7 +83,7 @@ public static function getMatches($username, $firstName, $lastName, $pids) { } } if (!empty($matchedRecordsInProject)) { - $matchedRecordsByName[$pid] = $matchedRecordsInProject; + $matches[$pid] = $matchedRecordsInProject; $foundMatch = TRUE; } if ($foundMatch) { @@ -81,9 +94,31 @@ public static function getMatches($username, $firstName, $lastName, $pids) { error_log("Portal: Skipping $pid"); } } - return [$matchedRecordsByName, $matchedRecordsByUserid, $projectTitles]; + return [$matches, $projectTitles]; } + public static function getPage($relativeFileLocation, $pid, $getParams = []) { + $getParams['pid'] = (string) $pid; + $page = preg_replace("/^\//", "", $relativeFileLocation); + $pageWithoutPHP = preg_replace("/\.php$/", "", $page); + $getParams['page'] = $pageWithoutPHP; + $getParams['prefix'] = Application::getPrefix(); + $getParams['hideHeader'] = "1"; + $getParams['headers'] = "false"; + error_log("getPage ($pid): ".json_encode($getParams)); + $filename = __DIR__."/../".$page; + error_log("file: ".$filename); + + $oldGet = $_GET; + $_GET = $getParams; + ob_start(); + include($filename); + $html = ob_get_clean(); + $_GET = $oldGet; + return $html; + } + + public static function makeName($fn, $ln) { if ($fn && $ln) { return "$fn $ln"; diff --git a/classes/Scholar.php b/classes/Scholar.php index f87da037..e1d06470 100644 --- a/classes/Scholar.php +++ b/classes/Scholar.php @@ -232,6 +232,28 @@ public function getTwitterHandle($rows) { return new Result($finalValue, "", "", "", $this->pid); } + public function lookupPersonalEmail($rows) { + if ($email = $this->getPersonalEmail()) { + return new Result($email, "", "", "", $this->pid); + } + $vars = self::getDefaultOrder("identifier_personal_email"); + $vars = $this->getOrder($vars, "identifier_personal_email"); + $result = $this->searchRowsForVars($rows, $vars, FALSE, $this->pid); + $result->trimResult(); + return $result; + } + + public function lookupPhone($rows) { + if ($email = $this->getPhone()) { + return new Result($email, "", "", "", $this->pid); + } + $vars = self::getDefaultOrder("identifier_phone"); + $vars = $this->getOrder($vars, "identifier_phone"); + $result = $this->searchRowsForVars($rows, $vars, FALSE, $this->pid); + $result->trimResult(); + return $result; + } + public function lookupEmail($rows) { if ($email = $this->getEmail()) { return new Result($email, "", "", "", $this->pid); @@ -308,13 +330,28 @@ private function getLDAPResult($rows, $field, $priorResult, $instrument = "ldap" } } + private function getNormativeField($field) { + $row = self::getNormativeRow($this->rows); + if ($row[$field]) { + return $row[$field]; + } + return ""; + } + # lookupEmail calculates the email; this simply returns the value that has already been saved - public function getEmail() { - $row = self::getNormativeRow($this->rows); - return $row['identifier_email']; - } + public function getEmail() { + return $this->getNormativeField("identifier_email"); + } + + public function getPersonalEmail() { + return $this->getNormativeField("identifier_personal_email"); + } - public function getResourcesUsed() { + public function getPhone() { + return $this->getNormativeField("identifier_phone"); + } + + public function getResourcesUsed() { $resources = array(); $choices = DataDictionaryManagement::getChoices($this->metadata); foreach ($this->rows as $row) { @@ -1863,13 +1900,23 @@ public static function getDefaultOrder($field) { "followup_orcid_id" => "followup", "init_import_orcid_id" => "manual", ); - $orders["identifier_email"] = array( + $orders["identifier_email"] = [ "check_email" => "scholars", "followup_email" => "followup", "init_import_email" => "manual", "ldapds_mail" => "ldap", "ldap_mail" => "ldap", - ); + ]; + $orders["identifier_personal_email"] = [ + "check_personal_email" => "scholars", + "followup_personal_email" => "followup", + "init_import_personal_email" => "manual", + ]; + $orders["identifier_phone"] = [ + "check_phone" => "scholars", + "followup_phone" => "followup", + "init_import_phone" => "manual", + ]; $orders["identifier_twitter"] = [ "check_twitter" => "scholars", "followup_twitter" => "followup", @@ -3304,6 +3351,8 @@ private static function getCalculatedFields($metadata) { "identifier_left_department" => "getNewDepartment", "identifier_orcid" => "getORCIDResult", "identifier_email" => "lookupEmail", + "identifier_personal_email" => "lookupPersonalEmail", + "identifier_phone" => "lookupPhone", "identifier_twitter" => "getTwitterHandle", "identifier_linkedin" => "getLinkedInHandle", "summary_degrees" => "getDegrees", diff --git a/config.php b/config.php index 52ddf128..c478b55f 100644 --- a/config.php +++ b/config.php @@ -350,7 +350,8 @@ function makeSettings($module, $pid, $metadata) { $ary["Installation Variables"] = []; $ary["Installation Variables"][] = makeSetting("institution", "text", "Full Name of Institution"); $ary["Installation Variables"][] = makeSetting("short_institution", "text", "Short Name of Institution"); - $ary["Installation Variables"][] = makeSetting("other_institutions", "text", "Other Institutions (if any); comma-separated"); + $ary["Installation Variables"][] = makeSetting("other_institutions", "text", "Other Institutions (if any); comma-separated"); + $ary["Installation Variables"][] = makeSetting("display_institutions", "text", "'Home' Institutions that Your Scholars Belong To; comma-separated"); $ary["Installation Variables"][] = makeSetting("token", "text", "API Token"); $ary["Installation Variables"][] = makeSetting("supertoken", "text", "REDCap Supertoken (optional, from REDCap Administrator, for turning on Cohort Portals)"); $ary["Installation Variables"][] = makeSetting("event_id", "text", "Event ID (read-only)", "", [], TRUE); diff --git a/hooks/checkHook.php b/hooks/checkHook.php index 977bdde8..7398c159 100644 --- a/hooks/checkHook.php +++ b/hooks/checkHook.php @@ -133,7 +133,9 @@ function getCSRFToken() { return ''; } presetValue("_name_first", ""); presetValue("_name_middle", ""); presetValue("_name_last", ""); - presetValue("_email", ""); + presetValue("_email", ""); + presetValue("_personal_email", ""); + presetValue("_phone", ""); presetValue("_date_of_birth", ""); $('#_date_of_birth-tr td .ui-button').hide(); presetValue("_gender", ""); diff --git a/hooks/followupHook.php b/hooks/followupHook.php index 22f48ed3..849f404d 100644 --- a/hooks/followupHook.php +++ b/hooks/followupHook.php @@ -100,7 +100,9 @@ function getCitizenship($value) { presetValue("followup_name_maiden_enter", ""); presetValue("followup_name_preferred", "") presetValue("followup_name_preferred_enter", ""); - presetValue("followup_email", ""); + presetValue("followup_email", ""); + presetValue("followup_personal_email", ""); + presetValue("followup_phone", ""); presetValue("followup_primary_mentor", ""); presetValue('followup_primary_dept', ''); diff --git a/install.php b/install.php index d626f5a1..5d17f31e 100644 --- a/install.php +++ b/install.php @@ -28,7 +28,7 @@ $pid = Application::getSetting("pid"); $tokenName = Application::getSetting("tokenName"); $installCoeus = Application::getSetting("hasCoeus"); - $institutions = Application::getInstitutions(); + $displayInstitutions = Application::getInstitutions($pid, FALSE); displayInstallHeaders($module, $token, $server, $pid, $tokenName); $departments = trim(Sanitizer::sanitizeWithoutChangingQuotes($_POST['departments'])); $resources = trim(Sanitizer::sanitizeWithoutChangingQuotes($_POST['resources'])); @@ -36,7 +36,7 @@ $lists = [ "departments" => $departments, "resources" => $resources, - "institutions" => implode("\n", $institutions), + "institutions" => implode("\n", $displayInstitutions), ]; foreach (REDCapManagement::getOptionalSettings() as $setting => $label) { $lists[$setting] = trim(Sanitizer::sanitizeWithoutChangingQuotes($_POST[$setting] ?? "")); @@ -77,6 +77,7 @@ 'institution' => Sanitizer::sanitize($_POST['institution']), 'short_institution' => Sanitizer::sanitize($_POST['short_institution']), 'other_institutions' => Sanitizer::sanitize($_POST['other_institutions']), + 'display_institutions' => Sanitizer::sanitize($_POST['display_institutions']), 'token' => $newToken, 'event_id' => $eventId, 'pid' => $projectId, @@ -118,7 +119,7 @@ $lists = [ "departments" => Application::getSetting("departments", $pid), "resources" => Application::getSetting("resources", $pid), - "institutions" => implode("\n", Application::getInstitutions($pid)), + "institutions" => implode("\n", Application::getInstitutions($pid, FALSE)), ]; foreach (REDCapManagement::getOptionalSettings() as $setting => $label) { $lists[$setting] = Application::getSetting($setting, $pid); @@ -306,31 +307,36 @@ function changeGrantClass(name) { $html .= "\n"; $html .= "\n"; - $html .= "Title:
(i.e., Name of Project)\n"; - $html .= "\n"; + $html .= "\n"; + $html .= "\n"; $html .= "\n"; $html .= "\n"; - $html .= "REDCap Token (32 characters):
with API Import/Export rights
(overwrites entire project)
\n"; - $html .= "\n"; + $html .= "\n"; + $html .= "\n"; $html .= "\n"; $html .= "\n"; - $html .= "Full Institution Name:
(e.g., Vanderbilt University Medical Center)
This should match what is reported on the NIH/Federal RePORTER systems or in a PubMed paper.
\n"; - $html .= "\n"; + $html .= "\n"; + $html .= "\n"; $html .= "\n"; $html .= "\n"; - $html .= "Short Institution Name:
(e.g., Vanderbilt)
This is the institution name that your scholars will be searched under in the NIH.
\n"; - $html .= "\n"; + $html .= "\n"; + $html .= "\n"; $html .= "\n"; - $html .= "\n"; - $html .= "Other Affiliated Institutions:
(Short Names, List Separated by Commas)
E.g., Vanderbilt pools resources to track scholars from Meharry and Tennessee State. These names will be searched from the NIH as well.
Optional.
\n"; - $html .= "\n"; - $html .= "\n"; + $html .= "\n"; + $html .= "\n"; + $html .= "\n"; + $html .= "\n"; - $html .= "\n"; + $html .= "\n"; + $html .= "\n"; + $html .= "\n"; + $html .= "\n"; + + $html .= "\n"; $html .= "Class of Project:
If the project is affiliated with a grant, specify what type of grant. Small variations exist for these grant classes.\n"; $html .= ""; $grantClasses = CareerDev::getGrantClasses(); @@ -338,15 +344,15 @@ function changeGrantClass(name) { $grantClassName = "grant_class"; foreach ($grantClasses as $value => $label) { $id = $grantClassName."_".$value; - array_push($grantClassRadios, ""); + $grantClassRadios[] = ""; } $html .= implode("
", $grantClassRadios); $html .= "\n"; $html .= "\n"; $html .= "\n"; - $html .= "Grant Number (e.g., R01CA654321):\n"; - $html .= "\n"; + $html .= "\n"; + $html .= "\n"; $html .= "\n"; $html .= "\n"; @@ -370,9 +376,9 @@ function changeGrantClass(name) { $zones = timezone_identifiers_list(); $currZone = date_default_timezone_get(); $html .= "\n"; - $html .= "Timezone:\n"; + $html .= "\n"; $html .= "\n"; - $html .= "\n"; foreach ($zones as $zone) { $html .= "