Beispiel #1
0
$tpl_data['mantis_url'] = $config->getSetting('mantis_url');
//Display the links, as specified in the config file
$links = $config->getExternalLinks('FooterLink');
foreach ($links as $label => $url) {
    $WindowName = md5($url);
    $tpl_data['links'][] = array('url' => $url, 'label' => $label, 'windowName' => $WindowName);
}
if ($config->getSetting("sandbox") === '1') {
    $tpl_data['sandbox'] = true;
}
// This should be array_filter, but to have access to both key and value
// in array_filter we need to require PHP >= 5.6
$realPerms = array();
foreach ($user->getPermissions() as $permName => $hasPerm) {
    if ($hasPerm === true) {
        $realPerms[] = $permName;
    }
}
$tpl_data['userPerms'] = $realPerms;
$tpl_data['jsonParams'] = json_encode(array('BaseURL' => $tpl_data['baseurl'], 'TestName' => $tpl_data['test_name'], 'Subtest' => $tpl_data['subtest'], 'CandID' => $tpl_data['candID'], 'SessionID' => $tpl_data['sessionID'], 'CommentID' => $tpl_data['commentID']));
$tpl_data['css'] = $config->getSetting('css');
//--------------------------------------------------
//Output template using Smarty
// Assign the console output to a variable, then stop
// capturing output so that smarty can render
$tpl_data['console'] = htmlspecialchars(ob_get_contents());
ob_end_clean();
$smarty = new Smarty_neurodb();
$smarty->assign($tpl_data);
$smarty->display('main.tpl');
ob_end_flush();
Beispiel #2
0
 /**
  * Loads the correct page and renders it to the user
  *
  * @return none
  */
 function display()
 {
     $DB = Database::singleton();
     $nextpage = null;
     $this->logRequest();
     if (isset($_REQUEST['nextpage'])) {
         $nextpage = "survey.php?key={$_REQUEST['key']}&pageNum={$_REQUEST['nextpage']}";
     }
     if (isset($_POST['ease'])) {
         // Comments is too comment of an instrument fieldname,
         // so just check if ease is set
         $this->updateComments($_POST['ease'], $_POST['comments']);
     }
     $workspace = $this->caller->load($this->TestName, $this->Subtest, $this->CommentID, $nextpage);
     // Caller calls instrument's save function and might have errors,
     // so we still need to call it. But if nextpage is 'complete',
     // then after that override with a "Thank you" message
     if ($_REQUEST['pageNum'] === 'finalpage') {
         if (isset($_POST['FinalPageSubmission']) && $_POST['FinalPageSubmission'] == "Yes") {
             // Data was submitted on the last page.
             $this->tpl_data['workspace'] = $workspace;
         } else {
             // We're just getting to the last page for the first time
             $this->tpl_data['workspace'] = '';
             $this->tpl_data['review'] = $this->caller->instrument->getReview();
         }
         $this->tpl_data['lastpage'] = "survey.php?key={$_REQUEST['key']}";
         $this->tpl_data['finalpage'] = true;
     } else {
         if ($_REQUEST['pageNum'] === 'complete') {
             $this->tpl_data['workspace'] = "Thank you for completing this survey.";
             $this->tpl_data['complete'] = true;
             $this->updateStatus('Complete');
             $Responses = $DB->update($this->TestName, array('Date_taken' => date('Y-m-d')), array('CommentID' => $this->CommentID));
             $Responses_flag = $DB->update('flag', array('Data_entry' => 'Complete', 'Administration' => 'All'), array('CommentID' => $this->CommentID));
         } else {
             $this->updateStatus('In Progress');
             $this->tpl_data['workspace'] = $workspace;
         }
     }
     $smarty = new Smarty_neurodb();
     $smarty->assign($this->tpl_data);
     $smarty->display('directentry.tpl');
 }