Ejemplo n.º 1
0
 /**
  * Initialize all of the class variables and things required from the
  * REQUEST.
  *
  * @return none, but as a side-effect modifies class
  */
 function initialize()
 {
     ob_start('ob_gzhandler');
     $client = new NDB_Client();
     $client->makeCommandLine();
     $client->initialize();
     $this->caller =& NDB_Caller::singleton();
     $this->caller->setDataEntryType('Direct');
     if (empty($_REQUEST['key'])) {
         throw new Exception("Missing parameter", 403);
     }
     $this->key = $_REQUEST['key'];
     $DB = Database::singleton();
     $this->TestName = $DB->pselectOne("SELECT Test_name FROM participant_accounts\n            WHERE OneTimePassword=:key AND Status <> 'Complete'", array('key' => $this->key));
     $this->CommentID = $DB->pselectOne("SELECT CommentID FROM participant_accounts \n            WHERE OneTimePassword=:key AND Status <> 'Complete'", array('key' => $this->key));
     $this->NumPages = $DB->pselectOne("SELECT COUNT(*) FROM instrument_subtests WHERE Test_name=:TN", array('TN' => $this->TestName));
     if (empty($this->TestName) && empty($this->CommentID)) {
         throw new Exception("Data has already been submitted.", 403);
     }
     $pageNum = null;
     if (!empty($_REQUEST['pageNum'])) {
         $pageNum = $_REQUEST['pageNum'];
     }
     if ($pageNum === 'finalpage') {
         $this->Subtest = 'finalpage';
     } else {
         $this->Subtest = $DB->pselectOne("SELECT Subtest_name\n                FROM instrument_subtests\n                WHERE Test_name=:TN AND Order_number=:PN", array('TN' => $this->TestName, 'PN' => $pageNum));
     }
     $totalPages = $DB->pselectOne("SELECT COUNT(*)+1 from instrument_subtests WHERE Test_name=:TN", array('TN' => $this->TestName));
     $this->NextPageNum = $this->getNextPageNum($pageNum);
     $this->PrevPageNum = $this->getPrevPageNum($pageNum);
     $this->CommentID = $this->getCommentID();
     $this->tpl_data = array('nextpage' => $this->NextPageNum, 'prevpage' => $this->PrevPageNum, 'pageNum' => $pageNum ? $pageNum + 1 : 1, 'totalPages' => $totalPages, 'key' => $this->key);
 }
Ejemplo n.º 2
0
// get time point data
if (!empty($_REQUEST['sessionID'])) {
    try {
        $timePoint =& TimePoint::singleton($_REQUEST['sessionID']);
        if ($config->getSetting("SupplementalSessionStatus")) {
            $tpl_data['SupplementalSessionStatuses'] = true;
        }
        $tpl_data['timePoint'] = $timePoint->getData();
    } catch (Exception $e) {
        $tpl_data['error_message'][] = "TimePoint Error (" . $_REQUEST['sessionID'] . "): " . $e->getMessage();
    }
}
//--------------------------------------------------
// load the menu or instrument
try {
    $caller =& NDB_Caller::singleton();
    $workspace = $caller->load($TestName, $subtest);
    if (isset($caller->page->FormAction)) {
        $tpl_data['FormAction'] = $caller->page->FormAction;
    }
    if (isset($caller->controlPanel)) {
        $tpl_data['control_panel'] = $caller->controlPanel;
    }
    if (isset($caller->feedbackPanel) && $user->hasPermission('bvl_feedback')) {
        $tpl_data['bvl_feedback'] = NDB_BVL_Feedback::bvlFeedbackPossible($TestName);
        $tpl_data['feedback_panel'] = $caller->feedbackPanel;
    }
    if (isset($caller->page)) {
        $tpl_data['jsfiles'] = $caller->page->getJSDependencies();
        $tpl_data['cssfiles'] = $caller->page->getCSSDependencies();
    }