Exemplo n.º 1
0
 function __construct($suid, $primkey, $phpid, $version, $seid, $doState = true, $doContext = true)
 {
     $this->primkey = $primkey;
     $this->phpid = $phpid;
     $this->setSuid($suid);
     if (isset($_SESSION['URID']) && $_SESSION['URID'] != '') {
         $user = new User($_SESSION['URID']);
         if (isTestmode() && inArray($user->getUserType(), array(USER_SYSADMIN, USER_TRANSLATOR, USER_TESTER))) {
             $this->display = new DisplayQuestionTest($this->primkey, $this);
         } else {
             if ($user->getUserType() == USER_NURSE) {
                 $this->display = new DisplayQuestionNurse($this->primkey, $this);
             } else {
                 $this->display = new DisplayQuestionSms($this->primkey, $this);
             }
         }
     } else {
         $this->display = new DisplayQuestion($this->primkey, $this);
     }
     global $survey;
     $this->survey = $survey;
     $this->version = $version;
     /* get context */
     if ($doContext == true) {
         $this->loadContext();
     }
     /* data record */
     $this->datarecord = new DataRecord($suid, $primkey);
     $this->datarecord->loadRecord();
     /* do state */
     if ($doState == true) {
         /* get main section and current section */
         $this->mainseid = getSurveyMainSection($suid, $primkey);
         $this->seid = getSurveySection($suid, $primkey);
         /* check for existing state */
         $this->state = new State($this->primkey, $this->survey->getSuid());
         if ($this->loadLastState() == true) {
             $this->previousrgid = $this->getRgid();
             $this->previousloopaction = $this->getForLoopLastAction();
             $this->previousloopstring = $this->getLoopString();
             $this->previouslooprgid = $this->getLoopRgid();
             $this->previouswhilergid = $this->getWhileRgid();
             $this->previouswhileaction = $this->getWhileLastAction();
         } else {
             $this->state->setSuid($suid);
             $this->setMainSeid($this->mainseid);
             $this->setSeid($this->seid);
             $this->setPrefix("");
             $this->setParentPrefix("");
             $this->setParentSeid(0);
             $this->setParentRgid(0);
             /* set loop string, loop rgid and loop left off to empty by default */
             $this->setLoopString("");
             $this->setLoopRgid("");
             $this->setForLoopLastAction("");
             $this->setWhileRgid("");
             $this->setWhileLastAction("");
         }
     } else {
         $this->seid = $seid;
         // set for loadSetFillClasses
     }
     $this->flooding = false;
     $this->stop = false;
     $this->startatbegin = false;
     $this->redofills = false;
     $this->forward = false;
     $this->firstform = false;
     $this->updateaction = false;
     $this->reset = array();
     $this->dk = array();
     $this->rf = array();
     $this->na = array();
     $this->processedfills = array();
     $this->justassigned = array();
     $this->currentaction = ACTION_DYNAMIC;
     /* load any set fill classes */
     //$this->loadSetFillClasses();
 }
Exemplo n.º 2
0
    require 'display/displaytranslator.php';
    require 'display/displaysearch.php';
    require 'display/displaysms.php';
    //require('display/displaynurse.php');
    require 'display/displayresearcher.php';
    require "data.php";
    require 'dataexport.php';
    require 'communication.php';
}
/* SMS admin and survey extensions */
if (Config::smsUsage()) {
    require 'psu.php';
    require 'psus.php';
    require 'proxypermission.php';
}
if (isTestmode() || Config::smsUsage()) {
    require 'contact.php';
    require 'contacts.php';
}
/* check for execution mode */
if (inArray(loadvar(POST_PARAM_SURVEY_EXECUTION_MODE), array(SURVEY_EXECUTION_MODE_NORMAL, SURVEY_EXECUTION_MODE_TEST))) {
    $_SESSION[SURVEY_EXECUTION_MODE] = loadvar(POST_PARAM_SURVEY_EXECUTION_MODE);
}
if (!isset($_SESSION[SURVEY_EXECUTION_MODE])) {
    $_SESSION[SURVEY_EXECUTION_MODE] = SURVEY_EXECUTION_MODE_NORMAL;
    // by default normal mode
}
// set timezone
date_default_timezone_set(Config::timezone());
$logActions = new LogActions();
/* global variables */