예제 #1
0
 function showImportSampleRes()
 {
     /* update last page */
     $_SESSION['LASTPAGE'] = substr($_SESSION['LASTPAGE'], 0, strripos($_SESSION['LASTPAGE'], ".res"));
     if (loadvar('filename') != '') {
         $list = file_get_contents(loadvar('filename'), FILE_USE_INCLUDE_PATH);
         $list = explode("\n", $list);
     } else {
         $list = loadvar('list');
         $list = explode("\r\n", $list);
     }
     $seperator = loadvar('separator', '^');
     $datatype = loadvar('datatype', 0);
     if ($datatype == 0) {
         //household
         $query = 'insert into ' . dbConfig::dbSurvey . '_households ';
         $query .= '(primkey, name, address1, city, puid) values ';
     } else {
         $query = 'insert into ' . dbConfig::dbSurvey . '_repsondents ';
         $query .= '(primkey, hhid, firstname, lastname, sex, age, birthdate, ';
         $query .= ' schoolingyears, educationlevel, ';
         $query .= ' selected, hhhead, occupationalstatus, relationshiphh, spouseprimkey) values ';
     }
     foreach ($list as $row) {
         if ($row != '') {
             $item = explode($seperator, $row);
             if ($datatype == 0) {
                 //household
                 $query .= "(";
                 $query .= '"' . addslashes($item[0]) . '", ';
                 //primkey
                 $query .= '"' . addslashes($item[6]) . '", ';
                 //name
                 $query .= '"' . addslashes($item[4]) . '", ';
                 //address1
                 $query .= '"' . addslashes($item[1]) . '", ';
                 //city
                 $query .= '"' . addslashes($item[0]) . '" ';
                 //puid
                 $query .= "),<br/>";
             } else {
                 $query .= "(";
                 $query .= '"' . addslashes($item[5]) . '", ';
                 //primkey
                 $query .= '"' . addslashes($item[0]) . '", ';
                 //household id
                 $query .= '"' . addslashes($item[6]) . '", ';
                 //name
                 $query .= '"' . addslashes('') . '", ';
                 //lastname
                 $query .= '"' . addslashes($item[8]) . '", ';
                 //sex
                 $query .= '"' . addslashes($item[13]) . '", ';
                 //age
                 $query .= '"' . addslashes($item[9]) . '", ';
                 //birthdate
                 $query .= '"' . addslashes($item[16]) . '", ';
                 //shcoolingyears
                 $query .= '"' . addslashes($item[15]) . '", ';
                 //educationlevel
                 $query .= '"' . addslashes($item[14]) . '", ';
                 //selected
                 $query .= '"' . addslashes($item[7]) . '", ';
                 //head
                 $query .= '"' . addslashes(0) . '", ';
                 //occupational
                 $query .= '"' . addslashes($item[17]) . '", ';
                 //relationshiphh
                 $query .= '"' . addslashes($item[18]) . '" ';
                 //spouseid
                 $query .= "),<br/>";
             }
         }
     }
     $query = rtrim($query, ',<br/>');
     $displaySms = new DisplaySms();
     $returnStr .= $displaySms->showSmsHeader(array());
     $returnStr .= '<br/><br/><br/>' . $query;
     $returnStr .= '</p></div>    </div>';
     //container and wrap
     $returnStr .= $displaySms->showBottomBar();
     $returnStr .= $displaySms->showFooter(false);
     return $returnStr;
 }
예제 #2
0
 function showUnassignedSample($message = '')
 {
     $returnStr = $this->showHeader(Language::messageSMSTitle(), '<link href="bootstrap/css/sticky-footer-navbar.min.css" rel="stylesheet"><link href="css/uscicadmin.css" rel="stylesheet">');
     $returnStr .= '<div id="wrap"><br/><br/><br/>';
     $returnStr .= $this->showNavBar();
     $returnStr .= '<div class="container"><p>';
     //CONTENT
     if (dbConfig::defaultPanel() == PANEL_HOUSEHOLD) {
         $returnStr .= '<h4>' . Language::labelSupervisorUnassignedHouseholds() . '</h4>';
     } else {
         $returnStr .= '<h4>' . Language::labelSupervisorUnassignedRespondents() . '</h4>';
     }
     $returnStr .= $message;
     $displaySms = new DisplaySms();
     $returnStr .= $displaySms->showAvailableUnassignedHouseholds();
     //END CONTENT
     $returnStr .= '</p></div>    </div>';
     //container and wrap
     $returnStr .= $this->showBottomBar();
     $returnStr .= $this->showFooter();
     return $returnStr;
 }
예제 #3
0
 function showSample($message = '')
 {
     $returnStr = $this->showResearchHeader(Language::messageSMSTitle());
     $returnStr .= '<div id="wrap">';
     $returnStr .= $this->showNavBar();
     $returnStr .= '<div class="container"><p>';
     $returnStr .= '<ol class="breadcrumb">';
     $returnStr .= '<li class="active">' . Language::linkUnassigned() . '</li>';
     $returnStr .= '</ol>';
     $returnStr .= $message;
     $displaySms = new DisplaySms();
     $returnStr .= $displaySms->showAvailableUnassignedHouseholds();
     $returnStr .= '<a href="index.php?r=' . setSessionsParamString(array('page' => 'researcher.sample.download')) . '&puid= ' . loadvar('puid', 0) . '">' . Language::labelResearcherDownloadCSV() . '</a>';
     $returnStr .= '&nbsp;&nbsp;|&nbsp;&nbsp;';
     $returnStr .= '<a href="index.php?r=' . setSessionsParamString(array('page' => 'researcher.sample.download.gps')) . '&puid= ' . loadvar('puid', 0) . '">' . Language::labelResearcherDownloadGPS() . '</a>';
     $returnStr .= '</p></div>    </div>';
     //container and wrap
     $returnStr .= $this->showBottomBar();
     $returnStr .= $this->showFooter(false);
     return $returnStr;
 }